Package org.apache.sis.internal.storage
Class TiledGridCoverage
java.lang.Object
org.apache.sis.coverage.BandedCoverage
org.apache.sis.coverage.grid.GridCoverage
org.apache.sis.internal.storage.TiledGridCoverage
Base class of grid coverage read from a resource where data are stored in tiles.
This grid coverage may represent only a subset of the coverage resource.
Tiles are read from the storage only when first needed.
Cell Coordinates
When there is no subsampling, this coverage uses the same cell coordinates than the originating resource. When there is a subsampling, cell coordinates in this coverage are divided by the subsampling factors. Conversions are done bytoFullResolution(long, int).
Tile coordinate matrix
In eachTiledGridCoverage, indices of tiles starts at (0, 0, …).
This class does not use the same tile indices than the coverage resource
in order to avoid integer overflow.- Since:
- 1.1
- Version:
- 1.2
- Author:
- Martin Desruisseaux (Geomatys)
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected final classThe Area Of Interest specified by user in a call torender(GridExtent).protected static classSnapshot of aTiledGridCoverage.AOIiterator position.Nested classes/interfaces inherited from class org.apache.sis.coverage.grid.GridCoverage
GridCoverage.Evaluator -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final intNumber of dimensions in a rendered image.protected final ColorModelThe Java2D color model for images rendered from this coverage.protected final NumberThe value to use for filling empty spaces in rasters, ornullif zero.protected final int[]Indices ofTiledGridResourcebands which have been retained for inclusion in thisTiledGridCoverage, in strictly increasing order.protected final SampleModelThe sample model for all rasters.protected static final intThe dimensions of x and y axes.protected static final intThe dimensions of x and y axes.Fields inherited from class org.apache.sis.coverage.grid.GridCoverage
gridGeometry -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCreates a new tiled grid coverage. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract org.opengis.util.GenericNameReturns a unique name that identifies this coverage.protected LocaleReturns the locale for error messages, ornullfor the default.protected final intReturns the number of pixels in a single bank element.protected final intgetSubsampling(int dimension) Returns the subsampling in the given dimension.protected final intgetTileSize(int dimension) Returns the size of all tiles in the domain of thisTiledGridCoverage, without clipping and subsampling.protected abstract Raster[]readTiles(TiledGridCoverage.AOI iterator) Returns all tiles in the given area of interest.render(GridExtent sliceExtent) Returns a two-dimensional slice of grid data as a rendered image.Methods inherited from class org.apache.sis.coverage.grid.GridCoverage
createConvertedValues, evaluator, forConvertedValues, getCoordinateReferenceSystem, getEnvelope, getGridGeometry, getSampleDimensions, toString, toTree
-
Field Details
-
BIDIMENSIONAL
protected static final int BIDIMENSIONALNumber of dimensions in a rendered image. Used for identifying codes where a two-dimensional slice is assumed.- See Also:
-
X_DIMENSION
protected static final int X_DIMENSIONThe dimensions of x and y axes. Static constants for now, may become configurable fields in the future.- See Also:
-
Y_DIMENSION
protected static final int Y_DIMENSIONThe dimensions of x and y axes. Static constants for now, may become configurable fields in the future.- See Also:
-
includedBands
protected final int[] includedBandsIndices ofTiledGridResourcebands which have been retained for inclusion in thisTiledGridCoverage, in strictly increasing order. An "included" band is stored in memory but not necessarily visible to the user, because theSampleModelcan be configured for ignoring some bands. This array isnullif all bands shall be included.If the user specified bands out of order, the change of band order is taken in account by the sample
model. ThisincludedBandsarray does not apply any change of order for making sequential readings easier. -
model
The sample model for all rasters. The width and height of this sample model are the two first elements oftileSizedivided by subsampling and clipped to the domain. If user requested to read only a subset of the bands, then this sample model is already the subset. -
colors
The Java2D color model for images rendered from this coverage. -
fillValue
The value to use for filling empty spaces in rasters, ornullif zero.
-
-
Constructor Details
-
TiledGridCoverage
Creates a new tiled grid coverage. All parameters should have been validated before this call.- Parameters:
subset- description of theTiledGridResourcesubset to cover.- Throws:
ArithmeticException- if the number of tiles overflows 32 bits integer arithmetic.
-
-
Method Details
-
getIdentifier
protected abstract org.opengis.util.GenericName getIdentifier()Returns a unique name that identifies this coverage. The name shall be unique in theTileMatrixSet.- Returns:
- an human-readable identification of this coverage.
-
getLocale
Returns the locale for error messages, ornullfor the default.- Returns:
- the locale for warning or error messages, or
nullif unspecified.
-
getTileSize
protected final int getTileSize(int dimension) Returns the size of all tiles in the domain of thisTiledGridCoverage, without clipping and subsampling.- Parameters:
dimension- dimension for which to get tile size.- Returns:
- tile size in the given dimension, without clipping and subsampling.
-
getSubsampling
protected final int getSubsampling(int dimension) Returns the subsampling in the given dimension.- Parameters:
dimension- dimension for which to get subsampling.- Returns:
- subsampling as a value ≥ 1.
-
getPixelsPerElement
protected final int getPixelsPerElement()Returns the number of pixels in a single bank element. This is usually 1, except forMultiPixelPackedSampleModelwhich packs many pixels in a single bank element. This value is a power of 2 accordingMultiPixelPackedSampleModelspecification.Note: this is "pixels per element", not "samples per element". It makes a difference in theSinglePixelPackedSampleModelcase, for which this method returns 1 (by contrast a "samples per element" would give a value greater than 1). But this value can nevertheless be understood as a "samples per element" value where only one band is considered at a time.- Returns:
- number of pixels in a single bank element. Usually 1.
- See Also:
-
render
Returns a two-dimensional slice of grid data as a rendered image.- Specified by:
renderin classGridCoverage- Parameters:
sliceExtent- a subspace of this grid coverage extent, ornullfor the whole image.- Returns:
- the grid slice as a rendered image. Image location is relative to
sliceExtent.
-
readTiles
protected abstract Raster[] readTiles(TiledGridCoverage.AOI iterator) throws IOException, DataStoreException Returns all tiles in the given area of interest. Tile indices are relative to thisTiledGridCoverage: (0,0) is the tile in the upper-left corner of thisTiledGridCoverage(not necessarily the upper-left corner of the image in theTiledGridResource). TheRaster.getMinX()andgetMinY()coordinates of returned rasters shall start at the giveniterator.offsetAOIvalues.This method must be thread-safe. It is implementer responsibility to ensure synchronization, for example using
AbstractResource.getSynchronizationLock().- Parameters:
iterator- an iterator over the tiles that intersect the Area Of Interest specified by user.- Returns:
- tiles decoded from the
TiledGridResource. - Throws:
IOException- if an I/O error occurred.DataStoreException- if a logical error occurred.RuntimeException- if the Java2D image cannot be created for another reason (too many exception types to list them all).
-