Class PassThroughTransform
Object
FormattableObject
AbstractMathTransform
PassThroughTransform
- All Implemented Interfaces:
- Serializable,- Parameterized,- LenientComparable,- MathTransform
Transform which passes through a subset of coordinates to another transform.
 This allows transforms to operate on a subset of coordinate values.
 
Example: giving (latitude, longitude, height) coordinates,
 
 PassThroughTransform can convert the height values from feet to meters without affecting the latitude and
 longitude values. Such transform can be built as below:
 MathTransform feetToMetres = MathTransforms.linear(0.3048, 0); // One-dimensional conversion. MathTransform tr = MathTransforms.passThrough(2, feetToMetres, 0); // Three-dimensional conversion.
Immutability and thread safety
PassThroughTransform is immutable and thread-safe if its subTransform is also
 immutable and thread-safe.
 Serialization
Serialized instances of this class are not guaranteed to be compatible with future SIS versions. Serialization should be used only for short term storage or RMI between applications running the same SIS version.- Since:
- 0.5
- See Also:
Defined in the sis-referencing module
- 
Nested Class SummaryNested classes/interfaces inherited from class AbstractMathTransformAbstractMathTransform.Inverse
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedPassThroughTransform(int firstAffectedCoordinate, MathTransform subTransform, int numTrailingCoordinates) Constructor for sub-classes.
- 
Method SummaryModifier and TypeMethodDescriptionprotected intComputes a hash value for this transform.derivative(DirectPosition point) Gets the derivative of this transform at a point.booleanequals(Object object, ComparisonMode mode) Compares the specified object with this math transform for equality.protected StringFormats this transform as a Well Known Text version 1 (WKT 1) element.final int[]Returns the ordered sequence of positive integers defining the positions in a source coordinate tuple of the coordinates affected by this pass-through operation.final intGets the dimension of input points.final MathTransformReturns the sub-transform to apply on the modified coordinates.final intGets the dimension of output points.inverse()Creates the inverse transform of this object.booleanTests whether this transform does not move any points.transform(double[] srcPts, int srcOff, double[] dstPts, int dstOff, boolean derivate) Transforms a single position in a list of coordinate values, and opportunistically computes the transform derivative if requested.voidtransform(double[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts) Transforms many positions in a list of coordinate values.voidtransform(double[] srcPts, int srcOff, float[] dstPts, int dstOff, int numPts) Transforms many positions in a list of coordinate values.voidtransform(float[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts) Transforms many positions in a list of coordinate values.voidtransform(float[] srcPts, int srcOff, float[] dstPts, int dstOff, int numPts) Transforms many positions in a list of coordinate values.protected MathTransformtryConcatenate(boolean applyOtherFirst, MathTransform other, MathTransformFactory factory) Concatenates or pre-concatenates in an optimized way this transform with the given transform, if possible.Methods inherited from class AbstractMathTransformequals, getContextualParameters, getDomain, getParameterDescriptors, getParameterValues, hashCode, transformMethods inherited from class FormattableObjectprint, toString, toString, toWKTMethods inherited from class Objectclone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface MathTransformtoWKT
- 
Constructor Details- 
PassThroughTransformprotected PassThroughTransform(int firstAffectedCoordinate, MathTransform subTransform, int numTrailingCoordinates) Constructor for sub-classes. Users should invoke the staticMathTransforms.passThrough(int, MathTransform, int)factory method instead, since the most optimal pass-through transform for the givensubTransformis not necessarily aPassThroughTransforminstance.- Parameters:
- firstAffectedCoordinate- index of the first affected coordinate.
- subTransform- the sub-transform to apply on modified coordinates.
- numTrailingCoordinates- number of trailing coordinates to pass through.
- See Also:
 
 
- 
- 
Method Details- 
getSourceDimensionspublic final int getSourceDimensions()Gets the dimension of input points. This the source dimension of the sub-transform plus the number of pass-through dimensions.- Specified by:
- getSourceDimensionsin interface- MathTransform
- Specified by:
- getSourceDimensionsin class- AbstractMathTransform
- Returns:
- the number of dimensions of input points.
- See Also:
 
- 
getTargetDimensionspublic final int getTargetDimensions()Gets the dimension of output points. This the target dimension of the sub-transform plus the number of pass-through dimensions.- Specified by:
- getTargetDimensionsin interface- MathTransform
- Specified by:
- getTargetDimensionsin class- AbstractMathTransform
- Returns:
- the number of dimensions of output points.
- See Also:
 
- 
getModifiedCoordinatespublic final int[] getModifiedCoordinates()Returns the ordered sequence of positive integers defining the positions in a source coordinate tuple of the coordinates affected by this pass-through operation.API note: this method is final for now because most of Apache SIS code do not use themodifiedCoordinatesarray. Instead, SIS uses thefirstAffectedCoordinateandnumTrailingCoordinatesinformation provided to the constructor. Consequently, overriding this method may be misleading since it would be ignored by SIS. We do not want to make the "really used" fields public in order to keep the flexibility to replace them by amodifiedCoordinatesarray in a future SIS version.- Returns:
- Zero-based indices of the modified source coordinates.
- See Also:
 
- 
getSubTransformReturns the sub-transform to apply on the modified coordinates. This is often the sub-transform specified at construction time, but not necessarily.- Returns:
- the sub-transform.
- See Also:
 
- 
isIdentitypublic boolean isIdentity()Tests whether this transform does not move any points. APassThroughTransformis identity if the sub-transform is also identity.- Specified by:
- isIdentityin interface- MathTransform
- Overrides:
- isIdentityin class- AbstractMathTransform
- Returns:
 
- 
transformpublic Matrix transform(double[] srcPts, int srcOff, double[] dstPts, int dstOff, boolean derivate) throws TransformException Transforms a single position in a list of coordinate values, and opportunistically computes the transform derivative if requested.- Specified by:
- transformin class- AbstractMathTransform
- Parameters:
- srcPts- the array containing the source coordinates (cannot be- null).
- srcOff- the offset to the point to be transformed in the source array.
- dstPts- the array into which the transformed coordinates is returned. May be the same than- srcPts. May be- nullif only the derivative matrix is desired.
- dstOff- the offset to the location of the transformed point that is stored in the destination array.
- derivate-- truefor computing the derivative, or- falseif not needed.
- Returns:
- the matrix of the transform derivative at the given source position,
         or nullif thederivateargument isfalse.
- Throws:
- TransformException- if the sub-transform failed.
- See Also:
 
- 
transformpublic void transform(double[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts) throws TransformException Transforms many positions in a list of coordinate values.- Specified by:
- transformin interface- MathTransform
- Overrides:
- transformin class- AbstractMathTransform
- Parameters:
- srcPts- the array containing the source point coordinates.
- srcOff- the offset to the first point to be transformed in the source array.
- dstPts- the array into which the transformed point coordinates are returned. May be the same than- srcPts.
- dstOff- the offset to the location of the first transformed point that is stored in the destination array.
- numPts- the number of point objects to be transformed.
- Throws:
- TransformException- if the sub-transform failed.
 
- 
transformpublic void transform(float[] srcPts, int srcOff, float[] dstPts, int dstOff, int numPts) throws TransformException Transforms many positions in a list of coordinate values.- Specified by:
- transformin interface- MathTransform
- Overrides:
- transformin class- AbstractMathTransform
- Parameters:
- srcPts- the array containing the source point coordinates.
- srcOff- the offset to the first point to be transformed in the source array.
- dstPts- the array into which the transformed point coordinates are returned. May be the same than- srcPts.
- dstOff- the offset to the location of the first transformed point that is stored in the destination array.
- numPts- the number of point objects to be transformed.
- Throws:
- TransformException- if the sub-transform failed.
 
- 
transformpublic void transform(double[] srcPts, int srcOff, float[] dstPts, int dstOff, int numPts) throws TransformException Transforms many positions in a list of coordinate values.- Specified by:
- transformin interface- MathTransform
- Overrides:
- transformin class- AbstractMathTransform
- Parameters:
- srcPts- the array containing the source point coordinates.
- srcOff- the offset to the first point to be transformed in the source array.
- dstPts- the array into which the transformed point coordinates are returned.
- dstOff- the offset to the location of the first transformed point that is stored in the destination array.
- numPts- the number of point objects to be transformed.
- Throws:
- TransformException- if the sub-transform failed.
 
- 
transformpublic void transform(float[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts) throws TransformException Transforms many positions in a list of coordinate values.- Specified by:
- transformin interface- MathTransform
- Overrides:
- transformin class- AbstractMathTransform
- Parameters:
- srcPts- the array containing the source point coordinates.
- srcOff- the offset to the first point to be transformed in the source array.
- dstPts- the array into which the transformed point coordinates are returned.
- dstOff- the offset to the location of the first transformed point that is stored in the destination array.
- numPts- the number of point objects to be transformed.
- Throws:
- TransformException- if the sub-transform failed.
 
- 
derivativeGets the derivative of this transform at a point.- Specified by:
- derivativein interface- MathTransform
- Overrides:
- derivativein class- AbstractMathTransform
- Parameters:
- point- the coordinate tuple where to evaluate the derivative.
- Returns:
- the derivative at the specified point (never null).
- Throws:
- TransformException- if the sub-transform failed.
 
- 
inverseCreates the inverse transform of this object.- Specified by:
- inversein interface- MathTransform
- Overrides:
- inversein class- AbstractMathTransform
- Returns:
- Throws:
- NoninvertibleTransformException- if the sub-transform is not invertible.
 
- 
tryConcatenateprotected MathTransform tryConcatenate(boolean applyOtherFirst, MathTransform other, MathTransformFactory factory) throws FactoryException Concatenates or pre-concatenates in an optimized way this transform with the given transform, if possible. This method applies the following special cases:- If the other transform is also a PassThroughTransform, then the two transforms may be merged in a singlePassThroughTransforminstance.
- If the other transform discards some dimensions, verify if we still need a PassThroughTransform.
 - Overrides:
- tryConcatenatein class- AbstractMathTransform
- Parameters:
- applyOtherFirst-- trueif the transformation order is- otherfollowed by- this, or- falseif the transformation order is- thisfollowed by- other.
- other- the other math transform to (pre-)concatenate with this transform.
- factory- the factory which is (indirectly) invoking this method, or- nullif none.
- Returns:
- the simplified transform, or nullif no such optimization is available.
- Throws:
- FactoryException- if an error occurred while combining the transforms.
- Since:
- 1.0
- See Also:
 
- If the other transform is also a 
- 
computeHashCodeprotected int computeHashCode()Computes a hash value for this transform. This method is invoked byAbstractMathTransform.hashCode()when first needed.- Overrides:
- computeHashCodein class- AbstractMathTransform
- Returns:
- the hash code value. This value may change between different execution of the Apache SIS library.
 
- 
equalsCompares the specified object with this math transform for equality.- Specified by:
- equalsin interface- LenientComparable
- Overrides:
- equalsin class- AbstractMathTransform
- Parameters:
- object- the object to compare with this transform.
- mode- the strictness level of the comparison. Default to- STRICT.
- Returns:
- trueif the given object is considered equals to this math transform.
- See Also:
 
- 
formatToFormats this transform as a Well Known Text version 1 (WKT 1) element.Compatibility note:PassThrough_MTis defined in the WKT 1 specification only. If the formatter convention is set to WKT 2, then this method silently uses the WKT 1 convention without raising an error (unless thisPassThroughTransformcannot be formatted as valid WKT 1 neither).- Overrides:
- formatToin class- AbstractMathTransform
- Parameters:
- formatter- the formatter to use.
- Returns:
- the WKT element name, which is "PassThrough_MT".
- See Also:
 
 
-