Class GridSlice

java.lang.Object
org.apache.sis.storage.aggregate.GridSlice

final class GridSlice extends Object
A grid resource which is a slice in a larger coverage. A slice is not necessarily 1 cell tick; larger slices are accepted.

Usage context

Instances of Gridslice are grouped by CRS, then instances having the same CRS are grouped by "grid to CRS" transform in the Group.members list.
Since:
1.3
Version:
1.3
  • Field Details

  • Constructor Details

  • Method Details

    • setOffset

      private void setOffset(MatrixSIS groupToSlice)
      Sets the offset terms to the values of the translation columns of the given matrix. This method shall be invoked if and only if isIntegerTranslation(Matrix) returned true.
      Parameters:
      groupToSlice - conversion from source coordinates of GroupByTransform.gridToCRS to grid coordinates of geometry.
      See Also:
    • isIntegerTranslation

      private static boolean isIntegerTranslation(org.opengis.referencing.operation.Matrix groupToSlice)
      Returns true if the given matrix is the identity matrix except for translation terms. Translation terms must be integer values.
      Parameters:
      groupToSlice - conversion from GroupByTransform.gridToCRS source coordinates to
      invalid reference
      #gridToCRS
      source coordinates.
      Returns:
      whether the matrix is identity, ignoring integer translation.
      See Also:
    • getList

      final GroupByTransform getList(List<GroupByCRS<GroupByTransform>> groups, MergeStrategy strategy) throws org.opengis.referencing.operation.NoninvertibleTransformException
      Returns the group of objects associated to the CRS and "grid to CRS" transform. The CRS comparisons ignore metadata and transform comparisons ignore integer translations. This method takes a synchronization lock on the given list.
      Parameters:
      groups - the list where to search for a group.
      strategy - algorithm to apply when more than one grid coverage can be found at the same grid index.
      Returns:
      group of objects associated to the given transform (never null).
      Throws:
      org.opengis.referencing.operation.NoninvertibleTransformException - if the transform is not invertible.
    • getGridExtent

      final GridExtent getGridExtent()
      Returns the grid extent of this slice. The grid coordinate system is specific to this slice. For converting grid coordinates to the concatenated grid coordinate system, offset must be subtracted.
    • getGridExtent

      final void getGridExtent(int i, DimensionSelector[] writeTo)
      Writes information about grid extent into the given DimensionSelector objects. This is invoked by GroupByTransform.findConcatenatedDimensions() for choosing a dimension to concatenate.
    • getGridLow

      final long getGridLow(int dim)
      Returns the low grid index in the given dimension, relative to the grid of the group. This is invoked by
      invalid reference
      GroupByTransform#sortAndGetLows(int)
      for sorting coverages.
      Parameters:
      dim - dimension of the desired grid coordinates.
      Returns:
      low index in the coordinate system of the group grid.
    • getOffset

      final long[] getOffset(Map<GridSlice,long[]> shared)
      Returns the translation from source coordinates of GroupByTransform.gridToCRS to grid coordinates of geometry. This method returns a unique instance if possible.
      Parameters:
      shared - a pool of existing offset instances.
      Returns:
      translation from aggregated grid geometry to slice. Shall be considered read-only.
    • equals

      public final boolean equals(Object other)
      Compares the offset of this grid slice with the offset of given slice. This method is defined only for the purpose of getOffset(Map). Equality should not be used in other context.
      Overrides:
      equals in class Object
    • hashCode

      public final int hashCode()
      Returns a hash code for the offset consistently with equals(Object) purpose.
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Returns a string representation for debugging purposes.
      Overrides:
      toString in class Object