Example #1
0
        public override IWorkspace Open(LocalConn conn)
        {
            IWorkspace workspace = null;

            switch (conn.Type)
            {
            case Base.Common.EnumDataSourceType.SHAPEFILE:
                workspace = WorkspaceUtil.OpenShapeFileWorkspace(conn.Path);
                break;

            case Base.Common.EnumDataSourceType.COVERAGE:
                workspace = WorkspaceUtil.OpenCoverageWorkspace(conn.Path);
                break;

            case Base.Common.EnumDataSourceType.PERSONAL_GEODATABASE:
                workspace = WorkspaceUtil.OpenMdbWorspace(conn.Path);
                break;

            case Base.Common.EnumDataSourceType.FILE_GEODATABASE:
                workspace = WorkspaceUtil.OpenFileGdbWorkspace(conn.Path);
                break;

            case Base.Common.EnumDataSourceType.TIN:
                workspace = WorkspaceUtil.OpenTinWorkspace(conn.Path);
                break;

            case Base.Common.EnumDataSourceType.CAD:
                workspace = WorkspaceUtil.OpenCadWorkspace(conn.Path);
                break;

            default:
                throw new Exception($"不支持当前本地文件格式[{conn.Path}]");
            }
            return(workspace);
        }
Example #2
0
        public override Result Execute()
        {
            string resultGDBPath = this.ResultGDBPath;

            try
            {
                if (!Directory.Exists(this.ResultGDBPath))
                {
                    DirectoryInfo dirInfo = Directory.CreateDirectory(this.ResultGDBPath);
                }
                resultGDBPath = Path.Combine(this.ResultGDBPath, string.Format("result_{0}.gdb", DateUtil.CurrentTimeMillis));
                string pTempletMDBFile  = AppDomain.CurrentDomain.BaseDirectory + GlobalSystemConfig.PATH_TEMPLATE_FGDB;// "template/fgdb.gdb";
                long   beginMillisecond = DateUtil.CurrentTimeMillis;
                // 创建一份gdb
                DirectFileUtil.CopyDirectInfo(pTempletMDBFile, resultGDBPath);
                IWorkspace resultWorkspace = WorkspaceUtil.OpenFileGdbWorkspace(resultGDBPath);
                LOG.Info("创建GDB消耗时间:[" + (DateUtil.CurrentTimeMillis - beginMillisecond) + "] 毫秒");
                // 拷贝源对比图层
                beginMillisecond = DateUtil.CurrentTimeMillis;
                //if (!WorkspaceServices.CopyLayer(new string[] { this.sourceLayerFirstFullPath, this.sourceLayerSecondFullPath }, resultGDBPath))
                //{
                //    LOG.Error("拷贝图层失败,中止计算");
                //    return new Result(STATUS.ERROR, "拷贝图层失败", SysStatusCode.DME3000, false);
                //}
                //LOG.Info("拷贝源对比图层消耗时间:[" + (DateUtil.CurrentTimeMillis() - beginMillisecond) + "] 毫秒");
                // 图层融合(union)
                UnionTool unionTool = new UnionTool
                {
                    InputFeatures = new String[] { this.sourceLayerFirstFullPath, this.sourceLayerSecondFullPath },
                    OutputFeature = resultGDBPath + "/" + this.ReulstLayerName
                };
                object result = unionTool.Excute();
                if (null == result)
                {
                    return(new Result(EnumSystemStatusCode.DME_ERROR, "图层联合分析失败", EnumSystemStatusCode.DME_ERROR, false));
                }
                // 对输出图层进行规则计算
                // TODO
                return(new Result(EnumSystemStatusCode.DME_SUCCESS, "差异分析完成", EnumSystemStatusCode.DME_SUCCESS, true));
            } catch (Exception ex)
            {
                LOG.Error("差异分析失败,详情:" + ex.Message);
                return(new Result(EnumSystemStatusCode.DME_ERROR, "差异分析失败,详情:" + ex.Message, EnumSystemStatusCode.DME_ERROR, false));
            }
        }