Ejemplo n.º 1
0
        public static IRasterDataset GetRasterDataset(IWorkspaceName workspaceName, string RasterDatasetName)
        {
            try
            {
                IDatasetName pRasterDatasetName = new RasterDatasetNameClass
                {
                    Name          = RasterDatasetName,
                    WorkspaceName = workspaceName
                };

                //Open the FeatureDataset
                IName name = (IName)pRasterDatasetName;
                return((IRasterDataset)name.Open());
            }
            catch (Exception ex)
            {
                LOG.Error(ex);
            }
            return(null);
        }
Ejemplo n.º 2
0
        public void OpenFolder()
        {
            try
            {
                try
                {
                    this.string_0 = (this.igxObject_0 as IGxFile).Path;
                    if (this.string_0 == null)
                    {
                        if (this.OnReadCompleted != null)
                        {
                            this.OnReadCompleted();
                        }
                        return;
                    }
                    string[] directories = Directory.GetDirectories(this.string_0);
                    IArray   array       = new ArrayClass();
                    foreach (string str in directories)
                    {
                        IGxObject      obj2;
                        IDatasetName   name;
                        IWorkspaceName name2;
                        string         str2 = this.method_1(str);
                        switch (str2)
                        {
                        case null:
                            break;

                        case "FOLDER":
                            obj2 = new GxFolder();
                            (obj2 as IGxFile).Path = str;
                            obj2.Attach(this.igxObject_0, this.igxCatalog_0);
                            break;

                        case "TIN":
                            obj2  = new GxDataset();
                            name  = new TinNameClass();
                            name2 = new WorkspaceNameClass
                            {
                                WorkspaceFactoryProgID = "esriDataSourcesFile.TinWorkspaceFactory",
                                PathName = Path.GetDirectoryName(str)
                            };
                            name.Name          = Path.GetFileName(str);
                            name.WorkspaceName = name2;
                            (obj2 as IGxDataset).DatasetName = name;
                            array.Add(obj2);
                            break;

                        case "GRID":
                            obj2  = new GxRasterDataset();
                            name  = new RasterDatasetNameClass();
                            name2 = new WorkspaceNameClass
                            {
                                WorkspaceFactoryProgID = "esriDataSourcesFile.RasterWorkspaceFactory",
                                PathName = Path.GetDirectoryName(str)
                            };
                            name.Name          = Path.GetFileName(str);
                            name.WorkspaceName = name2;
                            (obj2 as IGxDataset).DatasetName = name;
                            array.Add(obj2);
                            break;

                        default:
                            if (!(str2 == "COVERAGE"))
                            {
                                if (str2 == "FILEGDB")
                                {
                                    obj2  = new GxDatabase();
                                    name2 = new WorkspaceNameClass
                                    {
                                        WorkspaceFactoryProgID = "esriDataSourcesGDB.FileGDBWorkspaceFactory.1",
                                        PathName = str
                                    };
                                    (obj2 as IGxDatabase).WorkspaceName = name2;
                                    array.Add(obj2);
                                }
                            }
                            else
                            {
                                obj2  = new GxCoverageDataset();
                                name  = new CoverageNameClass();
                                name2 = new WorkspaceNameClass
                                {
                                    WorkspaceFactoryProgID = "esriDataSourcesFile.ArcInfoWorkspaceFactory.1",
                                    PathName = Path.GetDirectoryName(str)
                                };
                                name.Name          = Path.GetFileName(str);
                                name.WorkspaceName = name2;
                                (obj2 as IGxDataset).DatasetName = name;
                                array.Add(obj2);
                            }
                            break;
                        }
                    }
                    for (int i = 0; i < array.Count; i++)
                    {
                        (array.get_Element(i) as IGxObject).Attach(this.igxObject_0, this.igxCatalog_0);
                    }
                    foreach (string str3 in Directory.GetFiles(this.string_0))
                    {
                        string str4 = Path.GetExtension(str3).ToLower();
                        if (str4 != null)
                        {
                            this.method_0(str3, str4, false);
                        }
                    }
                }
                catch
                {
                }
            }
            finally
            {
            }
            if (this.OnReadCompleted != null)
            {
                this.OnReadCompleted();
            }
        }
