//---------------------------------------------------------------------

        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);
        }
Esempio n. 2
0
        //---------------------------------------------------------------------

        public static Landis.Raster.IOutputRaster <T> Create <T>(string path,
                                                                 Landis.Raster.Dimensions dimensions,
                                                                 Landis.Raster.IMetadata metadata)
            where T : Landis.Raster.IPixel, new()
        {
            try {
                string dir = System.IO.Path.GetDirectoryName(path);
                if (dir.Length > 0)
                {
                    Directory.EnsureExists(dir);
                }
                Landis.Raster.IOutputRaster <T> raster = lib.Create <T>(path, dimensions, metadata);
                return(raster);
            }
            catch (System.IO.IOException exc) {
                string mesg = string.Format("Error opening map \"{0}\"", path);
                throw new MultiLineException(mesg, exc);
            }
        }