コード例 #1
0
        protected object SearchRecord(string mdbfile, string sql)
        {
            object obj = null;

            using (var connection = new OleDbConnection(string.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0}", mdbfile)))
            {
                connection.Open();
                using (var command = connection.CreateCommand())
                {
                    command.CommandText = sql;
                    obj = command.ExecuteScalar();
                }
                connection.Close();
            }
            if (obj == null)
            {
                QuestionManager2.Add(new Question2
                {
                    Code         = ID,
                    Name         = RuleName,
                    CheckProject = CheckProject,
                    Description  = string.Format("核查【{0}】转换之前的地类的时候,执行SQL【{1}】结果为NULL", CheckProject.GetDescription(), sql)
                });
            }
            return(obj);
        }
コード例 #2
0
        public void Check()
        {
            #region 检查质检目录下的所有文件夹是否存在
            var resultComplete = new ResultComplete(ParameterManager2.Folder)
            {
                Children = ParameterManager2.Folders
            };
            resultComplete.Check();

            QuestionManager2.AddRange(resultComplete.Messages.Select(e =>
                                                                     new Question2
            {
                Code         = "110101",
                Name         = RuleName,
                CheckProject = CheckProject2.目录及文件规范性,
                Description  = e,
                Folder       = ParameterManager2.Folder
            }).ToList());
            #endregion

            var tool = new FileStandard {
                Files = ParameterManager2.Files
            };
            tool.Check2();
            QuestionManager2.AddRange(tool.List.Select(e => new Question2
            {
                Code         = "110102",
                Name         = RuleName,
                CheckProject = CheckProject2.目录及文件规范性,
                Description  = e,
                Folder       = ParameterManager2.Folder
            }
                                                       ).ToList());
        }
コード例 #3
0
        public virtual void Check()
        {
            foreach (var tool in Tools)
            {
                if (tool.Check(ParameterManager2.Connection) == false)
                {
                    QuestionManager2.Add(new Question2
                    {
                        Code         = ID,
                        Name         = RuleName,
                        TableName    = tool.TableName,
                        CheckProject = CheckProject,
                        Description  = string.Format("执行质检规则【{0}】失败", tool.Name)
                    });
                }

                if (tool.Messages2.Count > 0)
                {
                    QuestionManager2.AddRange(tool.Messages2.Select(e => new Question2
                    {
                        Code           = ID,
                        Name           = RuleName,
                        TableName      = tool.TableName,
                        CheckProject   = CheckProject,
                        Description    = e.Description,
                        LocationClause = e.WhereClause
                    }).ToList());
                }
            }
        }
コード例 #4
0
 private bool OutputMessage(string code, string message, ProgressResultTypeEnum result)
 {
     QuestionManager2.Add(new Question2 {
         Code = code, Description = message
     });
     return(OutputMessage(new ProgressEventArgs {
         Code = code, Message = message, Result = result
     }));
 }
コード例 #5
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;
            }
        }
コード例 #6
0
        public virtual void Check()
        {
            Config();
            if (ExcelInfo == null || ExcelInfo.Fields == null || ExcelInfo.Fields.Count == 0)
            {
                QuestionManager2.Add(new Question2
                {
                    Code         = ID,
                    Name         = RuleName,
                    CheckProject = CheckProject,
                    Description  = string.Format("未读取到配置文件中相关【{0}】信息", ExcelName)
                });
                return;
            }
            var excelfile = System.IO.Path.Combine(ParameterManager2.Folder, "2.规划表格数据", string.Format("表{0}.{1}.xlsx", ExcelInfo.Name, ExcelInfo.Title));

            if (System.IO.File.Exists(excelfile) == false)
            {
                QuestionManager2.Add(new Question2
                {
                    Code         = ID,
                    Name         = RuleName,
                    CheckProject = CheckProject,
                    Description  = string.Format("未找到文件【表{0}.{1}.xlsx】", ExcelInfo.Name, ExcelInfo.Title)
                });
                return;
            }
            IWorkbook workbook = excelfile.OpenExcel();

            if (workbook == null)
            {
                QuestionManager2.Add(new Question2
                {
                    Code         = ID,
                    Name         = RuleName,
                    CheckProject = CheckProject,
                    Description  = string.Format("打开Excel【表{0}.{1}.xlsx】workbook失败", ExcelInfo.Name, ExcelInfo.Title)
                });
                return;
            }
            var sheet = workbook.GetSheetAt(0);

            if (sheet == null)
            {
                QuestionManager2.Add(new Question2
                {
                    Code         = ID,
                    Name         = RuleName,
                    CheckProject = CheckProject,
                    Description  = string.Format("获取Excel【表{0}.{1}.xlsx】中的Sheet为空", ExcelInfo.Name, ExcelInfo.Title)
                });
                return;
            }
        }
