Class TiledGridCoverage.AOI

java.lang.Object
org.apache.sis.internal.storage.TiledGridCoverage.AOI
Enclosing class:
TiledGridCoverage

protected final class TiledGridCoverage.AOI extends Object
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

    Fields
    Modifier and Type
    Field
    Description
    private int
    Current iterator position as an index in the array of tiles to be returned by TiledGridCoverage.readTiles(AOI).
    private int
    Current iterator position as an index in the vector of tiles in the TiledGridResource.
    private final int[]
    Pixel coordinates to assign to the upper-left corner of the region to render, with subsampling applied.
    final int
    Total number of tiles in the AOI, from tileLower inclusive to tileUpper exclusive.
    private final int[]
    Indices (relative to enclosing TiledGridCoverage) 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 enclosing TiledGridCoverage) after the bottom-right tile to read.
    private final int[]
    Tile Matrix Coordinates (TMC) of current iterator position relative to enclosing TiledGridCoverage.
  • Constructor Summary

    Constructors
    Constructor
    Description
    AOI(int[] tileLower, int[] tileUpper, int[] offsetAOI, int dimension)
    Creates a new Area Of Interest for the given tile indices.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns 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 by TiledGridCoverage.readTiles(AOI).
    (package private) final int
    getTileOrigin(int dimension)
    Returns the origin to assign to the tile at current iterator position.
    boolean
    Moves the iterator position to next tile.
    subset(int[] tileLower, int[] tileUpper)
    Returns a new AOI instance over a sub-region of this Area Of Interest.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • tileCountInQuery

      public final int tileCountInQuery
      Total number of tiles in the AOI, from tileLower inclusive to tileUpper exclusive. This is the length of the array to be returned by TiledGridCoverage.readTiles(AOI).
    • tileLower

      private final int[] tileLower
      Indices (relative to enclosing TiledGridCoverage) 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[] tileUpper
      Indices (relative to enclosing TiledGridCoverage) after the bottom-right tile to read.
    • offsetAOI

      private final int[] offsetAOI
      Pixel 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
      Tile Matrix Coordinates (TMC) of current iterator position relative to enclosing TiledGridCoverage. Initial position is a clone of tileLower. This array is modified by calls to next().
    • tileOffsetFull

      private final long[] tileOffsetFull
      Pixel 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 is offsetAOI multiplied by TiledGridCoverage.subsampling. This array is modified by calls to next().
    • indexInResultArray

      private int indexInResultArray
      Current iterator position as an index in the array of tiles to be returned by TiledGridCoverage.readTiles(AOI). The initial position is zero. This field is incremented by calls to next().
    • indexInTileVector

      private int indexInTileVector
      Current iterator position as an index in the vector of tiles in the TiledGridResource. Tiles are assumed stored in a row-major fashion. This field is incremented by calls to next().
  • 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 enclosing TiledGridCoverage) of the upper-left tile to read.
      tileUpper - indices (relative to enclosing TiledGridCoverage) 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 the TiledGridCoverage grid extent.
  • Method Details

    • subset

      public TiledGridCoverage.AOI subset(int[] tileLower, int[] tileUpper)
      Returns a new AOI 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 this AOI. The tileLower and tileUpper 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 this AOI.
      Parameters:
      tileLower - indices (relative to enclosing TiledGridCoverage) of the upper-left tile to read.
      tileUpper - indices (relative to enclosing TiledGridCoverage) after the bottom-right tile to read.
      Returns:
      a new AOI instance for the specified sub-region.
    • getCoverage

      final TiledGridCoverage 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 by TiledGridCoverage.readTiles(AOI). The initial position is zero. The position is incremented by 1 in each call to next().
      Returns:
      current iterator position in result array.
    • getCachedTile

      public Raster 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, or false if the iteration is finished.