|
|
|
|
using ESRI.ArcGIS.Geodatabase;
|
|
|
|
|
using KGIS.Framework.AE;
|
|
|
|
|
using KGIS.Framework.AE.Enum;
|
|
|
|
|
using KGIS.Framework.Utils;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace Kingo.RuleCheck.XJRuleCheck
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 公共质检类-仅次于PluginServiceInterface 动态库外不外向引用
|
|
|
|
|
/// </summary>
|
|
|
|
|
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.通用类表间逻辑性检查,
|
|
|
|
|
RuleType.城镇村属性上图检查
|
|
|
|
|
};
|
|
|
|
|
DLParams.Init();
|
|
|
|
|
dicFeatureClass = new Dictionary<string, IFeatureClass>();
|
|
|
|
|
lstWorkapaceAPI = new List<IWorkspaceAPI>();
|
|
|
|
|
foreach (var basicData in lstBasicDataInfo)
|
|
|
|
|
{
|
|
|
|
|
IWorkspaceAPI workspaceAPI = null;
|
|
|
|
|
if (basicData.WorkspaceType == WorkspaceTypeEnum.GDBFile)
|
|
|
|
|
workspaceAPI = new WorkspaceAPI(basicData.WorkspacePath, basicData.WorkspaceType, true);
|
|
|
|
|
else
|
|
|
|
|
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="tbbsm"></param>
|
|
|
|
|
/// <param name="dbPath"></param>
|
|
|
|
|
/// <param name="dicFeatureClass"></param>
|
|
|
|
|
/// <param name="excuteRules"></param>
|
|
|
|
|
/// <param name="disExecuteRules"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public static List<RuleEntity> StartXJSHCheck(string tbbsm, string dbPath, Dictionary<string, IFeatureClass> dicFeatureClass, List<Tuple<string>> excuteRules = null, List<string> disExecuteRules = null)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
List<RuleEntity> result = new List<RuleEntity>();
|
|
|
|
|
List<RuleType> ruleTypes = new List<RuleType>()
|
|
|
|
|
{
|
|
|
|
|
RuleType.地类属性与举证照片逻辑性检查,
|
|
|
|
|
RuleType.数学基础规范性检查,
|
|
|
|
|
RuleType.图形属性规范性检查,
|
|
|
|
|
RuleType.通用类表内逻辑性检查,
|
|
|
|
|
RuleType.通用类表间逻辑性检查,
|
|
|
|
|
};
|
|
|
|
|
DLParams.Init();
|
|
|
|
|
foreach (var item in ruleTypes)
|
|
|
|
|
{
|
|
|
|
|
List<RuleEntity> rules = StartCheck(tbbsm, dbPath, dicFeatureClass, item, excuteRules, disExecuteRules);
|
|
|
|
|
if (rules != null && rules.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
result.AddRange(rules);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
throw ex;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 县级单图斑建库矢量数据检查(注:陕西)
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="OID"></param>
|
|
|
|
|
/// <param name="lstBasicDataInfo"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public static List<RuleEntity> StartXJSHCheck(IFeature featureCk, List<BasicDataInfo> lstBasicDataInfo = null)
|
|
|
|
|
{
|
|
|
|
|
List<IWorkspaceAPI> lstWorkapaceAPI = null;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (featureCk == null)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("输入参数错误");
|
|
|
|
|
}
|
|
|
|
|
List<RuleEntity> result = new List<RuleEntity>();
|
|
|
|
|
List<RuleType> ruleTypes = new List<RuleType>()
|
|
|
|
|
{
|
|
|
|
|
RuleType.矢量图形属性规范性检查
|
|
|
|
|
};
|
|
|
|
|
DLParams.Init();//公共当前地类集合
|
|
|
|
|
foreach (var ruleValue in ruleTypes)
|
|
|
|
|
{
|
|
|
|
|
List<RuleEntity> rules = StartCheck(featureCk, ((IDataset)featureCk.Class).Workspace, ruleValue);
|
|
|
|
|
if (rules != null && rules.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
result.AddRange(rules);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
int JCZTIndex = featureCk.Class.FindField("JCZT");
|
|
|
|
|
if (JCZTIndex != -1 && result != null)
|
|
|
|
|
{
|
|
|
|
|
featureCk.Value[JCZTIndex] = result.Count > 0 ? "质检错误" : "已完成";
|
|
|
|
|
featureCk.Store();
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
LogAPI.Debug("县级单图斑建库矢量数据检查(注:陕西)异常:" + ex);
|
|
|
|
|
throw ex;
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
if (lstWorkapaceAPI != null)
|
|
|
|
|
{
|
|
|
|
|
foreach (var item in lstWorkapaceAPI)
|
|
|
|
|
{
|
|
|
|
|
item.CloseWorkspace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 县级建库矢量数据检查(注:国家质检结果检查)
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="OID"></param>
|
|
|
|
|
/// <param name="excuteRules">要执行的质检规则</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public static List<RuleEntity> StartGJZJJGCheck(IFeature featureCk, List<Tuple<string>> excuteRules = null)
|
|
|
|
|
{
|
|
|
|
|
List<IWorkspaceAPI> lstWorkapaceAPI = null;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (featureCk == null || excuteRules == null)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("输入参数错误");
|
|
|
|
|
}
|
|
|
|
|
List<RuleEntity> result = new List<RuleEntity>();
|
|
|
|
|
List<RuleType> ruleTypes = new List<RuleType>()
|
|
|
|
|
{
|
|
|
|
|
RuleType.建库图斑图形规范性检查
|
|
|
|
|
};
|
|
|
|
|
DLParams.Init();//公共当前地类集合
|
|
|
|
|
foreach (var ruleValue in ruleTypes)
|
|
|
|
|
{
|
|
|
|
|
List<RuleEntity> rules = StartCheck(featureCk, ((IDataset)featureCk.Class).Workspace, ruleValue, excuteRules);
|
|
|
|
|
if (rules != null && rules.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
result.AddRange(rules);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
LogAPI.Debug("县级建库矢量数据检查(注:国家质检结果检查)异常:" + ex);
|
|
|
|
|
throw ex;
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
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;
|
|
|
|
|
case RuleType.城镇村属性上图检查:
|
|
|
|
|
ruleCheck = new CZCSXCheck_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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 开始检查-建库图斑/陕西矢量
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="featureCk"></param>
|
|
|
|
|
/// <param name="workspace"></param>
|
|
|
|
|
/// <param name="ruleType"></param>
|
|
|
|
|
/// <param name="excuteRules"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public static List<RuleEntity> StartCheck(IFeature featureCk, IWorkspace workspace, RuleType ruleType, List<Tuple<string>> excuteRules = null)
|
|
|
|
|
{
|
|
|
|
|
List<RuleEntity> checkRst = new List<RuleEntity>();
|
|
|
|
|
RuleCheckBase_DTB ruleCheck = null;
|
|
|
|
|
switch (ruleType)
|
|
|
|
|
{
|
|
|
|
|
case RuleType.建库图斑图形规范性检查:
|
|
|
|
|
ruleCheck = new TBTXCheck_JK();
|
|
|
|
|
break;
|
|
|
|
|
case RuleType.矢量图形属性规范性检查:
|
|
|
|
|
ruleCheck = new SLSJDataCheck_DTB();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (ruleCheck != null)
|
|
|
|
|
{
|
|
|
|
|
ruleCheck.SLFeatureCk = featureCk;
|
|
|
|
|
ruleCheck.Workspace = workspace as IFeatureWorkspace;//对应的矢量图层
|
|
|
|
|
ruleCheck.ExcuteRules = excuteRules;//执行的质检规则
|
|
|
|
|
checkRst = ruleCheck.ExcuteCheck(workspace, null, null);
|
|
|
|
|
}
|
|
|
|
|
return checkRst;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|