Class TiledGridCoverage.Snapshot

java.lang.Object
org.apache.sis.internal.storage.TiledGridCoverage.Snapshot
Direct Known Subclasses:
DataSubset.Tile
Enclosing class:
TiledGridCoverage

protected static class TiledGridCoverage.Snapshot extends Object
Snapshot of a TiledGridCoverage.AOI iterator position. Those snapshots can be created during an iteration for processing a tile later. For example, a TiledGridCoverage.readTiles(AOI) method implementation may want to create a list of all tiles to load before to start the actual reading process in order to read the tiles in some optimal order, or for combining multiple read operations in a single operation.
  • Field Details

    • coverage

      private final TiledGridCoverage coverage
      The source coverage.
    • tmcInSubset

      private final int[] tmcInSubset
      Tile Matrix Coordinates (TMC) relative to the enclosing TiledGridCoverage. Tile (0,0) is the tile in the upper-left corner of this TiledGridCoverage, not necessarily the tile in the upper-left corner of the image in the resource.
    • indexInResultArray

      public final int indexInResultArray
      Index of this tile in the array of tiles returned by TiledGridCoverage.readTiles(AOI).
    • indexInTileVector

      public final int indexInTileVector
      Index of this tile in the TiledGridResource. In a GeoTIFF image, this is the index of the tile in the tileOffsets and tileByteCounts vectors. This index is also used as key in the TiledGridCoverage.rasters map.
    • originX

      public final int originX
      Pixel coordinates of the upper-left corner of the tile.
    • originY

      public final int originY
      Pixel coordinates of the upper-left corner of the tile.
  • Constructor Details

    • Snapshot

      public Snapshot(TiledGridCoverage.AOI iterator)
      Stores information about a tile to be loaded.
      Parameters:
      iterator - the iterator for which to create a snapshot of its current position.
  • Method Details

    • getRegionInsideTile

      public boolean getRegionInsideTile(long[] lower, long[] upper, int[] subsampling, int dimension)
      Returns the coordinate of the pixel to read inside the tile, ignoring subsampling. The tile upper-left corner is assumed (0,0). Consequently, the lower coordinates are usually (0,0) and the upper coordinates are usually the tile size, but those value may be different if the enclosing TiledGridCoverage contains only one (potentially big) tile. In that case, the reading process is more like untiled image reading.

      The TiledGridCoverage subsampling is provided for convenience, but is constant for all tiles regardless the subregion to read. The same values can be obtained by TiledGridCoverage.getSubsampling(int).

      Parameters:
      lower - a pre-allocated array where to store relative coordinates of the first pixel.
      upper - a pre-allocated array where to store relative coordinates after the last pixel.
      subsampling - a pre-allocated array where to store subsampling.
      dimension - number of elements to write in the lower and upper arrays.
      Returns:
      true on success, or false if the tile is empty.
    • cache

      public Raster cache(Raster tile)
      Stores the given raster in the cache. If another raster existed previously in the cache, the old raster will be reused if it has the same size and model, or discarded otherwise. The latter case may happen if TiledGridCoverage.AOI.getCachedTile() determined that a cached raster exists but cannot be reused.
      Parameters:
      tile - the raster to cache.
      Returns:
      the cached raster. Should be the given raster instance, but this method check for concurrent caching as a paranoiac check.
      See Also: