DataBuffer. Those data can be shown as an untiled
RenderedImage. Images are created when
render(GridExtent)is invoked instead of at construction time. This delayed construction makes this class better suited to n-dimensional grids since those grids can not be wrapped into a single
GridCoverage2Dallows more flexibility in data layout and supports tiling with data loaded or computed on-the-fly, but is restricted to two-dimensional images (which may be slices in a n-dimensional grid).
SampleDimensions specified at construction time. The number of banks is either 1 or the number of bands.
- If the number of banks is 1, all data are packed in a single array with band indices varying fastest, then column indices (x), then row indices (y), then other dimensions.
- If the number of banks is greater than 1, then each band is stored in a separated array. In each array, sample values are stored with column indices (x) varying fastest, then row indices (y), then other dimensions. In the two-dimensional case, this layout is also known as row-major.
GridExtentof the geometry given at construction time. By default the extent size in the two first dimensions will define the image width and height, but different dimensions may be used depending on which dimensions are identified as the subspace dimensions.
Defined in the
Nested Class Summary
Constructor SummaryConstructorDescriptionConstructs a grid coverage using the specified grid geometry, sample dimensions and data type.
(GridGeometry domain, List<? extends SampleDimension> range, DataBuffer data)Constructs a grid coverage using the specified grid geometry, sample dimensions and data buffer.
Methods inherited from class GridCoverage
forConvertedValues, getCoordinateReferenceSystem, getEnvelope, getGridGeometry, getSampleDimensions, toString, toTree
dataprotected final DataBuffer dataThe sample values, potentially multi-banded. The bands may be stored either in a single bank (pixel interleaved image) or in different banks (banded image). This class detects automatically which of those two sample models is used when
Sample values in this buffer shall not be packed.
(GridGeometry domain, List<? extends SampleDimension> range, DataBuffer data)Constructs a grid coverage using the specified grid geometry, sample dimensions and data buffer. This method stores the given buffer by reference (no copy). The bands in the given buffer can be stored either in a single bank (pixel interleaved image) or in different banks (banded image). This class detects automatically which of those two sample models is used (see class javadoc for more information).
DataBufferdoes not contain any information about image size. Consequently
render(GridExtent)depends on the domain
GridExtent, which must be accurate. If the extent size does not reflect accurately the image size, then the image will not be rendered properly.
domain- the grid extent, CRS and conversion from cell indices to CRS.
range- sample dimensions for each image band.
data- the sample values, potentially multi-banded.
NullPointerException- if an argument is
IllegalArgumentException- if the data buffer has an incompatible number of banks.
IllegalGridGeometryException- if the grid extent is larger than the data buffer capacity.
ArithmeticException- if the number of cells is larger than 64 bits integer capacity.
BufferedGridCoverageConstructs a grid coverage using the specified grid geometry, sample dimensions and data type. This constructor creates a single-bank
DataBuffer(pixel interleaved sample model) with all sample values initialized to zero.
grid- the grid extent, CRS and conversion from cell indices to CRS.
bands- sample dimensions for each image band.
dataType- one of
DataBuffer.TYPE_*constants, the native data type used to store the coverage values.
ArithmeticException- if the grid size is too large.
evaluatorpublic GridEvaluator evaluator()Creates a new function for computing or interpolating sample values at given locations.
GridEvaluators are not thread-safe. For computing sample values concurrently, a new
GridEvaluatorinstance should be created for each thread.
renderReturns a two-dimensional slice of grid data as a rendered image. This method returns a view; sample values are not copied.
- Specified by:
sliceExtent- a subspace of this grid coverage extent where all dimensions except two have a size of 1 cell. May be
nullif this grid coverage has only two dimensions with a size greater than 1 cell.
- the grid slice as a rendered image.