using ESRI.ArcGIS.Geodatabase; using ESRI.ArcGIS.Geometry; using KGIS.Framework.AE; using KGIS.Framework.AE.Enum; using KGIS.Framework.Maps; using KGIS.Framework.Platform; using KGIS.Framework.Utils; using KGIS.Framework.Utils.Helper; using Kingo.PluginServiceInterface; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Xml; namespace Kingo.Plugin.BGResultManager.View { /// /// FrmCreateVCTTemplate.xaml 的交互逻辑 /// public partial class FrmCreateVCTTemplate : BaseWindow { private List Source = null; private List Source2 = null; private Dictionary dicFeatureCode = null; private BGVCTEntity GXVCTEntity = null; public FrmCreateVCTTemplate() { InitializeComponent(); InitFeatureCodeDic(); Init(); } private void Init() { IWorkspaceAPI s_WsAPI = null; try { Source = new List(); Source2 = new List(); GXVCTEntity = new BGVCTEntity() { Name = "更新VCT模板" }; string currentGDBPath = (MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo).ZLDatabase; s_WsAPI = new WorkspaceAPI(currentGDBPath, WorkspaceTypeEnum.GDBFile); foreach (KeyValuePair kvp in dicFeatureCode) { IFeatureClassAPI fcAPI = s_WsAPI.OpenFeatureClass2(kvp.Key); if (fcAPI != null) { IFeatureClass fc = fcAPI.FeatureClass; if ("CZCDYDGX,CZCDYDGXGC,DLTBGX,DLTBGXGC,XZQGX,XZQGXGC,CJDCQGX,CJDCQGXGC,XZQJXGX,CJDCQJXGX".Contains(kvp.Key))// { BGVCTEntity enetity = new BGVCTEntity() { Name = fc.AliasName, FeatureClassName = kvp.Key, IsChecked = true }; Source.Add(enetity); GXVCTEntity.SubEntities.Add(enetity); } else { BGVCTEntity enetity = new BGVCTEntity() { Name = fc.AliasName, FeatureClassName = kvp.Key, IsChecked = false }; Source2.Add(enetity); GXVCTEntity.SubEntities.Add(enetity); } } //增量更新数据填充 tvVCTEntity.ItemsSource = Source; //整层更新数据填充 tvVCTEntity2.ItemsSource = Source2; } } catch (Exception ex) { LogAPI.Debug(ex); MessageHelper.ShowError(ex.Message); } finally { if (s_WsAPI != null) { s_WsAPI.CloseWorkspace(); } } } /// /// 模板图层填充-要素名称/要素代码 /// private void InitFeatureCodeDic() { dicFeatureCode = new Dictionary(); dicFeatureCode.Add("CCWJQGX", "2099090100"); dicFeatureCode.Add("GFBQGX", "2099070100"); //dicFeatureCode.Add("LSYDGX", "2099010100"); dicFeatureCode.Add("GCHZZGX", "2099120100"); dicFeatureCode.Add("TTQGX", "2099080100"); dicFeatureCode.Add("DLTBGX", "2001010100"); dicFeatureCode.Add("CLKZDGX", "1000110000"); dicFeatureCode.Add("CZKFBJGX", "3002010000"); dicFeatureCode.Add("CZCDYDGX", "2099030100"); dicFeatureCode.Add("CZCDYDGXGC", "2099030100"); dicFeatureCode.Add("DGXGX", "1000710000"); dicFeatureCode.Add("DZGYGX", "3001050100"); dicFeatureCode.Add("FJMSQGX", "3001040100"); dicFeatureCode.Add("GCZJDGX", "1000720000"); dicFeatureCode.Add("GDDBGX", "2099040100"); dicFeatureCode.Add("GJGYGX", "3001010100"); dicFeatureCode.Add("JZKZDGX", "1000110408"); dicFeatureCode.Add("KFYQGX", "2099060100"); dicFeatureCode.Add("LMFWGX", "2099100100"); dicFeatureCode.Add("PDTGX", "1000780000"); dicFeatureCode.Add("PZWJSTDGX", "2099020100"); dicFeatureCode.Add("QTJZKFQGX", "3001990100"); dicFeatureCode.Add("SCZZBHQGX", "3001090100"); dicFeatureCode.Add("SDGYGX", "3001070100"); dicFeatureCode.Add("SLGYGX", "3001030100"); dicFeatureCode.Add("STBHHXGX", "3003010000"); dicFeatureCode.Add("WJMHDGX", "2099110100"); dicFeatureCode.Add("YYSSYDGX", "3001080100"); dicFeatureCode.Add("ZRBHQGX", "3001020100"); dicFeatureCode.Add("ZRYCBHQGX", "3001060100"); dicFeatureCode.Add("ZYXMYDGX", "2099050100"); dicFeatureCode.Add("XZQGX", "1000600100"); dicFeatureCode.Add("XZQJXGX", "1000600200"); dicFeatureCode.Add("CJDCQGX", "1000600400"); dicFeatureCode.Add("CJDCQJXGX", "1000600500"); dicFeatureCode.Add("YJJBNTTBGX", "2005010300"); dicFeatureCode.Add("DLTBGXGC", "2001010100"); dicFeatureCode.Add("XZQGXGC", "1000600100"); dicFeatureCode.Add("CJDCQGXGC", "1000600400"); } private void btnCreate_Click(object sender, RoutedEventArgs e) { IWorkspaceAPI s_WsAPI = null; try { if (string.IsNullOrWhiteSpace(txtTempName.Text)) { MessageHelper.ShowTips("请输入模板名称!"); return; } string currentGDBPath = (MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo).ZLDatabase; s_WsAPI = new WorkspaceAPI(currentGDBPath, WorkspaceTypeEnum.GDBFile); List TableMappingList = new List(); string sDir = System.IO.Path.Combine(SysAppPath.GetCurrentAppPath(), "工作空间", "模板", "变更成果模板", txtTempName.Text); if (Directory.Exists(sDir)) { MessageHelper.ShowTips("指定的模板名称或路径已存在!"); return; } else { Directory.CreateDirectory(sDir); } List list = GXVCTEntity.SubEntities.FindAll(x => x.IsChecked == true && (x.FeatureClassName.EndsWith("GX") || x.FeatureClassName == "GXZJ")); if (list.Count > 0) { string sPath = System.IO.Path.Combine(sDir, "VCTTemplate3ForBG.VCT"); FileStream fs = new FileStream(sPath, FileMode.Create); StreamWriter sw = new StreamWriter(fs, Encoding.GetEncoding("GB18030")); GenerateVCTHead(sw); foreach (BGVCTEntity item in list) { TableMappingList.Add(item); } GenerateVCTFeatureCode(sw, list, s_WsAPI); sw.WriteLine("TableStructureBegin"); foreach (BGVCTEntity entity in list) { IFeatureClassAPI fcSourceAPI = s_WsAPI.OpenFeatureClass(entity.FeatureClassName); IFeatureClass fcSource = fcSourceAPI.FeatureClass; IFields fields = fcSource.Fields; int FieldCount = 0; for (int i = 0; i < fields.FieldCount; i++) { IField field = fields.Field[i]; if (field.Name == "OBJECTID" || field.Name == "JCTBBSM" || field.Name == "Element" || field.Name == "SHAPE" || field.Name == "SHAPE_Length" || field.Name == "SHAPE_Area") { continue; } if (entity.FeatureClassName == "DLTBGX" && (field.Name == "XZQTZLX" || field.Name == "ONLYZLBG")) { continue; } FieldCount++; } sw.WriteLine(string.Format("{0},{1}", entity.FeatureClassName, FieldCount)); for (int i = 0; i < fields.FieldCount; i++) { IField field = fields.Field[i]; if (field.Name == "OBJECTID" || field.Name == "JCTBBSM" || field.Name == "Element" || field.Name == "SHAPE" || field.Name == "SHAPE_Length" || field.Name == "SHAPE_Area") { continue; } if (entity.FeatureClassName == "DLTBGX" && (field.Name == "XZQTZLX" || field.Name == "ONLYZLBG")) { continue; } string strFieldType = GetVCTFieldType(field); if (strFieldType == "Float") { sw.WriteLine(string.Format("{0},{1},{2},2", field.Name, strFieldType, field.Length <= 255 ? field.Length : 255)); } else { sw.WriteLine(string.Format("{0},{1},{2}", field.Name, strFieldType, field.Length <= 255 ? field.Length : 255)); } } sw.WriteLine("0"); } sw.Write("TableStructureEnd"); sw.Close(); sw.Dispose(); fs.Close(); fs.Dispose(); } #region 一键成果导出的VCT中不包含PDTGX图层及其相关表结构信息 2020-7-29 沈超 list = GXVCTEntity.SubEntities.FindAll(x => x.IsChecked == true && x.FeatureClassName == "PDTGX"); if (list.Count > 0)//创建没有PDTGCX的VCT { list = GXVCTEntity.SubEntities.FindAll(x => x.IsChecked == true && (x.FeatureClassName.EndsWith("GX") || x.FeatureClassName == "GXZJ") && x.FeatureClassName != "PDTGX"); if (list.Count > 0) { string sPath = System.IO.Path.Combine(sDir, "VCTTemplate3ForBG_WithOutPDXGX.VCT"); FileStream fs = new FileStream(sPath, FileMode.Create); StreamWriter sw = new StreamWriter(fs, Encoding.GetEncoding("GB18030")); GenerateVCTHead(sw); GenerateVCTFeatureCode(sw, list, s_WsAPI); sw.WriteLine("TableStructureBegin"); foreach (BGVCTEntity entity in list) { IFeatureClassAPI fcSourceAPI = s_WsAPI.OpenFeatureClass(entity.FeatureClassName); IFeatureClass fcSource = fcSourceAPI.FeatureClass; IFields fields = fcSource.Fields; int FieldCount = 0; for (int i = 0; i < fields.FieldCount; i++) { IField field = fields.Field[i]; if (entity.FeatureClassName == "DLTBGX" && field.Name.ToUpper() == "XHMARK") { continue; } else { if (field.Name == "OBJECTID" || field.Name == "JCTBBSM" || field.Name == "Element" || field.Name.ToUpper() == "SHAPE" || field.Name.ToUpper() == "SHAPE_LENGTH" || field.Name.ToUpper() == "SHAPE_AREA" || field.Name == "BGTBOID") { continue; } FieldCount++; } } sw.WriteLine(string.Format("{0},{1}", entity.FeatureClassName, FieldCount)); for (int i = 0; i < fields.FieldCount; i++) { IField field = fields.Field[i]; if (entity.FeatureClassName == "DLTBGX" && field.Name.ToUpper() == "XHMARK") { continue; } else { if (field.Name == "OBJECTID" || field.Name == "JCTBBSM" || field.Name == "Element" || field.Name.ToUpper() == "SHAPE" || field.Name.ToUpper() == "SHAPE_LENGTH" || field.Name.ToUpper() == "SHAPE_AREA" || field.Name == "BGTBOID") { continue; } string strFieldType = GetVCTFieldType(field); if (strFieldType == "Float") { sw.WriteLine(string.Format("{0},{1},{2},2", field.Name, strFieldType, field.Length <= 255 ? field.Length : 255)); } else { sw.WriteLine(string.Format("{0},{1},{2}", field.Name, strFieldType, field.Length <= 255 ? field.Length : 255)); } } } sw.WriteLine("0"); } sw.Write("TableStructureEnd"); sw.Close(); sw.Dispose(); fs.Close(); fs.Dispose(); } } #endregion list = GXVCTEntity.SubEntities.FindAll(x => x.IsChecked == true && x.FeatureClassName.EndsWith("GXGC")); if (list.Count > 0) { string sPath = System.IO.Path.Combine(sDir, "VCTTemplate3ForBG2.VCT"); FileStream fs = new FileStream(sPath, FileMode.Create); StreamWriter sw = new StreamWriter(fs, Encoding.GetEncoding("GB18030")); GenerateVCTHead(sw); foreach (BGVCTEntity item in list) { TableMappingList.Add(item); } GenerateVCTFeatureCode(sw, list, s_WsAPI); sw.WriteLine("TableStructureBegin"); foreach (BGVCTEntity entity in list) { IFeatureClassAPI fcSourceAPI = s_WsAPI.OpenFeatureClass(entity.FeatureClassName); IFeatureClass fcSource = fcSourceAPI.FeatureClass; IFields fields = fcSource.Fields; int FieldCount = 0; for (int i = 0; i < fields.FieldCount; i++) { IField field = fields.Field[i]; if (field.Name == "OBJECTID" || field.Name == "JCTBBSM" || field.Name == "SHAPE" || field.Name == "SHAPE_Length" || field.Name == "SHAPE_Area") { continue; } if (entity.FeatureClassName == "DLTBGXGC" && (field.Name == "JCZT" || field.Name == "JCJG" || field.Name == "ONLYZLBG")) { continue; } FieldCount++; } sw.WriteLine(string.Format("{0},{1}", entity.FeatureClassName, FieldCount)); for (int i = 0; i < fields.FieldCount; i++) { IField field = fields.Field[i]; if (field.Name == "OBJECTID" || field.Name == "JCTBBSM" || field.Name == "SHAPE" || field.Name == "SHAPE_Length" || field.Name == "SHAPE_Area") { continue; } if (entity.FeatureClassName == "DLTBGXGC" && (field.Name == "JCZT" || field.Name == "JCJG" || field.Name == "ONLYZLBG")) { continue; } string strFieldType = GetVCTFieldType(field); if (strFieldType == "Float") { sw.WriteLine(string.Format("{0},{1},{2},2", field.Name, strFieldType, field.Length <= 255 ? field.Length : 255)); } else { sw.WriteLine(string.Format("{0},{1},{2}", field.Name, strFieldType, field.Length <= 255 ? field.Length : 255)); } } sw.WriteLine("0"); } sw.Write("TableStructureEnd"); sw.Close(); sw.Dispose(); fs.Close(); fs.Dispose(); } string TMConfigPath = System.IO.Path.Combine(SysAppPath.GetCurrentAppPath(), "Configs", "BGCheckTableMappingConfig.xml"); CreateBGCheckTableMappingConfig(TMConfigPath, TableMappingList); MessageHelper.ShowTips("创建完成"); this.Close(); } catch (Exception ex) { LogAPI.Debug(ex); MessageHelper.ShowError(ex.Message); } finally { if (s_WsAPI != null) { s_WsAPI.CloseWorkspace(); } } } private void GenerateVCTHead(StreamWriter sw) { sw.WriteLine("HeadBegin"); sw.WriteLine("DataMark: LANDUSE-VCT"); sw.WriteLine("Version: 3.0"); sw.WriteLine("CoordinateSystemType:P"); sw.WriteLine("Dim:2"); sw.WriteLine("XAxisDirection:E"); sw.WriteLine("YAxisDirection:N"); sw.WriteLine("XYUnit:M"); sw.WriteLine("ZUnit:M"); sw.WriteLine("Spheroid:CGCS2000,6378137.0,298.257222101"); sw.WriteLine("PrimeMeridian:Greenwich"); sw.WriteLine("Projection:高斯-克吕格投影"); sw.WriteLine("Parameters:0,0,0,0,0,0"); sw.WriteLine("VerticalDatum:1985国家高程基准"); sw.WriteLine("TemporalReferenceSystem:北京时间"); sw.WriteLine("ExtentMin:0,0"); sw.WriteLine("ExtentMax:0,0"); sw.WriteLine("MapScale:5000"); sw.WriteLine("Offset:0,0"); sw.WriteLine("Date:201801"); sw.WriteLine("Separator:,"); sw.WriteLine("HeadEnd"); sw.WriteLine(); } private void GenerateVCTFeatureCode(StreamWriter sw, List list, IWorkspaceAPI s_WsAPI) { sw.WriteLine("FeatureCodeBegin"); foreach (BGVCTEntity item in list) { string FCode = ""; if (dicFeatureCode.ContainsKey(item.FeatureClassName)) { FCode = dicFeatureCode[item.FeatureClassName]; } string strGeoType = GetVCTGeometryType(s_WsAPI.OpenFeatureClass(item.FeatureClassName).FeatureClass); sw.WriteLine(string.Format("{0},{1},{2},{3}", FCode, item.Name, strGeoType, item.FeatureClassName)); } sw.WriteLine("FeatureCodeEnd"); sw.WriteLine(); } private string GetVCTFieldType(IField field) { string strType = null; switch (field.Type) { case esriFieldType.esriFieldTypeSmallInteger: strType = "Int"; break; case esriFieldType.esriFieldTypeInteger: strType = "Int"; break; case esriFieldType.esriFieldTypeSingle: strType = "Float"; break; case esriFieldType.esriFieldTypeDouble: strType = "Float"; break; case esriFieldType.esriFieldTypeString: if (field.Name.EndsWith("BZ") || field.Name.EndsWith("GLTBBSM") || field.Name.EndsWith("YQSX") || field.Name.EndsWith("TDSYHT") || field.Name.EndsWith("BGQBZ") || field.Name.EndsWith("BGHBZ") || field.Name.EndsWith("BHQDLWZ") || field.Name.EndsWith("STGNYBHMB") || field.Name.EndsWith("DLWZ") || field.Name.EndsWith("STHJWT") || field.Name.EndsWith("GKCS")) { strType = "VarChar"; } else { strType = "Char"; } break; case esriFieldType.esriFieldTypeDate: strType = "Date"; break; case esriFieldType.esriFieldTypeOID: break; case esriFieldType.esriFieldTypeGeometry: break; case esriFieldType.esriFieldTypeBlob: break; case esriFieldType.esriFieldTypeRaster: break; case esriFieldType.esriFieldTypeGUID: break; case esriFieldType.esriFieldTypeGlobalID: break; case esriFieldType.esriFieldTypeXML: break; default: break; } return strType; } private string GetVCTGeometryType(IFeatureClass featureClass) { string strGType = ""; switch (featureClass.ShapeType) { case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryNull: break; case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPoint: case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryMultipoint: strGType = "Point"; break; case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolyline: case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryLine: strGType = "Line"; break; case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryCircularArc: break; case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryEllipticArc: break; case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryBezier3Curve: break; case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPath: break; case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryRing: break; case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolygon: strGType = "Polygon"; break; case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryEnvelope: break; case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryAny: break; case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryBag: break; case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryMultiPatch: break; case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryTriangleStrip: break; case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryTriangleFan: break; case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryRay: break; case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometrySphere: break; case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryTriangles: break; default: break; } return strGType; } private void btnCancel_Click(object sender, RoutedEventArgs e) { Close(); } private void chek_all_Click_1(object sender, RoutedEventArgs e) { CheckBox chk = sender as CheckBox; if (chk.IsChecked == true) { foreach (var item in Source) { item.IsChecked = true; } } else { foreach (var item in Source) { item.IsChecked = false; } } } private void CreateBGCheckTableMappingConfig(string configFilePath, List list) { IWorkspaceAPI s_WsAPI = null; try { //创建XmlDocument对象 XmlDocument xmlDoc = new XmlDocument(); //XML的声明 XmlDeclaration xmlSM = xmlDoc.CreateXmlDeclaration("1.0", "UTF-8", null); //追加xmldecl位置 xmlDoc.AppendChild(xmlSM); //创建CheckTableMapping节点 XmlElement MainElement = xmlDoc.CreateElement("", "CheckTableMapping", ""); //追加CheckTableMapping的根节点位置 xmlDoc.AppendChild(MainElement); string currentGDBPath = (MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo).ZLDatabase; s_WsAPI = new WorkspaceAPI(currentGDBPath, WorkspaceTypeEnum.GDBFile); foreach (BGVCTEntity entity in list) { IFeatureClassAPI fcSourceAPI = s_WsAPI.OpenFeatureClass(entity.FeatureClassName); IFeatureClass fcSource = fcSourceAPI.FeatureClass; FeatureClass fc = fcSource as FeatureClass; XmlElement TableElement = xmlDoc.CreateElement("", "Table", ""); TableElement.SetAttribute("TableName", fc.Name); TableElement.SetAttribute("Name", fcSource.AliasName); TableElement.SetAttribute("Type", GetShapeTypeName(fcSource)); TableElement.SetAttribute("IsNecessary", "True"); TableElement.SetAttribute("YSDM", GetYSDMByLayerName(fc.Name)); IFields fields = fcSource.Fields; for (int i = 0; i < fields.FieldCount; i++) { IField field = fields.Field[i]; if (field.Name == "OBJECTID" || field.Name == "JCTBBSM" || field.Name == "SHAPE" || field.Name == "SHAPE_Length" || field.Name == "SHAPE_Area") { continue; } XmlElement FieldElement = xmlDoc.CreateElement("", "Column", ""); FieldElement.SetAttribute("Name", field.Name); FieldElement.SetAttribute("AliasName", field.AliasName); FieldElement.SetAttribute("AllowDBNull", field.IsNullable ? "True" : "False"); FieldElement.SetAttribute("DataType", GetFieldTypeName(field.Type)); if (field.Type == esriFieldType.esriFieldTypeString) { FieldElement.SetAttribute("MaxLength", field.Length.ToString()); } if (field.Type == esriFieldType.esriFieldTypeSingle || field.Type == esriFieldType.esriFieldTypeDouble) { FieldElement.SetAttribute("Precision", field.Precision.ToString()); } TableElement.AppendChild(FieldElement); } MainElement.AppendChild(TableElement); } xmlDoc.Save(configFilePath); } catch (Exception ex) { LogAPI.Debug(ex); } finally { if (s_WsAPI != null) { s_WsAPI.CloseWorkspace(); } } } private Dictionary ysdm = null; public Dictionary YSDM { get { if (ysdm == null) { ysdm = new Dictionary(); ysdm.Add("1000110000", "CLKZD"); ysdm.Add("1000110408", "JZKZD"); ysdm.Add("1000119000", "CLKZDZJ"); ysdm.Add("1000600100", "XZQ"); ysdm.Add("1000600200", "XZQJX"); ysdm.Add("1000609000", "XZQZJ"); ysdm.Add("1000600400", "CJDCQ"); ysdm.Add("1000600500", "CJDCQJX"); ysdm.Add("1000608000", "CJDCQZJ"); ysdm.Add("1000710000", "DGX"); ysdm.Add("1000720000", "GCZJD"); ysdm.Add("1000780000", "PDT"); ysdm.Add("2001010100", "DLTB"); ysdm.Add("2001010200", "DLTBZJ"); ysdm.Add("2006010100", "TDQSQ"); ysdm.Add("2006010200", "TDQSQZJ"); ysdm.Add("2006020100", "TDQSQJX"); ysdm.Add("2006020200", "TDQSQJXZJ"); ysdm.Add("2005010300", "YJJBNTTB"); ysdm.Add("2005010900", "YJJBNTTBZJ"); ysdm.Add("2099010100", "LSYD"); ysdm.Add("2099010200", "LSYDZJ"); ysdm.Add("2099020100", "PZWJSTD"); ysdm.Add("2099020200", "PZWJSTBZJ"); ysdm.Add("2099030100", "CZCDYD"); ysdm.Add("2099030200", "CZCDYDZJ"); ysdm.Add("2099040100", "GDDB"); ysdm.Add("2099040200", "GDDBZJ"); ysdm.Add("2099050100", "ZYXMYD"); ysdm.Add("2099050200", "ZYXMYDZJ"); ysdm.Add("2099060100", "KFYQ"); ysdm.Add("2099060200", "KFYQZJ"); ysdm.Add("3001010000", "GJGY"); ysdm.Add("3001020000", "ZRBHQ"); ysdm.Add("3001030000", "SLGY"); ysdm.Add("3001040000", "FJMSQ"); ysdm.Add("3001050000", "DZGY"); ysdm.Add("3001060000", "ZRYCBHQ"); ysdm.Add("3001070000", "SDGY"); ysdm.Add("3001080000", "YYSSYD"); ysdm.Add("3001090000", "SCZZBHQ"); ysdm.Add("3001990000", "QTJZKFQ"); ysdm.Add("3001200000", "ZRBHQZJ"); ysdm.Add("3002010000", "CSKFBJ"); ysdm.Add("3002020000", "CSKFBJZJ"); ysdm.Add("2099110100", "WJMHD"); ysdm.Add("2099100100", "LMFW"); } return ysdm; } } public string GetShapeTypeName(IFeatureClass fc) { string strType = ""; switch (fc.ShapeType) { case esriGeometryType.esriGeometryPoint: strType = "点"; break; case esriGeometryType.esriGeometryLine: strType = "线"; break; case esriGeometryType.esriGeometryPolygon: strType = "面"; break; default: if (fc.FeatureType == esriFeatureType.esriFTAnnotation) { strType = "注记"; } else { strType = "其他"; } break; } return strType; } private string GetYSDMByLayerName(string LayerName) { if (LayerName.EndsWith("GX")) { LayerName = LayerName.Replace("GX", ""); } else if (LayerName.EndsWith("GXGC")) { LayerName = LayerName.Replace("GXGC", ""); } KeyValuePair kvp = YSDM.FirstOrDefault(x => x.Value == LayerName); return kvp.Key; } private string GetFieldTypeName(esriFieldType fieldType) { string strTypeName = ""; switch (fieldType) { case esriFieldType.esriFieldTypeSmallInteger: strTypeName = "Int"; break; case esriFieldType.esriFieldTypeInteger: strTypeName = "Int"; break; case esriFieldType.esriFieldTypeSingle: strTypeName = "Float"; break; case esriFieldType.esriFieldTypeDouble: strTypeName = "Double"; break; case esriFieldType.esriFieldTypeString: strTypeName = "String"; break; case esriFieldType.esriFieldTypeDate: strTypeName = "Date"; break; case esriFieldType.esriFieldTypeOID: strTypeName = "Int"; break; case esriFieldType.esriFieldTypeGeometry: break; case esriFieldType.esriFieldTypeBlob: break; case esriFieldType.esriFieldTypeRaster: break; case esriFieldType.esriFieldTypeGUID: break; case esriFieldType.esriFieldTypeGlobalID: break; case esriFieldType.esriFieldTypeXML: break; default: break; } return strTypeName; } } }