Ejemplo n.º 3
0
        private void method_3(string[] string_1)
        {
            foreach (string str in string_1)
            {
                IDatasetName   name;
                IWorkspaceName name2;
                IGxObject      unk  = null;
                string         str2 = this.method_1(str);
                switch (str2)
                {
                case null:
                    break;

                case "FOLDER":
                    unk = new GxFolder();
                    (unk as IGxFile).Path = str;
                    unk.Attach(this.igxObject_0, this.igxCatalog_0);
                    break;

                case "TIN":
                    unk   = new GxDataset();
                    name  = new TinNameClass();
                    name2 = new WorkspaceNameClass
                    {
                        WorkspaceFactoryProgID = "esriDataSourcesFile.TinWorkspaceFactory",
                        PathName = Path.GetDirectoryName(str)
                    };
                    name.Name          = Path.GetFileName(str);
                    name.WorkspaceName = name2;
                    (unk as IGxDataset).DatasetName = name;
                    this.iarray_0.Add(unk);
                    break;

                case "GRID":
                    unk   = new GxRasterDataset();
                    name  = new RasterDatasetNameClass();
                    name2 = new WorkspaceNameClass
                    {
                        WorkspaceFactoryProgID = "esriDataSourcesFile.RasterWorkspaceFactory",
                        PathName = Path.GetDirectoryName(str)
                    };
                    name.Name          = Path.GetFileName(str);
                    name.WorkspaceName = name2;
                    (unk as IGxDataset).DatasetName = name;
                    this.iarray_0.Add(unk);
                    break;

                default:
                    if (!(str2 == "COVERAGE"))
                    {
                        if (str2 == "FILEGDB")
                        {
                            unk   = new GxDatabase();
                            name2 = new WorkspaceNameClass
                            {
                                WorkspaceFactoryProgID = "esriDataSourcesGDB.FileGDBWorkspaceFactory.1",
                                PathName = str
                            };
                            (unk as IGxDatabase).WorkspaceName = name2;
                            this.iarray_0.Add(unk);
                        }
                    }
                    else
                    {
                        unk   = new GxCoverageDataset();
                        name  = new CoverageNameClass();
                        name2 = new WorkspaceNameClass
                        {
                            WorkspaceFactoryProgID = "esriDataSourcesFile.ArcInfoWorkspaceFactory.1",
                            PathName = Path.GetDirectoryName(str)
                        };
                        name.Name          = Path.GetFileName(str);
                        name.WorkspaceName = name2;
                        (unk as IGxDataset).DatasetName = name;
                        this.iarray_0.Add(unk);
                    }
                    break;
                }
            }
        }
