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); }