//--------------------------------------------------------------------- public Band(Gdal.RasterBand band, IOutputRaster raster) : base(band) { this.raster = raster; toBytes = new ToBytesMethod <T>(new U().ToBytes); }
//--------------------------------------------------------------------- public IInputBand <T> GetBand <T>(int bandIndex) { if (bandIndex < 1 || bandIndex > BandCount) { throw new System.IndexOutOfRangeException(); } Gdal.RasterBand gdalBand = dataset.GetRasterBand(bandIndex); Debug.Assert(gdalBand != null); object band; if (typeof(T) == typeof(byte)) { band = new InputBand.Byte(gdalBand, this); } else if (typeof(T) == typeof(sbyte)) { band = new InputBand.SByte(gdalBand, this); } else if (typeof(T) == typeof(short)) { band = new InputBand.Short(gdalBand, this); } else if (typeof(T) == typeof(ushort)) { band = new InputBand.UShort(gdalBand, this); } else { throw new System.ApplicationException("invalid band type"); } // If the "if" statement above is constructed properly, then the // cast in the statement below just never throw an exception. return((IInputBand <T>)band); }
//--------------------------------------------------------------------- public Band(Gdal.RasterBand band, IInputRaster raster) : base(band) { this.raster = raster; fromBytes = new FromBytesMethod <T>(new U().FromBytes); }
//--------------------------------------------------------------------- public RasterBand(Gdal.RasterBand band) { this.gdalBand = band; band.GetBlockSize(out BlockXSize, out BlockYSize); pixelType = PixelType.Get(typeof(T)); BufferSize = BlockXSize * BlockYSize * pixelType.SizeOf; buffer = new byte[BufferSize]; currentBlockLoc = new BlockLocation(-1, -1); int rows = band.GetYSize(); int columns = band.GetXSize(); dimensions = new Landis.Raster.Dimensions(rows, columns); }
public UShort(Gdal.RasterBand gdalBand, IInputRaster raster) : base(gdalBand, raster) { }
public Short(Gdal.RasterBand gdalBand, IOutputRaster raster) : base(gdalBand, raster) { }
public Byte(Gdal.RasterBand gdalBand, IInputRaster raster) : base(gdalBand, raster) { }