Esempio n. 1
0
        public void Check()
        {
            if (System.IO.File.Exists(ParameterManager2.XGH) == false)
            {
                return;
            }

            if (ExtractJSYDGZQ("GZQLXDM = '010'") == false)
            {
                return;
            }

            var temps = ParameterManager2.XZCList.Select(e => string.Format("XZQDM = '{0}'", e.XZCDM)).ToArray();

            var where = string.Join(" OR ", temps);
            if (ArcExtensions2.Select(string.Format("{0}\\{1}", ParameterManager2.XGH, "XZQ"), string.Format("{0}\\{1}", MdbFilePath, "XZQ"), where) == false)  //XZQ 村规划行政区范围
            {
                QuestionManager2.Add(new Question2
                {
                    Code         = ID,
                    Name         = RuleName,
                    CheckProject = CheckProject,
                    Description  = string.Format("提取行政区矢量数据失败!")
                });
                return;
            }



            if (ArcExtensions2.Select(string.Format("{0}\\{1}", ParameterManager2.XGH, "JSYDGZQ"), string.Format("{0}\\{1}", MdbFilePath, "JSYDGZQ_X"), "GZQLXDM = '010'") == false) //JSYDGZQ_X 乡规划中所有的允许建设区
            {
                QuestionManager2.Add(new Question2
                {
                    Code         = ID,
                    Name         = RuleName,
                    CheckProject = CheckProject,
                    Description  = string.Format("提取乡规划中有条件建设区数据失败")
                });
                return;
            }



            if (ArcExtensions2.Clip(string.Format("{0}\\{1}", MdbFilePath, "JSYDGZQ_X"), string.Format("{0}\\{1}", MdbFilePath, "XZQ"), string.Format("{0}\\{1}", MdbFilePath, "JSYDGZQ_X_XZQ"), ParameterManager2.Tolerance) == false)//JSYDGZQ_X_XZQ 本次核查村规划范围的允许建设区
            {
                QuestionManager2.Add(new Question2
                {
                    Code         = ID,
                    Name         = RuleName,
                    CheckProject = CheckProject,
                    Description  = string.Format("提取行政区范围内的乡规划中的有条件建设区数据失败")
                });
                return;
            }
        }
