Package org.apache.sis.internal.storage
Class TiledGridCoverage.AOI
java.lang.Object
org.apache.sis.internal.storage.TiledGridCoverage.AOI
- Enclosing class:
TiledGridCoverage
The Area Of Interest specified by user in a call to
TiledGridCoverage.render(GridExtent)
.
This class is also an iterator over tiles in the region of interest.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate int
Current iterator position as an index in the array of tiles to be returned byTiledGridCoverage.readTiles(AOI)
.private int
Current iterator position as an index in the vector of tiles in theTiledGridResource
.private final int[]
Pixel coordinates to assign to the upper-left corner of the region to render, with subsampling applied.final int
private final int[]
Indices (relative to enclosingTiledGridCoverage
) of the upper-left tile to read.private final long[]
Pixel coordinates of current iterator position relative to the Area Of Interest specified by user.private final int[]
Indices (relative to enclosingTiledGridCoverage
) after the bottom-right tile to read.private final int[]
Tile Matrix Coordinates (TMC) of current iterator position relative to enclosingTiledGridCoverage
. -
Constructor Summary
ConstructorsConstructorDescriptionAOI
(int[] tileLower, int[] tileUpper, int[] offsetAOI, int dimension) Creates a new Area Of Interest for the given tile indices. -
Method Summary
Modifier and TypeMethodDescriptionReturns the cached tile for current iterator position.(package private) final TiledGridCoverage
Returns the enclosing coverage.final int
Returns the current iterator position as an index in the array of tiles to be returned byTiledGridCoverage.readTiles(AOI)
.(package private) final int
getTileOrigin
(int dimension) Returns the origin to assign to the tile at current iterator position.boolean
next()
Moves the iterator position to next tile.subset
(int[] tileLower, int[] tileUpper) Returns a newAOI
instance over a sub-region of this Area Of Interest.
-
Field Details
-
tileCountInQuery
public final int tileCountInQueryTotal number of tiles in the AOI, fromtileLower
inclusive totileUpper
exclusive. This is the length of the array to be returned byTiledGridCoverage.readTiles(AOI)
. -
tileLower
private final int[] tileLowerIndices (relative to enclosingTiledGridCoverage
) of the upper-left tile to read. Tile indices starts at (0, 0, …), not at the indices of the corresponding tile in resource, for avoiding integer overflow. -
tileUpper
private final int[] tileUpperIndices (relative to enclosingTiledGridCoverage
) after the bottom-right tile to read. -
offsetAOI
private final int[] offsetAOIPixel coordinates to assign to the upper-left corner of the region to render, with subsampling applied. This is the difference between the region requested by user and the region which will be rendered. -
tmcInSubset
private final int[] tmcInSubset -
tileOffsetFull
private final long[] tileOffsetFullPixel coordinates of current iterator position relative to the Area Of Interest specified by user. Those coordinates are in units of the full resolution image. Initial position isoffsetAOI
multiplied byTiledGridCoverage.subsampling
. This array is modified by calls tonext()
. -
indexInResultArray
private int indexInResultArrayCurrent iterator position as an index in the array of tiles to be returned byTiledGridCoverage.readTiles(AOI)
. The initial position is zero. This field is incremented by calls tonext()
. -
indexInTileVector
private int indexInTileVectorCurrent iterator position as an index in the vector of tiles in theTiledGridResource
. Tiles are assumed stored in a row-major fashion. This field is incremented by calls tonext()
.
-
-
Constructor Details
-
AOI
AOI(int[] tileLower, int[] tileUpper, int[] offsetAOI, int dimension) Creates a new Area Of Interest for the given tile indices.- Parameters:
tileLower
- indices (relative to enclosingTiledGridCoverage
) of the upper-left tile to read.tileUpper
- indices (relative to enclosingTiledGridCoverage
) after the bottom-right tile to read.offsetAOI
- pixel coordinates to assign to the upper-left corner of the subsampled region to render.dimension
- number of dimension of theTiledGridCoverage
grid extent.
-
-
Method Details
-
subset
Returns a newAOI
instance over a sub-region of this Area Of Interest. The region is specified by tile indices, with (0,0) being the first tile of the enclosing grid coverage. The given region is intersected with the region of thisAOI
. ThetileLower
andtileUpper
array can have any length; extra indices are ignored and missing indices are inherited from this AOI. This method is independent to the iterator position of thisAOI
.- Parameters:
tileLower
- indices (relative to enclosingTiledGridCoverage
) of the upper-left tile to read.tileUpper
- indices (relative to enclosingTiledGridCoverage
) after the bottom-right tile to read.- Returns:
- a new
AOI
instance for the specified sub-region.
-
getCoverage
Returns the enclosing coverage. -
getIndexInResultArray
public final int getIndexInResultArray()Returns the current iterator position as an index in the array of tiles to be returned byTiledGridCoverage.readTiles(AOI)
. The initial position is zero. The position is incremented by 1 in each call tonext()
.- Returns:
- current iterator position in result array.
-
getCachedTile
Returns the cached tile for current iterator position.- Returns:
- cached tile at current iterator position, or
null
if none. - See Also:
-
getTileOrigin
final int getTileOrigin(int dimension) Returns the origin to assign to the tile at current iterator position. Note that the subsampling should be a divisor of tile size, otherwise a drift in pixel coordinates will appear. There is two exceptions to this rule:- If image is untiled (i.e. there is only one tile), we allow to read a sub-region of the unique tile.
- If subsampling is larger than tile size.
-
next
public boolean next()Moves the iterator position to next tile. This method should be invoked in a loop as below:- Returns:
true
on success, orfalse
if the iteration is finished.
-