Ejemplo n.º 4
0
        private bool method_0(string string_1, string string_2, bool bool_0)
        {
            IGxObject      obj2 = null;
            IDatasetName   name;
            IWorkspaceName name2;

            switch (string_2.ToLower())
            {
            case ".bmp":
            case ".png":
            case ".jpg":
            case ".tif":
            case ".img":
            case ".sid":
                obj2  = new GxRasterDataset();
                name  = new RasterDatasetNameClass();
                name2 = new WorkspaceNameClass
                {
                    WorkspaceFactoryProgID = "esriDataSourcesFile.RasterWorkspaceFactory",
                    PathName = Path.GetDirectoryName(string_1)
                };
                name.Name          = Path.GetFileName(string_1);
                name.WorkspaceName = name2;
                (obj2 as IGxDataset).DatasetName = name;
                obj2.Attach(this.igxObject_0, this.igxCatalog_0);
                if (bool_0)
                {
                    this.igxCatalog_0.ObjectAdded(obj2);
                }
                return(true);

            case ".mdb":
                obj2  = new GxDatabase();
                name2 = new WorkspaceNameClass
                {
                    WorkspaceFactoryProgID = "esriDataSourcesGDB.AccessWorkspaceFactory",
                    PathName = string_1
                };
                (obj2 as IGxDatabase).WorkspaceName = name2;
                obj2.Attach(this.igxObject_0, this.igxCatalog_0);
                if (bool_0)
                {
                    this.igxCatalog_0.ObjectAdded(obj2);
                }
                return(true);

            case ".shp":
                obj2  = new GxShapefileDataset();
                name  = new FeatureClassNameClass();
                name2 = new WorkspaceNameClass
                {
                    WorkspaceFactoryProgID = "esriDataSourcesFile.ShapefileWorkspaceFactory",
                    PathName = Path.GetDirectoryName(string_1)
                };
                name.Name          = Path.GetFileName(string_1);
                name.WorkspaceName = name2;
                (obj2 as IGxDataset).DatasetName = name;
                obj2.Attach(this.igxObject_0, this.igxCatalog_0);
                if (bool_0)
                {
                    this.igxCatalog_0.ObjectAdded(obj2);
                }
                return(true);

            case ".dbf":
                if (
                    !File.Exists(Path.Combine(Path.GetDirectoryName(string_1),
                                              Path.GetFileNameWithoutExtension(string_1) + ".shp")))
                {
                    obj2  = new GxDataset();
                    name  = new TableNameClass();
                    name2 = new WorkspaceNameClass
                    {
                        WorkspaceFactoryProgID = "esriDataSourcesFile.ShapefileWorkspaceFactory",
                        PathName = Path.GetDirectoryName(string_1)
                    };
                    name.Name          = Path.GetFileName(string_1);
                    name.WorkspaceName = name2;
                    (obj2 as IGxDataset).DatasetName = name;
                    obj2.Attach(this.igxObject_0, this.igxCatalog_0);
                    if (bool_0)
                    {
                        this.igxCatalog_0.ObjectAdded(obj2);
                    }
                    return(true);
                }
                return(false);

            case ".sde":
                obj2  = new GxDatabase();
                name2 = new WorkspaceNameClass
                {
                    WorkspaceFactoryProgID = "esriDataSourcesGDB.SdeWorkspaceFactory",
                    PathName = string_1
                };
                (obj2 as IGxDatabase).WorkspaceName = name2;
                obj2.Attach(this.igxObject_0, this.igxCatalog_0);
                if (bool_0)
                {
                    this.igxCatalog_0.ObjectAdded(obj2);
                }
                return(true);

            case ".lyr":
                obj2 = new GxLayer();
                (obj2 as IGxFile).Path = string_1;
                obj2.Attach(this.igxObject_0, this.igxCatalog_0);
                if (bool_0)
                {
                    this.igxCatalog_0.ObjectAdded(obj2);
                }
                return(true);

            case ".dwg":
            case ".dxf":
                obj2  = new GxCadDataset();
                name  = new CadDrawingNameClass();
                name2 = new WorkspaceNameClass
                {
                    WorkspaceFactoryProgID = "esriDataSourcesFile.CadWorkspaceFactory",
                    PathName = Path.GetDirectoryName(string_1)
                };
                name.Name          = Path.GetFileName(string_1);
                name.WorkspaceName = name2;
                (obj2 as IGxDataset).DatasetName = name;
                obj2.Attach(this.igxObject_0, this.igxCatalog_0);
                if (bool_0)
                {
                    this.igxCatalog_0.ObjectAdded(obj2);
                }
                return(true);

            case ".doc":
            case ".xls":
                obj2 = new GxOfficeFile();
                (obj2 as IGxFile).Path = string_1;
                obj2.Attach(this.igxObject_0, this.igxCatalog_0);
                if (bool_0)
                {
                    this.igxCatalog_0.ObjectAdded(obj2);
                }
                return(true);
            }
            return(false);
        }