Esempio n. 2
0
        public void Check()
        {
            if (ExtractGHYT() == 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("导入基期地类图斑层失败!")
                });
                return;
            }

            if (ArcExtensions2.Select(string.Format("{0}\\{1}", MdbFilePath, "GHYT"), string.Format("{0}\\{1}_X", MdbFilePath, "GHYT"), "GHYTDM LIKE 'X*'") == 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_X", "JQDLTB"), string.Format("{0}\\{1}", MdbFilePath, "JQDLTB_X"), ParameterManager2.Tolerance) == false)
                {
                    QuestionManager2.Add(new Question2
                    {
                        Code         = ID,
                        Name         = RuleName,
                        CheckProject = CheckProject,
                        Description  = string.Format("规划用途层中现状用途层与基期地类图斑相交失败!")
                    });
                }
                else
                {
                    var sql = "SELECT COUNT(*) FROM JQDLTB_X WHERE MID(GHYTDM,2)!=DLDM";
                    var obj = SearchRecord(MdbFilePath, sql);
                    if (obj != null)
                    {
                        var count = 0;
                        if (int.TryParse(obj.ToString(), out count))
                        {
                            if (count > 0)
                            {
                                QuestionManager2.Add(new Question2
                                {
                                    Code         = ID,
                                    Name         = RuleName,
                                    CheckProject = CheckProject,
                                    Description  = string.Format("规划用途中现状用途的存在【{0}】个地块与基期地类图斑层地类不一致", count)
                                });
                            }
                        }
                        else
                        {
                            QuestionManager2.Add(new Question2
                            {
                                Code         = ID,
                                Name         = RuleName,
                                CheckProject = CheckProject,
                                Description  = string.Format("执行SQL【{0}】获取obj转换int失败", sql)
                            });
                        }
                    }
                }
            }


            if (ArcExtensions2.Select(string.Format("{0}\\{1}", MdbFilePath, "GHYT"), string.Format("{0}\\{1}_G", MdbFilePath, "GHYT"), "GHYTDM LIKE 'G*'") == 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_G", "JQDLTB"), string.Format("{0}\\{1}", MdbFilePath, "JQDLTB_G"), ParameterManager2.Tolerance) == false)
                {
                    QuestionManager2.Add(new Question2
                    {
                        Code         = ID,
                        Name         = RuleName,
                        CheckProject = CheckProject,
                        Description  = string.Format("规划用途层为新增用途层与基期地类图斑相交失败!")
                    });
                }
                else
                {
                    var sql = "SELECT COUNT(*) FROM JQDLTB_G WHERE MID(GHYTDM,2)=DLDM";
                    var obj = SearchRecord(MdbFilePath, sql);
                    if (obj != null)
                    {
                        var count = 0;
                        if (int.TryParse(obj.ToString(), out count))
                        {
                            if (count > 0)
                            {
                                QuestionManager2.Add(new Question2
                                {
                                    Code         = ID,
                                    Name         = RuleName,
                                    CheckProject = CheckProject,
                                    Description  = string.Format("规划用途中新增用途存在【{0}】个地块在空间位置上与基期图斑层地类一致", count)
                                });
                            }
                        }
                        else
                        {
                            QuestionManager2.Add(new Question2
                            {
                                Code         = ID,
                                Name         = RuleName,
                                CheckProject = CheckProject,
                                Description  = string.Format("执行SQL【{0}】获取obj转换int失败", sql)
                            });
                        }
                    }
                }
            }
        }
        public void Check()
        {
            if (System.IO.File.Exists(ParameterManager2.XGH) == false)
            {
                return;
            }
            if (ExtractGHYT("GHYTDM = 'G111'") == false)
            {
                return;
            }
            if (ArcExtensions2.ImportFeatureClass(string.Format("{0}\\{1}", ParameterManager2.XGH, "GHYT"), MdbFilePath, "GHYT_X", "GHYTDM = 'G111'") == false)
            {
                QuestionManager2.Add(new Question2
                {
                    Code         = ID,
                    Name         = RuleName,
                    CheckProject = CheckProject,
                    Description  = string.Format("导入乡规划中示范区基本农田数据失败")
                });
                return;
            }
            var sql  = "SELECT XZQDM FROM GHYT GROUP BY XZQDM";
            var list = Search(MdbFilePath, sql);

            var list2 = new List <string>();

            var questions = new List <Question2>();

            foreach (var xzqdm in list)
            {
                if (ArcExtensions2.Select(string.Format("{0}\\{1}", MdbFilePath, "GHYT"), string.Format("{0}\\{1}_{2}", MdbFilePath, "GHYT", xzqdm), string.Format("XZQDM = '{0}'", xzqdm)) == false)
                {
                    questions.Add(new Question2
                    {
                        Code         = ID,
                        Name         = RuleName,
                        CheckProject = CheckProject,
                        Description  = string.Format("提取行政区代码【{0}】的村规划中示范区永久基本农田数据失败", xzqdm)
                    });
                }
                else
                {
                    if (ArcExtensions2.Select(string.Format("{0}\\{1}", MdbFilePath, "GHYT_X"), string.Format("{0}\\{1}_{2}", MdbFilePath, "GHYT_X", xzqdm), string.Format("XZQDM = '{0}'", xzqdm)) == false)
                    {
                        questions.Add(new Question2
                        {
                            Code         = ID,
                            Name         = RuleName,
                            CheckProject = CheckProject,
                            Description  = string.Format("提取行政区代码【{0}】的乡规划中示范区永久基本农田数据失败", xzqdm)
                        });
                    }
                    else
                    {
                        list2.Add(xzqdm);
                        #region 核对范围
                        if (ArcExtensions2.Union(string.Format("{0}\\{1}_{2};{0}\\{1}_X_{2}", MdbFilePath, "GHYT", xzqdm), string.Format("{0}\\{1}_Union_{2}", MdbFilePath, "GHYT", xzqdm), ParameterManager2.Tolerance) == false)
                        {
                            questions.Add(new Question2
                            {
                                Code         = ID,
                                Name         = RuleName,
                                CheckProject = CheckProject,
                                Description  = string.Format("行政区代码【{0}】的村规划中示范区永久基本农田数据与乡规划中示范区永久基本农田数据Union失败", xzqdm)
                            });
                        }
                        else
                        {
                            var sql1 = string.Format("SELECT COUNT(*) FROM GHYT_Union_{0} WHERE FID_GHYT_{0} < 0 OR FID_GHYT_X_{0} < 0", xzqdm);
                            var obj  = SearchRecord(MdbFilePath, sql1);
                            if (obj != null)
                            {
                                var count = 0;
                                if (int.TryParse(obj.ToString(), out count))
                                {
                                    questions.Add(new Question2
                                    {
                                        Code         = ID,
                                        Name         = RuleName,
                                        CheckProject = CheckProject,
                                        Description  = string.Format("行政区代码【{0}】的村规划示范区永久基本农田范围与乡规划示范区永久基本农田范围不一致", xzqdm)
                                    });
                                }
                            }
                        }
                        #endregion
                    }
                }
            }

            var quests = CheckArea(list2, MdbFilePath, "6004", CheckProject2.村规划数据库与乡规划数据库示范区永久基本农田面积是否一致, ParameterManager2.Relative, ParameterManager2.Absolute);
            QuestionManager2.AddRange(quests);
        }
