public void Program()
        {
            _workspace = MDBFilePath.OpenAccessFileWorkSpace();
            if (_workspace == null)
            {
                _messages.Add("获取Access的workspace失败");
                return;
            }
            var str = string.Empty;

            foreach (var className in FeatureClassNames)
            {
                var featureClass = _workspace.GetFeatureClass(className);
                if (featureClass == null)
                {
                    str = string.Format("未获取图层:{0},无法进行图层相关检查", className);
                    _messages.Add(str);
                    _questions.Add(new Question()
                    {
                        Code = "2101", Name = "图层完整性", Project = CheckProject.图层完整性, TableName = className, Description = str
                    });
                    continue;
                }
                var spatialReference = SpatialReferenceManager.GetSpatialReference(featureClass);//检查图层坐标系
                if (spatialReference.Name.Trim() != CurrentSpatialReference.Name.Trim())
                {
                    str = string.Format("图层:{0}不符合2201(平面坐标系是否采用‘1980 西安坐标系’、3度带、带带号,检查高程系统是否采用‘1985 国家高程基准’,检查投影方式是否采用高斯-克吕格投影)", className);
                    _messages.Add(str);
                    _questions.Add(new Question {
                        Code = "2201", Name = "数学基础", Project = CheckProject.数学基础, TableName = className, Description = str
                    });
                }

                if (className == TABLENAME)//检查DCDYTB中是否存在相交
                {
                    var featurePath    = string.Format("{0}/{1}", _mdbFilePath, className);
                    var outFeatureName = string.Format("{0}_intersect", className);
                    var intersectPath  = string.Format("{0}/{1}", _mdbFilePath, outFeatureName);
                    if (Cross(string.Format("{0};{1}", featurePath, featurePath), intersectPath))
                    {
                        var intersectfeatureClass = _workspace.GetFeatureClass(outFeatureName);
                        if (intersectfeatureClass == null)
                        {
                            _messages.Add(string.Format("无法获取要素类:【{0}】,故无法验证图斑是否相交"));
                        }
                        else
                        {
                            Run(intersectfeatureClass, TABLENAME, "XZCMC", "TBBH");
                            DeleteFeatureClass(intersectPath);
                        }
                    }
                    else
                    {
                        _messages.Add(string.Format("验证表【{0}】中是否存在图斑相交,执行intersect发生错误"));
                    }
                }
            }

            QuestionManager.AddRange(_questions);
        }
Exemple #2
0
        public static void CheckCoordinate(string className, string ruleName)
        {
            var info         = string.Empty;
            var featureClass = ParameterManager.Workspace.GetFeatureClass(className);

            if (featureClass != null)//本工具只对存在的要素类进行坐标系核对,不存在不做坐标系核对操作
            {
                var spatialReference = SpatialReferenceManager.GetSpatialReference(featureClass);
                if (spatialReference.Name.Trim() != ParameterManager.CurrentSpatialReference.Name.Trim())
                {
                    info = string.Format("图层:{0}不符合2201(平面坐标系是否采用‘1980 西安坐标系’、3度带、带带号,检查高程系统是否采用‘1985 国家高程基准’,检查投影方式是否采用高斯-克吕格投影)", className);
                    QuestionManager.Add(new Question {
                        Code = "2201", Name = ruleName, Project = CheckProject.数学基础, TableName = className, Description = info
                    });
                }
            }
        }
Exemple #3
0
        public static List <string> CheckCoordinate2(IWorkspace workspace, List <string> tables)
        {
            var list = new List <string>();

            foreach (var table in tables)
            {
                var featureClass = workspace.GetFeatureClass(table);
                if (featureClass != null)
                {
                    var spatialReference = SpatialReferenceManager.GetSpatialReference(featureClass);
                    if (spatialReference.Name.Trim() != ParameterManager2.SpatialReference.Name.Trim())
                    {
                        list.Add(table);
                    }
                }
            }

            return(list);
        }