Ejemplo n.º 5
0
        private void axMapControl1_OnOleDrop(object sender, IMapControlEvents2_OnOleDropEvent e)
        {
            IDataObjectHelper      dataObjectHelper = (IDataObjectHelper)e.dataObjectHelper;
            esriControlsDropAction dropAction       = e.dropAction;

            e.effect = 0;
            switch (dropAction)
            {
            case esriControlsDropAction.esriDropEnter:
                if (dataObjectHelper.CanGetFiles() | dataObjectHelper.CanGetNames())
                {
                    this.m_Effect = esriControlsDragDropEffect.esriDragDropCopy;
                }
                else if (dataObjectHelper.InternalObject is IDataObject)
                {
                    this.m_Effect = esriControlsDragDropEffect.esriDragDropCopy;
                }
                break;

            case esriControlsDropAction.esriDropOver:
                e.effect = (int)this.m_Effect;
                break;
            }
            if (dropAction == esriControlsDropAction.esriDropped)
            {
                int num;
                if (dataObjectHelper.CanGetFiles())
                {
                    System.Array files = System.Array.CreateInstance(typeof(string), 0, 0);
                    files = (System.Array)dataObjectHelper.GetFiles();
                    for (num = 0; num <= (files.Length - 1); num++)
                    {
                        if (this.axMapControl1.CheckMxFile(files.GetValue(num).ToString()))
                        {
                            try
                            {
                                this.axMapControl1.LoadMxFile(files.GetValue(num).ToString(), System.Type.Missing, "");
                            }
                            catch (Exception exception)
                            {
                                MessageBox.Show("Error:" + exception.Message);
                                return;
                            }
                        }
                        else
                        {
                            IFileName name = new FileNameClass
                            {
                                Path = files.GetValue(num).ToString()
                            };
                            this.CreateLayer((IName)name);
                        }
                    }
                }
                else if (dataObjectHelper.CanGetNames())
                {
                    IEnumName names = dataObjectHelper.GetNames();
                    names.Reset();
                    for (IName name3 = names.Next(); name3 != null; name3 = names.Next())
                    {
                        this.CreateLayer(name3);
                    }
                }
                if (dataObjectHelper.InternalObject is IDataObject)
                {
                    IList data =
                        (dataObjectHelper.InternalObject as IDataObject).GetData("System.Collections.ArrayList") as
                        IList;
                    for (num = 0; num < data.Count; num++)
                    {
                        IWorkspaceName workspaceName;
                        IWorkspaceName name6;
                        object         obj3 = data[num];
                        if (obj3 is IFeatureDatasetName)
                        {
                            IFeatureDatasetName name4 = new FeatureDatasetNameClass();
                            workspaceName = (obj3 as IDatasetName).WorkspaceName;
                            name6         = new WorkspaceNameClass
                            {
                                WorkspaceFactoryProgID = workspaceName.WorkspaceFactoryProgID
                            };
                            if (workspaceName.ConnectionProperties != null)
                            {
                                name6.ConnectionProperties = workspaceName.ConnectionProperties;
                            }
                            else
                            {
                                name6.PathName = workspaceName.PathName;
                            }
                            (name4 as IDatasetName).WorkspaceName = name6;
                            (name4 as IDatasetName).Name          = (obj3 as IDatasetName).Name;
                            this.CreateLayer(name4 as IName);
                        }
                        else if (obj3 is IRasterDatasetName)
                        {
                            IRasterDatasetName name7 = new RasterDatasetNameClass();
                            workspaceName = (obj3 as IDatasetName).WorkspaceName;
                            name6         = new WorkspaceNameClass
                            {
                                WorkspaceFactoryProgID = workspaceName.WorkspaceFactoryProgID
                            };
                            if (workspaceName.ConnectionProperties != null)
                            {
                                name6.ConnectionProperties = workspaceName.ConnectionProperties;
                            }
                            else
                            {
                                name6.PathName = workspaceName.PathName;
                            }
                            (name7 as IDatasetName).WorkspaceName = name6;
                            (name7 as IDatasetName).Name          = (obj3 as IDatasetName).Name;
                            this.CreateLayer(name7 as IName);
                        }
                        else if (obj3 is IDatasetName)
                        {
                            IDatasetName name8 = null;
                            if ((obj3 as IDatasetName).Type == esriDatasetType.esriDTTin)
                            {
                                name8 = new TinNameClass();
                            }
                            if ((obj3 as IDatasetName).Type == esriDatasetType.esriDTFeatureClass)
                            {
                                name8 = new FeatureClassNameClass();
                                (name8 as IFeatureClassName).FeatureDatasetName =
                                    (obj3 as IFeatureClassName).FeatureDatasetName;
                            }
                            else if ((obj3 as IDatasetName).Type == esriDatasetType.esriDTTopology)
                            {
                                name8 = new TopologyNameClass();
                                (name8 as ITopologyName).FeatureDatasetName = (obj3 as ITopologyName).FeatureDatasetName;
                            }
                            else if ((obj3 as IDatasetName).Type == esriDatasetType.esriDTRasterBand)
                            {
                                name8 = new RasterBandNameClass();
                                (name8 as IRasterBandName).RasterDatasetName =
                                    (obj3 as IRasterBandName).RasterDatasetName;
                            }
                            else if ((obj3 as IDatasetName).Type == esriDatasetType.esriDTGeometricNetwork)
                            {
                                name8 = new GeometricNetworkNameClass();
                                (name8 as IGeometricNetworkName).FeatureDatasetName =
                                    (obj3 as IGeometricNetworkName).FeatureDatasetName;
                            }
                            else if ((obj3 as IDatasetName).Type == esriDatasetType.esriDTRasterCatalog)
                            {
                                name8 = new RasterCatalogNameClass();
                                (name8 as IFeatureClassName).FeatureDatasetName =
                                    (obj3 as IFeatureClassName).FeatureDatasetName;
                            }
                            else if ((obj3 as IDatasetName).Type == esriDatasetType.esriDTNetworkDataset)
                            {
                                name8 = new NetworkDatasetNameClass();
                                (name8 as INetworkDatasetName).FeatureDatasetName =
                                    (obj3 as INetworkDatasetName).FeatureDatasetName;
                            }
                            if (name8 != null)
                            {
                                if (name8.WorkspaceName == null)
                                {
                                    workspaceName = (obj3 as IDatasetName).WorkspaceName;
                                    name6         = new WorkspaceNameClass
                                    {
                                        WorkspaceFactoryProgID = workspaceName.WorkspaceFactoryProgID
                                    };
                                    if (workspaceName.ConnectionProperties != null)
                                    {
                                        name6.ConnectionProperties = workspaceName.ConnectionProperties;
                                    }
                                    else
                                    {
                                        name6.PathName = workspaceName.PathName;
                                    }
                                    name8.WorkspaceName = name6;
                                }
                                name8.Name = (obj3 as IDatasetName).Name;
                                this.CreateLayer(name8 as IName);
                            }
                        }
                        else if (obj3 is IWorkspaceName)
                        {
                            workspaceName = obj3 as IWorkspaceName;
                            name6         = new WorkspaceNameClass
                            {
                                WorkspaceFactoryProgID = workspaceName.WorkspaceFactoryProgID
                            };
                            if (workspaceName.ConnectionProperties != null)
                            {
                                name6.ConnectionProperties = workspaceName.ConnectionProperties;
                            }
                            else
                            {
                                name6.PathName = workspaceName.PathName;
                            }
                            this.CreateLayer(name6 as IName);
                        }
                        else if (obj3 is IPropertySet)
                        {
                            IPropertySet set      = obj3 as IPropertySet;
                            ILayer       property = set.GetProperty("Layer") as ILayer;
                            this.axMapControl1.AddLayer(property, 0);
                        }
                    }
                }
            }
        }
