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.
Defined 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.
|
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, getParameterDescriptors, getParameterValues, hashCode, transform
print, toString, toString, toWKT
toWKT
protected 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)
Affected ordinates will range fromSource: firstAffectedOrdinate + subTransform.getSourceDimensions() + numTrailingOrdinates Target: firstAffectedOrdinate + subTransform.getTargetDimensions() + numTrailingOrdinates
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 MathTransform
getSourceDimensions
in class AbstractMathTransform
public final int getTargetDimensions()
getTargetDimensions
in interface MathTransform
getTargetDimensions
in class AbstractMathTransform
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.public final MathTransform getSubTransform()
public boolean isIdentity()
PassThroughTransform
is identity if the sub-transform is also identity.isIdentity
in interface MathTransform
isIdentity
in class AbstractMathTransform
public Matrix transform(double[] srcPts, int srcOff, double[] dstPts, int dstOff, boolean derivate) throws TransformException
transform
in class AbstractMathTransform
srcPts
- 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 MathTransform
transform
in class AbstractMathTransform
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.TransformException
- If the sub-transform failed.public void transform(float[] srcPts, int srcOff, float[] dstPts, int dstOff, int numPts) throws TransformException
transform
in interface MathTransform
transform
in class AbstractMathTransform
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.TransformException
- If the sub-transform failed.public void transform(double[] srcPts, int srcOff, float[] dstPts, int dstOff, int numPts) throws TransformException
transform
in interface MathTransform
transform
in class AbstractMathTransform
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.TransformException
- If the sub-transform failed.public void transform(float[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts) throws TransformException
transform
in interface MathTransform
transform
in class AbstractMathTransform
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.TransformException
- If the sub-transform failed.public Matrix derivative(DirectPosition point) throws TransformException
derivative
in interface MathTransform
derivative
in class AbstractMathTransform
point
- The coordinate point where to evaluate the derivative.null
).TransformException
- If the sub-transform failed.public MathTransform inverse() throws NoninvertibleTransformException
inverse
in interface MathTransform
inverse
in class AbstractMathTransform
NoninvertibleTransformException
- If the sub-transform is not invertible.protected int computeHashCode()
AbstractMathTransform.hashCode()
when first needed.computeHashCode
in class AbstractMathTransform
public boolean equals(Object object, ComparisonMode mode)
equals
in interface LenientComparable
equals
in class AbstractMathTransform
object
- 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)
public String formatTo(Formatter formatter)
PassThrough_MT
is defined in the WKT 1 specification only.formatTo
in class AbstractMathTransform
formatter
- The formatter to use."PassThrough_MT"
.FormattableObject.toWKT()
,
FormattableObject.toString()
Copyright © 2010–2015 The Apache Software Foundation. All rights reserved.