Class SubOperationInfo
java.lang.Object
org.apache.sis.referencing.operation.SubOperationInfo
Information about the operation from a source component to a target component in
CompoundCRS instances.
An instance of SubOperationInfo is created for each target CRS component. This class allows to collect
information about all operation steps before to start the creation of pass-through operations. This separation
is useful for applying reordering.- Since:
- 0.7
- Version:
- 1.1
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Class<?>[][]Types of target CRS, together with the type of CRS that may be used as the source for that target.private final double[]The constant values to store in target coordinates, ornullif none.private final intThe first dimension (inclusive) and the last dimension (exclusive) where theSingleCRSstarts/ends in the full (usually compound) CRS.(package private) final org.opengis.referencing.operation.CoordinateOperationThe coordinate operation between a source CRS component and a target CRS component.private final intThe first dimension (inclusive) and the last dimension (exclusive) where theSingleCRSstarts/ends in the full (usually compound) CRS.(package private) final intIndex of this instance in the array ofSubOperationInfoinstances, before the reordering applied bygetSourceCRS(SubOperationInfo[]). -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateSubOperationInfo(int targetComponentIndex, org.opengis.referencing.operation.CoordinateOperation operation, double[] constants, int startAtDimension, int endAtDimension) Creates a new instance wrapping the given coordinate operation or coordinate constants. -
Method Summary
Modifier and TypeMethodDescription(package private) static MatrixSIScreateConstantOperation(SubOperationInfo[] selected, int n, int srcDim, int tgtDim) Returns the matrix of an operation setting some coordinates to a constant values.(package private) static SubOperationInfo[]createSteps(CoordinateOperationFinder caller, List<? extends org.opengis.referencing.crs.SingleCRS> sources, List<? extends org.opengis.referencing.crs.SingleCRS> targets) Searches in given list of source components for operations capable to transform coordinates to each target CRS.(package private) static org.opengis.referencing.crs.CoordinateReferenceSystem[]getSourceCRS(SubOperationInfo[] selected) Returns the source CRS of given operations.(package private) static intindexOfFinal(SubOperationInfo[] selected) Returns the index of the last non-identity operation.(package private) final booleanReturnstrueif the coordinate operation wrapped by this object is an identity transform.(package private) static MatrixSISsourceToSelected(int sourceDimensions, SubOperationInfo[] selected) Returns a matrix for an affine transform moving coordinate values from their position in the source CRS to a position in the orderoperations are applied.private static Class<?>type(org.opengis.referencing.crs.SingleCRS crs) Returns the class of the given CRS after unwrapping derived and projected CRS.
-
Field Details
-
COMPATIBLE_TYPES
Types of target CRS, together with the type of CRS that may be used as the source for that target. For each arrayCOMPATIBLE_TYPES[i], the first element (i.e.COMPATIBLE_TYPES[i][0]) is the target CRS and the whole array (including the first element) gives the valid source CRS type, if preference order.Example: if a target CRS is of typeVerticalCRS, then the source CRS may be anotherVerticalCRSor aGeodeticCRS. The geodetic CRS is possible because it may be three-dimensional.ProjectedCRSandDerivedCRSare not in this list because we rather use their base CRS as the criterion for determining their type. -
operation
final org.opengis.referencing.operation.CoordinateOperation operation -
constants
private final double[] constantsThe constant values to store in target coordinates, ornullif none. This array is usually null. It may be non-null if no source CRS component has been found for a target CRS component. For example, if the source CRS has (x, y) axes and the target CRS has (x, y, t) axes, then this array may be set to a non-null value for specifying the t value. The array length is the number of dimensions in the full (usually compound) target CRS, but only the coordinate values for sourceless dimensions are used. Other coordinates are ignored and can be NaN. Exactly one ofoperationorconstantsshall be non-null. -
startAtDimension
private final int startAtDimensionThe first dimension (inclusive) and the last dimension (exclusive) where theSingleCRSstarts/ends in the full (usually compound) CRS. It may be an index in source dimensions or in target dimensions, depending on the following rules: -
endAtDimension
private final int endAtDimensionThe first dimension (inclusive) and the last dimension (exclusive) where theSingleCRSstarts/ends in the full (usually compound) CRS. It may be an index in source dimensions or in target dimensions, depending on the following rules: -
targetComponentIndex
final int targetComponentIndexIndex of this instance in the array ofSubOperationInfoinstances, before the reordering applied bygetSourceCRS(SubOperationInfo[]).
-
-
Constructor Details
-
SubOperationInfo
private SubOperationInfo(int targetComponentIndex, org.opengis.referencing.operation.CoordinateOperation operation, double[] constants, int startAtDimension, int endAtDimension) Creates a new instance wrapping the given coordinate operation or coordinate constants. Exactly one ofoperationorconstantsshall be non-null.
-
-
Method Details
-
type
Returns the class of the given CRS after unwrapping derived and projected CRS. The returned type is for use withCOMPATIBLE_TYPES. -
createSteps
static SubOperationInfo[] createSteps(CoordinateOperationFinder caller, List<? extends org.opengis.referencing.crs.SingleCRS> sources, List<? extends org.opengis.referencing.crs.SingleCRS> targets) throws org.opengis.util.FactoryException, org.opengis.referencing.operation.TransformException Searches in given list of source components for operations capable to transform coordinates to each target CRS. There is oneSubOperationInfoper target CRS because we need to satisfy all target dimensions, while it is okay to ignore some source dimensions. If an operation cannot be found, then this method returnsnull.- Parameters:
caller- the object which is inferring a coordinate operation.sources- all components of the source CRS.targets- all components of the target CRS.- Returns:
- information about each coordinate operation from a source CRS to a target CRS, or
null. - Throws:
org.opengis.util.FactoryException- if an error occurred while grabbing a coordinate operation.org.opengis.referencing.operation.TransformException- if an error occurred while computing the sourceless coordinate constants.
-
getSourceCRS
static org.opengis.referencing.crs.CoordinateReferenceSystem[] getSourceCRS(SubOperationInfo[] selected) Returns the source CRS of given operations. This method modifies the given array in-place by moving all sourceless operations last. Then an array is returned with the source CRS of only ordinary operations. Each CRS at index i in the returned array is the component fromstartAtDimensioninclusive toendAtDimensionexclusive in the complete (usually compound) source CRS analyzed byCoordinateOperationFinder.- Parameters:
selected- all operations from source to targetCompoundCRS.- Returns:
- source CRS of all ordinary operations (excluding operations producing constant values).
-
indexOfFinal
Returns the index of the last non-identity operation. This is used as a slight optimization for deciding whenCoordinateOperationFindercan stop to create intermediate targetCompoundCRSinstances because all remaining operations leave target coordinates unchanged. It may help to skip a few operations for example when converting (x, y, t) coordinates where t value is unchanged.- Parameters:
selected- all operations from source to targetCompoundCRS.- Returns:
- index of the last non-identity operation, inclusive.
-
sourceToSelected
Returns a matrix for an affine transform moving coordinate values from their position in the source CRS to a position in the orderoperations are applied. This matrix is needed becauseoperationmay select any source CRS in the list ofSingleCRSgiven to thecreateSteps(…)method; the source CRS are not necessarily picked in the same order as they appear in the list.Example: if the source CRS has (x, y, t) coordinates and the target CRS has (t, x, y) coordinates with some operation applied on x and y, then the operations will be applied in that order:Furthermore, some dimensions may be dropped, e.g. from (x, y, t) to (x, y).- An operation for t, because it is the first coordinate to appear in target CRS.
- An operation for (x, y), because those coordinates are next in target CRS.
DefaultPassThroughOperationcannot take coordinates before the "first affected coordinate" dimension and move them into the "trailing coordinates" dimension, we have to reorder coordinates before to create the pass-through operations. This is done by the following matrix:- Parameters:
sourceDimensions- number of dimensions in the sourceCompoundCRS.selected- all operations from source to targetCompoundCRS.- Returns:
- mapping from source
CompoundCRSto eachCoordinateOperation.getSourceCRS().
-
isIdentity
final boolean isIdentity()Returnstrueif the coordinate operation wrapped by this object is an identity transform. -
createConstantOperation
static MatrixSIS createConstantOperation(SubOperationInfo[] selected, int n, int srcDim, int tgtDim) Returns the matrix of an operation setting some coordinates to a constant values.- Parameters:
selected- all operations from source to targetCompoundCRS.n- index of the first selected operation which describe a constant value.srcDim- number of dimensions in the target CRS of previous operation step.tgtDim- number of dimensions in the full (usually compound) target CRS.
-