using ESRI.ArcGIS.Geodatabase; using Kingo.RuleCheck.AEHelper; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Kingo.RuleCheck.XJRuleCheck { public class RuleCheckOpertion_DTB { /// /// 县级单图斑建库和审核任务包检查 /// /// /// /// /// 系统设置-需执行规则 /// public static List StartXJSHCheck(string tbbsm, string dbPath, List lstBasicDataInfo, string primityKey = "", List> excuteRules = null, EnumPC enumPC = EnumPC.TY) { List lstWorkapaceAPI = null; Dictionary dicFeatureClass = null; try { if (!System.IO.File.Exists(dbPath) || lstBasicDataInfo == null || lstBasicDataInfo.Count <= 0) { throw new Exception("输入参数错误"); } List result = new List(); List ruleTypes = new List() { RuleType.地类属性与举证照片逻辑性检查, RuleType.数学基础规范性检查, RuleType.图形属性规范性检查, RuleType.通用类表内逻辑性检查, RuleType.通用类表间逻辑性检查, RuleType.城镇村属性上图检查 }; DLParams.Init(); dicFeatureClass = new Dictionary(); lstWorkapaceAPI = new List(); foreach (var basicData in lstBasicDataInfo) { IWorkspaceAPI workspaceAPI = new WorkspaceAPI(basicData.WorkspacePath, basicData.WorkspaceType); foreach (var item in basicData.FeatureClassName) { dicFeatureClass.Add(item.Key, workspaceAPI.OpenFeatureClass(item.Value).FeatureClass); } lstWorkapaceAPI.Add(workspaceAPI); } foreach (var item in ruleTypes) { List rules = StartCheck(tbbsm, dbPath, dicFeatureClass, item, excuteRules, new List { "JZ005", "JZ007" }, enumPC); if (rules != null && rules.Count > 0) { result.AddRange(rules); } } return result; } catch (Exception ex) { throw ex; } finally { if (dicFeatureClass != null) { foreach (var item in dicFeatureClass) { if (item.Value != null) { System.Runtime.InteropServices.Marshal.ReleaseComObject(item.Value); } } } if (lstWorkapaceAPI != null) { foreach (var item in lstWorkapaceAPI) { item.CloseWorkspace(); } } } } public static List StartXJSHCheck(IFeature featureCk, List lstBasicDataInfo) { List result = new List(); return result; } /// /// 县级单图斑建库和审核任务包检查 /// /// /// /// /// /// /// public static List StartXJSHCheck(string tbbsm, string dbPath, Dictionary dicFeatureClass, List> excuteRules = null, List disExecuteRules = null, EnumPC enumPC = EnumPC.TY) { try { List result = new List(); List ruleTypes = new List() { RuleType.地类属性与举证照片逻辑性检查, RuleType.数学基础规范性检查, RuleType.图形属性规范性检查, RuleType.通用类表内逻辑性检查, RuleType.通用类表间逻辑性检查, }; DLParams.Init(); foreach (var item in ruleTypes) { List rules = StartCheck(tbbsm, dbPath, dicFeatureClass, item, excuteRules, disExecuteRules, enumPC); if (rules != null && rules.Count > 0) { result.AddRange(rules); } } return result; } catch (Exception ex) { throw ex; } } /// /// 县级单图斑建库和审核任务包检查(县级审核加载任务包时仅做二类错误检查) /// /// /// /// /// 系统设置-需执行规则 /// public static List StartXJSHCheckTypeTwoErrors(string tbbsm, string dbPath, List lstBasicDataInfo, string primityKey = "", List> excuteRules = null, EnumPC enumPC = EnumPC.TY) { List lstWorkapaceAPI = null; Dictionary dicFeatureClass = null; try { if (!System.IO.File.Exists(dbPath) || lstBasicDataInfo == null || lstBasicDataInfo.Count <= 0) { throw new Exception("输入参数错误"); } excuteRules = new List> { new Tuple("LNGD"), new Tuple("HFSX"), new Tuple("DDTC20X"), new Tuple("TX002"), new Tuple("TXSXJC"), new Tuple("TX02X"), }; List result = new List(); List ruleTypes = new List() { RuleType.地类属性与举证照片逻辑性检查, RuleType.数学基础规范性检查, RuleType.图形属性规范性检查, RuleType.通用类表内逻辑性检查, RuleType.通用类表间逻辑性检查, }; DLParams.Init(); dicFeatureClass = new Dictionary(); lstWorkapaceAPI = new List(); foreach (var basicData in lstBasicDataInfo) { IWorkspaceAPI workspaceAPI = new WorkspaceAPI(basicData.WorkspacePath, basicData.WorkspaceType); foreach (var item in basicData.FeatureClassName) { dicFeatureClass.Add(item.Key, workspaceAPI.OpenFeatureClass(item.Value).FeatureClass); } lstWorkapaceAPI.Add(workspaceAPI); } foreach (var item in ruleTypes) { List rules = StartCheck(tbbsm, dbPath, dicFeatureClass, item, excuteRules, new List { "JZ005", "JZ007" }, enumPC); if (rules != null && rules.Count > 0) { result.AddRange(rules); } } return result; } catch (Exception ex) { throw ex; } finally { if (dicFeatureClass != null) { foreach (var item in dicFeatureClass) { if (item.Value != null) { System.Runtime.InteropServices.Marshal.ReleaseComObject(item.Value); } } } if (lstWorkapaceAPI != null) { foreach (var item in lstWorkapaceAPI) { item.CloseWorkspace(); } } } } /// /// 开始检查 /// /// /// /// /// 系统设置-需执行规则 /// 不执行规则 /// public static List StartCheck(string tbbsm, string sourcePath, Dictionary dicFeatureClass, RuleType ruleType, List> excuteRules = null, List disExecuteRules = null, EnumPC enumPC = EnumPC.TY) { List checkRst = new List(); RuleCheckBase_DTB ruleCheck = null; switch (ruleType) { case RuleType.地类属性与举证照片逻辑性检查: ruleCheck = new DLSXYJZZPCheck_DTB(); break; case RuleType.数学基础规范性检查: ruleCheck = new SJJCCheck_DTB(); break; case RuleType.图形属性规范性检查: ruleCheck = new TXSXCheck_DTB(); break; case RuleType.通用类表内逻辑性检查: ruleCheck = new TYLBBNLJXCheck_DTB(); break; case RuleType.通用类表间逻辑性检查: ruleCheck = new TYLBJLJXCheck_DTB(); break; case RuleType.城镇村属性上图检查: ruleCheck = new CZCSXCheck_DTB(); break; } if (ruleCheck != null) { ruleCheck.TBBSM = tbbsm; ruleCheck.PC = enumPC; ruleCheck.ExcuteRules = excuteRules; ruleCheck.DisExecuteRules = disExecuteRules; checkRst = ruleCheck.ExcuteCheck(tbbsm, sourcePath, dicFeatureClass); if (ruleType == RuleType.单图斑建库人工检查) checkRst = ruleCheck.AllRGError; } return checkRst; } } }