年度变更建库软件5.0版本
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

220 lines
10 KiB

6 months ago
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ESRI.ArcGIS.Geodatabase;
namespace Kingo.RuleCheck.XJRuleCheck
{
/// <summary>
/// 数学基础规范性检查
/// </summary>
public class SJJCCheck_DTB : RuleCheckBase_DTB
{
List<string> ruleMethodNames = new List<string>() {
"JC001"
//, "JC002", "JC003"
};
public override List<RuleEntity> ExcuteCheck(string sourePath, IWorkspace workspace)
{
return this.StartCheck(sourePath, workspace, ruleMethodNames);
}
public override List<RuleEntity> ExcuteCheck(IWorkspace workspace, List<string> layerNames, List<string> dataSetNames)
{
return this.StartCheck(workspace, ruleMethodNames, layerNames, dataSetNames);
}
public override List<RuleEntity> ExcuteCheck(string sourePath, Dictionary<string, IFeatureClass> workspace)
{
return this.StartCheck(sourePath, workspace, ruleMethodNames);
}
public override List<RuleEntity> ExcuteCheck(string tbbsm, string sourePath, Dictionary<string, IFeatureClass> workspace)
{
return this.StartCheck(tbbsm, sourePath, workspace, ruleMethodNames);
}
/// <summary>
/// 矢量图形平面坐标系检查
/// </summary>
/// <returns></returns>
public List<RuleEntity> JC001()
{
List<RuleEntity> result = new List<RuleEntity>();
try
{
if (DicFeatureClass == null || !DicFeatureClass.ContainsKey("JC_DLTB") || DicFeatureClass["JC_DLTB"] == null)
{
throw new Exception("未找到“基础_地类图斑”层!");
//return result;
}
IFeatureClass featureClass = DicFeatureClass["JC_DLTB"];
string name = (featureClass as IGeoDataset).SpatialReference.Name.ToUpper();
if (!name.StartsWith("CGCS2000"))
{
result.Add(new RuleEntity()
{
ErrorId = "-1",
CheckObject = "内业预处理、单图斑建库所有矢量图层",
ErrorTip = $"【基础_地类图斑】坐标系错误,未采用2000国家大地坐标系",
ErrorType = "一类错误",
RuleCode = "JC001",
RuleContent = "检查矢量数据是否采用2000 国家大地坐标系,若不是,认定为错误图斑。",
RuleName = "矢量图形平面坐标系检查"
});
}
if (!name.Contains("GK") || !name.Contains("CGCS2000_3"))
{
result.Add(new RuleEntity()
{
ErrorId = "-1",
CheckObject = "内业预处理、单图斑建库所有矢量图层",
ErrorTip = $"【基础_地类图斑】投影方式错误,未采用高斯-克吕格投影,或按 3°分带",
ErrorType = "一类错误",
RuleCode = "JC003",
RuleContent = "检查矢量数据是否采用高斯-克吕格投影,并按 3°分带,若不是,认定为错误图斑。",
RuleName = "矢量图形投影方式检查"
});
}
//IWorkspace workspace = this.DicFeatureClass.FirstOrDefault(x => x.Key.Equals("DTBWorkspace")).Value as IWorkspace;
//IEnumDataset enumDataset = workspace.Datasets[esriDatasetType.esriDTAny];
//if (enumDataset != null)
//{
// IDataset dataset = null;
// while ((dataset = enumDataset.Next()) != null)
// {
// IGeoDataset geoDataset = dataset as IGeoDataset;
// if (geoDataset == null)
// continue;
// string name = geoDataset.SpatialReference.Name.ToUpper();
// if ((LayerNames != null && !LayerNames.Contains(dataset.Name)) || (DataSetNames != null && !DataSetNames.Contains(dataset.Name)))
// {
// break;
// }
// if (!name.StartsWith("CGCS2000"))
// {
// result.Add(new RuleEntity()
// {
// ErrorId = dataset.Name,
// CheckObject = "内业预处理、单图斑建库所有矢量图层",
// ErrorTip = $"【{dataset.Name}】坐标系错误,未采用2000国家大地坐标系",
// ErrorType = "一类错误",
// RuleCode = "JC001",
// RuleContent = "检查矢量数据是否采用2000 国家大地坐标系,若不是,认定为错误图斑。",
// RuleName = "矢量图形平面坐标系检查"
// });
// }
// //else if (!name.Contains("GK") || !name.Contains("CGCS2000_3"))
// //{
// // result.Add(new RuleEntity()
// // {
// // ErrorId = dataset.Name,
// // CheckObject = "内业预处理、单图斑建库所有矢量图层",
// // ErrorTip = $"【{dataset.Name}】投影方式错误,未采用高斯-克吕格投影,或按 3°分带",
// // ErrorType = "一类错误",
// // RuleCode = "JC003",
// // RuleContent = "检查矢量数据是否采用高斯-克吕格投影,并按 3°分带,若不是,认定为错误图斑。",
// // RuleName = "矢量图形投影方式检查"
// // });
// //}
// }
//}
}
catch (Exception ex)
{
RuleEntity ruleEntity = new RuleEntity()
{
ErrorId = this.TBBSM,
CheckObject = "内业预处理、单图斑建库所有矢量图层",
ErrorTip = $"【图层名称】坐标系错误,未采用2000国家大地坐标系规则检查失败:" + ex.Message,
ErrorType = "一类错误",
RuleCode = "JC001",
RuleContent = "检查矢量数据是否采用2000 国家大地坐标系,若不是,认定为错误图斑。",
RuleName = "矢量图形平面坐标系检查"
};
result.Add(ruleEntity);
}
return result;
}
/// <summary>
/// 矢量图形高程系统检查
/// </summary>
/// <returns></returns>
public List<RuleEntity> JC002()
{
return null;
}
/// <summary>
/// 矢量图形投影方式检查
/// </summary>
/// <returns></returns>
//public List<RuleEntity> JC003()
//{
// List<RuleEntity> result = new List<RuleEntity>();
// try
// {
// if (this.DicFeatureClass == null || !this.DicFeatureClass.ContainsKey("DTBWorkspace"))
// {
// return result;
// }
// IWorkspace workspace = this.DicFeatureClass.FirstOrDefault(x => x.Key.Equals("DTBWorkspace")).Value as IWorkspace;
// IEnumDataset enumDataset = workspace.Datasets[esriDatasetType.esriDTAny];
// if (enumDataset != null)
// {
// IDataset dataset = null;
// while ((dataset = enumDataset.Next()) != null)
// {
// IGeoDataset geoDataset = dataset as IGeoDataset;
// if (geoDataset == null)
// continue;
// string name = geoDataset.SpatialReference.Name.ToUpper();
// if ((LayerNames != null && !LayerNames.Contains(dataset.Name)) || (DataSetNames != null && !DataSetNames.Contains(dataset.Name)))
// {
// break;
// }
// if (!name.Contains("GK") || !name.Contains("CGCS2000_3"))
// {
// result.Add(new RuleEntity()
// {
// ErrorId = dataset.Name,
// CheckObject = "内业预处理、单图斑建库所有矢量图层",
// ErrorTip = $"【{dataset.Name}】投影方式错误,未采用高斯-克吕格投影,或按 3°分带",
// ErrorType = "一类错误",
// RuleCode = "JC003",
// RuleContent = "检查矢量数据是否采用高斯-克吕格投影,并按 3°分带,若不是,认定为错误图斑。",
// RuleName = "矢量图形投影方式检查"
// });
// }
// }
// }
// }
// catch (Exception ex)
// {
// RuleEntity ruleEntity = new RuleEntity()
// {
// ErrorId = this.TBBSM,
// CheckObject = "内业预处理、单图斑建库所有矢量图层",
// ErrorTip = $"【图层名称】坐标系错误,未采用2000国家大地坐标系规则检查失败:" + ex.Message,
// ErrorType = "一类错误",
// RuleCode = "JC003",
// RuleContent = "检查矢量数据是否采用高斯-克吕格投影,并按 3°分带,若不是,认定为错误图斑。",
// RuleName = "矢量图形投影方式检查"
// };
// result.Add(ruleEntity);
// }
// return result;
//}
}
}