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.
937 lines
49 KiB
937 lines
49 KiB
using ESRI.ArcGIS.Geodatabase; |
|
using ESRI.ArcGIS.Geometry; |
|
using KGIS.Framework.Platform; |
|
using KGIS.Framework.Utils; |
|
using KGIS.Framework.Utils.ExtensionMethod; |
|
using System; |
|
using System.Collections.Generic; |
|
using System.Linq; |
|
using System.Runtime.InteropServices; |
|
using System.Text.RegularExpressions; |
|
|
|
namespace Kingo.RuleCheck.XJRuleCheck |
|
{ |
|
/// <summary> |
|
/// 单图斑矢量数据质检库 |
|
/// </summary> |
|
public class SLSJDataCheck_DTB : RuleCheckBase_DTB |
|
{ |
|
public SLSJDataCheck_DTB() |
|
{ |
|
var list = GetConfigList("SLSJDataCheck_DTB"); |
|
if (list.Count > 0) |
|
ruleMethodNames = list; |
|
} |
|
private List<string> ruleMethodNames = new List<string>() |
|
{ |
|
"SLQSDM","SLZLDM", "SLXZDW", |
|
//"SLMSSM", |
|
"SLQSXZ","SLGDLX", |
|
//"SLDDTC", |
|
"TXSXJC","SLTBXH","SLDLBM","SLZZSX", |
|
//"SLXMInfo" |
|
}; |
|
|
|
private DLTBBGEntity dltbBGEntity = null; |
|
private List<DataDicTionary> Dics = null; |
|
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; |
|
private List<RuleEntity> dataCheckResults = new List<RuleEntity>(); |
|
public override List<RuleEntity> ExcuteCheck(string sourePath, IWorkspace workspace) |
|
{ |
|
return null; |
|
} |
|
|
|
public override List<RuleEntity> ExcuteCheck(string sourePath, Dictionary<string, IFeatureClass> dicFeatureClass) |
|
{ |
|
return null; |
|
} |
|
|
|
/// <summary> |
|
/// 执行检查 |
|
/// </summary> |
|
/// <param name="workspace">工作空间</param> |
|
/// <param name="layerNames">基础库等相关图层</param> |
|
/// <param name="dataSetNames"></param> |
|
/// <returns></returns> |
|
public override List<RuleEntity> ExcuteCheck(IWorkspace workspace, List<string> layerNames, List<string> dataSetNames) |
|
{ |
|
AssignmentEntity(this.SLFeatureCk); |
|
return this.StartCheck(workspace, ruleMethodNames, layerNames, dataSetNames); |
|
} |
|
|
|
public override List<RuleEntity> ExcuteCheck(string tbbsm, string sourePath, Dictionary<string, IFeatureClass> dicFeatureClass) |
|
{ |
|
return null; |
|
} |
|
|
|
private void AssignmentEntity(IFeature feature) |
|
{ |
|
dltbBGEntity = new RuleCheck.DLTBBGEntity(); |
|
try |
|
{ |
|
if (dltbBGEntity == null) return; |
|
Dics = Platform.Instance.DicHelper.GetAllDic(); |
|
if (Dics == null) return; |
|
if (DLBMdataDic == null) |
|
DLBMdataDic = Platform.Instance.DicHelper.GetNoGroupDic(DicTypeEnum.DLBM, Dics); |
|
if (TBXHdataDic == null) |
|
TBXHdataDic = Platform.Instance.DicHelper.GetNoGroupDic(DicTypeEnum.TBXHLX, Dics); |
|
if (ZZSXdataDic == null) |
|
ZZSXdataDic = Platform.Instance.DicHelper.GetNoGroupDic(DicTypeEnum.ZZSX, Dics); |
|
if (QSXZdataDic == null) |
|
QSXZdataDic = Platform.Instance.DicHelper.GetNoGroupDic(DicTypeEnum.QSXZ, Dics); |
|
if (GDPDJBdataDic == null) |
|
GDPDJBdataDic = Platform.Instance.DicHelper.GetNoGroupDic(DicTypeEnum.PDJB, Dics); |
|
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<RuleEntity>(); |
|
} |
|
} |
|
catch (Exception ex) |
|
{ |
|
LogAPI.Debug("获取质检Feature字段属性异常:" + ex.Message); |
|
throw ex; |
|
} |
|
} |
|
|
|
private void LogicCheck(string RuleContent, string ErrorTip, string ErrorType, string RuleCode, string RuleName) |
|
{ |
|
dataCheckResults.Add( |
|
new RuleEntity() |
|
{ |
|
CheckObject = ((IDataset)this.SLFeatureCk.Class).Name, |
|
ErrorId = this.SLFeatureCk.Value[SLFeatureCk.Class.FindField("BSM")].ToString(), |
|
BGFWBSM = this.SLFeatureCk.Value[SLFeatureCk.Class.FindField("BSM")].ToString(), |
|
ErrorTip = RuleContent, |
|
ErrorType = ErrorType, |
|
RuleCode = RuleCode, |
|
RuleName = RuleName, |
|
RuleContent = ErrorTip |
|
}); |
|
} |
|
|
|
public List<RuleEntity> TXSXJC() |
|
{ |
|
dataCheckResults = new List<RuleEntity>(); |
|
try |
|
{ |
|
//2、不存在不规则图斑(除地类1001、1002、1006、1009、1107、1109外,其余地类满足面积 / 周长 < 0.2,并且有一个角度小于20) |
|
//自相交/多部件 |
|
CheckGeometry(dltbBGEntity.feature); |
|
|
|
//3、地类图斑变更层要素所有角度均应大于10度,同时不存在局部狭长图形 |
|
AcuteAngle(dltbBGEntity.feature); |
|
|
|
//4、地类图斑变更层平均节点密度大于1米小于70米 |
|
PointToPoint(dltbBGEntity.feature); |
|
} |
|
catch (Exception ex) |
|
{ |
|
LogAPI.Debug("变更数据检查异常:" + ex.Message); |
|
LogAPI.Debug(ex); |
|
} |
|
return dataCheckResults; |
|
} |
|
|
|
public List<RuleEntity> SLDDTC() |
|
{ |
|
dataCheckResults = new List<RuleEntity>(); |
|
//建设用地 |
|
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)) |
|
{ |
|
string RuleContent = "当单独图层代码为“1301 临时用地”时,地类必须为建设用地;否则,认定为错误图斑!"; |
|
string ErrorTip = "单独图层标注错误!"; |
|
string ErrorType = "一类错误"; |
|
LogicCheck(RuleContent, ErrorTip, ErrorType, "SLDDTC", "项目信息检查"); |
|
} |
|
else if (dltbBGEntity.DDTCBZ == "1304" && !(liststr.Contains(dltbBGEntity.DLBM) || byds.Contains(dltbBGEntity.DLBM))) |
|
{ |
|
string RuleContent = "当单独图层代码为“1304 拆除未尽区”时,地类必须为建设用地或设施农用地;否则,认定为错误图斑!"; |
|
string ErrorTip = "单独图层标注错误!"; |
|
string ErrorType = "一类错误"; |
|
LogicCheck(RuleContent, ErrorTip, ErrorType, "SLDDTC", "单独图层检查"); |
|
} |
|
return dataCheckResults; |
|
} |
|
|
|
public List<RuleEntity> SLXMInfo() |
|
{ |
|
dataCheckResults = new List<RuleEntity>(); |
|
if ((string.IsNullOrWhiteSpace(dltbBGEntity.XMMC) || string.IsNullOrWhiteSpace(dltbBGEntity.XMBH) || string.IsNullOrWhiteSpace(dltbBGEntity.DKMC))) |
|
{ |
|
string RuleContent = "项目名称、项目编号和地块名称字段不能为空!"; |
|
string ErrorTip = "项目信息标注错误!"; |
|
string ErrorType = "一类错误"; |
|
LogicCheck(RuleContent, ErrorTip, ErrorType, "SLXMInfo", "项目信息检查"); |
|
} |
|
return dataCheckResults; |
|
} |
|
|
|
//包含耕地坡度级别,扣除系数 |
|
public List<RuleEntity> SLGDLX() |
|
{ |
|
dataCheckResults = new List<RuleEntity>(); |
|
if (!string.IsNullOrWhiteSpace(dltbBGEntity.DLBM) && dltbBGEntity.DLBM.Substring(0, 2) != "01") |
|
{ |
|
if (!string.IsNullOrEmpty(dltbBGEntity.GDPDJB) && dltbBGEntity.GDPDJB != "0") |
|
{ |
|
string RuleContent = "非耕地类型数据不允许填写耕地坡度级别!"; |
|
string ErrorTip = "耕地类型标注错误!"; |
|
string ErrorType = "一类错误"; |
|
LogicCheck(RuleContent, ErrorTip, ErrorType, "SLGDLX", "耕地类型检查"); |
|
} |
|
else if (!string.IsNullOrEmpty(dltbBGEntity.GDLX)) |
|
{ |
|
string RuleContent = "非耕地类型数据不允许填写耕地类型!"; |
|
string ErrorTip = "耕地类型标注错误!"; |
|
string ErrorType = "一类错误"; |
|
LogicCheck(RuleContent, ErrorTip, ErrorType, "SLGDLX", "耕地类型检查"); |
|
} |
|
else if (!string.IsNullOrEmpty(dltbBGEntity.KCXS) && dltbBGEntity.KCXS != "0") |
|
{ |
|
string RuleContent = "非耕地类型数据不允许填写扣除系数!"; |
|
string ErrorTip = "耕地类型标注错误!"; |
|
string ErrorType = "一类错误"; |
|
LogicCheck(RuleContent, ErrorTip, ErrorType, "SLGDLX", "耕地类型检查"); |
|
} |
|
} |
|
return dataCheckResults; |
|
} |
|
|
|
public List<RuleEntity> SLQSXZ() |
|
{ |
|
dataCheckResults = new List<RuleEntity>(); |
|
if (string.IsNullOrEmpty(dltbBGEntity.QSXZ)) |
|
{ |
|
string RuleContent = "地类图斑变更层QSXZ字段取值规范性,不能为空!"; |
|
string ErrorTip = "权属性质标注错误!"; |
|
string ErrorType = "一类错误"; |
|
LogicCheck(RuleContent, ErrorTip, ErrorType, "SLQSXZ", "权属性质检查"); |
|
} |
|
else if (DicFirstOrDefault(QSXZdataDic, dltbBGEntity.QSXZ.ToTrim(), "", true)) |
|
{ |
|
string RuleContent = "地类图斑变更层QSXZ字段取值规范性,权属字典中不存在!"; |
|
string ErrorTip = "权属性质标注错误!"; |
|
string ErrorType = "一类错误"; |
|
LogicCheck(RuleContent, ErrorTip, ErrorType, "SLQSXZ", "权属性质检查"); |
|
} |
|
return dataCheckResults; |
|
} |
|
|
|
public List<RuleEntity> SLMSSM() |
|
{ |
|
dataCheckResults = new List<RuleEntity>(); |
|
if (dltbBGEntity.MSSM != "00" && dltbBGEntity.MSSM != "01") |
|
{ |
|
string RuleContent = "地类图斑变更层MSSM字段取值为00或01!"; |
|
string ErrorTip = "描述说明标注错误!"; |
|
string ErrorType = "一类错误"; |
|
LogicCheck(RuleContent, ErrorTip, ErrorType, "SLMSSM", "描述说明检查"); |
|
} |
|
else if ((dltbBGEntity.QSXZ == "21" || dltbBGEntity.QSXZ == "41") && dltbBGEntity.MSSM != "01") |
|
{ |
|
string RuleContent = "地类图斑变更层权属性质为21或41,描述说明须为01!"; |
|
string ErrorTip = "描述说明标注错误!"; |
|
string ErrorType = "一类错误"; |
|
LogicCheck(RuleContent, ErrorTip, ErrorType, "SLMSSM", "描述说明检查"); |
|
} |
|
return dataCheckResults; |
|
} |
|
|
|
public List<RuleEntity> SLXZDW() |
|
{ |
|
dataCheckResults = new List<RuleEntity>(); |
|
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})?$")) |
|
{ |
|
string RuleContent = "地类图斑变更层线状地物宽度字段小数位数检查,保留1位小数!"; |
|
string ErrorTip = "线状地物标注错误!"; |
|
string ErrorType = "一类错误"; |
|
LogicCheck(RuleContent, ErrorTip, ErrorType, "SLXZDW", "线状地物检查"); |
|
} |
|
else if (dlbmliststr.Contains(dltbBGEntity.DLBM) && Convert.ToDouble(dltbBGEntity.XZDWKD) < 0) |
|
{ |
|
string RuleContent = "地类图斑变更层铁路、公路、管道用地、农村道路和沟渠等线形地物,线状图斑宽度XZDWKD大于0!"; |
|
string ErrorTip = "线状地物标注错误!"; |
|
string ErrorType = "一类错误"; |
|
LogicCheck(RuleContent, ErrorTip, ErrorType, "SLXZDW", "线状地物检查"); |
|
} |
|
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) |
|
{ |
|
string RuleContent = "地类图斑变更层非河流、铁路、公路、管道用地、农村道路和沟渠等线形地物,线状图斑宽度XZDWKD等于0,允许为空!"; |
|
string ErrorTip = "线状地物标注错误!"; |
|
string ErrorType = "一类错误"; |
|
LogicCheck(RuleContent, ErrorTip, ErrorType, "SLXZDW", "线状地物检查"); |
|
} |
|
} |
|
} |
|
return dataCheckResults; |
|
} |
|
|
|
public List<RuleEntity> SLZLDM() |
|
{ |
|
dataCheckResults = new List<RuleEntity>(); |
|
if (string.IsNullOrEmpty(dltbBGEntity.ZLDWDM) || string.IsNullOrEmpty(dltbBGEntity.ZLDWDM)) |
|
{ |
|
string RuleContent = "地类图斑变更层ZLDWDM/ZLDWMC不能为空!"; |
|
string ErrorTip = "坐落标注错误!"; |
|
string ErrorType = "一类错误"; |
|
LogicCheck(RuleContent, ErrorTip, ErrorType, "SLZLDM", "坐落检查"); |
|
} |
|
else if (!Regex.IsMatch(dltbBGEntity.ZLDWDM, "^\\d{19}$")) |
|
{ |
|
string RuleContent = "地类图斑变更层ZLDWDM不能为空,长度为19位,必须为纯数值!"; |
|
string ErrorTip = "坐落标注错误!"; |
|
string ErrorType = "一类错误"; |
|
LogicCheck(RuleContent, ErrorTip, ErrorType, "SLZLDM", "坐落检查"); |
|
} |
|
//else if (projectInfo.CODE != dltbBGEntity.ZLDWDM.Substring(0, 6))//待定-是否引用公共插件 |
|
//{ |
|
// LogicCheck("地类图斑变更层ZLDWDM前6位为县级行政区代码!", Synopsis, code, dltbBGEntity.OBJECTID); |
|
//} |
|
else if (!Regex.IsMatch(dltbBGEntity.QSDWMC, @"^[\u4E00-\u9FA5A-Za-z0-9-()()]+$")) |
|
{ |
|
string RuleContent = "地类图斑变更层ZLDWMC不能为空、不存在特殊字符!"; |
|
string ErrorTip = "坐落标注错误!"; |
|
string ErrorType = "一类错误"; |
|
LogicCheck(RuleContent, ErrorTip, ErrorType, "SLZLDM", "坐落检查"); |
|
} |
|
return dataCheckResults; |
|
} |
|
|
|
public List<RuleEntity> SLQSDM() |
|
{ |
|
dataCheckResults = new List<RuleEntity>(); |
|
if (string.IsNullOrEmpty(dltbBGEntity.QSDWDM) || string.IsNullOrEmpty(dltbBGEntity.QSDWMC)) |
|
{ |
|
string RuleContent = "地类图斑变更层QSDWDM/QSDWMC不能为空!"; |
|
string ErrorTip = "权属标注错误!"; |
|
string ErrorType = "一类错误"; |
|
LogicCheck(RuleContent, ErrorTip, ErrorType, "SLQSDM", "权属检查"); |
|
} |
|
else if (!Regex.IsMatch(dltbBGEntity.QSDWDM, "^\\d{19}$")) |
|
{ |
|
string RuleContent = "地类图斑变更层QSDWDM不能为空,长度为19位,必须为纯数值!"; |
|
string ErrorTip = "权属标注错误!"; |
|
string ErrorType = "一类错误"; |
|
LogicCheck(RuleContent, ErrorTip, ErrorType, "SLQSDM", "权属检查"); |
|
} |
|
else if (!Regex.IsMatch(dltbBGEntity.QSDWMC, @"^[\u4E00-\u9FA5A-Za-z0-9-()()]+$")) |
|
{ |
|
string RuleContent = "地类图斑变更层QSDWMC不能为空、不存在特殊字符!"; |
|
string ErrorTip = "权属标注错误!"; |
|
string ErrorType = "一类错误"; |
|
LogicCheck(RuleContent, ErrorTip, ErrorType, "SLQSDM", "权属检查"); |
|
} |
|
return dataCheckResults; |
|
} |
|
|
|
public List<RuleEntity> SLZZSX() |
|
{ |
|
dataCheckResults = new List<RuleEntity>(); |
|
if (!string.IsNullOrWhiteSpace(dltbBGEntity.DLBM)) |
|
{ |
|
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)) |
|
{ |
|
string RuleContent = "地类图斑变更层ZZSXMC与ZZSXDM字段取值匹配!"; |
|
string ErrorTip = "图斑细化标注错误!"; |
|
string ErrorType = "一类错误"; |
|
LogicCheck(RuleContent, ErrorTip, ErrorType, "SLZZSX", "图斑细化检查"); |
|
} |
|
else if (dltbBGEntity.DLBM.Substring(0, 2) == "01" && !liststr.Contains(dltbBGEntity.ZZSXDM.ToTrim())) |
|
{ |
|
string RuleContent = "地类图斑变更层DLBM前2位为01时,ZZSXDM取值在LS、FLS、LYFL、XG、LLJZ、WG范围内!"; |
|
string ErrorTip = "图斑细化标注错误!"; |
|
string ErrorType = "一类错误"; |
|
LogicCheck(RuleContent, ErrorTip, ErrorType, "SLZZSX", "图斑细化检查"); |
|
} |
|
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())) |
|
{ |
|
string RuleContent = "地类图斑变更层DLBM为0301、0302、0305、0307、0404、1104、1104A时,ZZSXDM取值在JKHF、GCHF、空范围内!"; |
|
string ErrorTip = "图斑细化标注错误!"; |
|
string ErrorType = "一类错误"; |
|
LogicCheck(RuleContent, ErrorTip, ErrorType, "SLZZSX", "图斑细化检查"); |
|
} |
|
dlbmliststr = new List<string>() { "0201K", "0202K", "0203K", "0204K", "0301K", "0302K", "0307K", "0403K", "1104K" }; |
|
if (dlbmliststr.Contains(dltbBGEntity.DLBM) && !liststr.Contains(dltbBGEntity.ZZSXDM.ToTrim())) |
|
{ |
|
string RuleContent = "地类图斑变更层DLBM为0201K、0202K、0203K、0204K、0301K、0302K、0307K、0403K、1104K时,ZZSXDM取值在JKHF、GCHF、空范围内!"; |
|
string ErrorTip = "图斑细化标注错误!"; |
|
string ErrorType = "一类错误"; |
|
LogicCheck(RuleContent, ErrorTip, ErrorType, "SLZZSX", "图斑细化检查"); |
|
} |
|
dlbmliststr = new List<string>() { "0201", "0202", "0203", "0204" }; |
|
if (dlbmliststr.Contains(dltbBGEntity.DLBM) && string.IsNullOrEmpty(dltbBGEntity.TBXHDM) && !liststr.Contains(dltbBGEntity.ZZSXDM.ToTrim())) |
|
{ |
|
string RuleContent = "地类图斑变更层DLBM为0201、0202、0203、0204,且TBXHDM为空时,ZZSXDM取值在JKHF、GCHF、空范围内!"; |
|
string ErrorTip = "图斑细化标注错误!"; |
|
string ErrorType = "一类错误"; |
|
LogicCheck(RuleContent, ErrorTip, ErrorType, "SLZZSX", "图斑细化检查"); |
|
} |
|
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)) |
|
{ |
|
string RuleContent = "地类图斑变更层DLBM前2位为04(不包括0404、0403K)、05、06、07、08、09、10、11(不包括1104、1104A、1104K)、12,或属于湿地的,不允许填写种植属性代码!"; |
|
string ErrorTip = "图斑细化标注错误!"; |
|
string ErrorType = "一类错误"; |
|
LogicCheck(RuleContent, ErrorTip, ErrorType, "SLZZSX", "图斑细化检查"); |
|
} |
|
} |
|
else if (dltbBGEntity.TBXHDM == "LQYD") |
|
{ |
|
dlbmliststr = new List<string>() { "0201", "0202", "0203", "0204" }; |
|
if (dlbmliststr.Contains(dltbBGEntity.DLBM) && !string.IsNullOrEmpty(dltbBGEntity.ZZSXDM)) |
|
{ |
|
string RuleContent = "地类图斑变更层地类为0201、0202、0203、0204,且标注林区种植园用地的不能标注种植属性!"; |
|
string ErrorTip = "图斑细化标注错误!"; |
|
string ErrorType = "一类错误"; |
|
LogicCheck(RuleContent, ErrorTip, ErrorType, "SLZZSX", "图斑细化检查"); |
|
} |
|
} |
|
} |
|
return dataCheckResults; |
|
} |
|
|
|
public List<RuleEntity> SLTBXH() |
|
{ |
|
dataCheckResults = new List<RuleEntity>(); |
|
if (!string.IsNullOrWhiteSpace(dltbBGEntity.DLBM)) |
|
{ |
|
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)) |
|
{ |
|
string RuleContent = "地类图斑变更层TBXHMC与TBXHDM字段取值匹配"; |
|
string ErrorTip = "图斑细化标注错误!"; |
|
string ErrorType = "一类错误"; |
|
LogicCheck(RuleContent, ErrorTip, ErrorType, "SLTBXH", "图斑细化检查"); |
|
} |
|
else if (!liststr.Contains(dltbBGEntity.DLBM.Substring(0, 2)) && !liststr.Contains(dltbBGEntity.DLBM) && (!string.IsNullOrEmpty(dltbBGEntity.TBXHDM) || !string.IsNullOrEmpty(dltbBGEntity.TBXHMC))) |
|
{ |
|
string RuleContent = "地类图斑变更层DLBM字段前2位非01、02、03、04,且DLBM不在0601、0602、1001、1003取值范围内,或属于湿地的地类,不能进行图斑细化标注!"; |
|
string ErrorTip = "图斑细化标注错误!"; |
|
string ErrorType = "一类错误"; |
|
LogicCheck(RuleContent, ErrorTip, ErrorType, "SLTBXH", "图斑细化检查"); |
|
} |
|
else if (dltbBGEntity.DLBM == "0601") |
|
{ |
|
liststr = new List<string>() { "HDGY", "GTGY", "MTGY", "SNGY", "BLGY", "DLGY", "" }; |
|
if (!liststr.Contains(dltbBGEntity.TBXHDM.ToTrim())) |
|
{ |
|
string RuleContent = "地类图斑变更层工业用地(0601),TBXHDM字段为HDGY、GTGY、MTGY、SNGY、BLGY、DLGY,或空值!"; |
|
string ErrorTip = "图斑细化标注错误!"; |
|
string ErrorType = "一类错误"; |
|
LogicCheck(RuleContent, ErrorTip, ErrorType, "SLTBXH", "图斑细化检查"); |
|
} |
|
} |
|
else if ((dltbBGEntity.DLBM == "0602" || dltbBGEntity.DLBM == "1001" || dltbBGEntity.DLBM == "1003") && dltbBGEntity.TBXHDM != "FQ" && !string.IsNullOrEmpty(dltbBGEntity.TBXHDM)) |
|
{ |
|
string RuleContent = "地类图斑变更层DLBM为0602、1001、1003时,TBXHDM字段为FQ或空值!"; |
|
string ErrorTip = "图斑细化标注错误!"; |
|
string ErrorType = "一类错误"; |
|
LogicCheck(RuleContent, ErrorTip, ErrorType, "SLTBXH", "图斑细化检查"); |
|
} |
|
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)) |
|
{ |
|
string RuleContent = "地类图斑变更层DLBM前2位为01时,TBXHDM字段取值在HDGD、HQGD、LQGD、MQGD、SHGD、SMGD、YJGD或空范围内!"; |
|
string ErrorTip = "图斑细化标注错误!"; |
|
string ErrorType = "一类错误"; |
|
LogicCheck(RuleContent, ErrorTip, ErrorType, "SLTBXH", "图斑细化检查"); |
|
} |
|
} |
|
else if (dltbBGEntity.DLBM.Substring(0, 2) == "04" && dltbBGEntity.DLBM != "0404" && dltbBGEntity.TBXHDM != "GCCD" && !string.IsNullOrEmpty(dltbBGEntity.TBXHDM)) |
|
{ |
|
string RuleContent = "地类图斑变更层DLBM前2位为04时(不含0404),TBXHDM取值在GCCD、空范围内!"; |
|
string ErrorTip = "图斑细化标注错误!"; |
|
string ErrorType = "一类错误"; |
|
LogicCheck(RuleContent, ErrorTip, ErrorType, "SLTBXH", "图斑细化检查"); |
|
} |
|
else if (dltbBGEntity.DLBM.Substring(0, 2) == "03" && !string.IsNullOrEmpty(dltbBGEntity.TBXHDM) && dltbBGEntity.TBXHDM != "LJTM") |
|
{ |
|
string RuleContent = "地类图斑变更层DLBM前2位为03时,TBXHDM取值在LJTM、空范围内!"; |
|
string ErrorTip = "图斑细化标注错误!"; |
|
string ErrorType = "一类错误"; |
|
LogicCheck(RuleContent, ErrorTip, ErrorType, "SLTBXH", "图斑细化检查"); |
|
} |
|
else if (dltbBGEntity.DLBM.Substring(0, 2) == "02" && !string.IsNullOrEmpty(dltbBGEntity.TBXHDM) && dltbBGEntity.TBXHDM != "LQYD") |
|
{ |
|
string RuleContent = "地类图斑变更层DLBM前2位为02时,TBXHDM取值在LQYD、空范围内!"; |
|
string ErrorTip = "图斑细化标注错误!"; |
|
string ErrorType = "一类错误"; |
|
LogicCheck(RuleContent, ErrorTip, ErrorType, "SLTBXH", "图斑细化检查"); |
|
} |
|
} |
|
return dataCheckResults; |
|
} |
|
|
|
public List<RuleEntity> SLDLBM() |
|
{ |
|
dataCheckResults = new List<RuleEntity>(); |
|
if (string.IsNullOrWhiteSpace(dltbBGEntity.DLBM) || string.IsNullOrEmpty(dltbBGEntity.DLMC)) |
|
{ |
|
string RuleContent = "地类编码/地类名称不允许为空!"; |
|
string ErrorTip = "地类编码/名称错误!"; |
|
string ErrorType = "一类错误"; |
|
LogicCheck(RuleContent, ErrorTip, ErrorType, "SLDLBM", "地类编码检查"); |
|
} |
|
if (DicFirstOrDefault(DLBMdataDic, dltbBGEntity.DLBM, dltbBGEntity.DLMC, false)) |
|
{ |
|
string RuleContent = "地类图斑变更层DLBM和DLMC在第三次全国土地调查工作分类表(最末级分类)中有对应项且匹配!"; |
|
string ErrorTip = "地类编码/名称错误!"; |
|
string ErrorType = "一类错误"; |
|
LogicCheck(RuleContent, ErrorTip, ErrorType, "SLDLBM", "地类编码检查"); |
|
} |
|
return dataCheckResults; |
|
} |
|
|
|
/// <summary> |
|
/// 检查单个图形 |
|
/// </summary> |
|
/// <param name="pGeometry"></param> |
|
/// <returns></returns> |
|
private void CheckGeometry(IFeature pfeature) |
|
{ |
|
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)//自相交 |
|
{ |
|
string RuleContent = "要素存在自相交!"; |
|
string ErrorTip = "图形自相交错误!"; |
|
string ErrorType = "一类错误"; |
|
LogicCheck(RuleContent, ErrorTip, ErrorType, "TXSXJC", "图形自相交检查"); |
|
} |
|
if (reason == esriNonSimpleReasonEnum.esriNonSimpleUnclosedRing)//存在不闭合的环 |
|
{ |
|
polygon = pfeature.ShapeCopy as IPolygon4; |
|
bag = polygon.ExteriorRingBag;//获取多边形的所有外环 |
|
if ((bag as IGeometryCollection).GeometryCount > 1) |
|
{ |
|
string RuleContent = "要素存在组合图斑(多部件)!"; |
|
string ErrorTip = "图形多部件错误!"; |
|
string ErrorType = "一类错误"; |
|
LogicCheck(RuleContent, ErrorTip, ErrorType, "TXSXJC", "图形多部件检查"); |
|
} |
|
} |
|
if (reason == esriNonSimpleReasonEnum.esriNonSimpleShortSegments) |
|
{ |
|
string RuleContent = "要素存在短线段!"; |
|
string ErrorTip = "图形短线段错误!"; |
|
string ErrorType = "一类错误"; |
|
LogicCheck(RuleContent, ErrorTip, ErrorType, "TXSXJC", "图形短线段检查"); |
|
} |
|
} |
|
} |
|
catch (Exception ex) |
|
{ |
|
LogAPI.Debug("检查单个图形异常:" + 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); |
|
} |
|
} |
|
|
|
#region 要素不存在尖锐角和局部狭长图形(即不允许存在一个角度小于10度,或局部图形狭长的情况) |
|
private void AcuteAngle(IFeature pFeature) |
|
{ |
|
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) |
|
{ |
|
string RuleContent = "要素存在尖锐角!"; |
|
string ErrorTip = "图形尖锐角错误!"; |
|
string ErrorType = "一类错误"; |
|
LogicCheck(RuleContent, ErrorTip, ErrorType, "TXSXJC", "图形尖锐角检查"); |
|
} |
|
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)) |
|
{ |
|
string RuleContent = "要素存在局部狭长图形!"; |
|
string ErrorTip = "图形局部狭长错误!"; |
|
string ErrorType = "一类错误"; |
|
LogicCheck(RuleContent, ErrorTip, ErrorType, "TXSXJC", "图形局部狭长检查"); |
|
} |
|
} |
|
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) |
|
{ |
|
LogAPI.Debug("获取最小角度异常:" + 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 void PointToPoint(IFeature pFeature) |
|
{ |
|
int idxBGBSM = pFeature.Fields.FindField("BSM"); |
|
int idxBGArea = pFeature.Fields.FindField("SHAPE_AREA"); |
|
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) |
|
{ |
|
string RuleContent = "地类图斑变更层平均节点密度大于1米小于70米!"; |
|
string ErrorTip = "图形节点密度错误!"; |
|
string ErrorType = "一类错误"; |
|
LogicCheck(RuleContent, ErrorTip, ErrorType, "TXSXJC", "图形节点密度检查"); |
|
} |
|
} |
|
#endregion |
|
|
|
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; |
|
} |
|
} |
|
|
|
} |
|
}
|
|
|