Esempio n. 4
0
        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
        }
Esempio n. 5
0
        public void Check()
        {
            if (System.IO.File.Exists(ParameterManager2.XGH) == false)
            {
                return;
            }
            if (ExtractJSYDGZQ("GZQLXDM = '040'") == false)//提取村规划中的禁止建设区
            {
                return;
            }

            var temps = ParameterManager2.XZCList.Select(e => string.Format("XZQDM = '{0}'", e.XZCDM)).ToArray();

            var where = string.Join(" OR ", temps);
            if (ArcExtensions2.Select(string.Format("{0}\\{1}", ParameterManager2.XGH, "XZQ"), string.Format("{0}\\{1}", MdbFilePath, "XZQ"), where) == false)
            {
                QuestionManager2.Add(new Question2
                {
                    Code         = ID,
                    Name         = RuleName,
                    CheckProject = CheckProject,
                    Description  = string.Format("提取行政区矢量数据失败!")
                });
                return;
            }
            if (ArcExtensions2.Select(string.Format("{0}\\{1}", ParameterManager2.XGH, "JSYDGZQ"), string.Format("{0}\\{1}", MdbFilePath, "JSYDGZQ_X"), "GZQLXDM = '040'") == false)
            {
                QuestionManager2.Add(new Question2
                {
                    Code         = ID,
                    Name         = RuleName,
                    CheckProject = CheckProject,
                    Description  = string.Format("提取乡规划中禁止建设区数据失败")
                });
                return;
            }



            if (ArcExtensions2.Clip(string.Format("{0}\\{1}", MdbFilePath, "JSYDGZQ_X"), string.Format("{0}\\{1}", MdbFilePath, "XZQ"), string.Format("{0}\\{1}", MdbFilePath, "JSYDGZQ_X_XZQ"), ParameterManager2.Tolerance) == false)
            {
                QuestionManager2.Add(new Question2
                {
                    Code         = ID,
                    Name         = RuleName,
                    CheckProject = CheckProject,
                    Description  = string.Format("提取行政区范围内的乡规划中的建设用地管制区数据失败")
                });
                return;
            }

            if (ArcExtensions2.Erase(string.Format("{0}\\{1}", MdbFilePath, "JSYDGZQ_X_XZQ"), string.Format("{0}\\{1}", MdbFilePath, "JSYDGZQ"), string.Format("{0}\\{1}", MdbFilePath, "JSYDGZQ_Erase"), ParameterManager2.Tolerance) == false)
            {
                QuestionManager2.Add(new Question2
                {
                    Code         = ID,
                    Name         = RuleName,
                    CheckProject = CheckProject,
                    Description  = string.Format("乡规划中禁止建设区数据Erase村规划中禁止建设区数据失败")
                });
            }
            else
            {
                var sql = "SELECT COUNT(*) FROM JSYDGZQ_Erase";
                var obj = SearchRecord(MdbFilePath, sql);
                if (obj != null)
                {
                    var count = 0;
                    if (int.TryParse(obj.ToString(), out count))
                    {
                        if (count > 0)
                        {
                            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;
            }
            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());
                }
            }
        }
Esempio n. 7
0
        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());
        }