Ejemplo n.º 6
0
        private void method_5()
        {
            try
            {
                int       num;
                IGxObject obj2;
                for (num = 0; num < this.openFolderDataHelper_0.m_DirectoryList.Count; num++)
                {
                    obj2 = new GxFolder();
                    (obj2 as IGxFile).Path = this.openFolderDataHelper_0.m_DirectoryList[num].Path;
                    obj2.Attach(this, this.igxCatalog_0);
                }
                for (num = 0; num < this.openFolderDataHelper_0.m_FileList.Count; num++)
                {
                    IDatasetName   name;
                    IWorkspaceName name2;
                    string         type = this.openFolderDataHelper_0.m_FileList[num].Type;
                    string         str2 = type;
                    switch (str2)
                    {
                    case null:
                        break;

                    case "TIN":
                    {
                        obj2  = new GxDataset();
                        name  = new TinNameClass();
                        name2 = new WorkspaceNameClass
                        {
                            WorkspaceFactoryProgID = "esriDataSourcesFile.TinWorkspaceFactory",
                            PathName =
                                System.IO.Path.GetDirectoryName(this.openFolderDataHelper_0.m_FileList[num].Path)
                        };
                        name.Name          = System.IO.Path.GetFileName(this.openFolderDataHelper_0.m_FileList[num].Path);
                        name.WorkspaceName = name2;
                        (obj2 as IGxDataset).DatasetName = name;
                        obj2.Attach(this, this.igxCatalog_0);
                        continue;
                    }

                    case "GRID":
                    {
                        obj2  = new GxRasterDataset();
                        name  = new RasterDatasetNameClass();
                        name2 = new WorkspaceNameClass
                        {
                            WorkspaceFactoryProgID = "esriDataSourcesFile.RasterWorkspaceFactory",
                            PathName =
                                System.IO.Path.GetDirectoryName(this.openFolderDataHelper_0.m_FileList[num].Path)
                        };
                        name.Name          = System.IO.Path.GetFileName(this.openFolderDataHelper_0.m_FileList[num].Path);
                        name.WorkspaceName = name2;
                        (obj2 as IGxDataset).DatasetName = name;
                        obj2.Attach(this, this.igxCatalog_0);
                        continue;
                    }

                    default:
                    {
                        if (!(str2 == "COVERAGE"))
                        {
                            if (!(str2 == "FILEGDB"))
                            {
                                break;
                            }
                            obj2  = new GxDatabase();
                            name2 = new WorkspaceNameClass
                            {
                                WorkspaceFactoryProgID = "esriDataSourcesGDB.FileGDBWorkspaceFactory.1",
                                PathName = this.openFolderDataHelper_0.m_FileList[num].Path
                            };
                            (obj2 as IGxDatabase).WorkspaceName = name2;
                            obj2.Attach(this, this.igxCatalog_0);
                        }
                        else
                        {
                            obj2  = new GxCoverageDataset();
                            name  = new CoverageNameClass();
                            name2 = new WorkspaceNameClass
                            {
                                WorkspaceFactoryProgID = "esriDataSourcesFile.ArcInfoWorkspaceFactory.1",
                                PathName =
                                    System.IO.Path.GetDirectoryName(this.openFolderDataHelper_0.m_FileList[num].Path)
                            };
                            name.Name          = System.IO.Path.GetFileName(this.openFolderDataHelper_0.m_FileList[num].Path);
                            name.WorkspaceName = name2;
                            (obj2 as IGxDataset).DatasetName = name;
                            obj2.Attach(this, this.igxCatalog_0);
                        }
                        continue;
                    }
                    }
                    this.method_0(this.openFolderDataHelper_0.m_FileList[num].Path, type, false);
                }
            }
            catch
            {
            }
        }
