Class TiledGridCoverage.TileIterator
Object
TiledGridCoverage.AOI
TileIterator
- Enclosing class:
TiledGridCoverage
An iterator over the tiles to read. Instances of this class are computed by
TiledGridCoverage.render(GridExtent)
and given to TiledGridCoverage.readTiles(TileIterator). The latter is the method that subclasses need to override.- Since:
- 1.7
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal intTotal number of tiles in the AOI, fromtileLowerinclusive totileUpperexclusive. -
Method Summary
Modifier and TypeMethodDescriptionReturns the extent of the full region to read (all tiles) in units of the originating resource.imageToResource(Rectangle bounds, boolean tight) Converts cell coordinates from pixel coordinates to the originating resource.booleannext()Moves the iterator position to next tile.resourceToImage(Rectangle bounds, boolean tight) Converts cell coordinates from the originating resource to pixel coordinates.Methods inherited from class TiledGridCoverage.AOI
cache, createRaster, getCachedTile, getRegionInsideTile, getRegionInsideTile, getTileCoordinatesInResource, getTileIndexInResource, getTileIndexInResultArray, getTileLocation, getUncroppedTileLocation, moveRasterModifier and TypeMethodDescriptionStores the given raster in the cache for the current AOI position.Creates an initially empty raster for the tile at the current AOI position.Returns the cached tile for current AOI position.getRegionInsideTile(boolean subsampled) Returns the coordinates of the pixels to read relative to the current tile's upper-left corner.booleangetRegionInsideTile(long[] lower, long[] upper, long[] subsampling, boolean subsampled) Returns the clipped coordinates of the cells to read relative to the tile's upper-left corner.final long[]Returns the current AOI position in the tile matrix of the original resource.final intReturns the current AOI position as an index in the vector of tiles of the original resource.final intReturns the current AOI position as an index in the array of tiles to be returned byTiledGridCoverage.readTiles(…).Creates the coordinates of the upper-left corner of the tile at the current AOI position.Returns the location (relative to the cropped tile) of the upper-left corner of the uncropped tile.moveRaster(Raster tile) Returns the given raster relocated at the current AOI position.
-
Field Details
-
tileCountInQuery
public final int tileCountInQueryTotal number of tiles in the AOI, fromtileLowerinclusive totileUpperexclusive. This is the length of the array to be returned byTiledGridCoverage.readTiles(TileIterator).
-
-
Method Details
-
getFullRegionInResourceCoordinates
Returns the extent of the full region to read (all tiles) in units of the originating resource. The returned extent does not change during the iteration process (this method is not available inTiledGridCoverage.Snapshotfor that reason). This method is typically invoked only at the beginning of the iteration process, when knowing in advance the full read region allows some optimizations.The returned region is based on the user's request in her/his call to
TiledGridCoverage.render(GridExtent), but is not necessarily identical. The render method may have expanded or clipped the user's request. The returned extent may be larger than the actual resource extent because it may be rounded to an integer number of chunks.- Returns:
- extent of all tiles to be traversed by this iterator, in units of the originating resource.
-
resourceToImage
Converts cell coordinates from the originating resource to pixel coordinates. Iftightistrue, this method returns the smallest bounding box of interest for a reader which will apply subsampling. SeeimageToResource(Rectangle, boolean)for a discussion of the trade-off.- Parameters:
bounds- the coordinates to convert.tight- whether to return the smallest bounding box.- Returns:
- the converted coordinates.
- Throws:
ArithmeticException- if the result cannot be expressed as 32-bits integers.
-
imageToResource
Converts cell coordinates from pixel coordinates to the originating resource. Iftightistrue, this method returns the smallest bounding box of interest for a reader which will apply subsampling. Iffalse, this method uses a more straightforward calculation which may result in a larger bounding box, with right and bottom areas possibly containing pixels that should be skipped by subsampling.The latter case is sometime desirable when the caller may compute scale factors as the ratio of the size of different rectangles. For such calculations, tight bounding boxes may be confusing.
- Parameters:
bounds- the coordinates to convert.tight- whether to return the smallest bounding box, at the cost of less straightforward rectangle size.- Returns:
- the image coordinates converted to resource coordinates.
- Throws:
ArithmeticException- if the result cannot be expressed as 32-bits integers.
-
next
public boolean next()Moves the iterator position to next tile. This method should be invoked in a loop as below:do { // Process current tile. } while (domain.next());- Returns:
trueon success, orfalseif the iteration is finished.
-