|
|
|
|
using ESRI.ArcGIS.Geodatabase;
|
|
|
|
|
using KGIS.Plugin.LayerProperty.Enum;
|
|
|
|
|
using KGIS.Plugin.LayerProperty.Interface;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Xml.Serialization;
|
|
|
|
|
|
|
|
|
|
namespace KGIS.Plugin.LayerProperty.Model
|
|
|
|
|
{
|
|
|
|
|
[Serializable]
|
|
|
|
|
internal class LocalRasterPropetry : RasterProperty, IRasterProperty
|
|
|
|
|
{
|
|
|
|
|
private IRasterDataset m_RasterDataset;
|
|
|
|
|
private string m_Folder = string.Empty;
|
|
|
|
|
[Browsable(true), Category("数据源"), DisplayName("文件夹"), ReadOnly(true), XmlElement("文件夹")]
|
|
|
|
|
public string Folder
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return this.m_Folder;
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
this.m_Folder = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public LocalRasterPropetry()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
public LocalRasterPropetry(IRasterDataset pRasterDataset)
|
|
|
|
|
{
|
|
|
|
|
base.Init(pRasterDataset);
|
|
|
|
|
this.m_RasterDataset = pRasterDataset;
|
|
|
|
|
this.getDataSource();
|
|
|
|
|
}
|
|
|
|
|
private void getDataSource()
|
|
|
|
|
{
|
|
|
|
|
IDataset dataset = (IDataset)this.m_RasterDataset;
|
|
|
|
|
IWorkspace workspace = dataset.Workspace;
|
|
|
|
|
if (workspace.Type == esriWorkspaceType.esriFileSystemWorkspace)
|
|
|
|
|
{
|
|
|
|
|
this.RasterType = enumRasterDataType.RDTFileSystem;
|
|
|
|
|
base.DataType = "文件型栅格";
|
|
|
|
|
this.m_Folder = workspace.PathName;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (workspace.Type == esriWorkspaceType.esriLocalDatabaseWorkspace)
|
|
|
|
|
{
|
|
|
|
|
this.RasterType = enumRasterDataType.RDTLocalDatabase;
|
|
|
|
|
base.DataType = "本地数据库栅格";
|
|
|
|
|
this.m_Folder = workspace.PathName;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public override void ExportToXML()
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
//LocalRasterPropetry o = new LocalRasterPropetry(this.m_RasterDataset);
|
|
|
|
|
//XmlSerializer xmlSerializer = new XmlSerializer(typeof(LocalRasterPropetry));
|
|
|
|
|
//SaveFileDialog saveFileDialog = new SaveFileDialog();
|
|
|
|
|
//saveFileDialog.Filter = "XML文件(*.xml)|*.xml";
|
|
|
|
|
//saveFileDialog.CheckPathExists = true;
|
|
|
|
|
//if (base.Raster.IndexOf(".") > 0)
|
|
|
|
|
//{
|
|
|
|
|
// saveFileDialog.FileName = base.Raster.Substring(0, base.Raster.IndexOf(".")) + ".xml";
|
|
|
|
|
//}
|
|
|
|
|
//else
|
|
|
|
|
//{
|
|
|
|
|
// saveFileDialog.FileName = base.Raster + ".xml";
|
|
|
|
|
//}
|
|
|
|
|
//if (saveFileDialog.ShowDialog() == DialogResult.OK && saveFileDialog.FileName.Length != 0)
|
|
|
|
|
//{
|
|
|
|
|
// StreamWriter streamWriter = new StreamWriter(saveFileDialog.FileName);
|
|
|
|
|
// xmlSerializer.Serialize(streamWriter, o);
|
|
|
|
|
// streamWriter.Close();
|
|
|
|
|
//}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|