コード例 #7
0
        protected bool ExtractJQDLTB(string where)
        {
            Init2();
            if (System.IO.File.Exists(MdbFilePath) == false)
            {
                return(false);
            }
            if (ArcExtensions2.ImportFeatureClass(string.Format("{0}\\{1}", ParameterManager2.MDBFilePath, "JQDLTB"), MdbFilePath, "JQDLTB", where) == false)
            {
                QuestionManager2.Add(new Question2
                {
                    Code         = ID,
                    Name         = RuleName,
                    CheckProject = CheckProject,
                    Description  = string.Format("导入【{0}】的基期地类图斑层失败", where)
                });
                return(false);
            }
            if (System.IO.File.Exists(ParameterManager2.TDLYXZ) == false)
            {
                QuestionManager2.Add(new Question2
                {
                    Code         = ID,
                    Name         = RuleName,
                    CheckProject = CheckProject,
                    Description  = string.Format("土地利用现状数据库未指定,无法核对转化前地类信息")
                });
                return(false);
            }
            var dltb         = string.Format("{0}\\{1}", ParameterManager2.TDLYXZ, "DLTB");
            var clip_feature = string.Format("{0}\\{1}", MdbFilePath, "JQDLTB");
            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("提取基期地类图斑层中【{0}】对应基数转换前的DLTB层失败", where)
                });
                return(false);
            }



            return(true);
        }
コード例 #8
0
        public override void Check()
        {
            var tools = new List <IVTool>()
            {
                new ValueNullTool2 {
                    TableName = "JQDLTB", Key = "BSM", Is_Nullable = true, CheckFields = new string[] { "PZWH" }, WhereClause = "ZHLX = 'C'"
                },
                new ValueRangeTool2 {
                    TableName = "JQDLTB", Key = "BSM", CheckFieldName = "DLDM", Values = new string[] { "2121", "2122", "2123", "2125", "2126", "2124", "221", "226", "213", "231", "232", "211" }, WhereClause = "ZHLX = 'C'"
                }
            };

            Tools.AddRange(tools);
            base.Check();

            if (ExtractJQDLTB("ZHLX = 'C'") == true)
            {
                var sql = "SELECT COUNT(*) FROM DLTB WHERE DLBM LIKE '20*' OR (DLBM LIKE '10*' AND DLBM != '104') OR DLBM = '113'";
                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("C类基数转换前的DLTB中存在【{0}】条记录为建设用地", count)
                            });
                        }
                    }
                    else
                    {
                        QuestionManager2.Add(new Question2
                        {
                            Code         = ID,
                            Name         = RuleName,
                            CheckProject = CheckProject,
                            Description  = string.Format("核查C类基数转换前是否为非建设用地的时候,执行SQL语句失败,SQL【{0}】", sql)
                        });
                    }
                }
            }
        }
コード例 #9
0
        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("拆旧区面积不符合大于等于村规划拟新建区面积")
                });
            }
        }
コード例 #10
0
        public override void Check()
        {
            Tools.Add(new ValueNullTool2 {
                TableName = "JQDLTB", Key = "BSM", Is_Nullable = false, CheckFields = new string[] { "PZWH" }, WhereClause = "ZHLX = 'B'"
            });
            Tools.Add(new ValueRangeTool2 {
                TableName = "JQDLTB", Key = "BSM", CheckFieldName = "DLDM", Values = new string[] { "111", "113" }, WhereClause = "ZHLX = 'B'"
            });
            base.Check();



            if (ExtractJQDLTB("ZHLX = 'B'") == true)
            {
                var sql = "SELECT COUNT(*) FROM DLTB WHERE DLBM = '011' OR DLBM = '013'";
                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("B类基数转换前的DLTB中存在【{0}】条记录为耕地", count)
                            });
                        }
                    }
                    else
                    {
                        QuestionManager2.Add(new Question2
                        {
                            Code         = ID,
                            Name         = RuleName,
                            CheckProject = CheckProject,
                            TableName    = "JQDLTB",
                            Description  = string.Format("核查B类基数转换前是否为非耕地的时候,执行SQL语句失败,SQL【{0}】", sql)
                        });
                    }
                }
            }
        }
