public class PassThroughTransform extends AbstractMathTransform implements Serializable
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 = PassThroughTransform.create(2, feetToMetres, 0); // Three-dimensional conversion.
PassThroughTransform is immutable and thread-safe if its subTransform is also
immutable and thread-safe.
MathTransforms.compound(MathTransform...),
Serialized FormDefined in the sis-referencing module
AbstractMathTransform.Inverse| Modifier | Constructor and Description |
|---|---|
protected |
PassThroughTransform(int firstAffectedOrdinate,
MathTransform subTransform,
int numTrailingOrdinates)
Constructor for sub-classes.
|
| Modifier and Type | Method and Description |
|---|---|
protected int |
computeHashCode()
Computes a hash value for this transform.
|
static MathTransform |
create(int firstAffectedOrdinate,
MathTransform subTransform,
int numTrailingOrdinates)
Creates a transform which passes through a subset of ordinates to another transform.
|
Matrix |
derivative(DirectPosition point)
Gets the derivative of this transform at a point.
|
boolean |
equals(Object object,
ComparisonMode mode)
Compares the specified object with this math transform for equality.
|
protected String |
formatTo(Formatter formatter)
Formats this transform as a Well Known Text version 1 (WKT 1) element.
|
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.
|
int |
getSourceDimensions()
Gets the dimension of input points.
|
MathTransform |
getSubTransform()
Returns the sub-transform to apply on the modified coordinates.
|
int |
getTargetDimensions()
Gets the dimension of output points.
|
MathTransform |
inverse()
Creates the inverse transform of this object.
|
boolean |
isIdentity()
Tests whether this transform does not move any points.
|
Matrix |
transform(double[] srcPts,
int srcOff,
double[] dstPts,
int dstOff,
boolean derivate)
Transforms a single coordinate in a list of ordinal values, and opportunistically
computes the transform derivative if requested.
|
void |
transform(double[] srcPts,
int srcOff,
double[] dstPts,
int dstOff,
int numPts)
Transforms many coordinates in a list of ordinal values.
|
void |
transform(double[] srcPts,
int srcOff,
float[] dstPts,
int dstOff,
int numPts)
Transforms many coordinates in a list of ordinal values.
|
void |
transform(float[] srcPts,
int srcOff,
double[] dstPts,
int dstOff,
int numPts)
Transforms many coordinates in a list of ordinal values.
|
void |
transform(float[] srcPts,
int srcOff,
float[] dstPts,
int dstOff,
int numPts)
Transforms many coordinates in a list of ordinal values.
|
equals, getContextualParameters, getParameterDescriptors, getParameterValues, hashCode, transform, tryConcatenateprint, toString, toString, toWKTclone, finalize, getClass, notify, notifyAll, wait, wait, waittoWKTprotected PassThroughTransform(int firstAffectedOrdinate,
MathTransform subTransform,
int numTrailingOrdinates)
create(int, MathTransform, int) factory method instead,
since the most optimal pass-through transform for the given subTransform is not necessarily
a PassThroughTransform instance.firstAffectedOrdinate - index of the first affected ordinate.subTransform - the sub-transform to apply on modified coordinates.numTrailingOrdinates - number of trailing ordinates to pass through.create(int, MathTransform, int)public static MathTransform create(int firstAffectedOrdinate, MathTransform subTransform, int numTrailingOrdinates)
Source: firstAffectedOrdinate + subTransform.getSourceDimensions() + numTrailingOrdinates Target: firstAffectedOrdinate + subTransform.getTargetDimensions() + numTrailingOrdinatesAffected ordinates will range from
firstAffectedOrdinate inclusive to
dimTarget - numTrailingOrdinates exclusive.firstAffectedOrdinate - index of the first affected ordinate.subTransform - the sub-transform to apply on modified coordinates.numTrailingOrdinates - number of trailing ordinates to pass through.PassThroughTransform instance.public final int getSourceDimensions()
getSourceDimensions in interface MathTransformgetSourceDimensions in class AbstractMathTransformDefaultOperationMethod.getSourceDimensions()public final int getTargetDimensions()
getTargetDimensions in interface MathTransformgetTargetDimensions in class AbstractMathTransformDefaultOperationMethod.getTargetDimensions()public final int[] getModifiedCoordinates()
modifiedCoordinates array. Instead, SIS uses the firstAffectedOrdinate
and numTrailingOrdinates information 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 a modifiedCoordinates
array in a future SIS version.DefaultPassThroughOperation.getModifiedCoordinates()public final MathTransform getSubTransform()
DefaultPassThroughOperation.getOperation()public boolean isIdentity()
PassThroughTransform
is identity if the sub-transform is also identity.isIdentity in interface MathTransformisIdentity in class AbstractMathTransformpublic Matrix transform(double[] srcPts, int srcOff, double[] dstPts, int dstOff, boolean derivate) throws TransformException
transform in class AbstractMathTransformsrcPts - the array containing the source coordinate (can not be null).srcOff - the offset to the point to be transformed in the source array.dstPts - the array into which the transformed coordinate is returned. May be the same than srcPts.
May be null if only the derivative matrix is desired.dstOff - the offset to the location of the transformed point that is stored in the destination array.derivate - true for computing the derivative, or false if not needed.null if the derivate argument is false.TransformException - if the sub-transform failed.AbstractMathTransform.derivative(DirectPosition),
AbstractMathTransform.transform(DirectPosition, DirectPosition),
MathTransforms.derivativeAndTransform(MathTransform, double[], int, double[], int)public void transform(double[] srcPts,
int srcOff,
double[] dstPts,
int dstOff,
int numPts)
throws TransformException
transform in interface MathTransformtransform in class AbstractMathTransformsrcPts - 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.TransformException - if the sub-transform failed.public void transform(float[] srcPts,
int srcOff,
float[] dstPts,
int dstOff,
int numPts)
throws TransformException
transform in interface MathTransformtransform in class AbstractMathTransformsrcPts - 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.TransformException - if the sub-transform failed.public void transform(double[] srcPts,
int srcOff,
float[] dstPts,
int dstOff,
int numPts)
throws TransformException
transform in interface MathTransformtransform in class AbstractMathTransformsrcPts - 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.TransformException - if the sub-transform failed.public void transform(float[] srcPts,
int srcOff,
double[] dstPts,
int dstOff,
int numPts)
throws TransformException
transform in interface MathTransformtransform in class AbstractMathTransformsrcPts - 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.TransformException - if the sub-transform failed.public Matrix derivative(DirectPosition point) throws TransformException
derivative in interface MathTransformderivative in class AbstractMathTransformpoint - the coordinate point where to evaluate the derivative.null).TransformException - if the sub-transform failed.public MathTransform inverse() throws NoninvertibleTransformException
inverse in interface MathTransforminverse in class AbstractMathTransformNoninvertibleTransformException - if the sub-transform is not invertible.protected int computeHashCode()
AbstractMathTransform.hashCode() when first needed.computeHashCode in class AbstractMathTransformpublic boolean equals(Object object, ComparisonMode mode)
equals in interface LenientComparableequals in class AbstractMathTransformobject - the object to compare with this transform.mode - the strictness level of the comparison. Default to STRICT.true if the given object is considered equals to this math transform.Utilities.deepEquals(Object, Object, ComparisonMode)protected String formatTo(Formatter formatter)
PassThrough_MT is 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 this PassThroughTransform can not be formatted as valid WKT 1 neither).formatTo in class AbstractMathTransformformatter - the formatter to use."PassThrough_MT".FormattableObject.toWKT(),
FormattableObject.toString()Copyright © 2010–2017 The Apache Software Foundation. All rights reserved.