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.
783 lines
45 KiB
783 lines
45 KiB
using ESRI.ArcGIS.Carto; |
|
using ESRI.ArcGIS.Geodatabase; |
|
using ESRI.ArcGIS.Geometry; |
|
using KGIS.Framework.AE.ExtensionMethod; |
|
using KGIS.Framework.Platform; |
|
using KGIS.Framework.Utils; |
|
using KGIS.Framework.Utils.ExtensionMethod; |
|
using Kingo.Plugin.MapView.Interface; |
|
using System; |
|
using System.Collections.Generic; |
|
using System.Data; |
|
using System.Linq; |
|
using System.Text; |
|
using System.Text.RegularExpressions; |
|
|
|
|
|
namespace Kingo.Plugin.MapView.Model |
|
{ |
|
|
|
public class DataCheck : IDateCheckInterface |
|
{ |
|
DLTBBGEntity dltbBGEntity = null; |
|
bool _inspectionCompleted = false; |
|
public event InspectionCompleted InspectionCompleted; |
|
public DLTBBGEntity DataCheckFeature(IFeature feature) |
|
{ |
|
try |
|
{ |
|
TBCheckDate(feature); |
|
_inspectionCompleted = true; |
|
return dltbBGEntity; |
|
} |
|
catch (Exception ex) |
|
{ |
|
throw ex; |
|
} |
|
} |
|
|
|
public Dictionary<int, List<CheckResultModel>> DataCheckFeatureLayer(IFeatureLayer featureLayer) |
|
{ |
|
try |
|
{ |
|
return new Dictionary<int, List<CheckResultModel>>(); |
|
} |
|
catch (Exception ex) |
|
{ |
|
throw ex; |
|
} |
|
} |
|
|
|
private List<DataDicTionary> DLBMdataDic = Platform.Instance.DicHelper.GetDic(DicTypeEnum.DLBM); |
|
private List<DataDicTionary> TBXHdataDic = Platform.Instance.DicHelper.GetDic(DicTypeEnum.TBXHLX); |
|
private List<DataDicTionary> ZZSXdataDic = Platform.Instance.DicHelper.GetDic(DicTypeEnum.ZZSX); |
|
|
|
public bool inspectionCompleted |
|
{ |
|
get { return _inspectionCompleted; } |
|
set |
|
{ |
|
InspectionCompleted(); |
|
} |
|
} |
|
|
|
#region 地类图斑变更层平均节点密度大于1米小于70米 |
|
/// <summary> |
|
/// 地类图斑变更层平均节点密度大于1米小于70米 |
|
/// </summary> |
|
/// <param name="pFeature"></param> |
|
/// <returns></returns> |
|
private CheckResultModel PointToPoint(IFeature pFeature) |
|
{ |
|
CheckResultModel 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 CheckResultModel(); |
|
result.ErrorType = ErrorTypeEnum.GraphicalError; |
|
result.ErrorCode = ((int)CheckRuleEnum.JDMD).ToTrim(); |
|
result.Error = "地类图斑变更层平均节点密度大于1米小于70米"; |
|
} |
|
return result; |
|
} |
|
#endregion |
|
|
|
#region 要素不存在尖锐角和局部狭长图形(即不允许存在一个角度小于10度,或局部图形狭长的情况) |
|
private List<CheckResultModel> AcuteAngle(IFeature pFeature) |
|
{ |
|
List<CheckResultModel> result = new List<CheckResultModel>(); |
|
IGeometry refgeometry = null; |
|
double angle = GetMinAngle(pFeature.ShapeCopy, ref refgeometry);//获取图形的最小角度 |
|
if (angle < 10) |
|
{ |
|
result.Add(new CheckResultModel() { ErrorType = ErrorTypeEnum.GraphicalError, ErrorCode = ((int)CheckRuleEnum.BGZTB).ToTrim(), Error = $"要素存在尖锐角!@{refgeometry.ToJson()}" }); |
|
} |
|
ITopologicalOperator topo = pFeature.ShapeCopy as ITopologicalOperator; |
|
IPolyline line1 = topo.Boundary as IPolyline; |
|
double length1 = line1.Length; |
|
int pointCount1 = (pFeature.ShapeCopy as IPointCollection).PointCount; |
|
IGeometry geo = topo.Buffer(-0.05); |
|
ITopologicalOperator topo2 = geo as ITopologicalOperator; |
|
IPolyline 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 CheckResultModel() { ErrorType = ErrorTypeEnum.GraphicalError, ErrorCode = ((int)CheckRuleEnum.BGZTB).ToTrim(), Error = "要素存在局部狭长图形" }); |
|
} |
|
return result; |
|
} |
|
|
|
/// <summary> |
|
/// 获取最小角度 |
|
/// </summary> |
|
/// <param name="pGeo"></param> |
|
/// <returns></returns> |
|
private static double GetMinAngle(IGeometry pGeo, ref IGeometry refgeometry) |
|
{ |
|
double result = -1; |
|
try |
|
{ |
|
if (pGeo == null || pGeo.IsEmpty) |
|
return result; |
|
IPolygon4 poly4 = pGeo as IPolygon4; |
|
ITopologicalOperator topo = poly4 as ITopologicalOperator; |
|
if (topo != null) |
|
{ |
|
topo.Simplify(); |
|
} |
|
GeometryBag geoBag = poly4.ExteriorRingBag as GeometryBag; |
|
if (geoBag == null) return result; |
|
IGeometryCollection 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)); |
|
} |
|
} |
|
} |
|
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); |
|
IGeometryCollection geometryCollection = new Polyline() as IGeometryCollection; |
|
IPointCollection pointCollection = new Path(); |
|
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; |
|
} |
|
return result; |
|
} |
|
/// <summary> |
|
/// 计算角度 |
|
/// </summary> |
|
/// <param name="cenPoint"></param> |
|
/// <param name="firstPoint"></param> |
|
/// <param name="secondPoint"></param> |
|
/// <returns></returns> |
|
public 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 检查单个图形 |
|
/// <summary> |
|
/// 检查单个图形 |
|
/// </summary> |
|
/// <param name="pGeometry"></param> |
|
/// <returns></returns> |
|
private static List<CheckResultModel> CheckGeometry(IFeature pfeature) |
|
{ |
|
List<CheckResultModel> result = new List<CheckResultModel>(); |
|
try |
|
{ |
|
IPointCollection polygonVertices = new PolygonClass(); |
|
IPointCollection lineVertices = pfeature.ShapeCopy as IPointCollection; |
|
polygonVertices.AddPointCollection(lineVertices); |
|
ITopologicalOperator3 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 CheckResultModel() { ErrorCode = ((int)CheckRuleEnum.ZHTB).ToTrim(), ErrorType = ErrorTypeEnum.GraphicalError, Error = "要素存在自相交" }); |
|
} |
|
if (reason == esriNonSimpleReasonEnum.esriNonSimpleUnclosedRing)//存在不闭合的环 |
|
{ |
|
IPolygon4 polygon = pfeature.ShapeCopy as IPolygon4; |
|
IGeometryBag bag = polygon.ExteriorRingBag;//获取多边形的所有外环 |
|
var xx = (bag as IGeometryCollection).GeometryCount; |
|
if ((bag as IGeometryCollection).GeometryCount > 1) |
|
{ |
|
result.Add(new CheckResultModel() { ErrorCode = ((int)CheckRuleEnum.ZHTB).ToTrim(), ErrorType = ErrorTypeEnum.GraphicalError, Error = "要素存在组合图斑(多部件)" }); |
|
} |
|
} |
|
if (reason == esriNonSimpleReasonEnum.esriNonSimpleShortSegments) |
|
{ |
|
result.Add(new CheckResultModel() { ErrorCode = ((int)CheckRuleEnum.ZHTB).ToTrim(), ErrorType = ErrorTypeEnum.GraphicalError, Error = "要素存在短线段" }); |
|
} |
|
} |
|
} |
|
catch (Exception ex) |
|
{ |
|
throw ex; |
|
} |
|
return result; |
|
} |
|
|
|
#endregion |
|
#region 图形检查 |
|
public void ShapeCheck(DLTBBGEntity dltbBGEntity) |
|
{ |
|
List<string> dlbmliststr = null; |
|
try |
|
{ |
|
if (dltbBGEntity.feature == null) |
|
return; |
|
int oid = dltbBGEntity.feature.OID; |
|
//1、不存在碎片多边形(要求面积大于30平方米),不检查以下地类'1001','1002','1003','1004','1006','1009','1101','1107','1107A','1203' |
|
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'!"); |
|
//2、不存在不规则图斑(除地类1001、1002、1006、1009、1107、1109外,其余地类满足面积 / 周长 < 0.2,并且有一个角度小于20) |
|
//自相交/多部件 |
|
List<CheckResultModel> liststr = CheckGeometry(dltbBGEntity.feature); |
|
if (liststr != null && liststr.Count > 0) |
|
{ |
|
dltbBGEntity.CheckResult.AddRange(liststr); |
|
} |
|
//3、地类图斑变更层要素所有角度均应大于10度,同时不存在局部狭长图形 |
|
liststr = AcuteAngle(dltbBGEntity.feature); |
|
if (liststr.Count > 0) |
|
{ |
|
dltbBGEntity.CheckResult.AddRange(liststr); |
|
} |
|
//4、地类图斑变更层平均节点密度大于1米小于70米 |
|
CheckResultModel result = PointToPoint(dltbBGEntity.feature); |
|
if (result != null) |
|
{ |
|
dltbBGEntity.CheckResult.Add(result); |
|
} |
|
} |
|
catch (Exception ex) |
|
{ |
|
LogAPI.Debug("变更数据检查异常:" + ex.Message); |
|
LogAPI.Debug(ex); |
|
} |
|
} |
|
|
|
#endregion |
|
|
|
private bool DicFirstOrDefault(List<DataDicTionary> dataDics, string Code, string Name) |
|
{ |
|
bool exist = true; |
|
try |
|
{ |
|
if (Code.Length >= 2) |
|
{ |
|
var code = dataDics.FirstOrDefault(x => x.CODE == Code.Substring(0, 2)); |
|
if (code == null) |
|
{ |
|
foreach (var item in dataDics) |
|
{ |
|
if (item.SubDic == null) |
|
{ |
|
if (item.NAME == Name && item.CODE == Code) |
|
{ |
|
exist = false; |
|
break; |
|
} |
|
} |
|
else |
|
{ |
|
var DataDicTionary = item.SubDic.FirstOrDefault(x => x.CODE == Code); |
|
if (DataDicTionary != null && DataDicTionary.NAME == Name && DataDicTionary.CODE == Code) |
|
{ |
|
exist = false; |
|
break; |
|
} |
|
} |
|
} |
|
} |
|
else |
|
{ |
|
if (code.SubDic == null) |
|
{ |
|
if (code.NAME == Name && code.CODE == Code) |
|
{ |
|
exist = false; |
|
return exist; |
|
} |
|
} |
|
else |
|
{ |
|
foreach (var item in code.SubDic) |
|
{ |
|
if (item.SubDic == null) |
|
{ |
|
if (item.NAME == Name && item.CODE == Code) |
|
{ |
|
exist = false; |
|
break; |
|
} |
|
} |
|
else |
|
{ |
|
if (item.CODE == Code && item.NAME == Name) |
|
{ |
|
exist = false; |
|
break; |
|
} |
|
var DataDicTionary = item.SubDic.FirstOrDefault(x => x.CODE == Code); |
|
if (DataDicTionary != null && DataDicTionary.NAME == Name && DataDicTionary.CODE == Code) |
|
{ |
|
exist = false; |
|
break; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
return exist; |
|
} |
|
catch (Exception ex) |
|
{ |
|
LogAPI.Debug("变更数据检查异常:" + ex.Message); |
|
throw ex; |
|
} |
|
} |
|
|
|
#region 属性检查 |
|
/// <summary> |
|
/// 属性检查 |
|
/// </summary> |
|
/// <param name="row"></param> |
|
/// <param name="pfeature"></param> |
|
/// <param name="featureLayer"></param> |
|
public void TBCheckDate(IFeature feature) |
|
{ |
|
List<string> liststr = null; |
|
List<string> dlbmliststr = null; |
|
try |
|
{ |
|
AssignmentEntity(feature); |
|
|
|
#region 1.1、地类图斑变更层DLBM和DLMC在第三次全国土地调查工作分类表(最末级分类)中有对应项且匹配。 |
|
if (string.IsNullOrWhiteSpace(dltbBGEntity.DLBM) || string.IsNullOrEmpty(dltbBGEntity.DLMC)) |
|
{ |
|
LogicCheck(true, "地类编码/地类名称不允许为空!"); |
|
return; |
|
} |
|
if (DLBMdataDic != null) |
|
{ |
|
LogicCheck(DicFirstOrDefault(DLBMdataDic, dltbBGEntity.DLBM, dltbBGEntity.DLMC), "地类图斑变更层DLBM和DLMC在第三次全国土地调查工作分类表(最末级分类)中有对应项且匹配!"); |
|
} |
|
#endregion |
|
|
|
#region 1.2、地类图斑变更层KCDLBM取值在1203、空范围内 |
|
LogicCheck(!string.IsNullOrEmpty(dltbBGEntity.KCDLBM) && dltbBGEntity.KCDLBM != "1203", "地类图斑变更层KCDLBM取值应在1203、空范围内!"); |
|
#endregion |
|
|
|
#region 1.3、地类图斑变更层QSDWDM不能为空,长度为19位,必须为纯数值 |
|
LogicCheck(!Regex.IsMatch(dltbBGEntity.QSDWDM, "^\\d{19}$"), "地类图斑变更层QSDWDM不能为空,长度为19位,必须为纯数值!"); |
|
#endregion |
|
|
|
#region 1.4地类图斑变更层ZLDWDM不能为空,长度为19位,必须为纯数值 |
|
LogicCheck(!Regex.IsMatch(dltbBGEntity.ZLDWDM, "^\\d{19}$"), "地类图斑变更层ZLDWDM不能为空,长度为19位,必须为纯数值!"); |
|
#endregion |
|
|
|
#region 1.5、地类图斑变更层QSXZ字段取值规范性,不能为空。 |
|
LogicCheck(string.IsNullOrEmpty(dltbBGEntity.QSXZ), "地类图斑变更层QSXZ字段取值规范性,不能为空!"); |
|
#endregion |
|
|
|
#region 1.6、地类图斑变更层ZLDWDM前6位为县级行政区代码; |
|
|
|
//LogicCheck(true, "地类图斑变更层ZLDWDM前6位为县级行政区代码!"); |
|
#endregion |
|
|
|
#region 1.7、地类图斑变更层QSDWMC不能为空、不存在特殊字符 |
|
LogicCheck(string.IsNullOrEmpty(dltbBGEntity.QSDWMC) && !Regex.IsMatch(dltbBGEntity.QSDWMC, @"^[\u4e00-\u9fa5]+$"), "地类图斑变更层QSDWMC不能为空、不存在特殊字符!"); |
|
#endregion |
|
|
|
#region 1.8、地类图斑变更层ZLDWMC不能为空、不存在特殊字符 |
|
LogicCheck(string.IsNullOrEmpty(dltbBGEntity.ZLDWMC) && !Regex.IsMatch(dltbBGEntity.ZLDWMC, @"^[\u4e00-\u9fa5]+$"), "地类图斑变更层ZLDWMC不能为空、不存在特殊字符!"); |
|
#endregion |
|
|
|
#region 1.9、地类图斑变更层BZ字段为空; |
|
LogicCheck(!string.IsNullOrEmpty(dltbBGEntity.BZ), "地类图斑变更层BZ字段为须为空!"); |
|
#endregion |
|
|
|
#region 1.10、地类图斑变更层线状地物宽度字段小数位数检查,保留1位小数 |
|
LogicCheck(!Regex.IsMatch(dltbBGEntity.XZDWKD, "^[0-9]+(.[0-9]{1})?$"), "地类图斑变更层线状地物宽度字段小数位数检查,保留1位小数!"); |
|
#endregion |
|
|
|
#region 1.11、地类图斑变更层FRDBS字段取值规范性,0或者1. |
|
LogicCheck(dltbBGEntity.FRDBS != "0" && dltbBGEntity.FRDBS != "1", "地类图斑变更层FRDBS字段取值规范性,0或者1!"); |
|
#endregion |
|
|
|
#region 1.12、地类图斑变更层MSSM字段取值为'00'或'01' |
|
LogicCheck(dltbBGEntity.MSSM != "00" && dltbBGEntity.MSSM != "01", "地类图斑变更层MSSM字段取值为'00'或'01'!"); |
|
#endregion |
|
|
|
#region 2.1、地类图斑变更层TBXHMC与TBXHDM字段取值匹配; |
|
if (TBXHdataDic != null) |
|
{ |
|
LogicCheck(!string.IsNullOrEmpty(dltbBGEntity.TBXHMC) && !string.IsNullOrEmpty(dltbBGEntity.TBXHDM) && DicFirstOrDefault(TBXHdataDic, dltbBGEntity.TBXHDM, dltbBGEntity.TBXHMC), "地类图斑变更层TBXHMC与TBXHDM字段取值匹配!"); |
|
} |
|
#endregion |
|
|
|
#region 2.2、地类图斑变更层DLBM字段前2位非01、02、03、04,且DLBM不在0601、0602、1001、1003取值范围内,或属于湿地的地类,不能进行图斑细化标注 |
|
liststr = new List<string>() { "01", "02", "03", "04", "0601", "0602", "1001", "1003", "0303", "0304", "0306", "0402", "0603", "1105", "1106", "1108" }; |
|
LogicCheck(!liststr.Contains(dltbBGEntity.DLBM.Substring(0, 2)) && !liststr.Contains(dltbBGEntity.DLBM) && (!string.IsNullOrEmpty(dltbBGEntity.TBXHDM) || !string.IsNullOrEmpty(dltbBGEntity.TBXHMC)), "地类图斑变更层DLBM字段前2位非01、02、03、04,且DLBM不在0601、0602、1001、1003取值范围内,或属于湿地的地类,不能进行图斑细化标注!"); |
|
#endregion |
|
|
|
#region 2.3、地类图斑变更层工业用地,TBXHDM字段为HDGY、GTGY、MTGY、SNGY、BLGY、DLGY,或空值 |
|
liststr = new List<string>() { "HDGY", "GTGY", "MTGY", "SNGY", "BLGY", "DLGY" }; |
|
LogicCheck(dltbBGEntity.DLBM == "0601" && !liststr.Contains(dltbBGEntity.TBXHDM) && !string.IsNullOrEmpty(dltbBGEntity.TBXHDM), "地类图斑变更层工业用地(0601),TBXHDM字段为HDGY、GTGY、MTGY、SNGY、BLGY、DLGY,或空值!"); |
|
#endregion |
|
|
|
#region 2.4、地类图斑变更层TBXHDM字段取值在HDGY、GTGY、MTGY、SNGY、BLGY、DLGY范围内时,DLBM等于0601 |
|
LogicCheck(dltbBGEntity.DLBM != "0601" && liststr.Contains(dltbBGEntity.TBXHDM), "地类图斑变更层TBXHDM字段取值在HDGY、GTGY、MTGY、SNGY、BLGY、DLGY范围内时,DLBM等于0601!"); |
|
#endregion |
|
|
|
#region 2.5、地类图斑变更层DLBM为0602、1001、1003时,TBXHDM字段为FQ或空值 |
|
LogicCheck((dltbBGEntity.DLBM == "0602" || dltbBGEntity.DLBM == "1001" || dltbBGEntity.DLBM == "1003") && dltbBGEntity.TBXHDM != "FQ" && !string.IsNullOrEmpty(dltbBGEntity.TBXHDM), "地类图斑变更层DLBM为0602、1001、1003时,TBXHDM字段为FQ或空值!"); |
|
#endregion |
|
|
|
#region 2.6、地类图斑变更层DLBM前2位为01时,TBXHDM字段取值在HDGD、HQGD、LQGD、MQGD、SHGD、SMGD、YJGD或空范围内 |
|
liststr = new List<string>() { "HDGD", "HQGD", "LQGD", "MQGD", "SHGD", "SMGD", "YJGD" }; |
|
LogicCheck(dltbBGEntity.DLBM.Substring(0, 2) == "01" && !liststr.Contains(dltbBGEntity.TBXHDM) && !string.IsNullOrEmpty(dltbBGEntity.TBXHDM), "地类图斑变更层DLBM前2位为01时,TBXHDM字段取值在HDGD、HQGD、LQGD、MQGD、SHGD、SMGD、YJGD或空范围内!"); |
|
#endregion |
|
|
|
#region 2.7、地类图斑变更层TBXHDM字段取值在HDGD、HQGD、LQGD、MQGD、SHGD、SMGD、YJGD范围内时,DLBM前2位为01 |
|
LogicCheck(dltbBGEntity.DLBM.Substring(0, 2) != "01" && liststr.Contains(dltbBGEntity.TBXHDM), "地类图斑变更层TBXHDM字段取值在HDGD、HQGD、LQGD、MQGD、SHGD、SMGD、YJGD范围内时,DLBM前2位为01!"); |
|
#endregion |
|
|
|
#region 2.8、地类图斑变更层DLBM前2位为04时(不含0404),TBXHDM取值在GCCD、空范围内 |
|
LogicCheck(dltbBGEntity.DLBM.Substring(0, 2) == "04" && dltbBGEntity.DLBM != "0404" && dltbBGEntity.TBXHDM != "GCCD" && string.IsNullOrEmpty(dltbBGEntity.TBXHDM), "地类图斑变更层DLBM前2位为04时(不含0404),TBXHDM取值在GCCD、空范围内!"); |
|
#endregion |
|
|
|
#region 2.9、地类图斑变更层DLBM为0404时,TBXHDM取值在LJTM、GCCD、空范围内 |
|
LogicCheck(dltbBGEntity.DLBM == "0404" && !string.IsNullOrEmpty(dltbBGEntity.TBXHDM) && dltbBGEntity.TBXHDM != "LJTM" && dltbBGEntity.TBXHDM != "GCCD", "地类图斑变更层DLBM为0404时,TBXHDM取值在LJTM、GCCD、空范围内!"); |
|
#endregion |
|
|
|
#region 2.10、地类图斑变更层DLBM前2位为03时,TBXHDM取值在LJTM、空范围内 |
|
LogicCheck(dltbBGEntity.DLBM.Substring(0, 2) == "03" && !string.IsNullOrEmpty(dltbBGEntity.TBXHDM) && dltbBGEntity.TBXHDM != "LJTM", "地类图斑变更层DLBM前2位为03时,TBXHDM取值在LJTM、空范围内!"); |
|
#endregion |
|
|
|
#region 2.11地类图斑变更层DLBM前2位为02时,TBXHDM取值在LQYD、空范围内 |
|
LogicCheck(dltbBGEntity.DLBM.Substring(0, 2) == "02" && !string.IsNullOrEmpty(dltbBGEntity.TBXHDM) && dltbBGEntity.TBXHDM != "LQYD", "地类图斑变更层DLBM前2位为02时,TBXHDM取值在LQYD、空范围内!"); |
|
#endregion |
|
|
|
#region 3.1、地类图斑变更层DLBM前2位为01时,ZZSXDM取值在LS、FLS、LYFL、XG、LLJZ、WG范围内 |
|
liststr = new List<string>() { "LS", "FLS", "LYFL", "XG", "LLJZ", "WG" }; |
|
LogicCheck(dltbBGEntity.DLBM.Substring(0, 2) == "01" && !liststr.Contains(dltbBGEntity.ZZSXDM.ToTrim()), "地类图斑变更层DLBM前2位为01时,ZZSXDM取值在LS、FLS、LYFL、XG、LLJZ、WG范围内!"); |
|
#endregion |
|
|
|
#region 3.2、地类图斑变更层ZZSXMC与ZZSXDM字段取值匹配; |
|
if (ZZSXdataDic != null) |
|
{ |
|
LogicCheck(!string.IsNullOrEmpty(dltbBGEntity.ZZSXMC) && !string.IsNullOrEmpty(dltbBGEntity.ZZSXDM) && DicFirstOrDefault(ZZSXdataDic, dltbBGEntity.ZZSXDM.ToTrim(), dltbBGEntity.ZZSXMC), "地类图斑变更层ZZSXMC与ZZSXDM字段取值匹配!"); |
|
} |
|
#endregion |
|
|
|
#region 3.3、地类图斑变更层DLBM为0301、0302、0305、0307、0404、1104、1104A时,ZZSXDM取值在JKHF、GCHF、空范围内 |
|
dlbmliststr = new List<string>() { "0301", "0302", "0305", "0307", "0404", "1104", "1104A" }; |
|
liststr = new List<string>() { "JKHF", "GCHF" }; |
|
LogicCheck(dlbmliststr.Contains(dltbBGEntity.DLBM) && !liststr.Contains(dltbBGEntity.ZZSXDM.ToTrim()) && !string.IsNullOrEmpty(dltbBGEntity.ZZSXDM), "地类图斑变更层DLBM为0301、0302、0305、0307、0404、1104、1104A时,ZZSXDM取值在JKHF、GCHF、空范围内!"); |
|
#endregion |
|
|
|
#region 3.4、地类图斑变更层DLBM为0201、0202、0203、0204,且TBXHDM为空时,ZZSXDM取值在JKHF、GCHF、空范围内 |
|
dlbmliststr = new List<string>() { "0201", "0202", "0203", "0204" }; |
|
liststr = new List<string>() { "JKHF", "GCHF" }; |
|
LogicCheck(dlbmliststr.Contains(dltbBGEntity.DLBM) && string.IsNullOrEmpty(dltbBGEntity.TBXHDM) && !liststr.Contains(dltbBGEntity.ZZSXDM.ToTrim()) && !string.IsNullOrEmpty(dltbBGEntity.ZZSXDM), "地类图斑变更层DLBM为0201、0202、0203、0204,且TBXHDM为空时,ZZSXDM取值在JKHF、GCHF、空范围内!"); |
|
#endregion |
|
|
|
#region 3.5、地类图斑变更层DLBM前2位为04(不包括0404、0403K)、05、06、07、08、09、10、11(不包括1104、1104A、1104K)、12,或属于湿地的,不允许填写种植属性代码 |
|
liststr = new List<string>() { "04", "05", "06", "07", "08", "09", "10", "11", "12", "0303", "0304", "0306", "0402", "0603", "1105", "1106", "1108" }; |
|
var liststr1 = new List<string>() { "0404", "0403K", "1104", "1104A", "1104K" }; |
|
LogicCheck((liststr.Contains(dltbBGEntity.DLBM.Substring(0, 2)) || liststr.Contains(dltbBGEntity.DLBM)) && !liststr1.Contains(dltbBGEntity.DLBM) && !string.IsNullOrEmpty(dltbBGEntity.ZZSXDM), "地类图斑变更层DLBM前2位为04(不包括0404、0403K)、05、06、07、08、09、10、11(不包括1104、1104A、1104K)、12,或属于湿地的,不允许填写种植属性代码!"); |
|
#endregion |
|
|
|
#region 3.6、地类图斑变更层地类为0201、0202、0203、0204,且标注林区种植园用地的不能标注种植属性 |
|
dlbmliststr = new List<string>() { "0201", "0202", "0203", "0204" }; |
|
LogicCheck(dlbmliststr.Contains(dltbBGEntity.DLBM) && dltbBGEntity.TBXHDM == "LQYD" && string.IsNullOrEmpty(dltbBGEntity.ZZSXDM), "地类图斑变更层地类为0201、0202、0203、0204,且标注林区种植园用地的不能标注种植属性!"); |
|
#endregion |
|
|
|
#region 3.7、地类图斑变更层DLBM为0201K、0202K、0203K、0204K、0301K、0302K、0307K、0403K、1104K时,ZZSXDM取值在JKHF、GCHF、空范围内 |
|
dlbmliststr = new List<string>() { "0201K", "0202K", "0203K", "0204K", "0301K", "0302K", "0307K", "0403K", "1104K" }; |
|
liststr = new List<string>() { "JKHF", "GCHF" }; |
|
LogicCheck(dlbmliststr.Contains(dltbBGEntity.DLBM) && !liststr.Contains(dltbBGEntity.ZZSXDM.ToTrim()) && !string.IsNullOrEmpty(dltbBGEntity.ZZSXDM), "地类图斑变更层DLBM为0201K、0202K、0203K、0204K、0301K、0302K、0307K、0403K、1104K时,ZZSXDM取值在JKHF、GCHF、空范围内!"); |
|
#endregion |
|
|
|
#region 4.1、地类图斑变更层权属性质为21或41,描述说明为海岛 |
|
LogicCheck((dltbBGEntity.QSXZ == "21" || dltbBGEntity.QSXZ == "41") && dltbBGEntity.MSSM != "海岛", "地类图斑变更层权属性质为21或41,描述说明为海岛!"); |
|
#endregion |
|
|
|
#region 4.2、地类图斑变更层权属和坐落属于同一区县的国有土地飞入地标识不能为1; |
|
LogicCheck(!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", "地类图斑变更层权属和坐落属于同一区县的国有土地飞入地标识不能为1!"); |
|
#endregion |
|
|
|
#region 4.3、地类图斑变更层FRDBS字段值为1时,ZLDWDM前12位与QSDWDM前12位不一致 |
|
LogicCheck(!string.IsNullOrEmpty(dltbBGEntity.QSDWDM) && !string.IsNullOrEmpty(dltbBGEntity.ZLDWDM) && dltbBGEntity.QSDWDM.Substring(0, 12) == dltbBGEntity.ZLDWDM.Substring(0, 12) && dltbBGEntity.FRDBS == "1", "地类图斑变更层FRDBS字段值为1时,ZLDWDM前12位与QSDWDM前12位不一致!"); |
|
#endregion |
|
|
|
#region 5.1、地类图斑变更层CZCSXM字段取值为201A、202A、203A时,DLBM字段取值为0601 |
|
liststr = new List<string>() { "201A", "202A", "203A" }; |
|
LogicCheck(liststr.Contains(dltbBGEntity.CZCSXM) && dltbBGEntity.DLBM != "0601", "地类图斑变更层CZCSXM字段取值为201A、202A、203A时,DLBM字段取值为0601!"); |
|
#endregion |
|
|
|
#region 5.2、地类图斑变更层建设用地(05H1、0508、0602、0603、0701、0702、08H1、08H2、08H2A、0809、0810、0810A、09、1004、1005、1201),CZCSXM取值在201、202、203、204、205范围内,不允许为空 |
|
dlbmliststr = new List<string>() { "05H1", "0508", "0602", "0603", "0701", "0702", "08H1", "08H2", "08H2A", "0809", "0810", "0810A", "09", "1004", "1005", "1201" }; |
|
LogicCheck(dlbmliststr.Contains(dltbBGEntity.DLBM) && string.IsNullOrEmpty(dltbBGEntity.CZCSXM), "地类图斑变更层建设用地(05H1、0508、0602、0603、0701、0702、08H1、08H2、08H2A、0809、0810、0810A、09、1004、1005、1201),CZCSXM取值在201、202、203、204、205范围内,不允许为空!"); |
|
#endregion |
|
|
|
#region 5.3、地类图斑变更层工业用地0601,CZCSXM字段取值在201、202、203、201A、202A、203A、204、205范围内 |
|
liststr = new List<string>() { "201", "202", "203", "204", "205", "201A", "202A", "203A" }; |
|
LogicCheck(dltbBGEntity.DLBM == "0601" && !liststr.Contains(dltbBGEntity.CZCSXM), "地类图斑变更层工业用地0601,CZCSXM字段取值在201、202、203、201A、202A、203A、204、205范围内!"); |
|
#endregion |
|
|
|
#region 5.4、地类图斑变更层非建设用地、交通运输用地(1001, 1002, 1003, 1006, 1007, 1008, 1009)、水工建筑用地(1109),CZCSXM字段取值在201、202、203、204、205范围内,或取值为空 |
|
dlbmliststr = new List<string>() { "1001", "1002", "1003", "1006", "1007", "1008", "1009", "1109" }; |
|
liststr = new List<string>() { "201", "202", "203", "204", "205" }; |
|
LogicCheck(dlbmliststr.Contains(dltbBGEntity.DLBM) && !liststr.Contains(dltbBGEntity.CZCSXM) && !string.IsNullOrEmpty(dltbBGEntity.CZCSXM), "地类图斑变更层非建设用地、交通运输用地(1001, 1002, 1003, 1006, 1007, 1008, 1009)、水工建筑用地(1109),CZCSXM字段取值在201、202、203、204、205范围内,或取值为空!"); |
|
#endregion |
|
|
|
#region 5.5、地类图斑变更层要素的城镇村属性码,应与其所在城镇村等用地范围的城镇村等用地类型一致 |
|
|
|
#endregion |
|
|
|
#region 5.6、地类图斑变更层非建设用地不在城镇村等用地范围内的要素,城镇村属性码应为空 |
|
|
|
#endregion |
|
|
|
#region 7.1、地类图斑变更层DLBM前2位非01时,GDLX为空 |
|
LogicCheck(dltbBGEntity.DLBM.Substring(0, 2) != "01" && !string.IsNullOrEmpty(dltbBGEntity.GDLX), "地类图斑变更层DLBM前2位非01时,GDLX为空!"); |
|
#endregion |
|
|
|
#region 7.2、地类图斑变更层DLBM前2位非01时,GDPDJB为空 |
|
LogicCheck(dltbBGEntity.DLBM.Substring(0, 2) != "01" && !string.IsNullOrEmpty(dltbBGEntity.GDPDJB), "地类图斑变更层DLBM前2位非01时,GDLX为空!"); |
|
#endregion |
|
|
|
#region 7.3、地类图斑变更层DLBM前2位非01时,KCXS等于0 |
|
LogicCheck(dltbBGEntity.DLBM.Substring(0, 2) != "01" && !string.IsNullOrEmpty(dltbBGEntity.KCXS) && Convert.ToDouble(dltbBGEntity.KCXS) != 0, "地类图斑变更层DLBM前2位非01时,KCXS等于0!"); |
|
#endregion |
|
|
|
#region 7.4、地类图斑变更层扣除系数(KCXS)与省级提交田坎系数表一致性检查 |
|
|
|
#endregion |
|
|
|
#region 7.5、地类图斑变更层DLBM前2位非01时,GDDB字段取值为空 |
|
LogicCheck(dltbBGEntity.DLBM.Substring(0, 2) != "01" && !string.IsNullOrEmpty(dltbBGEntity.GDDB), "地类图斑变更层DLBM前2位非01时,KCXS等于0!"); |
|
#endregion |
|
|
|
#region 8.1、地类图斑变更层铁路、公路、管道用地、农村道路和沟渠等线形地物,线状图斑宽度XZDWKD大于0 |
|
dlbmliststr = new List<string>() { "1001", "1002", "1003", "1006", "1007", "1008", "1009", "1109", "1107", "1107A" }; |
|
LogicCheck(dlbmliststr.Contains(dltbBGEntity.DLBM) && (string.IsNullOrEmpty(dltbBGEntity.XZDWKD) || Convert.ToDouble(dltbBGEntity.XZDWKD) < 0), "地类图斑变更层铁路、公路、管道用地、农村道路和沟渠等线形地物,线状图斑宽度XZDWKD大于0!"); |
|
#endregion |
|
|
|
#region 8.2、地类图斑变更层非河流、铁路、公路、管道用地、农村道路和沟渠等线形地物,线状图斑宽度XZDWKD等于0,允许为空 |
|
dlbmliststr = new List<string>() { "1001", "1002", "1003", "1006", "1007", "1008", "1009", "1109", "1107", "1107A", "1101" }; |
|
LogicCheck(!dlbmliststr.Contains(dltbBGEntity.DLBM) && !string.IsNullOrEmpty(dltbBGEntity.XZDWKD) && Convert.ToDouble(dltbBGEntity.XZDWKD) > 0, "地类图斑变更层非河流、铁路、公路、管道用地、农村道路和沟渠等线形地物,线状图斑宽度XZDWKD等于0,允许为空!"); |
|
#endregion |
|
|
|
ShapeCheck(dltbBGEntity); |
|
} |
|
catch (Exception ex) |
|
{ |
|
LogAPI.Debug("图斑变更前数据检查失败信息:" + ex.Message); |
|
throw 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 iSHAPE_Length = feature.Fields.FindField("SHAPE_Length"); |
|
int iErrorMessage = feature.Fields.FindField("ErrorMessage"); |
|
int iErrorShape = feature.Fields.FindField("ErrorShape"); |
|
|
|
dltbBGEntity.DLBM = feature.Value[iDLBM].ToString();//地类编码 |
|
dltbBGEntity.DLMC = feature.Value[iDLMC].ToString();//地类名称 |
|
dltbBGEntity.QSDWDM = feature.Value[iQSDWDM].ToString();//权属单位代码 |
|
dltbBGEntity.QSDWMC = feature.Value[iQSDWMC].ToString();//权属单位名称 |
|
dltbBGEntity.ZLDWDM = feature.Value[iZLDWDM].ToString();//坐落单位代码 |
|
dltbBGEntity.ZLDWMC = feature.Value[iZLDWMC].ToString();//坐落单位名称 |
|
dltbBGEntity.GDLX = feature.Value[iGDLX].ToString();//耕地类型 |
|
dltbBGEntity.GDPDJB = feature.Value[iGDPDJB].ToString();//耕地坡度级别 |
|
dltbBGEntity.TBXHDM = feature.Value[iTBXHDM].ToString();//图斑细化代码 |
|
dltbBGEntity.TBXHMC = feature.Value[iTBXHMC].ToString();//图斑细化代码 |
|
dltbBGEntity.ZZSXDM = feature.Value[iZZSXDM].ToString();//种植属性代码 |
|
dltbBGEntity.ZZSXMC = feature.Value[iZZSXMC].ToString();//种植属性名称 |
|
dltbBGEntity.KCDLBM = feature.Value[iKCDLBM].ToString();//扣除地类编码 |
|
dltbBGEntity.QSXZ = feature.Value[iQSXZ].ToString();//权属性质 |
|
dltbBGEntity.BZ = feature.Value[iBZ].ToString();//备注 |
|
dltbBGEntity.XZDWKD = feature.Value[iXZDWKD].ToString();//线状地物宽度 |
|
dltbBGEntity.FRDBS = feature.Value[iFRDBS].ToString();//飞入地标识 |
|
dltbBGEntity.MSSM = feature.Value[iMSSM].ToString();//描述说明 |
|
dltbBGEntity.CZCSXM = feature.Value[iCZCSXM].ToString();//城镇村属性码 |
|
dltbBGEntity.KCXS = feature.Value[iKCXS].ToString();//扣除系数 |
|
dltbBGEntity.GDDB = feature.Value[iGDDB].ToString();//扣除系数 |
|
dltbBGEntity.SHAPE_Area = feature.Value[iSHAPE_Area].ToString();//SHAPE_Area |
|
dltbBGEntity.SHAPE_Length = feature.Value[iSHAPE_Length].ToString();//SHAPE_Length |
|
dltbBGEntity.feature = feature; |
|
dltbBGEntity.CheckResult = new List<CheckResultModel>(); |
|
dltbBGEntity.ErrorMessage = ""; |
|
dltbBGEntity.ErrorShape = ""; |
|
} |
|
} |
|
catch (Exception ex) |
|
{ |
|
throw ex; |
|
} |
|
} |
|
|
|
private void LogicCheck(bool iserror, string Error) |
|
{ |
|
if (iserror) |
|
dltbBGEntity.CheckResult.Add(new CheckResultModel() |
|
{ |
|
OBJECTID = dltbBGEntity.OBJECTID.ToString(), |
|
Error = Error, |
|
ErrorType = ErrorTypeEnum.AttributeError |
|
}); |
|
} |
|
|
|
} |
|
public class DLTBBGEntity |
|
{ |
|
public List<CheckResultModel> CheckResult { get; set; } |
|
public IFeature feature { get; set; } |
|
public int OBJECTID { get; set; } |
|
public string BSM { get; set; } |
|
public string YSDM { get; set; } |
|
public string TBYBH { get; set; } |
|
public string TBBH { 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 TBMJ { get; set; } |
|
public string KCDLBM { get; set; } |
|
public string KCXS { get; set; } |
|
public string KCMJ { get; set; } |
|
public string TBDLMJ { 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 HDMC { get; set; } |
|
public string BZ { get; set; } |
|
public string XZQTZLX { get; set; } |
|
public string BGZT { get; set; } |
|
public string JCZT { get; set; } |
|
public string SHAPE_Length { get; set; } |
|
public string SHAPE_Area { get; set; } |
|
public string ErrorMessage { get; set; } |
|
public string ErrorShape { get; set; } |
|
} |
|
|
|
}
|
|
|