コード例 #11
0
        public override void Check()
        {
            #region (1)基数转换前可调整地类是否归入
            #endregion

            //(2)A类转换后规划地类应为水田、旱地


            var tool = new ValueRangeTool2 {
                TableName = "JQDLTB", Key = "BSM", CheckFieldName = "DLDM", WhereClause = "ZHLX = 'A'", Values = new string[] { "111", "113" }, RelationName = "JQDLTB", ID = ""
            };
            Tools.Add(tool);
            base.Check();

            if (ExtractJQDLTB("ZHLX = 'A'") == true)
            {
                var obj = SearchRecord(MdbFilePath, "SELECT COUNT(*) FROM DLTB WHERE DLBM = '011' OR DLBM = '013'");
                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("A类基数转换前的DLTB层存在【{0}】条记录为水田或旱地", count)
                            });
                        }
                    }
                    else
                    {
                        QuestionManager2.Add(new Question2
                        {
                            Code         = ID,
                            Name         = RuleName,
                            CheckProject = CheckProject,
                            Description  = string.Format("核查A类基数转换前是否为非耕地的时候,执行SQL语句失败,obj【{0}】", obj.ToString())
                        });
                    }
                }
            }
        }
コード例 #12
0
        public void Program()
        {
            QuestionManager2.Questions.Clear();
            if (Init() == false)
            {
                OutputMessage("00", "初始化失败,即将退出质检", ProgressResultTypeEnum.Fail);
                return;
            }

            foreach (var id in IDs)
            {
                var rule = _rules.FirstOrDefault(e => e.ID == id.ToString());
                if (rule != null)
                {
                    var sb     = new StringBuilder(rule.RuleName);
                    var result = ProgressResultTypeEnum.Pass;
                    try
                    {
                        rule.Check();
                    }catch (AggregateException ae)
                    {
                        foreach (var exp in ae.InnerExceptions)
                        {
                            sb.Append(exp.Message + "\r\n");
                        }
                        result = ProgressResultTypeEnum.Fail;
                    }catch (Exception ex)
                    {
                        sb.Append(ex.ToString());
                        result = ProgressResultTypeEnum.Fail;
                    }
                    if (result != ProgressResultTypeEnum.Pass)
                    {
                        QuestionManager2.Add(new Question2 {
                            Code = rule.ID, Name = rule.RuleName, Description = sb.ToString()
                        });
                    }

                    if (OutputMessage(rule.ID, sb.ToString(), result) == true)
                    {
                        break;
                    }
                }
            }
        }
コード例 #13
0
        protected void Init2()
        {
            var goalFilePath = CreateNewAccess();

            if (System.IO.File.Exists(goalFilePath) == false)
            {
                QuestionManager2.Add(new Models.Question2
                {
                    Code         = ID,
                    Name         = RuleName,
                    Description  = "创建MDB文件失败,文件不存在",
                    CheckProject = CheckProject
                });
            }
            else
            {
                MdbFilePath = goalFilePath;
            }
        }
コード例 #14
0
        protected void Init()
        {
            var goalFilePath = CopyFile(ParameterManager2.MDBFilePath);

            if (System.IO.File.Exists(goalFilePath) == false)
            {
                QuestionManager2.Add(new Models.Question2
                {
                    Code         = ID,
                    Name         = RuleName,
                    Description  = "复制MDB文件失败,文件不存在",
                    CheckProject = CheckProject
                });
            }
            else
            {
                MdbFilePath = goalFilePath;
            }
        }
コード例 #15
0
        public void Check()
        {
            var existTables   = MdbClass.GetTables(ParameterManager2.Connection);
            var requireTables = ParameterManager2.Tables.Select(e => e.Name).ToList();
            var messages      = new List <string>();

            foreach (var table in requireTables)
            {
                if (existTables.Contains(table) == false)
                {
                    messages.Add(table);
                }
            }
            if (messages.Count > 0)
            {
                QuestionManager2.Add(new Question2 {
                    Code = ID, Name = RuleName, CheckProject = CheckProject2.图层完整性, Description = string.Format("缺少表:{0}", string.Join("、", messages.ToArray()))
                });
            }
        }
コード例 #16
0
 protected bool ExtractJSYDGZQ(string where = null)
 {
     Init2();
     if (System.IO.File.Exists(MdbFilePath) == false)
     {
         return(false);
     }
     if (ArcExtensions2.ImportFeatureClass(string.Format("{0}\\{1}", ParameterManager2.MDBFilePath, "JSYDGZQ"), MdbFilePath, "JSYDGZQ", where) == false)
     {
         QuestionManager2.Add(new Question2
         {
             Code         = ID,
             Name         = RuleName,
             CheckProject = CheckProject,
             Description  = string.Format("导入建设用地管制区图层失败")
         });
         return(false);
     }
     return(true);
 }
