org.geotools.referencing.operation.transform
Class ConcatenatedTransform

Object
  extended by Formattable
      extended by AbstractMathTransform
          extended by ConcatenatedTransform
All Implemented Interfaces:
Serializable, MathTransform

public class ConcatenatedTransform
extends AbstractMathTransform
implements Serializable

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:
Serialized Form
Module:

Nested Class Summary
 
Nested classes/interfaces inherited from class AbstractMathTransform
AbstractMathTransform.Inverse
 
Field Summary
 MathTransform transform1
          The first math transform.
 MathTransform transform2
          The second math transform.
 
Fields inherited from class Formattable
SINGLE_LINE
 
Constructor Summary
protected ConcatenatedTransform(MathTransform transform1, MathTransform transform2)
          Constructs a concatenated transform.
 
Method Summary
static MathTransform create(MathTransform tr1, MathTransform tr2)
          Constructs a concatenated transform.
 Matrix derivative(DirectPosition point)
          Gets the derivative of this transform at a point.
 Matrix derivative(Point2D point)
          Gets the derivative of this transform at a point.
 boolean equals(Object object)
          Compares the specified object with this math transform for equality.
protected  String formatWKT(Formatter formatter)
          Format the inner part of a Well Known Text (WKT) element.
 int getSourceDimensions()
          Gets the dimension of input points.
 int getStepCount()
          Returns the number of math transform steps performed by this concatenated transform.
 int getTargetDimensions()
          Gets the dimension of output points.
 int hashCode()
          Returns a hash value for this transform.
 MathTransform inverse()
          Creates the inverse transform of this object.
 boolean isIdentity()
          Tests whether this transform does not move any points.
 DirectPosition transform(DirectPosition ptSrc, DirectPosition ptDst)
          Transforms the specified ptSrc and stores the result in ptDst.
 void transform(double[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts)
          Transforms a list of coordinate point ordinal values.
 void transform(float[] srcPts, int srcOff, float[] dstPts, int dstOff, int numPts)
          Transforms a list of coordinate point ordinal values.
 
Methods inherited from class AbstractMathTransform
createTransformedShape, ensureNonNull, getName, getParameterDescriptors, getParameterValues, needCopy, rollLongitude, transform, transform, transform
 
Methods inherited from class Formattable
toString, toWKT, toWKT, toWKT
 
Methods inherited from class Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface MathTransform
toWKT
 

Field Detail

transform1

public final MathTransform transform1
The first math transform.


transform2

public final MathTransform transform2
The second math transform.

Constructor Detail

ConcatenatedTransform

protected ConcatenatedTransform(MathTransform transform1,
                                MathTransform transform2)
Constructs a concatenated transform. This constructor is for subclasses only. To create a concatenated transform, use the factory method create(org.opengis.referencing.operation.MathTransform, org.opengis.referencing.operation.MathTransform) instead.

Parameters:
transform1 - The first math transform.
transform2 - The second math transform.
Method Detail

create

public static MathTransform create(MathTransform tr1,
                                   MathTransform tr2)
Constructs a concatenated transform. This factory method checks for step transforms dimension. The returned transform will implements MathTransform2D if source and target dimensions are equal to 2. Likewise, it will implements MathTransform1D if source and target dimensions are equal to 1. MathTransform implementations 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:
getSourceDimensions in interface MathTransform
Specified by:
getSourceDimensions in class AbstractMathTransform

getTargetDimensions

public final int getTargetDimensions()
Gets the dimension of output points.

Specified by:
getTargetDimensions in interface MathTransform
Specified by:
getTargetDimensions in class AbstractMathTransform

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

public DirectPosition transform(DirectPosition ptSrc,
                                DirectPosition ptDst)
                         throws TransformException
Transforms the specified ptSrc and stores the result in ptDst.

Specified by:
transform in interface MathTransform
Overrides:
transform in class AbstractMathTransform
Throws:
TransformException

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 by transform1, then the intermediate points are transformed by transform2. The transformations are performed without intermediate buffer if it can be avoided.

Specified by:
transform in interface MathTransform
Throws:
TransformException

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 type double[], transformed by transform1 first, then by transform2 and finally the result is casted to float primitive type and stored in the destination array. The use of double primitive type for intermediate results is necesssary for reducing rounding errors.

Specified by:
transform in interface MathTransform
Overrides:
transform in class AbstractMathTransform
Throws:
TransformException

inverse

public MathTransform inverse()
                      throws NoninvertibleTransformException
Creates the inverse transform of this object.

Specified by:
inverse in interface MathTransform
Overrides:
inverse in class AbstractMathTransform
Throws:
NoninvertibleTransformException

derivative

public Matrix derivative(Point2D point)
                  throws TransformException
Gets the derivative of this transform at a point. This method delegates to the derivative(DirectPosition) method because the transformation steps transform1 and transform2 may not be instances of MathTransform2D.

Overrides:
derivative in class AbstractMathTransform
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:
MathTransform2D.derivative(Point2D)

derivative

public Matrix derivative(DirectPosition point)
                  throws TransformException
Gets the derivative of this transform at a point.

Specified by:
derivative in interface MathTransform
Overrides:
derivative in class AbstractMathTransform
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:
isIdentity in interface MathTransform
Overrides:
isIdentity in class AbstractMathTransform

hashCode

public final int hashCode()
Returns a hash value for this transform.

Overrides:
hashCode in class AbstractMathTransform

equals

public final boolean equals(Object object)
Compares the specified object with this math transform for equality.

Overrides:
equals in class AbstractMathTransform
Parameters:
object - The object to compare with this transform.
Returns:
true if the given object is a transform of the same class and if, given identical source position, the transformed position would be the equals.

formatWKT

protected String formatWKT(Formatter formatter)
Format the inner part of a Well Known Text (WKT) element.

Overrides:
formatWKT in class AbstractMathTransform
Parameters:
formatter - The formatter to use.
Returns:
The WKT element name.
See Also:
Formattable.toWKT(), Formattable.toString()


Copyright © 1996-2009 Geotools. All Rights Reserved.