public void Check() { if (ExtractGHYT() == false) { return; } IWorkspace workspace = MdbFilePath.OpenAccessFileWorkSpace(); if (workspace == null) { QuestionManager2.Add(new Question2 { Code = ID, Name = RuleName, CheckProject = CheckProject, Description = string.Format("无法打开ArcGIS 工作空间") }); return; } IFeatureClass featureClass = workspace.GetFeatureClass("GHYT"); if (featureClass == null) { QuestionManager2.Add(new Question2 { Code = ID, Name = RuleName, CheckProject = CheckProject, Description = string.Format("获取GHYT要素类失败") }); return; } var CArea = Math.Round(ArcClass.GainArea(featureClass, "CJJX = 'C1' OR CJJX = 'C2'"), 0); var E2Area = Math.Round(ArcClass.GainArea(featureClass, "CJJX = 'E2'"), 0); if (CArea < E2Area) { QuestionManager2.Add(new Question2 { Code = ID, Name = RuleName, CheckProject = CheckProject, Description = string.Format("拆旧区面积不符合大于等于村规划拟新建区面积") }); } }
public void Check() { Init(); if (System.IO.File.Exists(MdbFilePath) == false) { return; } IWorkspace workspace = MdbFilePath.OpenAccessFileWorkSpace(); if (workspace == null) { QuestionManager2.Add(new Question2 { Code = ID, Name = RuleName, CheckProject = CheckProject, Folder = "", Description = string.Format("无法打开矢量数据的workspace,故无法检查规则") }); return; } var tables = ParameterManager2.Tables.Where(e => e.IsSpace == true).Select(e => e.Name).ToList(); var results = ArcGISManager.CheckCoordinate2(workspace, tables); if (results.Count > 0) { QuestionManager2.Add(new Question2 { Code = ID, Name = RuleName, CheckProject = CheckProject, Description = string.Format("【{0}】不符合坐标系", string.Join("、", results.ToArray())), Folder = "" }); } }
public void Check() { Init(); if (System.IO.File.Exists(MdbFilePath) == false) { return; } IWorkspace workspace = MdbFilePath.OpenAccessFileWorkSpace(); if (workspace == null) { QuestionManager2.Add(new Question2 { Code = ID, Name = RuleName, Description = "无法打开ArcGIS 工作空间", CheckProject = CheckProject }); return; } var tools = new List <SplinterTool>() { #region 建设用地 new SplinterTool { FeatureClassName = "JQDLTB", CompareValue = 100, Absolute = 20, Key = "BSM", WhereClause = "DLDM LIKE '2*'" }, new SplinterTool { FeatureClassName = "GHYT", CompareValue = 100, Absolute = 20, Key = "BSM", WhereClause = "GHYTDM LIKE 'X2*' OR GHYTDM LIKE 'G2*'" }, new SplinterTool { FeatureClassName = "TDGHDL", CompareValue = 100, Absolute = 20, Key = "BSM", WhereClause = "GHDLDM LIKE '2*'" }, #endregion #region 设施农用地 new SplinterTool { FeatureClassName = "JDQLTB", CompareValue = 200, Absolute = 20, Key = "BSM", WhereClause = "DLDM = '151'" }, new SplinterTool { FeatureClassName = "GHYT", CompareValue = 200, Absolute = 20, Key = "BSM", WhereClause = "GHYTDM = 'X151' OR GHYTDM = 'G151'" }, new SplinterTool { FeatureClassName = "TDGHDL", CompareValue = 200, Absolute = 20, Key = "BSM", WhereClause = "GHDLDM = '151'" }, #endregion #region 农用地(除设施农用地) new SplinterTool { FeatureClassName = "JQDLTB", CompareValue = 400, Absolute = 20, Key = "BSM", WhereClause = "DLDM = '111' OR DLDM = '113' OR DLDM = '12' OR DLDM = '132' OR DLDM = '152' OR DLDM = '153' OR DLDM = '154' OR DLDM = '155'" }, new SplinterTool { FeatureClassName = "GHYT", CompareValue = 400, Absolute = 20, Key = "BSM", WhereClause = "" }, new SplinterTool { FeatureClassName = "TDGHDL", CompareValue = 400, Absolute = 20, Key = "BSM", WhereClause = "DLDM = '111' OR DLDM = '113' OR DLDM = '12' OR DLDM = '132' OR DLDM = '152' OR DLDM = '153' OR DLDM = '154' OR DLDM = '155'" }, #endregion #region 其他地类 new SplinterTool { FeatureClassName = "JQDLTB", CompareValue = 600, Absolute = 20, Key = "BSM", WhereClause = "DLDM = '131' OR DLDM = '31' OR DLDM = '32'" }, new SplinterTool { FeatureClassName = "GHYT", CompareValue = 600, Absolute = 20, Key = "BSM", WhereClause = "" }, new SplinterTool { FeatureClassName = "TDGHDL", CompareValue = 600, Absolute = 20, Key = "BSM", WhereClause = "DLDM = '131' OR DLDM = '31' OR DLDM = '32'" }, #endregion #region 建设用地管制区 new SplinterTool { FeatureClassName = "JSYDGZQ", CompareValue = 10000, Absolute = 20, Key = "BSM" } #endregion }; foreach (var tool in tools) { if (tool.Check(workspace) == false) { QuestionManager2.Add(new Question2 { Code = ID, Name = RuleName, TableName = tool.FeatureClassName, CheckProject = CheckProject2.碎片多边形, Description = string.Format("执行【{0}】失败", tool.Name) }); } if (tool.Messages.Count > 0) { QuestionManager2.AddRange(tool.Messages.Select(e => new Question2 { Code = ID, Name = RuleName, TableName = tool.FeatureClassName, Description = e.Description, LocationClause = e.WhereClause, CheckProject = CheckProject2.碎片多边形 }).ToList()); } } }
public void Check() { Init(); if (System.IO.File.Exists(MdbFilePath) == false) { return; } #region 检查基期地类图斑地类面积=图斑面积-应扣田坎计算面积 应扣田坎计算面积=图斑面积*田坎系数 var tool1 = new JQDLTBAreaTool { Relative = ParameterManager2.Relative, Absolute = ParameterManager2.Absolute }; if (tool1.Check(ParameterManager2.Connection) == false) { QuestionManager2.Add(new Question2 { Code = ID, Name = RuleName, CheckProject = CheckProject2.面积一致性, TableName = "JQDLTB", Description = "检查基期地类图斑层相关数据失败" }); } if (tool1.Messages.Count > 0) { QuestionManager2.AddRange(tool1.Messages.Select(e => new Question2 { Code = ID, Name = RuleName, CheckProject = CheckProject2.面积一致性, TableName = "JQDLTB", Description = e.Description, LocationClause = e.WhereClause, }).ToList()); } #endregion #region 规划用途净面积核对 if (ArcExtensions2.Select(string.Format("{0}\\{1}", MdbFilePath, "GHYT"), string.Format("{0}\\{1}", MdbFilePath, "GHYT_JBNT"), "GHYTDM = 'G111' OR GHYTDM = 'G112'") == false) { QuestionManager2.Add(new Question2 { Code = ID, Name = RuleName, CheckProject = CheckProject, Description = string.Format("提取规划用途层中的基本农田数据失败") }); } else { if (ArcExtensions2.Intersect(string.Format("{0}\\{1};{0}\\{2}", MdbFilePath, "GHYT_JBNT", "JQDLTB"), string.Format("{0}\\{1}", MdbFilePath, "GHYT_JBNT_Intersect"), ParameterManager2.Tolerance) == false) { QuestionManager2.Add(new Question2 { Code = ID, Name = RuleName, CheckProject = CheckProject, Description = string.Format("规划用途层中的基本农田数据与基期地类图斑数据相交Intersect失败") }); } else { CheckJMJ(); } } #endregion IWorkspace workspace = MdbFilePath.OpenAccessFileWorkSpace(); if (workspace == null) { QuestionManager2.Add(new Question2 { Code = ID, Name = RuleName, CheckProject = CheckProject, Description = "无法打开ArcGIS 工作空间", Folder = "", }); return; } if (System.IO.File.Exists(ParameterManager2.TDLYXZ) == true)//判断土地利用现状数据库文件是否存在 存在 导入行政区 { var in_feature = string.Format("{0}\\{1}", ParameterManager2.TDLYXZ, "XZQ"); var tools = new List <ExtentTool>(); foreach (var xzc in ParameterManager2.XZCList) { var where = string.Format("XZQDM = '{0}'", xzc.XZCDM); var extentLayerName = "XZQ_" + xzc.XZCDM; if (ArcExtensions2.ImportFeatureClass(in_feature, MdbFilePath, extentLayerName, where) == false)//将指定行政区XZQ导入到 { QuestionManager2.Add(new Question2 { Code = ID, Name = RuleName, CheckProject = CheckProject, Description = string.Format("导入行政区【{0}({1})】信息失败", xzc.XZCMC, xzc.XZCDM), Folder = "" }); } else { foreach (var table in ParameterManager2.Tables) { var checkLayerName = string.Format("{0}_{1}", table.Name, xzc.XZCDM);//JSYDGZQ_xxxxxxxxxxxx if (ArcExtensions2.Select(string.Format("{0}\\{1}", MdbFilePath, table.Name), string.Format("{0}\\{1}", MdbFilePath, checkLayerName), where) == false) { QuestionManager2.Add(new Question2 { Code = ID, Name = RuleName, CheckProject = CheckProject, Description = string.Format("提取图层【{0}】中行政区为【{1}】失败", table.Name, xzc.XZCDM) }); } else { var unionLayerName = string.Format("{0}_Union", checkLayerName); if (ArcExtensions2.Union(string.Format("{0}\\{1};{0}\\{2}", MdbFilePath, checkLayerName, extentLayerName), string.Format("{0}\\{1}", MdbFilePath, unionLayerName), ParameterManager2.Tolerance) == false) { QuestionManager2.Add(new Question2 { Code = ID, Name = RuleName, CheckProject = CheckProject, Description = string.Format("执行图层【{0}】与图层【{1}】之间的Union操作失败", checkLayerName, extentLayerName) }); } else { tools.Add(new ExtentTool { CheckLayerName = checkLayerName, ExtentLayerName = extentLayerName, Absolute = ParameterManager2.Absolute, Relative = ParameterManager2.Relative }); } } } } } foreach (var tool in tools) { if (tool.Check(workspace) == false) { QuestionManager2.Add(new Question2 { Code = ID, Name = RuleName, CheckProject = CheckProject, Description = string.Format("执行检查【{0}】失败", tool.Name) }); } if (tool.Messages.Count > 0) { QuestionManager2.AddRange(tool.Messages.Select(e => new Question2 { Code = ID, Name = RuleName, CheckProject = CheckProject, Description = e.Description }).ToList()); } } } else { QuestionManager2.Add(new Question2 { Code = ID, Name = RuleName, CheckProject = CheckProject, Description = string.Format("土地利用现状数据库文件未指定,不做行政区范围与面积核查") }); } #region 建设用地管制区面积 公顷 var tool2 = new JSYDGZQAreaTool { Relative = ParameterManager2.Relative, Absolute = ParameterManager2.Absolute }; if (tool2.Check(workspace) == false) { QuestionManager2.Add(new Question2 { Code = ID, Name = RuleName, CheckProject = CheckProject2.面积一致性, TableName = "JSYDGZQ", Description = "检查建设用地管制区面积公顷失败" }); } if (tool2.Messages.Count > 0) { QuestionManager2.AddRange(tool2.Messages.Select(e => new Question2 { Code = ID, Name = RuleName, CheckProject = CheckProject2.面积一致性, TableName = "JSYDGZQ", Description = e.Description, LocationClause = e.WhereClause }).ToList()); } #endregion }
public void Check() { Init(); if (System.IO.File.Exists(MdbFilePath) == false) { return; } var layers = new string[] { "JQDLTB", "GHYT", "TDGHDL", "JSYDGZQ" }; IWorkspace workspace = MdbFilePath.OpenAccessFileWorkSpace(); if (workspace == null) { QuestionManager2.Add(new Question2 { Code = ID, Name = RuleName, CheckProject = CheckProject, Folder = "", Description = string.Format("无法打开矢量数据的workspace,故无法质检") }); return; } var tools = new List <TopoTool>(); foreach (var layer in layers) { var path = string.Format("{0}\\{1}", MdbFilePath, layer); var in_features = string.Format("{0};{1}", path, path); var intersectName = string.Format("{0}_intersect", layer); var out_feature = string.Format("{0}\\{1}", MdbFilePath, intersectName); if (ArcExtensions2.Intersect(in_features, out_feature, ParameterManager2.Tolerance) == false) { QuestionManager2.Add(new Question2 { Code = ID, Name = RuleName, CheckProject = CheckProject, Description = string.Format("图层【{0}】执行Intersect失败", layer) }); } else { tools.Add(new TopoTool { LayerName = layer, Key = "BSM" }); } } foreach (var tool in tools) { if (tool.Check(workspace) == false) { QuestionManager2.Add(new Question2 { Code = ID, Name = RuleName, CheckProject = CheckProject, Description = string.Format("执行【{0}】失败", tool.Name) }); } if (tool.Messages.Count > 0) { QuestionManager2.AddRange(tool.Messages.Select(e => new Question2 { Code = ID, Name = RuleName, CheckProject = CheckProject, Description = e.Description, LocationClause = e.WhereClause }).ToList()); } } }
public void Check() { if (ExtractGHYT() == false) { return; } if (ArcExtensions2.ImportFeatureClass(string.Format("{0}\\{1}", ParameterManager2.MDBFilePath, "TDGHDL"), MdbFilePath, "TDGHDL", null) == false) { QuestionManager2.Add(new Question2 { Code = ID, Name = RuleName, CheckProject = CheckProject, Description = string.Format("导入土地规划地类图层失败") }); return; } if (ArcExtensions2.Select(string.Format("{0}\\{1}", MdbFilePath, "GHYT"), string.Format("{0}\\{1}", MdbFilePath, "GHYT_XG"), "GHYTDM LIKE 'G*' OR GHYTDM LIKE 'X*'") == false) { QuestionManager2.Add(new Question2 { Code = ID, Name = RuleName, CheckProject = CheckProject, Description = string.Format("提取规划用途层中现状和新增数据失败!") }); return; } var sql = "SELECT MID(GHYTDM,2) FROM GHYT_XG GROUP BY MID(GHYTDM,2)"; var list = Search(MdbFilePath, sql); if (list.Count == 0) { QuestionManager2.Add(new Question2 { Code = ID, Name = RuleName, CheckProject = CheckProject, Description = string.Format("执行SQL[{0}]获取结果为空", sql) }); return; } var workspace = MdbFilePath.OpenAccessFileWorkSpace(); if (workspace == null) { QuestionManager2.Add(new Question2 { Code = ID, Name = RuleName, CheckProject = CheckProject, Description = string.Format("打开ArcGIS 工作空间失败!") }); return; } var ghytFeatureClass = workspace.GetFeatureClass("GHYT_XG"); if (ghytFeatureClass == null) { QuestionManager2.Add(new Question2 { Code = ID, Name = RuleName, CheckProject = CheckProject, Description = string.Format("获取要素类【GHYT_XG】失败!") }); return; } var tdghdlFeatureClass = workspace.GetFeatureClass("TDGHDL"); if (tdghdlFeatureClass == null) { QuestionManager2.Add(new Question2 { Code = ID, Name = RuleName, CheckProject = CheckProject, Description = string.Format("获取要素类【TDGHDL】失败!") }); return; } var messages = new List <string>(); foreach (var item in list) { var ghytArea = Math.Round(ArcClass.GainArea(ghytFeatureClass, string.Format("GHYTDM = 'X{0}' OR GHYTDM = 'G{0}'", item)), 2); var tdghdlArea = Math.Round(ArcClass.GainArea(tdghdlFeatureClass, string.Format("GHDLDM = '{0}'", item)), 2); var abs = Math.Abs(ghytArea - tdghdlArea); var flag = false; if (ParameterManager2.Absolute.HasValue) { flag = abs < ParameterManager2.Absolute.Value; } if (ParameterManager2.Relative.HasValue) { var pp = abs / tdghdlArea; flag = pp < ParameterManager2.Relative.Value; } if (flag == false) { messages.Add(string.Format("规划用途中规划用途代码为【X{0}】+【G{0}】的面积和与土地规划地类层中地类面积和不相等", item)); } } QuestionManager2.AddRange(messages.Select(e => new Question2 { Code = ID, Name = RuleName, CheckProject = CheckProject, Description = e }).ToList()); }
public void Check() { Init2(); if (System.IO.File.Exists(MdbFilePath) == false) { return; } if (ArcExtensions2.ImportFeatureClass(string.Format("{0}\\{1}", ParameterManager2.MDBFilePath, "JQDLTB"), MdbFilePath, "JQDLTB", null) == false) { QuestionManager2.Add(new Question2 { Code = ID, Name = RuleName, CheckProject = CheckProject, Description = string.Format("导入JQDLTB图层失败") }); return; } if (System.IO.File.Exists(ParameterManager2.TDLYXZ) == true) { var in_feature = string.Format("{0}\\{1}", ParameterManager2.TDLYXZ, "XZQ"); var array = ParameterManager2.XZCList.Select(e => string.Format("[XZQDM] = '{0}'", e.XZCDM)).ToArray(); var where = string.Join(" OR ", array); if (ArcExtensions2.ImportFeatureClass(in_feature, MdbFilePath, "XZQ", where) == false)//首先导入行政区 { QuestionManager2.Add(new Question2 { Code = ID, Name = RuleName, CheckProject = CheckProject, Description = string.Format("导入行政区信息失败") }); } else { var dltb = string.Format("{0}\\{1}", ParameterManager2.TDLYXZ, "DLTB"); var clip_feature = string.Format("{0}\\{1}", MdbFilePath, "XZQ"); var out_feature = string.Format("{0}\\{1}", MdbFilePath, "DLTB"); if (ArcExtensions2.Clip(dltb, clip_feature, out_feature, ParameterManager2.Tolerance) == false) { QuestionManager2.Add(new Question2 { Code = ID, Name = RuleName, CheckProject = CheckProject, Description = string.Format("通过行政区提取DLTB层失败") }); } else { var workspace = MdbFilePath.OpenAccessFileWorkSpace(); if (workspace == null) { QuestionManager2.Add(new Question2 { Code = ID, Name = RuleName, CheckProject = CheckProject, Description = string.Format("无法打开ArcGIS 工作空间") }); return; } var tools = new List <AreaTool>(); tools.Add(new AreaTool { CheckFeatureClassName = "JQDLTB", CurrentFeatureClassName = "DLTB", Relative = ParameterManager2.Relative, Absolute = ParameterManager2.Absolute }); tools.Add(new AreaTool { CheckFeatureClassName = "JQDLTB", CheckWhereClause = "DLDM = '111' OR DLDM = '113'", CurrentFeatureClassName = "DLTB", CurrentWhereClause = "DLBM LIKE '01*'", Relative = ParameterManager2.Relative, Absolute = ParameterManager2.Absolute }); tools.Add(new AreaTool { CheckFeatureClassName = "JQDLTB", CheckWhereClause = "DLDM LIKE '21*'", CurrentFeatureClassName = "DLTB", CurrentWhereClause = "DLBM LIKE '05*' OR DLBM LIKE '06*' OR DLBM LIKE '07*' OR DLBM LIKE '08*' OR DLBM LIKE '09*' OR DLBM LIKE '10*' OR DLBM = '1109' OR DLBM DLBM = '1201'", Relative = ParameterManager2.Relative, Absolute = ParameterManager2.Absolute }); foreach (var tool in tools) { if (tool.Check(workspace) == false) { QuestionManager2.Add(new Question2 { Code = ID, Name = RuleName, CheckProject = CheckProject, Description = string.Format("执行检查【{0}】失败", tool.Name) }); } if (tool.Messages.Count > 0) { QuestionManager2.AddRange(tool.Messages.Select(e => new Question2 { Code = ID, Name = RuleName, CheckProject = CheckProject, Description = e.Description }).ToList()); } } } } } else { QuestionManager2.Add(new Question2 { Code = ID, Name = RuleName, CheckProject = CheckProject, Description = string.Format("土地利用现状数据库文件未指定,不做检查") }); } }