Ejemplo n.º 7
0
        private void buildPathAllocation()
        {
            IDistanceOp2 dOp = new RasterDistanceOpClass();
            IRasterAnalysisEnvironment rasterAnalysisEnvironment = (ESRI.ArcGIS.GeoAnalyst.IRasterAnalysisEnvironment)dOp;

            rasterAnalysisEnvironment.OutSpatialReference = ((IGeoDataset)Dem).SpatialReference;
            rasterAnalysisEnvironment.OutWorkspace        = OutWorkspace;
            object ext  = ((IGeoDataset)RoadFeatureClass).Extent;
            object snap = ((IGeoDataset)Dem);

            rasterAnalysisEnvironment.SetCellSize(ESRI.ArcGIS.GeoAnalyst.esriRasterEnvSettingEnum.esriRasterEnvValue, Dem);
            rasterAnalysisEnvironment.SetExtent(ESRI.ArcGIS.GeoAnalyst.esriRasterEnvSettingEnum.esriRasterEnvValue, ext, Dem);
            IRasterAnalysisGlobalEnvironment analysisGlobalEnv = (IRasterAnalysisGlobalEnvironment)dOp;

            analysisGlobalEnv.AvoidDataConversion = true;

            IRasterOpBase      rasOpBase = (IRasterOpBase)dOp;
            IRasterDatasetName rasDatasetName;

            rasDatasetName = new RasterDatasetNameClass();

            IDatasetName datasetName;

            datasetName = (IDatasetName)rasDatasetName;
            datasetName.WorkspaceName = (IWorkspaceName)((IDataset)OutWorkspace).FullName;
            string onRoadNm = rsUtil.getSafeOutputName(OutWorkspace, "onRoadHr");

            datasetName.Name = onRoadNm;
            rasOpBase.AddOutputDatasetName(0, datasetName);

            object noVl = Type.Missing;
            IFunctionRasterDataset cr1    = rsUtil.calcArithmaticFunction(RoadRaster, speedConFactor, esriRasterArithmeticOperation.esriRasterMultiply);
            IFunctionRasterDataset costRs = rsUtil.calcArithmaticFunction(1, cr1, esriRasterArithmeticOperation.esriRasterDivide);
            IGeoDataset            rpdOut = dOp.PathDistance((IGeoDataset)FacilityFeatureClass, costRs, Dem, noVl, noVl, noVl, noVl, noVl, noVl);//outputs in hours

            FunctionAccumulatedPathDistance = rsUtil.createIdentityRaster((IRaster)rpdOut);
            // Use FunctonAccumulated Path Distance (hours) for allocation
            string frRoadDist = rsUtil.getSafeOutputName(OutWorkspace, "offRoadHr");

            datasetName.Name = frRoadDist;

            string             frRoadAllo      = rsUtil.getSafeOutputName(OutWorkspace, "onRoadAllo");
            IRasterDatasetName rasDatasetName2 = new RasterDatasetNameClass();
            IDatasetName       datasetName2    = (IDatasetName)rasDatasetName2;

            datasetName2.WorkspaceName = (IWorkspaceName)((IDataset)OutWorkspace).FullName;
            datasetName2.Name          = frRoadAllo;

            string             frRoadBack      = rsUtil.getSafeOutputName(OutWorkspace, "offRoadBack");
            IRasterDatasetName rasDatasetName3 = new RasterDatasetNameClass();
            IDatasetName       datasetName3    = (IDatasetName)rasDatasetName3;

            datasetName3.WorkspaceName = (IWorkspaceName)((IDataset)OutWorkspace).FullName;
            datasetName3.Name          = frRoadBack;

            rasOpBase.AddOutputDatasetName(0, datasetName);
            rasOpBase.AddOutputDatasetName(1, datasetName3);
            rasOpBase.AddOutputDatasetName(2, datasetName2);
            IFunctionRasterDataset costRS = null;

            //add in barriers to costRS
            if (OffRoadSpeedRaster != null)
            {
                IFunctionRasterDataset c1 = rsUtil.calcArithmaticFunction(OffRoadSpeedRaster, speedConFactor, esriRasterArithmeticOperation.esriRasterMultiply);
                costRS = rsUtil.calcArithmaticFunction(1, c1, esriRasterArithmeticOperation.esriRasterDivide);
            }
            else
            {
                costRS = rsUtil.constantRasterFunction(FunctionAccumulatedPathDistance, 1 / (OffRoadSpeed * speedConFactor));
            }

            //add in barriers to costRs
            IFunctionRasterDataset rdCs = null;//rsUtil.calcArithmaticFunction(FunctionAccumulatedPathDistance, 1000, esriRasterArithmeticOperation.esriRasterMultiply, rstPixelType.PT_LONG);

            if (BarriersFeatureClass != null)
            {
                IFunctionRasterDataset[] rslt = addBarrierRasters(costRS, FunctionAccumulatedPathDistance);
                costRS = rslt[0];
                rdCs   = rslt[1];
            }
            else
            {
                rdCs = rsUtil.calcArithmaticFunction(FunctionAccumulatedPathDistance, 1000, esriRasterArithmeticOperation.esriRasterMultiply, rstPixelType.PT_LONG);
            }
            IGeoDataset           rpdOut2 = dOp.PathDistanceFull((IGeoDataset)rdCs, true, false, true, costRS, Dem, noVl, noVl, noVl, noVl, noVl, rdCs);
            IRasterBandCollection rsbc    = (IRasterBandCollection)rpdOut;

            FunctionAccumulatedFromPathDistance = rsUtil.getBand((IRaster)rpdOut2, 0);
            FunctionAccumulatedPathAllocation   = rsUtil.getBand((IRaster)rpdOut2, 1);
        }
