Package org.apache.sis.storage.aggregate
Class GridSlice
java.lang.Object
org.apache.sis.storage.aggregate.GridSlice
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 ofGridslice 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 Summary
FieldsModifier and TypeFieldDescriptionprivate final GridGeometryGeometry of the grid coverage or resource.private final long[]Translation from source coordinates ofGroupByTransform.gridToCRSto grid coordinates ofgeometry.(package private) final GridCoverageResourceThe resource associated to this slice. -
Constructor Summary
ConstructorsConstructorDescriptionGridSlice(GridCoverageResource slice) Creates a new slice for the specified resource. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanCompares the offset of this grid slice with the offset of given slice.(package private) final GridExtentReturns the grid extent of this slice.(package private) final voidgetGridExtent(int i, DimensionSelector[] writeTo) Writes information about grid extent into the givenDimensionSelectorobjects.(package private) final longgetGridLow(int dim) Returns the low grid index in the given dimension, relative to the grid of the group.(package private) final GroupByTransformgetList(List<GroupByCRS<GroupByTransform>> groups, MergeStrategy strategy) Returns the group of objects associated to the CRS and "grid to CRS" transform.(package private) final long[]Returns the translation from source coordinates ofGroupByTransform.gridToCRSto grid coordinates ofgeometry.final inthashCode()Returns a hash code for the offset consistently withequals(Object)purpose.private static booleanisIntegerTranslation(org.opengis.referencing.operation.Matrix groupToSlice) Returnstrueif the given matrix is the identity matrix except for translation terms.private voidSets theoffsetterms to the values of the translation columns of the given matrix.toString()Returns a string representation for debugging purposes.
-
Field Details
-
resource
The resource associated to this slice. -
geometry
Geometry of the grid coverage or resource. -
offset
private final long[] offsetTranslation from source coordinates ofGroupByTransform.gridToCRSto grid coordinates ofgeometry. Shall be considered read-only after initialization ofsetOffset(MatrixSIS).
-
-
Constructor Details
-
GridSlice
GridSlice(GridCoverageResource slice) throws DataStoreException Creates a new slice for the specified resource.- Parameters:
slice- resource associated to this slice.- Throws:
DataStoreException
-
-
Method Details
-
setOffset
Sets theoffsetterms to the values of the translation columns of the given matrix. This method shall be invoked if and only ifisIntegerTranslation(Matrix)returnedtrue.- Parameters:
groupToSlice- conversion from source coordinates ofGroupByTransform.gridToCRSto grid coordinates ofgeometry.- See Also:
-
isIntegerTranslation
private static boolean isIntegerTranslation(org.opengis.referencing.operation.Matrix groupToSlice) Returnstrueif the given matrix is the identity matrix except for translation terms. Translation terms must be integer values.- Parameters:
groupToSlice- conversion fromGroupByTransform.gridToCRSsource coordinates to#gridToCRSsource 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
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,offsetmust be subtracted. -
getGridExtent
Writes information about grid extent into the givenDimensionSelectorobjects. This is invoked byGroupByTransform.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 byGroupByTransform#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
Returns the translation from source coordinates ofGroupByTransform.gridToCRSto grid coordinates ofgeometry. 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
Compares the offset of this grid slice with the offset of given slice. This method is defined only for the purpose ofgetOffset(Map). Equality should not be used in other context. -
hashCode
public final int hashCode()Returns a hash code for the offset consistently withequals(Object)purpose. -
toString
Returns a string representation for debugging purposes.
-