Esempio n. 8
0
        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("土地利用现状数据库文件未指定,不做检查")
                });
            }
        }
        public void Check()
        {
            if (ExtractGHYT() == false)
            {
                return;
            }

            if (ArcExtensions2.ImportFeatureClass(string.Format("{0}\\{1}", ParameterManager2.MDBFilePath, "JSYDGZQ"), MdbFilePath, "JSYDGZQ", 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_G21"), "GHYTDM LIKE 'G21*'") == false)
            {
                QuestionManager2.Add(new Question2
                {
                    Code         = ID,
                    Name         = RuleName,
                    CheckProject = CheckProject,
                    Description  = string.Format("规划用途层中提取新增城乡建设用地数据失败!")
                });
            }
            else
            {
                if (ArcExtensions2.Select(string.Format("{0}\\{1}", MdbFilePath, "JSYDGZQ"), string.Format("{0}\\{1}", MdbFilePath, "JSYDGZQ_010"), "GZQLXDM = '010'") == false)
                {
                    QuestionManager2.Add(new Question2
                    {
                        Code         = ID,
                        Name         = RuleName,
                        CheckProject = CheckProject,
                        Description  = string.Format("提取建设用地管制区中允许建设区图层失败")
                    });
                }
                else
                {
                    if (ArcExtensions2.Erase(string.Format("{0}\\{1}", MdbFilePath, "GHYT_G21"), string.Format("{0}\\{1}", MdbFilePath, "JSYDGZQ_010"), string.Format("{0}\\{1}", MdbFilePath, "GHYT_G21_Erase"), ParameterManager2.Tolerance) == false)
                    {
                        QuestionManager2.Add(new Question2
                        {
                            Code         = ID,
                            Name         = RuleName,
                            CheckProject = CheckProject,
                            Description  = string.Format("新增城乡建设用地Erase允许建设区失败!")
                        });
                    }
                    else
                    {
                        var sql = "SELECT COUNT(*) FROM GHYT_G21_Erase";
                        var obj = SearchRecord(MdbFilePath, sql);
                        if (obj != null)
                        {
                            var count = 0;
                            if (int.TryParse(obj.ToString(), out count))
                            {
                                if (count > 0)
                                {
                                    QuestionManager2.Add(new Question2
                                    {
                                        Code         = ID,
                                        Name         = RuleName,
                                        CheckProject = CheckProject,
                                        Description  = string.Format("存在新增城乡建设用地不在允许建设区内")
                                    });
                                }
                            }
                            else
                            {
                                QuestionManager2.Add(new Question2
                                {
                                    Code         = ID,
                                    Name         = RuleName,
                                    CheckProject = CheckProject,
                                    Description  = string.Format("查询新增城乡建设用地是否与允许建设区内失败")
                                });
                            }
                        }
                    }
                }
            }

            if (ArcExtensions2.Select(string.Format("{0}\\{1}", MdbFilePath, "GHYT"), string.Format("{0}\\{1}", MdbFilePath, "GHYT_E"), "CJJX = 'E1' OR CJJX = 'E2'") == false)
            {
                QuestionManager2.Add(new Question2
                {
                    Code         = ID,
                    Name         = RuleName,
                    CheckProject = CheckProject,
                    Description  = string.Format("提取规划用图层中拟新增E2、虚拟新增E1数据失败")
                });
            }
            else
            {
                if (ArcExtensions2.Select(string.Format("{0}\\{1}", MdbFilePath, "GHYT"), string.Format("{0}\\{1}", MdbFilePath, "JSYDGZQ_021"), "GZQLXDM = '021' OR GZQLXDM = '020'") == false)
                {
                    QuestionManager2.Add(new Question2
                    {
                        Code         = ID,
                        Name         = RuleName,
                        CheckProject = CheckProject,
                        Description  = string.Format("提取建设用地管制区中有条件建设区失败")
                    });
                }
                else
                {
                    if (ArcExtensions2.Erase(string.Format("{0}\\{1}", MdbFilePath, "GHYT_E"), string.Format("{0}\\{1}", MdbFilePath, "JSYDGZQ_021"), string.Format("{0}\\{1}", MdbFilePath, "GHYT_E_Erase"), ParameterManager2.Tolerance) == false)
                    {
                        QuestionManager2.Add(new Question2
                        {
                            Code         = ID,
                            Name         = RuleName,
                            CheckProject = CheckProject,
                            Description  = string.Format("拟新增、虚拟新增Erase有条件建设区失败")
                        });
                    }
                    else
                    {
                        var sql = "SELECT COUNT(*) FROM GHYT_E_Erase";
                        var obj = SearchRecord(MdbFilePath, sql);
                        if (obj != null)
                        {
                            var count = 0;
                            if (int.TryParse(obj.ToString(), out count))
                            {
                                if (count > 0)
                                {
                                    QuestionManager2.Add(new Question2
                                    {
                                        Code         = ID,
                                        Name         = RuleName,
                                        CheckProject = CheckProject,
                                        Description  = string.Format("存在拟新增E2、虚拟新增E1不在有条件建设区")
                                    });
                                }
                            }
                        }
                    }
                }
            }


            if (ArcExtensions2.Select(string.Format("{0}\\{1}", MdbFilePath, "GHYT"), string.Format("{0}\\{1}", MdbFilePath, "GHYT_G111"), "GHYTDM = 'G111'") == false)
            {
                QuestionManager2.Add(new Question2
                {
                    Code         = ID,
                    Name         = RuleName,
                    CheckProject = CheckProject,
                    Description  = string.Format("提取规划用途层中示范区基本农田数据失败")
                });
            }
            else
            {
                if (ArcExtensions2.Select(string.Format("{0}\\{1}", MdbFilePath, "JSYDGZQ"), string.Format("{0}\\{1}", MdbFilePath, "JSYDGZQ_040"), "GZQLXDM = '040'") == false)
                {
                    QuestionManager2.Add(new Question2
                    {
                        Code         = ID,
                        Name         = RuleName,
                        CheckProject = CheckProject,
                        Description  = string.Format("提取禁止建设区数据失败")
                    });
                }
                else
                {
                    if (ArcExtensions2.Erase(string.Format("{0}\\{1}", MdbFilePath, "GHYT_G111"), string.Format("{0}\\{1}", MdbFilePath, "JSYDGZQ_040"), string.Format("{0}\\{1}", MdbFilePath, "GHYT_G111_Erase"), ParameterManager2.Tolerance) == false)
                    {
                        QuestionManager2.Add(new Question2
                        {
                            Code         = ID,
                            Name         = RuleName,
                            CheckProject = CheckProject,
                            Description  = string.Format("示范区基本农田Erase禁止建设区失败")
                        });
                    }
                    else
                    {
                        var sql = "SELECT COUNT(*) FROM GHYT_G111_Erase";
                        var obj = SearchRecord(MdbFilePath, sql);
                        if (obj != null)
                        {
                            var count = 0;
                            if (int.TryParse(obj.ToString(), out count))
                            {
                                if (count > 0)
                                {
                                    QuestionManager2.Add(new Question2
                                    {
                                        Code         = ID,
                                        Name         = RuleName,
                                        CheckProject = CheckProject,
                                        Description  = string.Format("存在示范区基本农田部不在禁止建设区")
                                    });
                                }
                            }
                        }
                    }
                }
            }
        }
Esempio n. 10
0
        public void Check()
        {
            if (System.IO.File.Exists(ParameterManager2.TDLYXZ) == false)
            {
                return;
            }
            if (ExtractJQDLTB("ZHLX IS NULL") == false)//JQDLTB  基数转换类型为空的基期地类图斑
            {
                return;
            }
            if (ArcExtensions2.ImportFeatureClass(string.Format("{0}\\{1}", ParameterManager2.TDLYXZ, "DLTB"), MdbFilePath, "DLTB_A", null) == false)//DLTB_A  变更调查数据
            {
                QuestionManager2.Add(new Question2
                {
                    Code         = ID,
                    Name         = RuleName,
                    CheckProject = CheckProject,
                    Description  = string.Format("导入土地利用现状数据库中的DLTB层失败")
                });
                return;
            }



            if (ArcExtensions2.Intersect(string.Format("{0}\\{1};{0}\\{2}", MdbFilePath, "JQDLTB", "DLTB_A"), string.Format("{0}\\{1}", MdbFilePath, "JQDLTB_Intersect"), ParameterManager2.Tolerance) == false)//基期地类图斑与变更调查数据Intersect
            {
                QuestionManager2.Add(new Question2
                {
                    Code         = ID,
                    Name         = RuleName,
                    CheckProject = CheckProject,
                    Description  = string.Format("JQDLTB与DLTB层Intersect")
                });
                return;
            }


            using (var connection = new OleDbConnection(string.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0}", MdbFilePath)))
            {
                connection.Open();

                using (var command = connection.CreateCommand())
                {
                    command.CommandText = "SELECT DLDM,DLBM FROM JQDLTB_Intersect";
                    var reader = command.ExecuteReader();
                    while (reader.Read())
                    {
                        var dldm = reader[0].ToString();
                        var dlbm = reader[1].ToString();
                        if (ParameterManager2.DLDY.ContainsKey(dldm))
                        {
                            var ranges = ParameterManager2.DLDY[dldm];
                            if (ranges.Contains(dlbm) == false)
                            {
                            }
                        }
                    }
                }

                connection.Close();
            }
        }