Class ConcatenatedTransform
Object
Formattable
AbstractMathTransform
ConcatenatedTransform
- All Implemented Interfaces:
Serializable,MathTransform
Base class for concatenated transform. Concatenated transforms are serializable if all their step transforms are
serializables.
- Since:
- 2.0
- Author:
- Martin Desruisseaux (IRD)
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class AbstractMathTransform
AbstractMathTransform.Inverse -
Field Summary
FieldsModifier and TypeFieldDescriptionfinal MathTransformThe first math transform.final MathTransformThe second math transform.Fields inherited from class Formattable
SINGLE_LINE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConcatenatedTransform(MathTransform transform1, MathTransform transform2) Constructs a concatenated transform. -
Method Summary
Modifier and TypeMethodDescriptionstatic MathTransformcreate(MathTransform tr1, MathTransform tr2) Constructs a concatenated transform.derivative(Point2D point) Gets the derivative of this transform at a point.derivative(Position point) Gets the derivative of this transform at a point.final booleanCompares the specified object with this math transform for equality.protected StringFormat the inner part of a Well Known Text (WKT) element.final intGets the dimension of input points.final intReturns the number of math transform steps performed by this concatenated transform.final intGets the dimension of output points.final inthashCode()Returns a hash value for this transform.inverse()Creates the inverse transform of this object.final booleanTests whether this transform does not move any points.voidtransform(double[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts) Transforms a list of coordinate point ordinal values.voidtransform(float[] srcPts, int srcOff, float[] dstPts, int dstOff, int numPts) Transforms a list of coordinate point ordinal values.Transforms the specifiedptSrcand stores the result inptDst.Methods inherited from class AbstractMathTransform
createTransformedShape, ensureNonNull, getName, getParameterDescriptors, getParameterValues, needCopy, normalizeAngle, rollLongitude, transform, transform, transformMethods inherited from class Formattable
cleanupThreadLocals, toString, toWKT, toWKT, toWKT, toWKTMethods inherited from interface MathTransform
toWKT
-
Field Details
-
transform1
The first math transform. -
transform2
The second math transform.
-
-
Constructor Details
-
ConcatenatedTransform
Constructs a concatenated transform. This constructor is for subclasses only. To create a concatenated transform, use the factory methodcreate(org.geotools.api.referencing.operation.MathTransform, org.geotools.api.referencing.operation.MathTransform)instead.- Parameters:
transform1- The first math transform.transform2- The second math transform.
-
-
Method Details
-
create
Constructs a concatenated transform. This factory method checks for step transforms dimension. The returned transform will implementsMathTransform2Dif source and target dimensions are equal to 2. Likewise, it will implementsMathTransform1Dif source and target dimensions are equal to 1.MathTransformimplementations are available in two version: direct and non-direct. The "non-direct" version use an intermediate buffer when performing transformations; they are slower and consume more memory. They are used only as a fallback when a "direct" version can't be created.- Parameters:
tr1- The first math transform.tr2- The second math transform.- Returns:
- The concatenated transform.
-
getSourceDimensions
public final int getSourceDimensions()Gets the dimension of input points.- Specified by:
getSourceDimensionsin interfaceMathTransform- Specified by:
getSourceDimensionsin classAbstractMathTransform- Returns:
- The dimension of input points.
-
getTargetDimensions
public final int getTargetDimensions()Gets the dimension of output points.- Specified by:
getTargetDimensionsin interfaceMathTransform- Specified by:
getTargetDimensionsin classAbstractMathTransform- Returns:
- The dimension of output points.
-
getStepCount
public final int getStepCount()Returns the number of math transform steps performed by this concatenated transform.- Returns:
- The number of transform steps.
- Since:
- 2.5
-
transform
Transforms the specifiedptSrcand stores the result inptDst.- Specified by:
transformin interfaceMathTransform- Overrides:
transformin classAbstractMathTransform- Parameters:
ptSrc- the specified coordinate point to be transformed.ptDst- the specified coordinate point that stores the result of transformingptSrc, ornull.- Returns:
- the coordinate point after transforming
ptSrcand storing the result inptDst, or a newly created point ifptDstwas null. - Throws:
TransformException- if the point can't be transformed.
-
transform
public void transform(double[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts) throws TransformException Transforms a list of coordinate point ordinal values. The source points are first transformed bytransform1, then the intermediate points are transformed bytransform2. The transformations are performed without intermediate buffer if it can be avoided.- Specified by:
transformin interfaceMathTransform- 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 thansrcPts.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 a point can't be transformed. Some implementations will stop at the first failure, wile some other implementations will fill the untransformable points with NaN values, continue and throw the exception only at end. Implementations that fall in the later case should set the last completed transform tothis.
-
transform
public void transform(float[] srcPts, int srcOff, float[] dstPts, int dstOff, int numPts) throws TransformException Transforms a list of coordinate point ordinal values. The source points are first copied in a temporary array of typedouble[], transformed bytransform1first, then bytransform2and finally the result is casted tofloatprimitive type and stored in the destination array. The use ofdoubleprimitive type for intermediate results is necesssary for reducing rounding errors.- Specified by:
transformin interfaceMathTransform- Overrides:
transformin classAbstractMathTransform- 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 thansrcPts.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 a point can't be transformed. Some implementations will stop at the first failure, wile some other implementations will fill the untransformable points with NaN values, continue and throw the exception only at end. Implementations that fall in the later case should set the last completed transform tothis.
-
inverse
Creates the inverse transform of this object.- Specified by:
inversein interfaceMathTransform- Overrides:
inversein classAbstractMathTransform- Returns:
- The inverse transform.
- Throws:
NoninvertibleTransformException- if the transform can't be inversed.
-
derivative
Gets the derivative of this transform at a point. This method delegates to thederivative(Position)method because the transformation stepstransform1andtransform2may not be instances ofMathTransform2D.- Overrides:
derivativein classAbstractMathTransform- Parameters:
point- The coordinate point where to evaluate the derivative.- Returns:
- The derivative at the specified point as a 2×2 matrix.
- Throws:
TransformException- if the derivative can't be evaluated at the specified point.- See Also:
-
derivative
Gets the derivative of this transform at a point.- Specified by:
derivativein interfaceMathTransform- Overrides:
derivativein classAbstractMathTransform- Parameters:
point- The coordinate point where to evaluate the derivative.- Returns:
- The derivative at the specified point (never
null). - Throws:
TransformException- if the derivative can't be evaluated at the specified point.
-
isIdentity
public final boolean isIdentity()Tests whether this transform does not move any points. Default implementation check if the two transforms are identity.- Specified by:
isIdentityin interfaceMathTransform- Overrides:
isIdentityin classAbstractMathTransform- Returns:
trueif thisMathTransformis an identity transform;falseotherwise.
-
hashCode
public final int hashCode()Returns a hash value for this transform.- Overrides:
hashCodein classAbstractMathTransform
-
equals
Compares the specified object with this math transform for equality.- Overrides:
equalsin classAbstractMathTransform- Parameters:
object- The object to compare with this transform.- Returns:
trueif the given object is a transform of the same class and if, given identical source position, the transformed position would be the equals.
-
formatWKT
Format the inner part of a Well Known Text (WKT) element.- Overrides:
formatWKTin classAbstractMathTransform- Parameters:
formatter- The formatter to use.- Returns:
- The WKT element name.
- See Also:
-