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.
1487 lines
74 KiB
1487 lines
74 KiB
using ESRI.ArcGIS.Geodatabase; |
|
using ESRI.ArcGIS.Geometry; |
|
using KGIS.Framework.AE.ExtensionMethod; |
|
using KGIS.Framework.DBOperator; |
|
using KGIS.Framework.Maps; |
|
using KGIS.Framework.Platform; |
|
using KGIS.Framework.Utils; |
|
using KGIS.Framework.Utils.ExtensionMethod; |
|
using Kingo.PluginServiceInterface; |
|
using System; |
|
using System.Collections.Generic; |
|
using System.Data; |
|
using System.Linq; |
|
using System.Runtime.InteropServices; |
|
using System.Text.RegularExpressions; |
|
|
|
namespace Kingo.RuleCheck.XJRuleCheck |
|
{ |
|
public class BGQDataCheck |
|
{ |
|
//分类编号+规则编号+字段编号+错误类别 |
|
DLTBBGEntity dltbBGEntity = null; |
|
List<CheckResult> dataCheckResults = null; |
|
ProjectInfo projectInfo = null; |
|
private string AttributeErrorCode = "1001" + "0002" + "0000"; |
|
private List<DataDicTionary> DLBMdataDic = null; |
|
private List<DataDicTionary> TBXHdataDic = null; |
|
private List<DataDicTionary> ZZSXdataDic = null; |
|
private List<DataDicTionary> QSXZdataDic = null; |
|
private List<DataDicTionary> GDPDJBdataDic = null; |
|
public string IDataCheckName => "BGQDataCheck"; |
|
public void FeatureCheck(object pParm) |
|
{ |
|
try |
|
{ |
|
lock (this) |
|
{ |
|
CheckParametr _Parm = pParm as CheckParametr; |
|
if (_Parm.DataSource as IFeature == null) return; |
|
dataCheckResults = new List<CheckResult>(); |
|
if ((_Parm.CheckType & enumCheckType.Attribute) == enumCheckType.Attribute && (_Parm.DataSource as IFeature).Class.AliasName == "地类图斑变更层") |
|
{ |
|
ExecuteAttributeCheck(_Parm.DataSource, _Parm.RuleName); |
|
} |
|
else if ((_Parm.CheckType & enumCheckType.Attribute) == enumCheckType.Attribute && (_Parm.DataSource as IFeature).Class.AliasName == "单图斑地类图斑更新") |
|
{ |
|
ExecuteAttributeCheckDTB(_Parm.DataSource, _Parm.RuleName); |
|
} |
|
if ((_Parm.CheckType & enumCheckType.Graphic) == enumCheckType.Graphic && (_Parm.DataSource as IFeature).Class.AliasName == "地类图斑变更层") |
|
{ |
|
ExecuteGraphicCheck(_Parm.DataSource); |
|
} |
|
(pParm as CheckParametr).CheckResults = dataCheckResults; |
|
} |
|
} |
|
catch (Exception ex) |
|
{ |
|
LogAPI.Debug($"单图层图形检查异常:{ex.Message}"); |
|
LogAPI.Debug(ex); |
|
} |
|
} |
|
|
|
public void FeatureClassCheck(object pParm) |
|
{ |
|
IFeature feature = null; |
|
IFeatureCursor featureCursor = null; |
|
try |
|
{ |
|
CheckParametr _Parm = pParm as CheckParametr; |
|
if (_Parm == null) |
|
return; |
|
dataCheckResults = new List<CheckResult>(); |
|
IFeatureClass featureClass = _Parm.DataSource as IFeatureClass; |
|
if (featureClass != null) |
|
{ |
|
featureCursor = featureClass.Search(null, true); |
|
while ((feature = featureCursor.NextFeature()) != null) |
|
{ |
|
if ((_Parm.CheckType & enumCheckType.Attribute) == enumCheckType.Attribute) |
|
{ |
|
ExecuteAttributeCheck(feature, _Parm.RuleName); |
|
} |
|
if ((_Parm.CheckType & enumCheckType.Graphic) == enumCheckType.Graphic) |
|
{ |
|
ExecuteGraphicCheck(feature); |
|
} |
|
} |
|
_Parm.CheckResults = dataCheckResults; |
|
} |
|
} |
|
catch (Exception ex) |
|
{ |
|
LogAPI.Debug($"单图层图形检查异常:{ex.Message}"); |
|
throw ex; |
|
} |
|
finally |
|
{ |
|
if (feature != null) |
|
Marshal.ReleaseComObject(feature); |
|
if (featureCursor != null) |
|
Marshal.ReleaseComObject(featureCursor); |
|
} |
|
} |
|
|
|
/// <summary> |
|
/// 属性检查 |
|
/// </summary> |
|
/// <param name="row"></param> |
|
/// <param name="pfeature"></param> |
|
/// <param name="featureLayer"></param> |
|
public void ExecuteAttributeCheck(object feature, string ruleName = "") |
|
{ |
|
try |
|
{ |
|
AssignmentEntity(feature as IFeature); |
|
if (dltbBGEntity == null) return; |
|
if (DLBMdataDic == null) |
|
DLBMdataDic = GetNoGroupDic(DicTypeEnum.DLBM); |
|
if (TBXHdataDic == null) |
|
TBXHdataDic = GetNoGroupDic(DicTypeEnum.TBXHLX); |
|
if (ZZSXdataDic == null) |
|
ZZSXdataDic = GetNoGroupDic(DicTypeEnum.ZZSX); |
|
if (QSXZdataDic == null) |
|
QSXZdataDic = GetNoGroupDic(DicTypeEnum.QSXZ); |
|
if (GDPDJBdataDic == null) |
|
GDPDJBdataDic = GetNoGroupDic(DicTypeEnum.PDJB); |
|
projectInfo = (MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo); |
|
string code = AttributeErrorCode; |
|
|
|
#region 地类编码 |
|
if (ruleName == "地类编码/地类名称不允许为空!" || string.IsNullOrEmpty(ruleName)) |
|
{ |
|
if (string.IsNullOrWhiteSpace(dltbBGEntity.DLBM) || string.IsNullOrEmpty(dltbBGEntity.DLMC)) |
|
{ |
|
LogicCheck("地类编码/地类名称不允许为空!", "地类编码/名称错误!", code + "0001", dltbBGEntity.OBJECTID); |
|
return; |
|
} |
|
else if (ruleName == "地类图斑变更层DLBM和DLMC在第三次全国土地调查工作分类表(最末级分类)中有对应项且匹配!" || string.IsNullOrEmpty(ruleName)) |
|
{ |
|
if (DicFirstOrDefault(DLBMdataDic, dltbBGEntity.DLBM, dltbBGEntity.DLMC, false)) |
|
{ |
|
LogicCheck("地类图斑变更层DLBM和DLMC在第三次全国土地调查工作分类表(最末级分类)中有对应项且匹配!", "地类编码/名称错误!", code + "0001", dltbBGEntity.OBJECTID); |
|
return; |
|
} |
|
} |
|
} |
|
#endregion |
|
|
|
#region 权属单位代码/名称 |
|
|
|
//QSDW(dltbBGEntity, code + "0002", "权属单位代码/名称错误!", ruleName); |
|
#endregion |
|
|
|
#region 坐落单位代码/名称 |
|
//ZLDW(dltbBGEntity, code + "0003", "坐落单位代码/名称错误!"); |
|
#endregion |
|
|
|
#region 图斑细化代码/名称 |
|
TBXHDM(dltbBGEntity, code + "0004", "图斑细化标注错误"); |
|
#endregion |
|
|
|
#region 种植属性代码/名称 |
|
ZZSXDM(dltbBGEntity, code + "0005", "种植属性标注错误!"); |
|
#endregion |
|
|
|
#region 扣除地类编码 |
|
if (!string.IsNullOrEmpty(dltbBGEntity.KCDLBM) && dltbBGEntity.KCDLBM != "1203") |
|
{ |
|
//LogicCheck("地类图斑变更层KCDLBM取值应在1203、空范围内!", "扣除地类编码赋值错误!", code + "0006", dltbBGEntity.OBJECTID); |
|
} |
|
#endregion |
|
|
|
#region 城镇村属性码 |
|
CZCSXM(dltbBGEntity, code + "0007", "城镇村属性码赋值错误!"); |
|
#endregion |
|
|
|
#region 权属性质 |
|
//QSXZ(dltbBGEntity, code + "0008", "权属性质赋值错误!"); |
|
#endregion |
|
|
|
#region 飞入地标识 |
|
//FRDBS(dltbBGEntity, code + "0009", "飞入地标识赋值错误!"); |
|
#endregion |
|
|
|
#region 备注 |
|
if (!string.IsNullOrEmpty(dltbBGEntity.BZ)) |
|
{ |
|
//LogicCheck("地类图斑变更层BZ字段为须为空!", "备注赋值错误!", code + "0010", dltbBGEntity.OBJECTID); |
|
} |
|
#endregion |
|
|
|
#region 描述说明 |
|
//MSSM(dltbBGEntity, code + "0011", "MSSM赋值错误!"); |
|
#endregion |
|
|
|
#region 线状地物宽度 |
|
//XZDWKD(dltbBGEntity, code + "0012", "线状地物宽度赋值错误!"); |
|
#endregion |
|
|
|
#region 耕地坡度级别 |
|
//if (dltbBGEntity.DLBM.Substring(0, 2) == "01" && string.IsNullOrEmpty(dltbBGEntity.GDPDJB)) |
|
//{ |
|
// LogicCheck("耕地坡度级别赋值错误(空值)!", "耕地坡度级别错误!", code + "0023", dltbBGEntity.OBJECTID); |
|
//} |
|
//else if (dltbBGEntity.DLBM.Substring(0, 2) == "01" && DicFirstOrDefault(GDPDJBdataDic, dltbBGEntity.GDPDJB.ToTrim(), "", true)) |
|
//{ |
|
// LogicCheck("地类图斑变更层GDPDJB字段取值规范性,字典中不存在!", "耕地坡度级别错误!", code + "0023", dltbBGEntity.OBJECTID); |
|
//} |
|
#endregion |
|
|
|
#region 耕地 |
|
GD(dltbBGEntity, code + "0008", "非耕地类型数据赋值错误!"); |
|
#endregion |
|
|
|
#region 要求面积大于30平方米 |
|
List<string> dlbmliststr = new List<string>() { "1001", "1002", "1003", "1004", "1006", "1009", "1101", "1107", "1107A", "1203" }; |
|
LogicCheck(!dlbmliststr.Contains(dltbBGEntity.DLBM) && Convert.ToDecimal(dltbBGEntity.SHAPE_Area) < 30, "存在碎片多边形(要求面积大于30平方米)不检查以下地'1001','1002','1003','1004','1006','1009','1101','1107','1107A','1203'!", "面积小于30,属于碎片多边形!", code + "0013", dltbBGEntity.OBJECTID); |
|
#endregion |
|
|
|
#region 项目信息 |
|
FeatureXMInfo(dltbBGEntity, code + "0014", "项目信息检查!"); |
|
#endregion |
|
|
|
#region 单独图层图斑与地类 |
|
DDTCAndDLBM(dltbBGEntity, code + "0015", "单独图层图斑与地类逻辑性检查!"); |
|
#endregion |
|
|
|
#region 路面范围与地类编码 |
|
LMFWAndDLBM(dltbBGEntity, code + "0016", "路面范围与地类编码逻辑性检查!"); |
|
#endregion |
|
|
|
} |
|
catch (Exception ex) |
|
{ |
|
LogAPI.Debug("属性检查失败信息:" + ex.Message); |
|
throw ex; |
|
} |
|
} |
|
|
|
/// <summary> |
|
/// 属性检查 |
|
/// </summary> |
|
/// <param name="row"></param> |
|
/// <param name="pfeature"></param> |
|
/// <param name="featureLayer"></param> |
|
public void ExecuteAttributeCheckDTB(object feature, string ruleName = "") |
|
{ |
|
try |
|
{ |
|
AssignmentEntityDTB(feature as IFeature); |
|
if (dltbBGEntity == null) return; |
|
if (DLBMdataDic == null) |
|
DLBMdataDic = GetNoGroupDic(DicTypeEnum.DLBM); |
|
if (TBXHdataDic == null) |
|
TBXHdataDic = GetNoGroupDic(DicTypeEnum.TBXHLX); |
|
if (ZZSXdataDic == null) |
|
ZZSXdataDic = GetNoGroupDic(DicTypeEnum.ZZSX); |
|
if (QSXZdataDic == null) |
|
QSXZdataDic = GetNoGroupDic(DicTypeEnum.QSXZ); |
|
if (GDPDJBdataDic == null) |
|
GDPDJBdataDic = GetNoGroupDic(DicTypeEnum.PDJB); |
|
if (projectInfo == null) |
|
projectInfo = (MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo); |
|
string code = AttributeErrorCode; |
|
|
|
#region 地类编码 |
|
if (ruleName == "地类编码/地类名称不允许为空!" || string.IsNullOrEmpty(ruleName)) |
|
{ |
|
if (string.IsNullOrWhiteSpace(dltbBGEntity.DLBM) || string.IsNullOrEmpty(dltbBGEntity.DLMC)) |
|
{ |
|
LogicCheck("地类编码/地类名称不允许为空!", "地类编码/名称错误!", code + "0001", dltbBGEntity.OBJECTID); |
|
return; |
|
} |
|
else if (ruleName == "地类图斑变更层DLBM和DLMC在第三次全国土地调查工作分类表(最末级分类)中有对应项且匹配!" || string.IsNullOrEmpty(ruleName)) |
|
{ |
|
if (DicFirstOrDefault(DLBMdataDic, dltbBGEntity.DLBM, dltbBGEntity.DLMC, false)) |
|
{ |
|
LogicCheck("地类图斑变更层DLBM和DLMC在第三次全国土地调查工作分类表(最末级分类)中有对应项且匹配!", "地类编码/名称错误!", code + "0001", dltbBGEntity.OBJECTID); |
|
return; |
|
} |
|
} |
|
} |
|
#endregion |
|
|
|
#region 图斑细化代码/名称 |
|
TBXHDM(dltbBGEntity, code + "0004", "图斑细化标注错误"); |
|
#endregion |
|
|
|
#region 种植属性代码/名称 |
|
ZZSXDM(dltbBGEntity, code + "0005", "种植属性标注错误!"); |
|
#endregion |
|
|
|
#region 城镇村属性码 |
|
CZCSXM(dltbBGEntity, code + "0007", "城镇村属性码赋值错误!"); |
|
#endregion |
|
|
|
#region 要求面积大于30平方米 |
|
List<string> dlbmliststr = new List<string>() { "1001", "1002", "1003", "1004", "1006", "1009", "1101", "1107", "1107A", "1203" }; |
|
LogicCheck(!dlbmliststr.Contains(dltbBGEntity.DLBM) && Convert.ToDecimal(dltbBGEntity.SHAPE_Area) < 30, "存在碎片多边形(要求面积大于30平方米)不检查以下地'1001','1002','1003','1004','1006','1009','1101','1107','1107A','1203'!", "面积小于30,属于碎片多边形!", code + "0013", dltbBGEntity.OBJECTID); |
|
#endregion |
|
|
|
#region 项目信息 |
|
FeatureXMInfo(dltbBGEntity, code + "0014", "项目信息检查!"); |
|
#endregion |
|
|
|
#region 单独图层图斑与地类 |
|
DDTCAndDLBM(dltbBGEntity, code + "0015", "单独图层图斑与地类逻辑性检查!"); |
|
#endregion |
|
|
|
#region 路面范围与地类编码 |
|
LMFWAndDLBM(dltbBGEntity, code + "0016", "路面范围与地类编码逻辑性检查!"); |
|
#endregion |
|
|
|
} |
|
catch (Exception ex) |
|
{ |
|
LogAPI.Debug("属性检查失败信息:" + ex.Message); |
|
throw ex; |
|
} |
|
} |
|
|
|
#region 属性逻辑检查 |
|
private void FRDBS(DLTBBGEntity dltbBGEntity, string code, string Synopsis) |
|
{ |
|
if (dltbBGEntity.FRDBS != "0" && dltbBGEntity.FRDBS != "1") |
|
{ |
|
LogicCheck("地类图斑变更层FRDBS字段取值规范性,0或者1!", Synopsis, code, dltbBGEntity.OBJECTID); |
|
return; |
|
} |
|
else if (!string.IsNullOrEmpty(dltbBGEntity.QSDWDM) && !string.IsNullOrEmpty(dltbBGEntity.ZLDWDM) && dltbBGEntity.QSDWDM.Substring(0, 6) == dltbBGEntity.ZLDWDM.Substring(0, 6) && (dltbBGEntity.QSXZ == "10" || dltbBGEntity.QSXZ == "20") && dltbBGEntity.FRDBS == "1") |
|
{ |
|
LogicCheck("地类图斑变更层权属和坐落属于同一区县的国有土地飞入地标识不能为1!", Synopsis, code, dltbBGEntity.OBJECTID); |
|
return; |
|
} |
|
else if (!string.IsNullOrEmpty(dltbBGEntity.QSDWDM) && !string.IsNullOrEmpty(dltbBGEntity.ZLDWDM) && dltbBGEntity.QSDWDM.Substring(0, 12) == dltbBGEntity.ZLDWDM.Substring(0, 12) && dltbBGEntity.FRDBS == "1") |
|
{ |
|
LogicCheck("ZLDWDM前12位与QSDWDM前12位不致,地类图斑变更层FRDBS字段值不能为1!", Synopsis, code, dltbBGEntity.OBJECTID); |
|
return; |
|
} |
|
} |
|
private void CZCSXM(DLTBBGEntity dltbBGEntity, string code, string Synopsis) |
|
{ |
|
List<string> liststr = new List<string>() { "05H1", "0508", "0602", "0603", "0701", "0702", "08H1", "08H2", "08H2A", "0809", "0810", "0810A", "09", "1004", "1005", "1201" }; |
|
if (liststr.Contains(dltbBGEntity.DLBM) && string.IsNullOrEmpty(dltbBGEntity.CZCSXM)) |
|
{ |
|
LogicCheck("地类图斑变更层建设用地(05H1、0508、0602、0603、0701、0702、08H1、08H2、08H2A、0809、0810、0810A、09、1004、1005、1201),CZCSXM取值在201、202、203、204、205范围内,不允许为空!", Synopsis, code, dltbBGEntity.OBJECTID); |
|
} |
|
else if (dltbBGEntity.DLBM == "0601") |
|
{ |
|
liststr = new List<string>() { "201", "202", "203", "204", "205", "201A", "202A", "203A" }; |
|
if (!liststr.Contains(dltbBGEntity.CZCSXM)) |
|
{ |
|
LogicCheck("地类图斑变更层工业用地0601,CZCSXM字段取值在201、202、203、201A、202A、203A、204、205范围内!", Synopsis, code, dltbBGEntity.OBJECTID); |
|
} |
|
} |
|
else if (!string.IsNullOrEmpty(dltbBGEntity.CZCSXM)) |
|
{ |
|
List<string> dlbmliststr = new List<string>() { "1001", "1002", "1003", "1006", "1007", "1008", "1009", "1109" }; |
|
liststr = new List<string>() { "201", "202", "203", "204", "205", "" }; |
|
if (dlbmliststr.Contains(dltbBGEntity.DLBM) && !liststr.Contains(dltbBGEntity.CZCSXM)) |
|
{ |
|
LogicCheck("地类图斑变更层非建设用地、交通运输用地(1001, 1002, 1003, 1006, 1007, 1008, 1009)、水工建筑用地(1109),CZCSXM字段取值在201、202、203、204、205范围内,或取值为空!", Synopsis, code, dltbBGEntity.OBJECTID); |
|
} |
|
} |
|
} |
|
private void ZZSXDM(DLTBBGEntity dltbBGEntity, string code, string Synopsis) |
|
{ |
|
List<string> liststr = new List<string>() { "LS", "FLS", "LYFL", "XG", "LLJZ", "WG" }; |
|
List<string> dlbmliststr = null; |
|
if (!string.IsNullOrEmpty(dltbBGEntity.ZZSXMC) && !string.IsNullOrEmpty(dltbBGEntity.ZZSXDM) && DicFirstOrDefault(ZZSXdataDic, dltbBGEntity.ZZSXDM.ToTrim(), dltbBGEntity.ZZSXMC, false)) |
|
{ |
|
LogicCheck("地类图斑变更层ZZSXMC与ZZSXDM字段取值匹配!", Synopsis, code, dltbBGEntity.OBJECTID); |
|
return; |
|
} |
|
else if (dltbBGEntity.DLBM.Substring(0, 2) == "01" && !liststr.Contains(dltbBGEntity.ZZSXDM.ToTrim())) |
|
{ |
|
LogicCheck("地类图斑变更层DLBM前2位为01时,ZZSXDM取值在LS、FLS、LYFL、XG、LLJZ、WG范围内!", Synopsis, code, dltbBGEntity.OBJECTID); |
|
return; |
|
} |
|
else if (!string.IsNullOrEmpty(dltbBGEntity.ZZSXDM)) |
|
{ |
|
dlbmliststr = new List<string>() { "0301", "0302", "0305", "0307", "0404", "1104", "1104A" }; |
|
liststr = new List<string>() { "JKHF", "GCHF" }; |
|
if (dlbmliststr.Contains(dltbBGEntity.DLBM) && !liststr.Contains(dltbBGEntity.ZZSXDM.ToTrim())) |
|
{ |
|
LogicCheck("地类图斑变更层DLBM为0301、0302、0305、0307、0404、1104、1104A时,ZZSXDM取值在JKHF、GCHF、空范围内!", Synopsis, code, dltbBGEntity.OBJECTID); |
|
return; |
|
} |
|
dlbmliststr = new List<string>() { "0201K", "0202K", "0203K", "0204K", "0301K", "0302K", "0307K", "0403K", "1104K" }; |
|
if (dlbmliststr.Contains(dltbBGEntity.DLBM) && !liststr.Contains(dltbBGEntity.ZZSXDM.ToTrim())) |
|
{ |
|
LogicCheck("地类图斑变更层DLBM为0201K、0202K、0203K、0204K、0301K、0302K、0307K、0403K、1104K时,ZZSXDM取值在JKHF、GCHF、空范围内!", Synopsis, code, dltbBGEntity.OBJECTID); |
|
return; |
|
} |
|
dlbmliststr = new List<string>() { "0201", "0202", "0203", "0204" }; |
|
if (dlbmliststr.Contains(dltbBGEntity.DLBM) && string.IsNullOrEmpty(dltbBGEntity.TBXHDM) && !liststr.Contains(dltbBGEntity.ZZSXDM.ToTrim())) |
|
{ |
|
LogicCheck("地类图斑变更层DLBM为0201、0202、0203、0204,且TBXHDM为空时,ZZSXDM取值在JKHF、GCHF、空范围内!", Synopsis, code, dltbBGEntity.OBJECTID); |
|
return; |
|
} |
|
liststr = new List<string>() { "04", "05", "06", "07", "08", "09", "10", "11", "12", "0303", "0304", "0306", "0402", "0603", "1105", "1106", "1108" }; |
|
dlbmliststr = new List<string>() { "0404", "0403K", "1104", "1104A", "1104K" }; |
|
if ((liststr.Contains(dltbBGEntity.DLBM.Substring(0, 2)) || liststr.Contains(dltbBGEntity.DLBM)) && !dlbmliststr.Contains(dltbBGEntity.DLBM)) |
|
{ |
|
LogicCheck("地类图斑变更层DLBM前2位为04(不包括0404、0403K)、05、06、07、08、09、10、11(不包括1104、1104A、1104K)、12,或属于湿地的,不允许填写种植属性代码!", Synopsis, code, dltbBGEntity.OBJECTID); |
|
return; |
|
} |
|
} |
|
else if (dltbBGEntity.TBXHDM == "LQYD") |
|
{ |
|
dlbmliststr = new List<string>() { "0201", "0202", "0203", "0204" }; |
|
if (dlbmliststr.Contains(dltbBGEntity.DLBM)) |
|
{ |
|
LogicCheck(string.IsNullOrEmpty(dltbBGEntity.ZZSXDM), "地类图斑变更层地类为0201、0202、0203、0204,且标注林区种植园用地的不能标注种植属性!", Synopsis, code, dltbBGEntity.OBJECTID); |
|
return; |
|
} |
|
} |
|
} |
|
private void QSDW(DLTBBGEntity dltbBGEntity, string code, string Synopsis, string ruleName) |
|
{ |
|
if (ruleName == "地类图斑变更层QSDWDM/QSDWMC不能为空!" || string.IsNullOrEmpty(ruleName)) |
|
{ |
|
if (string.IsNullOrEmpty(dltbBGEntity.QSDWDM) || string.IsNullOrEmpty(dltbBGEntity.QSDWMC)) |
|
{ |
|
LogicCheck("地类图斑变更层QSDWDM/QSDWMC不能为空!", Synopsis, code, dltbBGEntity.OBJECTID); |
|
return; |
|
} |
|
else if (!Regex.IsMatch(dltbBGEntity.QSDWDM, "^\\d{19}$")) |
|
{ |
|
LogicCheck("地类图斑变更层QSDWDM不能为空,长度为19位,必须为纯数值!", Synopsis, code, dltbBGEntity.OBJECTID); |
|
return; |
|
} |
|
else if (!Regex.IsMatch(dltbBGEntity.QSDWMC, @"^[\u4E00-\u9FA5A-Za-z0-9-()()]+$")) |
|
{ |
|
LogicCheck("地类图斑变更层QSDWMC不能为空、不存在特殊字符!", Synopsis, code, dltbBGEntity.OBJECTID); |
|
return; |
|
} |
|
} |
|
} |
|
private void ZLDW(DLTBBGEntity dltbBGEntity, string code, string Synopsis) |
|
{ |
|
if (string.IsNullOrEmpty(dltbBGEntity.ZLDWDM) || string.IsNullOrEmpty(dltbBGEntity.ZLDWDM)) |
|
{ |
|
LogicCheck("地类图斑变更层ZLDWDM/ZLDWMC不能为空!", Synopsis, code, dltbBGEntity.OBJECTID); |
|
return; |
|
} |
|
else if (!Regex.IsMatch(dltbBGEntity.ZLDWDM, "^\\d{19}$")) |
|
{ |
|
LogicCheck("地类图斑变更层ZLDWDM不能为空,长度为19位,必须为纯数值!", Synopsis, code, dltbBGEntity.OBJECTID); |
|
return; |
|
} |
|
else if (projectInfo.CODE != dltbBGEntity.ZLDWDM.Substring(0, 6)) |
|
{ |
|
LogicCheck("地类图斑变更层ZLDWDM前6位为县级行政区代码!", Synopsis, code, dltbBGEntity.OBJECTID); |
|
} |
|
//else if (!Regex.IsMatch(dltbBGEntity.ZLDWMC, @"^[\u4e00-\u9fa5]+$")) |
|
//else if (IsLetterOrDigit(dltbBGEntity.ZLDWMC)) |
|
else if (!Regex.IsMatch(dltbBGEntity.QSDWMC, @"^[\u4E00-\u9FA5A-Za-z0-9-()()]+$")) |
|
{ |
|
LogicCheck("地类图斑变更层ZLDWMC不能为空、不存在特殊字符!", Synopsis, code, dltbBGEntity.OBJECTID); |
|
} |
|
} |
|
private void TBXHDM(DLTBBGEntity dltbBGEntity, string code, string Synopsis) |
|
{ |
|
List<string> liststr = new List<string>() { "01", "02", "03", "04", "0601", "0602", "1001", "1003", "0303", "0304", "0306", "0402", "0603", "1105", "1106", "1108" }; |
|
if (!string.IsNullOrEmpty(dltbBGEntity.TBXHMC) && !string.IsNullOrEmpty(dltbBGEntity.TBXHDM) && DicFirstOrDefault(TBXHdataDic, dltbBGEntity.TBXHDM, dltbBGEntity.TBXHMC, false)) |
|
{ |
|
LogicCheck("地类图斑变更层TBXHMC与TBXHDM字段取值匹配!", Synopsis, code, dltbBGEntity.OBJECTID); |
|
return; |
|
} |
|
else if (!liststr.Contains(dltbBGEntity.DLBM.Substring(0, 2)) && !liststr.Contains(dltbBGEntity.DLBM) && (!string.IsNullOrEmpty(dltbBGEntity.TBXHDM) || !string.IsNullOrEmpty(dltbBGEntity.TBXHMC))) |
|
{ |
|
LogicCheck("地类图斑变更层DLBM字段前2位非01、02、03、04,且DLBM不在0601、0602、1001、1003取值范围内,或属于湿地的地类,不能进行图斑细化标注!", Synopsis, code, dltbBGEntity.OBJECTID); |
|
return; |
|
} |
|
else if (dltbBGEntity.DLBM == "0601") |
|
{ |
|
liststr = new List<string>() { "HDGY", "GTGY", "MTGY", "SNGY", "BLGY", "DLGY", "" }; |
|
if (!liststr.Contains(dltbBGEntity.TBXHDM.ToTrim())) |
|
{ |
|
LogicCheck("地类图斑变更层工业用地(0601),TBXHDM字段为HDGY、GTGY、MTGY、SNGY、BLGY、DLGY,或空值!", Synopsis, code, dltbBGEntity.OBJECTID); |
|
return; |
|
} |
|
} |
|
else if ((dltbBGEntity.DLBM == "0602" || dltbBGEntity.DLBM == "1001" || dltbBGEntity.DLBM == "1003") && dltbBGEntity.TBXHDM != "FQ" && !string.IsNullOrEmpty(dltbBGEntity.TBXHDM)) |
|
{ |
|
LogicCheck("地类图斑变更层DLBM为0602、1001、1003时,TBXHDM字段为FQ或空值!", Synopsis, code, dltbBGEntity.OBJECTID); |
|
return; |
|
} |
|
else if (dltbBGEntity.DLBM.Substring(0, 2) == "01") |
|
{ |
|
liststr = new List<string>() { "HDGD", "HQGD", "LQGD", "MQGD", "SHGD", "SMGD", "YJGD", "" }; |
|
if (!liststr.Contains(dltbBGEntity.TBXHDM) && !string.IsNullOrEmpty(dltbBGEntity.TBXHDM)) |
|
{ |
|
LogicCheck("地类图斑变更层DLBM前2位为01时,TBXHDM字段取值在HDGD、HQGD、LQGD、MQGD、SHGD、SMGD、YJGD或空范围内!", Synopsis, code, dltbBGEntity.OBJECTID); |
|
return; |
|
} |
|
} |
|
else if (dltbBGEntity.DLBM.Substring(0, 2) == "04" && dltbBGEntity.DLBM != "0404" && dltbBGEntity.TBXHDM != "GCCD" && !string.IsNullOrEmpty(dltbBGEntity.TBXHDM)) |
|
{ |
|
LogicCheck("地类图斑变更层DLBM前2位为04时(不含0404),TBXHDM取值在GCCD、空范围内!", Synopsis, code, dltbBGEntity.OBJECTID); |
|
return; |
|
} |
|
else if (dltbBGEntity.DLBM.Substring(0, 2) == "03" && !string.IsNullOrEmpty(dltbBGEntity.TBXHDM) && dltbBGEntity.TBXHDM != "LJTM") |
|
{ |
|
LogicCheck("地类图斑变更层DLBM前2位为03时,TBXHDM取值在LJTM、空范围内!", Synopsis, code, dltbBGEntity.OBJECTID); |
|
return; |
|
} |
|
else if (dltbBGEntity.DLBM.Substring(0, 2) == "02" && !string.IsNullOrEmpty(dltbBGEntity.TBXHDM) && dltbBGEntity.TBXHDM != "LQYD") |
|
{ |
|
LogicCheck("地类图斑变更层DLBM前2位为02时,TBXHDM取值在LQYD、空范围内!", Synopsis, code, dltbBGEntity.OBJECTID); |
|
return; |
|
} |
|
} |
|
private void XZDWKD(DLTBBGEntity dltbBGEntity, string code, string Synopsis) |
|
{ |
|
List<string> dlbmliststr = new List<string>() { "1001", "1002", "1003", "1006", "1007", "1008", "1009", "1109", "1107", "1107A" }; |
|
if (!string.IsNullOrEmpty(dltbBGEntity.XZDWKD)) |
|
{ |
|
if (!Regex.IsMatch(dltbBGEntity.XZDWKD, "^[0-9]+(.[0-9]{1})?$")) |
|
{ |
|
LogicCheck("地类图斑变更层线状地物宽度字段小数位数检查,保留1位小数!", Synopsis, code, dltbBGEntity.OBJECTID); |
|
return; |
|
} |
|
else if (dlbmliststr.Contains(dltbBGEntity.DLBM) && Convert.ToDouble(dltbBGEntity.XZDWKD) < 0) |
|
{ |
|
LogicCheck("地类图斑变更层铁路、公路、管道用地、农村道路和沟渠等线形地物,线状图斑宽度XZDWKD大于0!", Synopsis, code, dltbBGEntity.OBJECTID); |
|
return; |
|
} |
|
else |
|
{ |
|
dlbmliststr = new List<string>() { "1001", "1002", "1003", "1004", "1006", "1007", "1008", "1009", "1109", "1107", "1107A", "1101" }; |
|
if (!dlbmliststr.Contains(dltbBGEntity.DLBM) && Convert.ToDouble(dltbBGEntity.XZDWKD) > 0) |
|
{ |
|
LogicCheck("地类图斑变更层非河流、铁路、公路、管道用地、农村道路和沟渠等线形地物,线状图斑宽度XZDWKD等于0,允许为空!", Synopsis, code, dltbBGEntity.OBJECTID); |
|
return; |
|
} |
|
} |
|
} |
|
} |
|
private void MSSM(DLTBBGEntity dltbBGEntity, string code, string Synopsis) |
|
{ |
|
if (dltbBGEntity.MSSM != "00" && dltbBGEntity.MSSM != "01") |
|
{ |
|
LogicCheck("地类图斑变更层MSSM字段取值为00或01!", Synopsis, code, dltbBGEntity.OBJECTID); |
|
return; |
|
} |
|
else if ((dltbBGEntity.QSXZ == "21" || dltbBGEntity.QSXZ == "41") && dltbBGEntity.MSSM != "01") |
|
{ |
|
LogicCheck("地类图斑变更层权属性质为21或41,描述说明须为01!", Synopsis, code, dltbBGEntity.OBJECTID); |
|
return; |
|
} |
|
} |
|
private void QSXZ(DLTBBGEntity dltbBGEntity, string code, string Synopsis) |
|
{ |
|
if (string.IsNullOrEmpty(dltbBGEntity.QSXZ)) |
|
{ |
|
LogicCheck("地类图斑变更层QSXZ字段取值规范性,不能为空!", Synopsis, code, dltbBGEntity.OBJECTID); |
|
} |
|
else if (DicFirstOrDefault(QSXZdataDic, dltbBGEntity.QSXZ.ToTrim(), "", true)) |
|
{ |
|
LogicCheck("地类图斑变更层QSXZ字段取值规范性,权属字典中不存在!", Synopsis, code, dltbBGEntity.OBJECTID); |
|
} |
|
} |
|
private void GD(DLTBBGEntity dltbBGEntity, string code, string Synopsis) |
|
{ |
|
if (dltbBGEntity.DLBM.Substring(0, 2) != "01") |
|
{ |
|
if (!string.IsNullOrEmpty(dltbBGEntity.GDPDJB) && dltbBGEntity.GDPDJB != "0") |
|
{ |
|
LogicCheck("非耕地类型数据不允许填写耕地坡度级别!", Synopsis, code, dltbBGEntity.OBJECTID); |
|
return; |
|
} |
|
else if (!string.IsNullOrEmpty(dltbBGEntity.GDLX)) |
|
{ |
|
LogicCheck("非耕地类型数据不允许填写耕地类型!", Synopsis, code, dltbBGEntity.OBJECTID); |
|
return; |
|
} |
|
else if (!string.IsNullOrEmpty(dltbBGEntity.KCXS) && dltbBGEntity.KCXS != "0") |
|
{ |
|
LogicCheck("非耕地类型数据不允许填写扣除系数!", Synopsis, code, dltbBGEntity.OBJECTID); |
|
return; |
|
} |
|
} |
|
} |
|
|
|
/// <summary> |
|
/// 图斑项目信息检查 |
|
/// </summary> |
|
/// <returns></returns> |
|
private void FeatureXMInfo(DLTBBGEntity dltbBGEntity, string code, string Synopsis) |
|
{ |
|
//if (string.IsNullOrWhiteSpace(dltbBGEntity.SFXML)) |
|
//{ |
|
// LogicCheck("“是否项目类”字段不允许为空!", Synopsis, code, dltbBGEntity.OBJECTID); |
|
//} |
|
//else if (dltbBGEntity.SFXML == "1" && (string.IsNullOrWhiteSpace(dltbBGEntity.XMLX) || string.IsNullOrWhiteSpace(dltbBGEntity.XMMC) || string.IsNullOrWhiteSpace(dltbBGEntity.XMBH) || string.IsNullOrWhiteSpace(dltbBGEntity.DKMC))) |
|
//{ |
|
// LogicCheck("“是否项目类”字段选择“是”时,项目类型、项目名称、项目编号和地块名称字段不能为空!", Synopsis, code, dltbBGEntity.OBJECTID); |
|
//} |
|
//else if (dltbBGEntity.SFXML == "0" && (!string.IsNullOrWhiteSpace(dltbBGEntity.XMLX) || !string.IsNullOrWhiteSpace(dltbBGEntity.XMMC) || !string.IsNullOrWhiteSpace(dltbBGEntity.XMBH) || !string.IsNullOrWhiteSpace(dltbBGEntity.DKMC))) |
|
//{ |
|
// LogicCheck("“是否项目类”字段选择“否”时,项目类型、项目名称、项目编号和地块名称字段都为空!", Synopsis, code, dltbBGEntity.OBJECTID); |
|
//} |
|
if ((string.IsNullOrWhiteSpace(dltbBGEntity.XMMC) || string.IsNullOrWhiteSpace(dltbBGEntity.XMBH) || string.IsNullOrWhiteSpace(dltbBGEntity.DKMC))) |
|
{ |
|
LogicCheck("项目名称、项目编号和地块名称字段不能为空!", Synopsis, code, dltbBGEntity.OBJECTID); |
|
} |
|
} |
|
|
|
private void DDTCAndDLBM(DLTBBGEntity dltbBGEntity, string code, string Synopsis) |
|
{ |
|
//建设用地 |
|
List<string> liststr = new List<string>() { "05H1", "0508", "0602", "0603", "0701", "0702", "08H1", "08H2", "08H2A", "0809", "0810", "0810A", "09", "1001A", "1002A", "1003A", "1004A", "1004", "1005", "1201" }; |
|
string nyd_dlbms = "'0101','0102','0103','0201','0201K','0202','0202K','0203','0203K','0204','0204K','0301','0301K','0302','0302K','0303','0304','0305','0306','0307','0307K','0401','0402','0403','0403K','1006','1103','1104','1104A','1104K','1107','1107A','1202','1203'"; |
|
string[] byds = nyd_dlbms.Split(','); |
|
if (dltbBGEntity.DDTCBZ == "1301" && !liststr.Contains(dltbBGEntity.DLBM)) |
|
{ |
|
LogicCheck("当单独图层代码为“1301 临时用地”时,地类必须为建设用地;否则,认定为错误图斑!", Synopsis, code, dltbBGEntity.OBJECTID); |
|
} |
|
else if (dltbBGEntity.DDTCBZ == "1304" && !(liststr.Contains(dltbBGEntity.DLBM) || byds.Contains(dltbBGEntity.DLBM))) |
|
{ |
|
LogicCheck("当单独图层代码为“1304 拆除未尽区”时,地类必须为建设用地或设施农用地;否则,认定为错误图斑。!", Synopsis, code, dltbBGEntity.OBJECTID); |
|
} |
|
} |
|
|
|
private void LMFWAndDLBM(DLTBBGEntity dltbBGEntity, string code, string Synopsis) |
|
{ |
|
if (dltbBGEntity.DDTCBZ == "1305" && dltbBGEntity.DLBM != "1003") |
|
{ |
|
LogicCheck("当“单独图层代码”为1305时,若地类编码不为1003,认定为错误图斑!", Synopsis, code, dltbBGEntity.OBJECTID); |
|
} |
|
|
|
if (dltbBGEntity.DLBM == "1003" && !"1303,1304,1305".Contains(dltbBGEntity.DDTCBZ)) |
|
{ |
|
LogicCheck("地类编码为1003(不含A),单独图层代码不为1303或1304或1305的,认定为错误图斑!", Synopsis, code, dltbBGEntity.OBJECTID); |
|
} |
|
//建设用地 |
|
List<string> liststr = new List<string>() { "05H1", "0508", "0602", "0603", "0701", "0702", "08H1", "08H2", "08H2A", "0809", "0810", "0810A", "09", "1001A", "1002A", "1003A", "1004A", "1004", "1005", "1201" }; |
|
string gd_dlbms = "'0101','0102','0103','01'"; |
|
if (dltbBGEntity.DDTCBZ == "1303" && !(liststr.Contains(dltbBGEntity.DLBM) || gd_dlbms.Contains(dltbBGEntity.DLBM))) |
|
{ |
|
LogicCheck("当单独图层代码为1303时,地类编码必须为耕地、建设用地。!", Synopsis, code, dltbBGEntity.OBJECTID); |
|
} |
|
} |
|
|
|
#endregion |
|
|
|
#region 图形检查 |
|
public void ExecuteGraphicCheck(object feature) |
|
{ |
|
try |
|
{ |
|
AssignmentEntity(feature as IFeature); |
|
//2、不存在不规则图斑(除地类1001、1002、1006、1009、1107、1109外,其余地类满足面积 / 周长 < 0.2,并且有一个角度小于20) |
|
//自相交/多部件 |
|
List<CheckResult> liststr = CheckGeometry(dltbBGEntity.feature); |
|
if (liststr != null && liststr.Count > 0) |
|
{ |
|
dataCheckResults.AddRange(liststr); |
|
} |
|
//3、地类图斑变更层要素所有角度均应大于10度,同时不存在局部狭长图形 |
|
liststr = AcuteAngle(dltbBGEntity.feature); |
|
if (liststr.Count > 0) |
|
{ |
|
dataCheckResults.AddRange(liststr); |
|
} |
|
//4、地类图斑变更层平均节点密度大于1米小于70米 |
|
CheckResult result = PointToPoint(dltbBGEntity.feature); |
|
if (result != null) |
|
{ |
|
dataCheckResults.Add(result); |
|
} |
|
} |
|
catch (Exception ex) |
|
{ |
|
LogAPI.Debug("变更数据检查异常:" + ex.Message); |
|
LogAPI.Debug(ex); |
|
} |
|
} |
|
#endregion |
|
|
|
private void AssignmentEntity(IFeature feature) |
|
{ |
|
dltbBGEntity = new DLTBBGEntity(); |
|
try |
|
{ |
|
if (feature != null) |
|
{ |
|
dltbBGEntity.OBJECTID = feature.OID; |
|
int iDLBM = feature.Fields.FindField("DLBM"); |
|
int iDLMC = feature.Fields.FindField("DLMC"); |
|
int iQSDWDM = feature.Fields.FindField("QSDWDM"); |
|
int iQSDWMC = feature.Fields.FindField("QSDWMC"); |
|
int iZLDWDM = feature.Fields.FindField("ZLDWDM"); |
|
int iZLDWMC = feature.Fields.FindField("ZLDWMC"); |
|
int iGDLX = feature.Fields.FindField("GDLX"); |
|
int iGDPDJB = feature.Fields.FindField("GDPDJB"); |
|
int iTBXHDM = feature.Fields.FindField("TBXHDM"); |
|
int iTBXHMC = feature.Fields.FindField("TBXHMC"); |
|
int iZZSXDM = feature.Fields.FindField("ZZSXDM"); |
|
int iZZSXMC = feature.Fields.FindField("ZZSXMC"); |
|
int iKCDLBM = feature.Fields.FindField("KCDLBM"); |
|
int iQSXZ = feature.Fields.FindField("QSXZ"); |
|
int iBZ = feature.Fields.FindField("BZ"); |
|
int iXZDWKD = feature.Fields.FindField("XZDWKD"); |
|
int iFRDBS = feature.Fields.FindField("FRDBS"); |
|
int iMSSM = feature.Fields.FindField("MSSM"); |
|
int iCZCSXM = feature.Fields.FindField("CZCSXM"); |
|
int iKCXS = feature.Fields.FindField("KCXS"); |
|
int iGDDB = feature.Fields.FindField("GDDB"); |
|
int iSHAPE_Area = feature.Fields.FindField("SHAPE_Area"); |
|
//配置单图斑属性数据检查 |
|
int iDDTCBZ = feature.Fields.FindField("DDTCBZ"); |
|
int iDDTCMC = feature.Fields.FindField("DDTCMC"); |
|
int iSFXML = feature.Fields.FindField("SFXML"); |
|
int iXMLX = feature.Fields.FindField("XMLX"); |
|
int iXMMC = feature.Fields.FindField("XMMC"); |
|
int iXMBH = feature.Fields.FindField("XMBH"); |
|
int iDKMC = feature.Fields.FindField("DKMC"); |
|
|
|
dltbBGEntity.iDLBM = iDLBM; |
|
dltbBGEntity.iDLMC = iDLMC; |
|
dltbBGEntity.iQSDWDM = iQSDWDM; |
|
dltbBGEntity.iQSDWMC = iQSDWMC; |
|
dltbBGEntity.iZLDWDM = iZLDWDM; |
|
dltbBGEntity.iZLDWMC = iZLDWMC; |
|
dltbBGEntity.iGDLX = iGDLX; |
|
dltbBGEntity.iGDPDJB = iGDPDJB; |
|
dltbBGEntity.iTBXHDM = iTBXHDM; |
|
dltbBGEntity.iTBXHMC = iTBXHMC; |
|
dltbBGEntity.iZZSXDM = iZZSXDM; |
|
dltbBGEntity.iZZSXMC = iZZSXMC; |
|
dltbBGEntity.iKCDLBM = iKCDLBM; |
|
dltbBGEntity.iQSXZ = iQSXZ; |
|
dltbBGEntity.iBZ = iBZ; |
|
dltbBGEntity.iXZDWKD = iXZDWKD; |
|
dltbBGEntity.iFRDBS = iFRDBS; |
|
dltbBGEntity.iMSSM = iMSSM; |
|
dltbBGEntity.iCZCSXM = iCZCSXM; |
|
dltbBGEntity.iKCXS = iKCXS; |
|
dltbBGEntity.iGDDB = iGDDB; |
|
dltbBGEntity.iSHAPE_Area = iSHAPE_Area; |
|
dltbBGEntity.iDDTCBZ = iSHAPE_Area; |
|
dltbBGEntity.iDDTCMC = iSHAPE_Area; |
|
dltbBGEntity.iSFXML = iSHAPE_Area; |
|
dltbBGEntity.iXMLX = iSHAPE_Area; |
|
dltbBGEntity.iXMMC = iSHAPE_Area; |
|
dltbBGEntity.iXMBH = iSHAPE_Area; |
|
dltbBGEntity.iDKMC = iSHAPE_Area; |
|
|
|
dltbBGEntity.DLBM = feature.Value[iDLBM].ToString().ToTrim();//地类编码 |
|
dltbBGEntity.DLMC = feature.Value[iDLMC].ToString().ToTrim();//地类名称 |
|
dltbBGEntity.QSDWDM = feature.Value[iQSDWDM].ToString().ToTrim();//权属单位代码 |
|
dltbBGEntity.QSDWMC = feature.Value[iQSDWMC].ToString().ToTrim();//权属单位名称 |
|
dltbBGEntity.ZLDWDM = feature.Value[iZLDWDM].ToString().ToTrim();//坐落单位代码 |
|
dltbBGEntity.ZLDWMC = feature.Value[iZLDWMC].ToString().ToTrim();//坐落单位名称 |
|
dltbBGEntity.GDLX = feature.Value[iGDLX].ToString().ToTrim();//耕地类型 |
|
dltbBGEntity.GDPDJB = feature.Value[iGDPDJB].ToString().ToTrim();//耕地坡度级别 |
|
dltbBGEntity.TBXHDM = feature.Value[iTBXHDM].ToString().ToTrim();//图斑细化代码 |
|
dltbBGEntity.TBXHMC = feature.Value[iTBXHMC].ToString().ToTrim();//图斑细化代码 |
|
dltbBGEntity.ZZSXDM = feature.Value[iZZSXDM].ToString().ToTrim();//种植属性代码 |
|
dltbBGEntity.ZZSXMC = feature.Value[iZZSXMC].ToString().ToTrim();//种植属性名称 |
|
dltbBGEntity.KCDLBM = feature.Value[iKCDLBM].ToString().ToTrim();//扣除地类编码 |
|
dltbBGEntity.QSXZ = feature.Value[iQSXZ].ToString().ToTrim();//权属性质 |
|
dltbBGEntity.BZ = feature.Value[iBZ].ToString().ToTrim();//备注 |
|
dltbBGEntity.XZDWKD = feature.Value[iXZDWKD].ToString().ToTrim();//线状地物宽度 |
|
dltbBGEntity.FRDBS = feature.Value[iFRDBS].ToString().ToTrim();//飞入地标识 |
|
dltbBGEntity.MSSM = feature.Value[iMSSM].ToString().ToTrim();//描述说明 |
|
dltbBGEntity.CZCSXM = feature.Value[iCZCSXM].ToString().ToTrim();//城镇村属性码 |
|
dltbBGEntity.KCXS = feature.Value[iKCXS].ToString().ToTrim();//扣除系数 |
|
dltbBGEntity.GDDB = feature.Value[iGDDB].ToString().ToTrim();//扣除系数 |
|
dltbBGEntity.SHAPE_Area = feature.Value[iSHAPE_Area].ToString().ToTrim();//SHAPE_Area |
|
dltbBGEntity.DDTCBZ = feature.Value[iDDTCBZ].ToString().ToTrim();//单独图层代码 |
|
dltbBGEntity.DDTCMC = feature.Value[iDDTCMC].ToString().ToTrim();//单独图层名称 |
|
dltbBGEntity.SFXML = feature.Value[iSFXML].ToString().ToTrim();//是否项目类 |
|
dltbBGEntity.XMLX = feature.Value[iXMLX].ToString().ToTrim();//项目类型 |
|
dltbBGEntity.XMMC = feature.Value[iXMMC].ToString().ToTrim();//项目名称 |
|
dltbBGEntity.XMBH = feature.Value[iXMBH].ToString().ToTrim();//项目编号 |
|
dltbBGEntity.DKMC = feature.Value[iDKMC].ToString().ToTrim();//地块名称 |
|
dltbBGEntity.feature = feature; |
|
dltbBGEntity.CheckResult = new List<DataCheckResult>(); |
|
} |
|
} |
|
catch (Exception ex) |
|
{ |
|
throw ex; |
|
} |
|
} |
|
|
|
private void AssignmentEntityDTB(IFeature feature) |
|
{ |
|
dltbBGEntity = new DLTBBGEntity(); |
|
try |
|
{ |
|
if (feature != null) |
|
{ |
|
dltbBGEntity.OBJECTID = feature.OID; |
|
int iDLBM = feature.Fields.FindField("DLBM"); |
|
int iDLMC = feature.Fields.FindField("DLMC"); |
|
int iGDLX = feature.Fields.FindField("GDLX"); |
|
int iTBXHDM = feature.Fields.FindField("TBXHDM"); |
|
int iZZSXDM = feature.Fields.FindField("ZZSXDM"); |
|
int iZZSXMC = feature.Fields.FindField("ZZSXMC"); |
|
int iKCDLBM = feature.Fields.FindField("KCDLBM"); |
|
int iBZ = feature.Fields.FindField("BZ"); |
|
int iXZDWKD = feature.Fields.FindField("XZDWKD"); |
|
int iCZCSXM = feature.Fields.FindField("CZCSXM"); |
|
int iSHAPE_Area = feature.Fields.FindField("SHAPE_Area"); |
|
//配置单图斑属性数据检查 |
|
int iDDTCBZ = feature.Fields.FindField("DDTCBZ"); |
|
int iDDTCMC = feature.Fields.FindField("DDTCMC"); |
|
int iSFXML = feature.Fields.FindField("SFXML"); |
|
int iXMLX = feature.Fields.FindField("XMLX"); |
|
int iXMMC = feature.Fields.FindField("XMMC"); |
|
int iXMBH = feature.Fields.FindField("XMBH"); |
|
int iDKMC = feature.Fields.FindField("DKMC"); |
|
|
|
dltbBGEntity.iDLBM = iDLBM; |
|
dltbBGEntity.iDLMC = iDLMC; |
|
dltbBGEntity.iGDLX = iGDLX; |
|
dltbBGEntity.iTBXHDM = iTBXHDM; |
|
dltbBGEntity.iZZSXDM = iZZSXDM; |
|
dltbBGEntity.iZZSXMC = iZZSXMC; |
|
dltbBGEntity.iKCDLBM = iKCDLBM; |
|
dltbBGEntity.iBZ = iBZ; |
|
dltbBGEntity.iXZDWKD = iXZDWKD; |
|
dltbBGEntity.iCZCSXM = iCZCSXM; |
|
dltbBGEntity.iSHAPE_Area = iSHAPE_Area; |
|
dltbBGEntity.iDDTCBZ = iSHAPE_Area; |
|
dltbBGEntity.iDDTCMC = iSHAPE_Area; |
|
dltbBGEntity.iSFXML = iSHAPE_Area; |
|
dltbBGEntity.iXMLX = iSHAPE_Area; |
|
dltbBGEntity.iXMMC = iSHAPE_Area; |
|
dltbBGEntity.iXMBH = iSHAPE_Area; |
|
dltbBGEntity.iDKMC = iSHAPE_Area; |
|
|
|
dltbBGEntity.DLBM = feature.Value[iDLBM].ToString().ToTrim();//地类编码 |
|
dltbBGEntity.DLMC = feature.Value[iDLMC].ToString().ToTrim();//地类名称 |
|
dltbBGEntity.GDLX = feature.Value[iGDLX].ToString().ToTrim();//耕地类型 |
|
dltbBGEntity.TBXHDM = feature.Value[iTBXHDM].ToString().ToTrim();//图斑细化代码 |
|
dltbBGEntity.ZZSXDM = feature.Value[iZZSXDM].ToString().ToTrim();//种植属性代码 |
|
dltbBGEntity.ZZSXMC = feature.Value[iZZSXMC].ToString().ToTrim();//种植属性名称 |
|
dltbBGEntity.KCDLBM = feature.Value[iKCDLBM].ToString().ToTrim();//扣除地类编码 |
|
dltbBGEntity.BZ = feature.Value[iBZ].ToString().ToTrim();//备注 |
|
dltbBGEntity.XZDWKD = feature.Value[iXZDWKD].ToString().ToTrim();//线状地物宽度 |
|
dltbBGEntity.CZCSXM = feature.Value[iCZCSXM].ToString().ToTrim();//城镇村属性码 |
|
dltbBGEntity.SHAPE_Area = feature.Value[iSHAPE_Area].ToString().ToTrim();//SHAPE_Area |
|
dltbBGEntity.DDTCBZ = feature.Value[iDDTCBZ].ToString().ToTrim();//单独图层代码 |
|
dltbBGEntity.DDTCMC = feature.Value[iDDTCMC].ToString().ToTrim();//单独图层名称 |
|
dltbBGEntity.SFXML = feature.Value[iSFXML].ToString().ToTrim();//是否项目类 |
|
dltbBGEntity.XMLX = feature.Value[iXMLX].ToString().ToTrim();//项目类型 |
|
dltbBGEntity.XMMC = feature.Value[iXMMC].ToString().ToTrim();//项目名称 |
|
dltbBGEntity.XMBH = feature.Value[iXMBH].ToString().ToTrim();//项目编号 |
|
dltbBGEntity.DKMC = feature.Value[iDKMC].ToString().ToTrim();//地块名称 |
|
dltbBGEntity.feature = feature; |
|
dltbBGEntity.CheckResult = new List<DataCheckResult>(); |
|
} |
|
} |
|
catch (Exception ex) |
|
{ |
|
throw ex; |
|
} |
|
} |
|
|
|
/// <summary> |
|
/// LogicCheck |
|
/// </summary> |
|
/// <param name="ErrorDesc">错误描述</param> |
|
/// <param name="Synopsis">摘要</param> |
|
/// <param name="ErrorCode">错误代码</param> |
|
/// <param name="ObjectID">ObjectID</param> |
|
private void LogicCheck(string ErrorDesc, string Synopsis, string ErrorCode, int ObjectID) |
|
{ |
|
dataCheckResults.Add( |
|
new CheckResult() |
|
{ |
|
ErrorDesc = ErrorDesc, |
|
Synopsis = Synopsis, |
|
ErrorCode = ErrorCode, |
|
ErrorLayer = IDataCheckName, |
|
ObjectID = ObjectID, |
|
ErrorType = EnumErrorType.错误, |
|
ErrorCategory = "Attribute" |
|
}); |
|
} |
|
private void LogicCheck(bool istrue, string ErrorDesc, string Synopsis, string ErrorCode, int ObjectID) |
|
{ |
|
if (!istrue) return; |
|
if (dataCheckResults.Where(x => x.Synopsis == Synopsis) == null) |
|
dataCheckResults.Add( |
|
new CheckResult() |
|
{ |
|
ErrorDesc = ErrorDesc, |
|
Synopsis = Synopsis, |
|
ErrorCode = ErrorCode, |
|
ErrorLayer = IDataCheckName, |
|
ObjectID = ObjectID, |
|
ErrorType = EnumErrorType.错误, |
|
ErrorCategory = "Attribute" |
|
}); |
|
} |
|
|
|
private Dictionary<string, string> DicTypes = new Dictionary<string, string>(); |
|
public string GetDicTypeID(DicTypeEnum pDicType, bool GetNewDic = false) |
|
{ |
|
string result = string.Empty; |
|
DataTable dtDicTypeID = null; |
|
try |
|
{ |
|
if (dtDicTypeID == null || GetNewDic) |
|
{ |
|
IRDBHelper rdbHelper = null; |
|
try |
|
{ |
|
string dbPath = ((MapsManager.Instance.CurrProjectInfo as ProjectInfo) as ProjectInfo).GetDicDataPath(); |
|
if (string.IsNullOrWhiteSpace(dbPath)) |
|
{ |
|
LogAPI.Debug("GetDicDataPath 获取失败"); |
|
} |
|
rdbHelper = RDBFactory.CreateDbHelper("Data Source=" + dbPath, DatabaseType.SQLite); |
|
string strSQL = "select ID,ALIASNAME from Sys_DicManage ";//WHERE ALIASNAME = '" + pDicType + "'"; |
|
dtDicTypeID = rdbHelper.ExecuteDatatable("DicType", strSQL, true); |
|
} |
|
catch (Exception ex) |
|
{ |
|
LogAPI.Debug(ex); |
|
} |
|
finally |
|
{ |
|
if (rdbHelper != null) |
|
{ |
|
rdbHelper.DisConnect(); |
|
} |
|
} |
|
} |
|
if (dtDicTypeID != null && dtDicTypeID.Rows.Count > 0) |
|
{ |
|
foreach (DataRow item in dtDicTypeID.Rows) |
|
{ |
|
if (item[0] != null && !(item[0] is DBNull)) |
|
{ |
|
if (item[1].ToString() == pDicType.ToString()) |
|
result = item[0].ToString(); |
|
if (DicTypes.ContainsKey(item[0].ToString())) |
|
continue; |
|
DicTypes.Add(item[0].ToString(), item[1].ToString()); |
|
} |
|
} |
|
} |
|
return result; |
|
} |
|
catch (Exception ex) |
|
{ |
|
throw ex; |
|
} |
|
finally |
|
{ |
|
if (dtDicTypeID != null) |
|
{ |
|
dtDicTypeID.Clear(); |
|
dtDicTypeID.Dispose(); |
|
} |
|
} |
|
} |
|
|
|
public List<DataDicTionary> GetNoGroupDic(DicTypeEnum pDicType, List<DataDicTionary> dicList = null) |
|
{ |
|
List<DataDicTionary> result = null; |
|
try |
|
{ |
|
string s = GetDicTypeID(pDicType); |
|
if (string.IsNullOrWhiteSpace(s)) |
|
return result; |
|
List<DataDicTionary> tempDic = dicList; |
|
if (dicList == null || dicList.Count == 0) |
|
tempDic = GetAllDic(); |
|
if (tempDic == null) |
|
return result; |
|
foreach (DataDicTionary item in tempDic) |
|
{ |
|
if (item.OWNERDIC == s) |
|
{ |
|
if (result == null) |
|
{ |
|
result = new List<DataDicTionary>(); |
|
result.Add(new DataDicTionary() { CODE = "", NAME = "", DisplayName = "" }); |
|
} |
|
result.Add(item); |
|
} |
|
} |
|
} |
|
catch (Exception ex) |
|
{ |
|
throw ex; |
|
} |
|
return result; |
|
} |
|
|
|
/// <summary> |
|
/// 获取工程下的字典 |
|
/// </summary> |
|
/// <returns></returns> |
|
public static List<DataDicTionary> GetAllDic() |
|
{ |
|
DataTable dt = null; |
|
List<DataDicTionary> result = new List<DataDicTionary>(); |
|
IRDBHelper rdbHelper = null; |
|
try |
|
{ |
|
string dbPath = (MapsManager.Instance.CurrProjectInfo as ProjectInfo).GetDicDataPath(); |
|
if (!string.IsNullOrWhiteSpace(dbPath)) |
|
{ |
|
rdbHelper = RDBFactory.CreateDbHelper("Data Source=" + dbPath, DatabaseType.SQLite); |
|
string strSQL = "select * from Sys_DicDetail"; |
|
dt = rdbHelper.ExecuteDatatable("Dic", strSQL, true); |
|
if (dt != null) |
|
{ |
|
//Bug-12137 霍岩 2018-11-14 使用CODE字段按顺序排序 |
|
result = KGIS.Framework.Utils.Utility.TBToList.ToList<DataDicTionary>(dt).OrderBy(x => x.CODE).ToList(); |
|
result.ForEach(x => x.DisplayName = x.CODE + "-" + x.NAME); |
|
} |
|
} |
|
} |
|
catch (Exception ex) |
|
{ |
|
LogAPI.Debug(ex); |
|
} |
|
finally |
|
{ |
|
if (rdbHelper != null) |
|
{ |
|
rdbHelper.DisConnect(); |
|
} |
|
if (dt != null) |
|
{ |
|
dt.Clear(); |
|
dt.Dispose(); |
|
} |
|
} |
|
return result; |
|
} |
|
|
|
private bool DicFirstOrDefault(List<DataDicTionary> dataDics, string Code, string Name, bool ISQSXZ) |
|
{ |
|
bool exist = true; |
|
try |
|
{ |
|
List<DataDicTionary> dataDic = null; |
|
if (ISQSXZ) |
|
{ |
|
dataDic = dataDics.Where(x => x.CODE == Code).ToList(); |
|
} |
|
else |
|
{ |
|
dataDic = dataDics.Where(x => x.CODE == Code && x.NAME == Name).ToList(); |
|
} |
|
if (dataDic != null && dataDic.Count > 0) |
|
{ |
|
exist = false; |
|
} |
|
return exist; |
|
} |
|
catch (Exception ex) |
|
{ |
|
LogAPI.Debug("变更数据检查异常:" + ex.Message); |
|
throw ex; |
|
} |
|
} |
|
|
|
/// <summary> |
|
/// 检查单个图形 |
|
/// </summary> |
|
/// <param name="pGeometry"></param> |
|
/// <returns></returns> |
|
private static List<CheckResult> CheckGeometry(IFeature pfeature) |
|
{ |
|
List<CheckResult> result = new List<CheckResult>(); |
|
IPointCollection polygonVertices = null; |
|
IPointCollection lineVertices = null; |
|
ITopologicalOperator3 pTopology = null; |
|
IPolygon4 polygon = null; |
|
IGeometryBag bag = null; |
|
try |
|
{ |
|
int idxBGBSM = pfeature.Fields.FindField("BSM"); |
|
int idxBGArea = pfeature.Fields.FindField("SHAPE_AREA"); |
|
polygonVertices = new PolygonClass(); |
|
lineVertices = pfeature.ShapeCopy as IPointCollection; |
|
polygonVertices.AddPointCollection(lineVertices); |
|
pTopology = polygonVertices as ITopologicalOperator3; |
|
esriNonSimpleReasonEnum reason = esriNonSimpleReasonEnum.esriNonSimpleOK; |
|
pTopology.IsKnownSimple_2 = false; |
|
if (!pTopology.get_IsSimpleEx(out reason)) |
|
{ |
|
if (reason == esriNonSimpleReasonEnum.esriNonSimpleSelfIntersections)//自相交 |
|
{ |
|
result.Add(new CheckResult() |
|
{ |
|
ErrorDesc = "要素存在自相交!", |
|
Synopsis = "要素存在自相交!", |
|
ErrorCode = "2001" + "0003" + "9999" + "0015", |
|
ErrorLayer = "BGQDataCheck", |
|
ErrorCategory = "Graphic", |
|
ObjectID = pfeature.OID, |
|
ErrorType = EnumErrorType.错误, |
|
}); |
|
} |
|
if (reason == esriNonSimpleReasonEnum.esriNonSimpleUnclosedRing)//存在不闭合的环 |
|
{ |
|
polygon = pfeature.ShapeCopy as IPolygon4; |
|
bag = polygon.ExteriorRingBag;//获取多边形的所有外环 |
|
if ((bag as IGeometryCollection).GeometryCount > 1) |
|
{ |
|
result.Add(new CheckResult() |
|
{ |
|
ErrorDesc = "要素存在组合图斑(多部件)!", |
|
Synopsis = "要素存在组合图斑(多部件)!", |
|
ErrorCode = "2001" + "0003" + "9999" + "0016", |
|
ErrorLayer = "BGQDataCheck", |
|
ErrorCategory = "Graphic", |
|
ObjectID = pfeature.OID, |
|
ErrorType = EnumErrorType.错误 |
|
}); |
|
} |
|
} |
|
if (reason == esriNonSimpleReasonEnum.esriNonSimpleShortSegments) |
|
{ |
|
result.Add(new CheckResult() |
|
{ |
|
ErrorDesc = "要素存在短线段!", |
|
Synopsis = "要素存在短线段!", |
|
ErrorCode = "2001" + "0003" + "9999" + "0017", |
|
ErrorLayer = "BGQDataCheck", |
|
ErrorCategory = "Graphic", |
|
ObjectID = pfeature.OID, |
|
ErrorType = EnumErrorType.错误, |
|
}); |
|
} |
|
} |
|
} |
|
catch (Exception ex) |
|
{ |
|
throw ex; |
|
} |
|
finally |
|
{ |
|
if (polygonVertices != null) |
|
Marshal.ReleaseComObject(polygonVertices); |
|
if (lineVertices != null) |
|
Marshal.ReleaseComObject(lineVertices); |
|
if (pTopology != null) |
|
Marshal.ReleaseComObject(pTopology); |
|
if (polygon != null) |
|
Marshal.ReleaseComObject(polygon); |
|
if (bag != null) |
|
Marshal.ReleaseComObject(bag); |
|
} |
|
return result; |
|
} |
|
|
|
#region 要素不存在尖锐角和局部狭长图形(即不允许存在一个角度小于10度,或局部图形狭长的情况) |
|
private List<CheckResult> AcuteAngle(IFeature pFeature) |
|
{ |
|
List<CheckResult> result = new List<CheckResult>(); |
|
IGeometry refgeometry = null; |
|
ITopologicalOperator topo = null; |
|
IPolyline line1 = null; |
|
IGeometry geo = null; |
|
ITopologicalOperator topo2 = null; |
|
IPolyline line2 = null; |
|
try |
|
{ |
|
int idxBGBSM = pFeature.Fields.FindField("BSM"); |
|
int idxBGArea = pFeature.Fields.FindField("SHAPE_AREA"); |
|
double angle = GetMinAngle(pFeature.ShapeCopy, ref refgeometry);//获取图形的最小角度 |
|
if (angle < 10) |
|
{ |
|
result.Add(new CheckResult() |
|
{ |
|
ErrorDesc = "要素存在尖锐角!", |
|
Synopsis = "要素存在尖锐角!", |
|
ErrorCode = "2001" + "0003" + "9999" + "0018", |
|
ErrorLayer = "BGQDataCheck", |
|
ErrorCategory = "Graphic", |
|
ObjectID = pFeature.OID, |
|
ErrorType = EnumErrorType.错误, |
|
ErrorArea = refgeometry.ToJson() |
|
}); |
|
} |
|
topo = pFeature.ShapeCopy as ITopologicalOperator; |
|
line1 = topo.Boundary as IPolyline; |
|
double length1 = line1.Length; |
|
int pointCount1 = (pFeature.ShapeCopy as IPointCollection).PointCount; |
|
geo = topo.Buffer(-0.05); |
|
topo2 = geo as ITopologicalOperator; |
|
line2 = topo2.Boundary as IPolyline; |
|
double length2 = line2.Length; |
|
int pointCount2 = (geo as IPointCollection).PointCount - 1; |
|
double delta_length = length1 - length2; |
|
double avg_halfangle = 180 * (pointCount1 - 1 - 2) / (pointCount1 - 1) / 2; |
|
double conner_normal_length = 2 * 0.05 / Math.Tan(avg_halfangle * (Math.PI / 180)); |
|
if (delta_length > 8 * conner_normal_length * (pointCount1 - 1)) |
|
{ |
|
result.Add(new CheckResult() |
|
{ |
|
ErrorDesc = "要素存在局部狭长图形!", |
|
Synopsis = "要素存在局部狭长图形!", |
|
ErrorCode = "2001" + "0003" + "9999" + "0019", |
|
ErrorLayer = "BGQDataCheck", |
|
ErrorCategory = "Graphic", |
|
ObjectID = pFeature.OID, |
|
ErrorType = EnumErrorType.错误, |
|
}); |
|
} |
|
return result; |
|
} |
|
catch (Exception ex) |
|
{ |
|
throw ex; |
|
} |
|
finally |
|
{ |
|
if (refgeometry != null) |
|
Marshal.ReleaseComObject(refgeometry); |
|
if (topo != null) |
|
Marshal.ReleaseComObject(topo); |
|
if (line1 != null) |
|
Marshal.ReleaseComObject(line1); |
|
if (topo2 != null) |
|
Marshal.ReleaseComObject(topo2); |
|
if (line2 != null) |
|
Marshal.ReleaseComObject(line2); |
|
} |
|
} |
|
|
|
/// <summary> |
|
/// 获取最小角度 |
|
/// </summary> |
|
/// <param name="pGeo"></param> |
|
/// <returns></returns> |
|
private static double GetMinAngle(IGeometry pGeo, ref IGeometry refgeometry) |
|
{ |
|
double result = -1; |
|
IPolygon4 poly4 = null; |
|
ITopologicalOperator topo = null; |
|
GeometryBag geoBag = null; |
|
IGeometryCollection geoCollection = null; |
|
IGeometryCollection geometryCollection = null; |
|
IPointCollection pointCollection = null; |
|
try |
|
{ |
|
if (pGeo == null || pGeo.IsEmpty) |
|
return result; |
|
poly4 = pGeo as IPolygon4; |
|
topo = poly4 as ITopologicalOperator; |
|
if (topo != null) |
|
{ |
|
topo.Simplify(); |
|
} |
|
geoBag = poly4.ExteriorRingBag as GeometryBag; |
|
if (geoBag == null) return result; |
|
geoCollection = geoBag as IGeometryCollection; |
|
List<IGeometry> rings = new List<IGeometry>(); |
|
for (int j = 0; j < geoCollection.GeometryCount; j++) |
|
{ |
|
IGeometry geo = geoCollection.get_Geometry(j); |
|
rings.Add(geo); |
|
//内环图形 |
|
IGeometryBag InteriorBag = (pGeo as IPolygon4).get_InteriorRingBag(geo as IRing); |
|
if (InteriorBag != null) |
|
{ |
|
IGeometryCollection InteriorRingGeometryCollection = InteriorBag as IGeometryCollection; |
|
for (int IR = 0; IR < InteriorRingGeometryCollection.GeometryCount; IR++) |
|
{ |
|
rings.Add(InteriorRingGeometryCollection.get_Geometry(IR)); |
|
} |
|
} |
|
} |
|
geometryCollection = new Polyline() as IGeometryCollection; |
|
pointCollection = new Path(); |
|
foreach (IGeometry ring in rings) |
|
{ |
|
if (ring.IsEmpty) continue; |
|
IPointCollection points = ring as IPointCollection; |
|
int num = points.PointCount - 1; |
|
for (int i = 0; i < num; i++) |
|
{ |
|
IPoint p1 = null; |
|
IPoint p2 = points.get_Point(i); |
|
IPoint p3 = null; |
|
if (i == 0) |
|
{ |
|
p1 = points.get_Point(num - 1); |
|
p3 = points.get_Point(i + 1); |
|
} |
|
else if (i == num - 1) |
|
{ |
|
p1 = points.get_Point(i - 1); |
|
p3 = points.get_Point(0); |
|
} |
|
else |
|
{ |
|
p1 = points.get_Point(i - 1); |
|
p3 = points.get_Point(i + 1); |
|
} |
|
double angle = GetAngle(p2, p1, p3); |
|
|
|
if (result == -1) |
|
{ |
|
result = angle; |
|
pointCollection.AddPoint(p1); |
|
pointCollection.AddPoint(p2); |
|
pointCollection.AddPoint(p3); |
|
geometryCollection.AddGeometry(pointCollection as IGeometry); |
|
refgeometry = geometryCollection as IGeometry; |
|
refgeometry.SpatialReference = pGeo.SpatialReference; |
|
} |
|
else |
|
{ |
|
if (result > angle) |
|
{ |
|
result = angle; |
|
pointCollection.AddPoint(p1); |
|
pointCollection.AddPoint(p2); |
|
pointCollection.AddPoint(p3); |
|
geometryCollection.AddGeometry(pointCollection as IGeometry); |
|
refgeometry = geometryCollection as IGeometry; |
|
refgeometry.SpatialReference = pGeo.SpatialReference; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
catch (Exception ex) |
|
{ |
|
throw ex; |
|
} |
|
finally |
|
{ |
|
//if (poly4 != null) |
|
// Marshal.ReleaseComObject(poly4); |
|
//if (topo != null) |
|
// Marshal.ReleaseComObject(topo); |
|
//if (geoBag != null) |
|
// Marshal.ReleaseComObject(geoBag); |
|
//if (geoCollection != null) |
|
// Marshal.ReleaseComObject(geoCollection); |
|
//if (geometryCollection != null) |
|
// Marshal.ReleaseComObject(geometryCollection); |
|
//if (pointCollection != null) |
|
// Marshal.ReleaseComObject(pointCollection); |
|
} |
|
return result; |
|
} |
|
/// <summary> |
|
/// 计算角度 |
|
/// </summary> |
|
/// <param name="cenPoint"></param> |
|
/// <param name="firstPoint"></param> |
|
/// <param name="secondPoint"></param> |
|
/// <returns></returns> |
|
private static double GetAngle(IPoint cenPoint, IPoint firstPoint, IPoint secondPoint) |
|
{ |
|
double ma_x = firstPoint.X - cenPoint.X; |
|
double ma_y = firstPoint.Y - cenPoint.Y; |
|
double mb_x = secondPoint.X - cenPoint.X; |
|
double mb_y = secondPoint.Y - cenPoint.Y; |
|
double v1 = (ma_x * mb_x) + (ma_y * mb_y); |
|
double ma_val = Math.Sqrt(ma_x * ma_x + ma_y * ma_y); |
|
double mb_val = Math.Sqrt(mb_x * mb_x + mb_y * mb_y); |
|
if (ma_val * mb_val == 0) |
|
{ |
|
return -1; |
|
} |
|
double cosM = v1 / (ma_val * mb_val); |
|
double angleAMB = Math.Acos(cosM) * 180 / Math.PI; |
|
return angleAMB; |
|
} |
|
#endregion |
|
|
|
#region 地类图斑变更层平均节点密度大于1米小于70米 |
|
/// <summary> |
|
/// 地类图斑变更层平均节点密度大于1米小于70米 |
|
/// </summary> |
|
/// <param name="pFeature"></param> |
|
/// <returns></returns> |
|
private CheckResult PointToPoint(IFeature pFeature) |
|
{ |
|
int idxBGBSM = pFeature.Fields.FindField("BSM"); |
|
int idxBGArea = pFeature.Fields.FindField("SHAPE_AREA"); |
|
CheckResult result = null; |
|
List<double> Segmentslength = new List<double>(); |
|
IGeometryCollection _GeoColl = pFeature.ShapeCopy as IGeometryCollection; |
|
for (int i = 0; i < _GeoColl.GeometryCount; i++) |
|
{ |
|
ISegmentCollection _segmColl = _GeoColl.Geometry[i] as ISegmentCollection; |
|
for (int j = 0; j < _segmColl.SegmentCount; j++) |
|
{ |
|
Segmentslength.Add(_segmColl.Segment[j].Length); |
|
} |
|
} |
|
if (Segmentslength.Average() > 70 || Segmentslength.Average() < 1) |
|
{ |
|
result = new CheckResult() |
|
{ |
|
ErrorDesc = "地类图斑变更层平均节点密度大于1米小于70米!", |
|
Synopsis = "平均节点密度不在1-70米!", |
|
ErrorCode = "200400", |
|
ErrorLayer = "BGQDataCheck", |
|
ErrorCategory = "Graphic", |
|
ObjectID = pFeature.OID, |
|
ErrorType = EnumErrorType.错误, |
|
}; |
|
} |
|
return result; |
|
} |
|
#endregion |
|
} |
|
|
|
|
|
|
|
public class DLTBBGEntity |
|
{ |
|
public List<DataCheckResult> CheckResult { get; set; } |
|
public IFeature feature { get; set; } |
|
public int OBJECTID { get; set; } |
|
public string DLBM { get; set; } |
|
public string DLMC { get; set; } |
|
public string QSXZ { get; set; } |
|
public string QSDWDM { get; set; } |
|
public string QSDWMC { get; set; } |
|
public string ZLDWDM { get; set; } |
|
public string ZLDWMC { get; set; } |
|
public string KCDLBM { get; set; } |
|
public string KCXS { get; set; } |
|
public string GDLX { get; set; } |
|
public string GDPDJB { get; set; } |
|
public string XZDWKD { get; set; } |
|
public string TBXHDM { get; set; } |
|
public string TBXHMC { get; set; } |
|
public string ZZSXDM { get; set; } |
|
public string ZZSXMC { get; set; } |
|
public string GDDB { get; set; } |
|
public string FRDBS { get; set; } |
|
public string CZCSXM { get; set; } |
|
public string MSSM { get; set; } |
|
public string BZ { get; set; } |
|
public string SHAPE_Area { get; set; } |
|
public string DDTCBZ { get; set; } |
|
public string DDTCMC { get; set; } |
|
public string SFXML { get; set; } |
|
public string XMLX { get; set; } |
|
public string XMMC { get; set; } |
|
public string XMBH { get; set; } |
|
public string DKMC { get; set; } |
|
public int iDLBM { get; set; } |
|
public int iDLMC { get; set; } |
|
public int iQSXZ { get; set; } |
|
public int iQSDWDM { get; set; } |
|
public int iQSDWMC { get; set; } |
|
public int iZLDWDM { get; set; } |
|
public int iZLDWMC { get; set; } |
|
public int iKCDLBM { get; set; } |
|
public int iKCXS { get; set; } |
|
public int iGDLX { get; set; } |
|
public int iGDPDJB { get; set; } |
|
public int iXZDWKD { get; set; } |
|
public int iTBXHDM { get; set; } |
|
public int iTBXHMC { get; set; } |
|
public int iZZSXDM { get; set; } |
|
public int iZZSXMC { get; set; } |
|
public int iGDDB { get; set; } |
|
public int iFRDBS { get; set; } |
|
public int iCZCSXM { get; set; } |
|
public int iMSSM { get; set; } |
|
public int iBZ { get; set; } |
|
public int iSHAPE_Area { get; set; } |
|
public int iDDTCBZ { get; set; } |
|
public int iDDTCMC { get; set; } |
|
public int iSFXML { get; set; } |
|
public int iXMLX { get; set; } |
|
public int iXMMC { get; set; } |
|
public int iXMBH { get; set; } |
|
public int iDKMC { get; set; } |
|
} |
|
}
|
|
|