You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
144 lines
4.9 KiB
144 lines
4.9 KiB
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 RemoteRasterPropetry : RasterProperty, IRasterProperty |
|
{ |
|
private IRasterDataset m_RasterDataset; |
|
private string m_Server = string.Empty; |
|
private string m_User = string.Empty; |
|
private string m_Instance = string.Empty; |
|
private string m_Database = string.Empty; |
|
private string m_Version = string.Empty; |
|
[Browsable(true), Category("SDE信息"), DisplayName("服务器"), ReadOnly(true), XmlElement("服务器")] |
|
public string Server |
|
{ |
|
get |
|
{ |
|
return this.m_Server; |
|
} |
|
set |
|
{ |
|
this.m_Server = value; |
|
} |
|
} |
|
[Browsable(true), Category("SDE信息"), DisplayName("用户"), ReadOnly(true), XmlElement("用户")] |
|
public string User |
|
{ |
|
get |
|
{ |
|
return this.m_User; |
|
} |
|
set |
|
{ |
|
this.m_User = value; |
|
} |
|
} |
|
[Browsable(true), Category("SDE信息"), DisplayName("实例"), ReadOnly(true), XmlElement("实例")] |
|
public string Instance |
|
{ |
|
get |
|
{ |
|
return this.m_Instance; |
|
} |
|
set |
|
{ |
|
this.m_Instance = value; |
|
} |
|
} |
|
[Browsable(true), Category("SDE信息"), DisplayName("数据库"), ReadOnly(true), XmlElement("数据库")] |
|
public string Database |
|
{ |
|
get |
|
{ |
|
return this.m_Database; |
|
} |
|
set |
|
{ |
|
this.m_Database = value; |
|
} |
|
} |
|
[Browsable(true), Category("SDE信息"), DisplayName("版本"), ReadOnly(true), XmlElement("版本")] |
|
public string Version |
|
{ |
|
get |
|
{ |
|
return this.m_Version; |
|
} |
|
set |
|
{ |
|
this.m_Version = value; |
|
} |
|
} |
|
public RemoteRasterPropetry() |
|
{ |
|
} |
|
public RemoteRasterPropetry(IRasterDataset pRasterDataset) |
|
{ |
|
this.m_RasterDataset = pRasterDataset; |
|
base.Init(pRasterDataset); |
|
this.getDataSource(); |
|
} |
|
private void getDataSource() |
|
{ |
|
IWorkspace workspace = null; |
|
IDataset dataset = (IDataset)this.m_RasterDataset; |
|
workspace = dataset.Workspace; |
|
if (workspace.Type == esriWorkspaceType.esriRemoteDatabaseWorkspace) |
|
{ |
|
this.RasterType = enumRasterDataType.RDTRemoteDatabase; |
|
base.DataType = "SDE栅格"; |
|
this.m_Server = workspace.ConnectionProperties.GetProperty("SERVER").ToString(); |
|
this.m_User = workspace.ConnectionProperties.GetProperty("USER").ToString(); |
|
this.m_Instance = workspace.ConnectionProperties.GetProperty("INSTANCE").ToString(); |
|
try |
|
{ |
|
this.m_Database = workspace.ConnectionProperties.GetProperty("DATABASE").ToString(); |
|
} |
|
catch (Exception) |
|
{ |
|
} |
|
this.m_Version = workspace.ConnectionProperties.GetProperty("VERSION").ToString(); |
|
} |
|
} |
|
public override void ExportToXML() |
|
{ |
|
try |
|
{ |
|
//RemoteRasterPropetry o = new RemoteRasterPropetry(this.m_RasterDataset); |
|
//XmlSerializer xmlSerializer = new XmlSerializer(typeof(RemoteRasterPropetry)); |
|
//SaveFileDialog saveFileDialog = new SaveFileDialog(); |
|
//saveFileDialog.Filter = "XML文件(*.xml)|*.xml"; |
|
//saveFileDialog.CheckPathExists = true; |
|
//string text = base.Raster; |
|
//string str = ""; |
|
//if (text.IndexOf("\\") > 0) |
|
//{ |
|
// str = text.Substring(0, text.IndexOf("\\")); |
|
// text = text.Substring(text.IndexOf("\\") + 1); |
|
//} |
|
//text = str + "_" + text + ".xml"; |
|
//saveFileDialog.FileName = text; |
|
//if (saveFileDialog.ShowDialog() == DialogResult.OK && saveFileDialog.FileName.Length != 0) |
|
//{ |
|
// StreamWriter streamWriter = new StreamWriter(saveFileDialog.FileName); |
|
// xmlSerializer.Serialize(streamWriter, o); |
|
// streamWriter.Close(); |
|
//} |
|
} |
|
catch (Exception) |
|
{ |
|
} |
|
} |
|
} |
|
}
|
|
|