private void ReadShapefileWorksapceFactory(string path) { Wsf = new ShapefileWorkspaceFactoryClass(); Directory = System.IO.Path.GetDirectoryName(path); NameWithoutExtension = System.IO.Path.GetFileNameWithoutExtension(path); Extension = System.IO.Path.GetExtension(path); Ws = Wsf.OpenFromFile(Directory, 0); FeatWs = Ws as IFeatureWorkspace; FeatCls = FeatWs.OpenFeatureClass(NameWithoutExtension); EnumDs = Ws.get_Datasets(esriDatasetType.esriDTFeatureClass); }
private void ReadRasterWorkspaceFactory(string path) { Wsf = new RasterWorkspaceFactoryClass(); Directory = System.IO.Path.GetDirectoryName(path); NameWithoutExtension = System.IO.Path.GetFileNameWithoutExtension(path); Extension = System.IO.Path.GetExtension(path); Ws = Wsf.OpenFromFile(Directory, 0); RstWs = Ws as IRasterWorkspace; RstDs = RstWs.OpenRasterDataset(NameWithoutExtension + Extension) as IRasterDataset2; Rst = RstDs.CreateDefaultRaster(); RstProps = Rst as IRasterProps; RawBlocks = (IRawBlocks)RstDs; RstInfo = RawBlocks.RasterInfo; EnumDs = Ws.get_Datasets(esriDatasetType.esriDTRasterDataset); }
private void ReadFileGDBWorkspaceFactory(string path) { Wsf = new FileGDBWorkspaceFactoryClass(); Directory = path.Substring(0, path.IndexOf(".gdb") + 4); NameWithoutExtension = System.IO.Path.GetFileNameWithoutExtension(path.Substring(path.IndexOf(".gdb") + 5, path.Length - path.IndexOf(".gdb") - 5)); Extension = System.IO.Path.GetExtension(path.Substring(path.IndexOf(".gdb") + 5, path.Length - path.IndexOf(".gdb") - 5)); Ws = Wsf.OpenFromFile(Directory, 0); RstWsEx = Ws as IRasterWorkspaceEx; RstDs = RstWsEx.OpenRasterDataset(NameWithoutExtension) as IRasterDataset2; Rst = RstDs.CreateDefaultRaster(); RstProps = Rst as IRasterProps; RawBlocks = (IRawBlocks)RstDs; RstInfo = RawBlocks.RasterInfo; EnumDs = Ws.get_Datasets(esriDatasetType.esriDTRasterDataset); }
private void ReadFileGDBWorkspaceFactory(string path) { Wsf = new FileGDBWorkspaceFactoryClass(); Directory = path.Substring(0, path.IndexOf(".gdb") + 4); FeatDsName = System.IO.Path.GetDirectoryName(path.Substring(path.IndexOf(".gdb") + 5, path.Length - path.IndexOf(".gdb") - 5)); NameWithoutExtension = System.IO.Path.GetFileNameWithoutExtension(path.Substring(path.IndexOf(".gdb") + 5, path.Length - path.IndexOf(".gdb") - 5)); Extension = System.IO.Path.GetExtension(path.Substring(path.IndexOf(".gdb") + 5, path.Length - path.IndexOf(".gdb") - 5)); Ws = Wsf.OpenFromFile(Directory, 0); FeatWs = Ws as IFeatureWorkspace; if (FeatDsName.Equals(string.Empty)) { IFeatureClassContainer featClsCtn = FeatWs.OpenFeatureDataset(FeatDsName) as IFeatureClassContainer; FeatCls = featClsCtn.get_ClassByName(NameWithoutExtension); EnumDs = Ws.get_Datasets(esriDatasetType.esriDTFeatureClass); } else { FeatCls = FeatWs.OpenFeatureClass(NameWithoutExtension); IFeatureDataset FeatDs = FeatWs.OpenFeatureDataset(FeatDsName); EnumDs = FeatDs.Subsets; } }