コード例 #17
0
 public override void Check()
 {
     Tools.Add(new ValueRangeTool2 {
         TableName = "JQDLTB", Key = "BSM", CheckFieldName = "DLDM", Values = new string[] { "211" }, WhereClause = "ZHLX = 'F'"
     });
     base.Check();
     if (ExtractJQDLTB("ZHLX = 'F'") == true)
     {
         var sql = "SELECT COUNT(*) FROM DLTB WHERE DLBM LIKE '01*' OR DLBM LIKE '02*' OR DLBM LIKE '03*' OR DLBM LIKE '04*' OR DLBM = '104' OR (DLBM LIKE '11*' AND DLBM != '113' AND DLBM != '118') OR DLBM LIKE '12*'";
         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("F类基数转换前的DLTB中存在【{0}】条记录为非建设用地", count)
                     });
                 }
             }
             else
             {
                 QuestionManager2.Add(new Question2
                 {
                     Code         = ID,
                     Name         = RuleName,
                     CheckProject = CheckProject,
                     Description  = string.Format("核查F类基数转换钱是否为及为建设用地的时候,执行SQL【{0}】失败", sql)
                 });
             }
         }
     }
 }
コード例 #18
0
 public override void Check()
 {
     Tools.Add(new ValueRangeTool2 {
         TableName = "JQDLTB", Key = "BSM", CheckFieldName = "DLDM", WhereClause = "ZHLX = 'E'", Values = new string[] { "232" }, RelationName = "JQDLTB", ID = ""
     });
     if (ExtractJQDLTB("ZHLX = 'E'") == true)
     {
         var sql = "SELECT COUNT(*) FROM DLTB WHERE DLBM != '205'";
         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("E类转换前地类存在【{0}】条记录为非风景名称及特殊用地", count)
                     });
                 }
             }
             else
             {
                 QuestionManager2.Add(new Question2
                 {
                     Code         = ID,
                     Name         = RuleName,
                     CheckProject = CheckProject,
                     Description  = string.Format("核查E类基数转换前是否为风景名胜及特殊用地的时候,执行SQL语句失败,SQL【{0}】", sql)
                 });
             }
         }
     }
 }
コード例 #19
0
        public void Check()
        {
            if (ParameterManager2.Connection == null)
            {
                QuestionManager2.Add(new Question2
                {
                    Code         = ID,
                    Name         = RuleName,
                    CheckProject = CheckProject2.结构符合性,
                    Description  = string.Format("无法获取数据库连接字符串信息,无法进行检查"),
                    Folder       = ""
                });
                return;
            }

            foreach (var table in ParameterManager2.Tables)
            {
                var tool = new FieldStructureTool2 {
                    CheckTable = table
                };
                tool.Check(ParameterManager2.Connection);
                var mes = tool.Message;
                if (string.IsNullOrEmpty(mes) == false)
                {
                    QuestionManager2.Add(new Question2
                    {
                        Code         = ID,
                        Name         = RuleName,
                        Description  = mes,
                        CheckProject = CheckProject2.结构符合性,
                        TableName    = table.Name,
                        Folder       = ""
                    });
                }
            }
        }
コード例 #20
0
        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       = ""
                });
            }
        }
コード例 #21
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("村规划禁止建设区范围小于乡规划禁止建设区范围")
                            });
                        }
                    }
                }
            }
        }
コード例 #22
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("土地利用现状数据库文件未指定,不做检查")
                });
            }
        }
コード例 #23
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());
        }
コード例 #24
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)
                            });
                        }
                    }
                }
            }
        }
コード例 #25
0
        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());
                }
            }
        }