Ejemplo n.º 8
0
        private void method_3()
        {
            string[] directories;
            this.bool_0 = false;
            try
            {
                directories = Directory.GetDirectories(this.string_0);
            }
            catch
            {
                return;
            }
            IArray array = new ArrayClass();

            foreach (string str in directories)
            {
                IGxObject      obj2;
                IDatasetName   name;
                IWorkspaceName name2;
                string         str2 = this.method_2(str);
                switch (str2)
                {
                case null:
                    break;

                case "FOLDER":
                    obj2 = new GxFolder();
                    (obj2 as IGxFile).Path = str;
                    obj2.Attach(this, this.igxCatalog_0);
                    break;

                case "TIN":
                    obj2  = new GxDataset();
                    name  = new TinNameClass();
                    name2 = new WorkspaceNameClass
                    {
                        WorkspaceFactoryProgID = "esriDataSourcesFile.TinWorkspaceFactory",
                        PathName = System.IO.Path.GetDirectoryName(str)
                    };
                    name.Name          = System.IO.Path.GetFileName(str);
                    name.WorkspaceName = name2;
                    (obj2 as IGxDataset).DatasetName = name;
                    array.Add(obj2);
                    break;

                case "GRID":
                    obj2  = new GxRasterDataset();
                    name  = new RasterDatasetNameClass();
                    name2 = new WorkspaceNameClass
                    {
                        WorkspaceFactoryProgID = "esriDataSourcesFile.RasterWorkspaceFactory",
                        PathName = System.IO.Path.GetDirectoryName(str)
                    };
                    name.Name          = System.IO.Path.GetFileName(str);
                    name.WorkspaceName = name2;
                    (obj2 as IGxDataset).DatasetName = name;
                    array.Add(obj2);
                    break;

                default:
                    if (!(str2 == "COVERAGE"))
                    {
                        if (str2 == "FILEGDB")
                        {
                            obj2  = new GxDatabase();
                            name2 = new WorkspaceNameClass
                            {
                                WorkspaceFactoryProgID = "esriDataSourcesGDB.FileGDBWorkspaceFactory.1",
                                PathName = str
                            };
                            (obj2 as IGxDatabase).WorkspaceName = name2;
                            array.Add(obj2);
                        }
                    }
                    else
                    {
                        obj2  = new GxCoverageDataset();
                        name  = new CoverageNameClass();
                        name2 = new WorkspaceNameClass
                        {
                            WorkspaceFactoryProgID = "esriDataSourcesFile.ArcInfoWorkspaceFactory.1",
                            PathName = System.IO.Path.GetDirectoryName(str)
                        };
                        name.Name          = System.IO.Path.GetFileName(str);
                        name.WorkspaceName = name2;
                        (obj2 as IGxDataset).DatasetName = name;
                        array.Add(obj2);
                    }
                    break;
                }
            }
            for (int i = 0; i < array.Count; i++)
            {
                (array.get_Element(i) as IGxObject).Attach(this, this.igxCatalog_0);
            }
            foreach (string str3 in Directory.GetFiles(this.string_0))
            {
                this.method_0(str3, false);
            }
            this.bool_1 = true;
        }