年度变更建库软件5.0版本
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.

110 lines
4.2 KiB

6 months ago
using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.Geodatabase;
using KGIS.Framework.DBOperator;
using KGIS.Framework.Maps;
using KGIS.Framework.Utils;
using KGIS.Framework.Utils.ExtensionMethod;
using KGIS.Framework.Utils.Helper;
using Kingo.PluginServiceInterface;
using System;
using System.Data;
namespace Kingo.Plugin.DataCheck.Helper
{
public class BGTBTopoCheck : DataCheckRule
{
private string _RuleName;
public override string RuleName { get => _RuleName; set => _RuleName = value; }
private string _RuleDesc;
public override string RuleDesc { get => _RuleDesc; set => _RuleDesc = value; }
public BGTBTopoCheck() : base()
{
_RuleName = "变更图斑图形";
_RuleDesc = "检查变更图斑数据是否存在自相交/多部件/短线段/尖锐角/局部狭长问题";
}
public override void StartCheck(object pParm)
{
IFeatureClass m_Fc = null;
try
{
base.CheckState = EnumCheckState.;
m_Fc = MapsManager.Instance.MapService.GetFeatureClassByName("DLTBBG");
IDataCheckHelper dataCheckHelper = UIShell.OSGi.BundleRuntime.Instance.GetFirstOrDefaultService<IDataCheckHelper>();
if (dataCheckHelper == null)
{
base.CheckState = EnumCheckState.;
return;
}
dataCheckHelper.DataCheck(new CheckParametr()
{
CheckType = enumCheckType.Graphic,
DataSource = m_Fc,
IDataCheckName = "BGQDataCheck"
});
StartLoadData(pParm);
base.CheckState = EnumCheckState.;
}
catch (Exception ex)
{
base.CheckState = EnumCheckState.;
LogAPI.Debug(string.Format("{0}", _RuleName));
LogAPI.Debug(ex);
}
}
public override void StartLoadData(object pParm)
{
try
{
string dbPath = System.IO.Path.Combine((MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo).ProjDir, "DataCheckrResult.db");
DataTable dtFJ = SQLiteDBOperate.Instance.ExceDataTable(dbPath, "select * from DataCheckResults WHERE ErrorCode like '200100039999001%' and ErrorLayer='BGQDataCheck' order by ErrorType DESC");
if (dtFJ == null)
return;
base.CheckResults.Clear();
for (int i = 0; i < dtFJ.Rows.Count; i++)
{
int id = dtFJ.Rows[i]["ID"].ToInt();
int bgoid = dtFJ.Rows[i]["OBJECTID"].ToInt();
string jcError = dtFJ.Rows[i]["ErrorDesc"].ToTrim();
string jcErroArea = dtFJ.Rows[i]["ErrorArea"].ToTrim();
string bgErrorType = dtFJ.Rows[i]["ErrorType"].ToTrim();
string errorcode = dtFJ.Rows[i]["ErrorCode"].ToTrim();
EnumErrorType errType = (EnumErrorType)Enum.Parse(typeof(EnumErrorType), bgErrorType);
base.CheckResults.Add(new DataCheckResult()
{
ID = id,
ErrorDesc = jcError,
ErrorCode = errorcode,
ErrorLayer = "DLTBBG",
PrimaryKey = "OBJECTID",
PrimaryKeyValue = bgoid.ToTrim(),
ErrorType = errType,
ErrorArea = jcErroArea,
Icon = string.Format("pack://siteoforigin:,,,/Images/{0}.{1}", errType.ToString(), "png")
});
}
}
catch (Exception ex)
{
MessageHelper.ShowError("加载检查结果视图数据失败,请查看日志!");
LogAPI.Debug(ex.Message);
}
}
public override void StartRepair(object pParm)
{
StartLoadData(pParm);
}
public override void StartSingleRepair(object pParm)
{
}
public override void StartCheckForThread(object pParam)
{
}
}
}