コード例 #26
0
        /// <summary>
        /// 核对面积
        /// </summary>
        /// <param name="list"></param>
        /// <param name="mdbfile"></param>
        /// <param name="id"></param>
        /// <param name="checkProject"></param>
        /// <param name="relative"></param>
        /// <param name="absolute"></param>
        private void CheckArea(List <string> list, string mdbfile, string id, CheckProject2 checkProject, double?relative, double?absolute)
        {
            IWorkspace workspace = mdbfile.OpenAccessFileWorkSpace();

            if (workspace == null)
            {
                QuestionManager2.Add(new Question2
                {
                    Code         = id,
                    Name         = RuleName,
                    CheckProject = checkProject,
                    Description  = string.Format("无法打开ArcGIS 工作空间")
                });
                return;
            }

            var questions = new List <Question2>();

            foreach (var xzqdm in list)
            {
                var cghyt = workspace.GetFeatureClass(string.Format("GHYT_{0}", xzqdm));
                if (cghyt == null)
                {
                    questions.Add(new Question2
                    {
                        Code         = id,
                        Name         = RuleName,
                        CheckProject = checkProject,
                        Description  = string.Format("无法获取行政区代码【{0}】的村规划中永久基本农田的要素类", xzqdm)
                    });
                    continue;
                }
                var xghyt = workspace.GetFeatureClass(string.Format("GHYT_X_{0}", xzqdm));


                if (xghyt == null)
                {
                    questions.Add(new Question2
                    {
                        Code         = id,
                        Name         = RuleName,
                        CheckProject = checkProject,
                        Description  = string.Format("无法获取行政区代码【{0}】的乡规划中永久基本农田的要素类", xzqdm)
                    });
                    continue;
                }

                var cArea = Math.Round(ArcClass.GainArea(cghyt), 0);
                var xArea = Math.Round(ArcClass.GainArea(xghyt), 0);
                var abs   = Math.Abs(cArea - xArea);
                var flag  = false;
                if (absolute.HasValue)
                {
                    flag = abs < absolute.Value;
                }
                if (relative.HasValue)
                {
                    var pp = abs / xArea;
                    flag = pp < relative.Value;
                }

                if (flag == false)
                {
                    questions.Add(new Question2
                    {
                        Code         = id,
                        Name         = RuleName,
                        CheckProject = checkProject,
                        Description  = string.Format("行政区代码【{0}】的村规划永久基本农田面积与乡规划永久基本农田面积不一致", xzqdm)
                    });
                }
            }
            QuestionManager2.AddRange(questions);
        }
コード例 #27
0
        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);
        }
コード例 #28
0
        private void CheckJMJ()
        {
            var questions = new List <Question2>();

            using (var connection = new OleDbConnection(string.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0}", MdbFilePath)))
            {
                connection.Open();
                var list = new List <GHYTJMJ>();
                using (var command = connection.CreateCommand())
                {
                    command.CommandText = "SELECT BSM,MJ,JMJ FROM GHYT_JBNT";
                    var reader = command.ExecuteReader();
                    while (reader.Read())
                    {
                        list.Add(new GHYTJMJ
                        {
                            BSM = reader[0].ToString(),
                            MJ  = Math.Round(double.Parse(reader[1].ToString()), 0),
                            JMJ = Math.Round(double.Parse(reader[2].ToString()), 0)
                        });
                    }
                }
                using (var command = connection.CreateCommand())
                {
                    foreach (var item in list)
                    {
                        var tt = new List <TKXSEntry>();
                        command.CommandText = "SELECT TKXS,Shape_Area FROM GHYT_JBNT_Intersect";
                        var reader = command.ExecuteReader();
                        while (reader.Read())
                        {
                            tt.Add(new TKXSEntry
                            {
                                TKXS = Math.Round(double.Parse(reader[0].ToString()), 4),
                                Area = double.Parse(reader[1].ToString())
                            });
                        }
                        item.TKXSList = tt;

                        var sum  = tt.Sum(e => e.Area);
                        var tkxs = .0;
                        foreach (var t in tt)
                        {
                            tkxs += t.Area / sum * t.TKXS;
                        }
                        tkxs = Math.Round(tkxs, 4);
                        var jmj  = item.MJ * (1 - tkxs);
                        var abs  = Math.Abs(jmj - item.JMJ);
                        var flag = false;
                        if (ParameterManager2.Absolute.HasValue)
                        {
                            flag = abs < ParameterManager2.Absolute.Value;
                        }
                        if (ParameterManager2.Relative.HasValue)
                        {
                            var pp = abs / jmj;
                            flag = pp < ParameterManager2.Relative.Value;
                        }
                        if (flag == false)
                        {
                            questions.Add(new Question2
                            {
                                Code           = ID,
                                Name           = RuleName,
                                CheckProject   = CheckProject,
                                Description    = string.Format("[BSM = '{0}'] 对应的净面积填写误差不符合容差", item.BSM),
                                LocationClause = string.Format("[BSM] = '{0}'", item.BSM)
                            });
                        }
                    }
                }
                connection.Close();
            }
            QuestionManager2.AddRange(questions);
        }
コード例 #29
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
        }
コード例 #30
0
        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());
                }
            }
        }