public WritableRaster getRaster() { if (raster == null) { int bands = 1; Point location = new Point(0, 0); // DataBuffer.TYPE_DOUBLE is unsupported, may have to add a multiplication factor if rate/yield values are small raster = WritableRaster.createBandedRaster(DataBuffer.TYPE_INT, nCols, nRows, bands, location); int[] values = new int[nCols * nRows]; Arrays.fill(values, Grid.EMPTY_VALUE); raster.setSamples(0, 0, nCols, nRows, 0, values); } return raster; }
public WritableRaster getRaster() { if (raster == null) { int bands = 1; Point location = new Point(0, 0); // DataBuffer.TYPE_DOUBLE is unsupported, may have to add a multiplication factor if rate/yield values are small raster = WritableRaster.createBandedRaster(DataBuffer.TYPE_INT, nCols, nRows, bands, location); for (int iw = 0; iw < nRows; iw++) { for (int ih = 0; ih < nCols; ih++) { raster.setSample(iw, ih, 0, Grid.EMPTY_VALUE); } } } return raster; }
public WritableRaster getRaster() { if (raster == null) { int bands = 1; Point location = new Point(0, 0); // DataBuffer.TYPE_DOUBLE is unsupported, may have to add a multiplication factor if rate/yield values are small raster = WritableRaster.createBandedRaster(DataBuffer.TYPE_INT, nCols, nRows, bands, location); for (int iw = 0; iw < nRows; iw++) { for (int ih = 0; ih < nCols; ih++) { raster.setSample(iw, ih, 0, Grid.EMPTY_VALUE); } } } return raster; }
public static BufferedImage createGreyscaleColorModelImage(int width, int height, byte[] data) { ColorModel cm = create8BitGreyscaleColorModel(); DataBufferByte db = new DataBufferByte(data, data.length); WritableRaster wr = WritableRaster.createBandedRaster(db, width, height, width, new int[]{0}, new int[]{0}, null); return new BufferedImage(cm, wr, false, null); }
/** * create a dummy raster on the place of the grid. creates a 1x1 raster with * a transparent value. * * Can be overriden by sub classes, will be called in checkstate(). Do not * call checkstate in an implementation * * @return */ protected GridCoverage2D getDummyRaster() { WritableRaster dummyRaster = WritableRaster.createBandedRaster(DataBuffer.TYPE_INT, 1, 1, 1, new Point(0, 0)); dummyRaster.setSample(0, 0, 0, EMPTY_VALUE); GridCoverageFactory factory = CoverageFactoryFinder.getGridCoverageFactory(null); return factory.create("name", dummyRaster, boundingBox); }
protected GridCoverage2D getDummyRaster() { checkState(); WritableRaster dummyRaster = WritableRaster.createBandedRaster(DataBuffer.TYPE_INT, 1,1,1, new Point(0,0)); dummyRaster.setSample(0,0,0,Integer.MIN_VALUE); GridCoverageFactory factory = CoverageFactoryFinder.getGridCoverageFactory(null); return factory.create("name", dummyRaster, boundingBox); }
int bands = 5; Point location = new Point(0, 0); WritableRaster raster = WritableRaster.createBandedRaster(DataBuffer.TYPE_INT, w, h, bands, location);
int bands = 5; Point location = new Point(0, 0); WritableRaster raster = WritableRaster.createBandedRaster(DataBuffer.TYPE_INT, w, h, bands, location);
static TileImpl createIterableTile(int x0, int y0, int w, int h) { Band band = new Band("x", ProductData.TYPE_INT32, w, h); WritableRaster raster = WritableRaster.createBandedRaster(DataBuffer.TYPE_INT, w, h, 1, new Point(x0, y0)); return new TileImpl(band, raster); }
int bands = 1; Point location = new Point(0, 0); WritableRaster raster = WritableRaster.createBandedRaster(DataBuffer.TYPE_INT, w, h, bands, location);
public GridCoverage2D getDummyRaster() { WritableRaster raster = WritableRaster.createBandedRaster(DataBuffer.TYPE_INT, 1,1,1, new Point(0,0)); raster.setSample(0,0,0,Integer.MIN_VALUE); Envelope e = getActivityField().getBoundingBox().getEnvelopeInternal(); BoundingBox boundingBox = new ReferencedEnvelope(e.getMinX(), e.getMaxX(), e.getMinY(), e.getMaxY(), DefaultGeographicCRS.WGS84); GridCoverageFactory factory = CoverageFactoryFinder.getGridCoverageFactory(null); return factory.create("name", raster, boundingBox); }
int bands = 1; Point location = new Point(0, 0); WritableRaster raster = WritableRaster.createBandedRaster(DataBuffer.TYPE_INT, w, h, bands, location);
WritableRaster raster = WritableRaster.createBandedRaster(DataBuffer.TYPE_INT, d.width, d.height, bands, location);
public final void setBoundingBox(BoundingBox boundingBox) { this.boundingBox = boundingBox; LOGGER.finest("Initializing bounding box for Grid"); Coordinate[] coordinates = new Coordinate[5]; coordinates[0] = new Coordinate(boundingBox.getMinX(), boundingBox.getMinY()); coordinates[1] = new Coordinate(boundingBox.getMaxX(), boundingBox.getMinY()); coordinates[2] = new Coordinate(boundingBox.getMaxX(), boundingBox.getMaxY()); coordinates[3] = new Coordinate(boundingBox.getMinX(), boundingBox.getMaxY()); coordinates[4] = new Coordinate(boundingBox.getMinX(), boundingBox.getMinY()); GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory(null); LinearRing linearRing = new LinearRing(new CoordinateArraySequence(coordinates), geometryFactory); boundingBoxGeometry = new Polygon(linearRing, null, geometryFactory); Dimension d = gridCellSize.getDimension(boundingBox); int bands = 1; Point location = new Point(0, 0); this.raster = WritableRaster.createBandedRaster(DataBuffer.TYPE_INT, d.width, d.height, bands, location); LOGGER.log(Level.FINEST, "created raster with dimension{0}", d); // fill raster with min values for (int iw = 0; iw < d.width; iw++) { for (int ih = 0; ih < d.height; ih++) { raster.setSample(iw, ih, 0, Integer.MIN_VALUE); } } }
if(nbBand == 1){ if(dataType == DataBuffer.TYPE_BYTE || dataType == DataBuffer.TYPE_USHORT || dataType == DataBuffer.TYPE_INT){ raster = WritableRaster.createBandedRaster(dataType, width, height, nbBand, upperLeft); }else{