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.
216 lines
9.0 KiB
216 lines
9.0 KiB
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 |
|
{ |
|
/// <summary> |
|
/// 县级单图斑建库和审核任务包检查 |
|
/// </summary> |
|
/// <param name="dbPath"></param> |
|
/// <param name="workspace"></param> |
|
/// <param name="primityKey"></param> |
|
/// <param name="excuteRules">系统设置-需执行规则</param> |
|
/// <returns></returns> |
|
public static List<RuleEntity> StartXJSHCheck(string tbbsm, string dbPath, List<BasicDataInfo> lstBasicDataInfo, string primityKey = "", List<Tuple<string>> excuteRules = null) |
|
{ |
|
List<IWorkspaceAPI> lstWorkapaceAPI = null; |
|
Dictionary<string, IFeatureClass> dicFeatureClass = null; |
|
try |
|
{ |
|
if (!System.IO.File.Exists(dbPath) || lstBasicDataInfo == null || lstBasicDataInfo.Count <= 0) |
|
{ |
|
throw new Exception("输入参数错误"); |
|
} |
|
List<RuleEntity> result = new List<RuleEntity>(); |
|
List<RuleType> ruleTypes = new List<RuleType>() |
|
{ |
|
RuleType.地类属性与举证照片逻辑性检查, |
|
RuleType.数学基础规范性检查, |
|
RuleType.图形属性规范性检查, |
|
RuleType.通用类表内逻辑性检查, |
|
RuleType.通用类表间逻辑性检查, |
|
}; |
|
DLParams.Init(); |
|
dicFeatureClass = new Dictionary<string, IFeatureClass>(); |
|
lstWorkapaceAPI = new List<IWorkspaceAPI>(); |
|
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<RuleEntity> rules = StartCheck(tbbsm, dbPath, dicFeatureClass, item, excuteRules, new List<string> { "JZ005", "JZ007" }); |
|
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(); |
|
} |
|
} |
|
} |
|
} |
|
|
|
/// <summary> |
|
/// 县级单图斑建库和审核任务包检查(县级审核加载任务包时仅做二类错误检查) |
|
/// </summary> |
|
/// <param name="dbPath"></param> |
|
/// <param name="workspace"></param> |
|
/// <param name="primityKey"></param> |
|
/// <param name="excuteRules">系统设置-需执行规则</param> |
|
/// <returns></returns> |
|
public static List<RuleEntity> StartXJSHCheckTypeTwoErrors(string tbbsm, string dbPath, List<BasicDataInfo> lstBasicDataInfo, string primityKey = "", List<Tuple<string>> excuteRules = null) |
|
{ |
|
List<IWorkspaceAPI> lstWorkapaceAPI = null; |
|
Dictionary<string, IFeatureClass> dicFeatureClass = null; |
|
try |
|
{ |
|
if (!System.IO.File.Exists(dbPath) || lstBasicDataInfo == null || lstBasicDataInfo.Count <= 0) |
|
{ |
|
throw new Exception("输入参数错误"); |
|
} |
|
excuteRules = new List<Tuple<string>> |
|
{ |
|
new Tuple<string>("LNGD"), |
|
new Tuple<string>("HFSX"), |
|
new Tuple<string>("DDTC20X"), |
|
new Tuple<string>("TX002"), |
|
new Tuple<string>("TXSXJC"), |
|
new Tuple<string>("TX02X"), |
|
}; |
|
List<RuleEntity> result = new List<RuleEntity>(); |
|
List<RuleType> ruleTypes = new List<RuleType>() |
|
{ |
|
RuleType.地类属性与举证照片逻辑性检查, |
|
RuleType.数学基础规范性检查, |
|
RuleType.图形属性规范性检查, |
|
RuleType.通用类表内逻辑性检查, |
|
RuleType.通用类表间逻辑性检查, |
|
}; |
|
DLParams.Init(); |
|
dicFeatureClass = new Dictionary<string, IFeatureClass>(); |
|
lstWorkapaceAPI = new List<IWorkspaceAPI>(); |
|
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<RuleEntity> rules = StartCheck(tbbsm, dbPath, dicFeatureClass, item, excuteRules, new List<string> { "JZ005", "JZ007" }); |
|
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(); |
|
} |
|
} |
|
} |
|
} |
|
|
|
/// <summary> |
|
/// 开始检查 |
|
/// </summary> |
|
/// <param name="sourcePath"></param> |
|
/// <param name="workspace"></param> |
|
/// <param name="ruleType"></param> |
|
/// <param name="excuteRules">系统设置-需执行规则</param> |
|
/// <param name="disExecuteRules">不执行规则</param> |
|
/// <returns></returns> |
|
public static List<RuleEntity> StartCheck(string tbbsm, string sourcePath, Dictionary<string, IFeatureClass> dicFeatureClass, RuleType ruleType, List<Tuple<string>> excuteRules = null, List<string> disExecuteRules = null) |
|
{ |
|
List<RuleEntity> checkRst = new List<RuleEntity>(); |
|
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; |
|
} |
|
if (ruleCheck != null) |
|
{ |
|
ruleCheck.TBBSM = tbbsm; |
|
ruleCheck.ExcuteRules = excuteRules; |
|
ruleCheck.DisExecuteRules = disExecuteRules; |
|
checkRst = ruleCheck.ExcuteCheck(tbbsm, sourcePath, dicFeatureClass); |
|
if (ruleType == RuleType.单图斑建库人工检查) |
|
checkRst = ruleCheck.AllRGError; |
|
} |
|
return checkRst; |
|
} |
|
|
|
} |
|
}
|
|
|