org.geotools.referencing.operation.transform
Class ConcatenatedTransform

java.lang.Object
  extended byorg.geotools.referencing.wkt.Formattable
      extended byorg.geotools.referencing.operation.transform.AbstractMathTransform
          extended byorg.geotools.referencing.operation.transform.ConcatenatedTransform
All Implemented Interfaces:
org.opengis.referencing.operation.MathTransform, java.io.Serializable

public class ConcatenatedTransform
extends AbstractMathTransform
implements java.io.Serializable

Base class for concatenated transform. Concatenated transforms are serializable if all their step transforms are serializables.

Since:
2.0
Version:
$Id: ConcatenatedTransform.java 17672 2006-01-19 00:25:55Z desruisseaux $
Author:
Martin Desruisseaux
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class org.geotools.referencing.operation.transform.AbstractMathTransform
AbstractMathTransform.Inverse
 
Field Summary
 org.opengis.referencing.operation.MathTransform transform1
          The first math transform.
 org.opengis.referencing.operation.MathTransform transform2
          The second math transform.
 
Constructor Summary
protected ConcatenatedTransform(org.opengis.referencing.operation.MathTransform transform1, org.opengis.referencing.operation.MathTransform transform2)
          Constructs a concatenated transform.
 
Method Summary
static org.opengis.referencing.operation.MathTransform create(org.opengis.referencing.operation.MathTransform tr1, org.opengis.referencing.operation.MathTransform tr2)
          Constructs a concatenated transform.
 org.opengis.referencing.operation.Matrix derivative(org.opengis.spatialschema.geometry.DirectPosition point)
          Gets the derivative of this transform at a point.
 org.opengis.referencing.operation.Matrix derivative(java.awt.geom.Point2D point)
          Gets the derivative of this transform at a point.
 boolean equals(java.lang.Object object)
          Compares the specified object with this math transform for equality.
protected  java.lang.String formatWKT(Formatter formatter)
          Format the inner part of a Well Known Text (WKT) element.
 int getSourceDimensions()
          Gets the dimension of input points.
 int getTargetDimensions()
          Gets the dimension of output points.
 int hashCode()
          Returns a hash value for this transform.
 org.opengis.referencing.operation.MathTransform inverse()
          Creates the inverse transform of this object.
 boolean isIdentity()
          Tests whether this transform does not move any points.
 org.opengis.spatialschema.geometry.DirectPosition transform(org.opengis.spatialschema.geometry.DirectPosition ptSrc, org.opengis.spatialschema.geometry.DirectPosition ptDst)
          Transforms the specified and stores the result in .
 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 org.geotools.referencing.operation.transform.AbstractMathTransform
createTransformedShape, ensureNonNull, getDimSource, getDimTarget, getParameterDescriptors, getParameterValues, needCopy, rollLongitude, transform
 
Methods inherited from class org.geotools.referencing.wkt.Formattable
toString, toWKT, toWKT, toWKT
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.opengis.referencing.operation.MathTransform
toWKT
 

Field Detail

transform1

public final org.opengis.referencing.operation.MathTransform transform1
The first math transform.


transform2

public final org.opengis.referencing.operation.MathTransform transform2
The second math transform.

Constructor Detail

ConcatenatedTransform

protected ConcatenatedTransform(org.opengis.referencing.operation.MathTransform transform1,
                                org.opengis.referencing.operation.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 org.opengis.referencing.operation.MathTransform create(org.opengis.referencing.operation.MathTransform tr1,
                                                                     org.opengis.referencing.operation.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.
To Do:
We could add one more optimisation: if one transform is a matrix and the other transform is a PassThroughTransform, and if the matrix as 0 elements for all rows matching the PassThrough sub-transform, then we can get ride of the whole PassThroughTransform object.

getSourceDimensions

public final int getSourceDimensions()
Gets the dimension of input points.

Specified by:
getSourceDimensions in interface org.opengis.referencing.operation.MathTransform
Specified by:
getSourceDimensions in class AbstractMathTransform

getTargetDimensions

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

Specified by:
getTargetDimensions in interface org.opengis.referencing.operation.MathTransform
Specified by:
getTargetDimensions in class AbstractMathTransform

transform

public org.opengis.spatialschema.geometry.DirectPosition transform(org.opengis.spatialschema.geometry.DirectPosition ptSrc,
                                                                   org.opengis.spatialschema.geometry.DirectPosition ptDst)
                                                            throws org.opengis.referencing.operation.TransformException
Transforms the specified and stores the result in .

Specified by:
transform in interface org.opengis.referencing.operation.MathTransform
Overrides:
transform in class AbstractMathTransform
Throws:
org.opengis.referencing.operation.TransformException

transform

public void transform(double[] srcPts,
                      int srcOff,
                      double[] dstPts,
                      int dstOff,
                      int numPts)
               throws org.opengis.referencing.operation.TransformException
Transforms a list of coordinate point ordinal values.

Specified by:
transform in interface org.opengis.referencing.operation.MathTransform
Throws:
org.opengis.referencing.operation.TransformException

transform

public void transform(float[] srcPts,
                      int srcOff,
                      float[] dstPts,
                      int dstOff,
                      int numPts)
               throws org.opengis.referencing.operation.TransformException
Transforms a list of coordinate point ordinal values.

Specified by:
transform in interface org.opengis.referencing.operation.MathTransform
Overrides:
transform in class AbstractMathTransform
Throws:
org.opengis.referencing.operation.TransformException

inverse

public final org.opengis.referencing.operation.MathTransform inverse()
                                                              throws org.opengis.referencing.operation.NoninvertibleTransformException
Creates the inverse transform of this object.

Specified by:
inverse in interface org.opengis.referencing.operation.MathTransform
Overrides:
inverse in class AbstractMathTransform
Throws:
org.opengis.referencing.operation.NoninvertibleTransformException

derivative

public org.opengis.referencing.operation.Matrix derivative(java.awt.geom.Point2D point)
                                                    throws org.opengis.referencing.operation.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:
org.opengis.referencing.operation.TransformException - if the derivative can't be evaluated at the specified point.
See Also:
MathTransform2D.derivative(Point2D)

derivative

public org.opengis.referencing.operation.Matrix derivative(org.opengis.spatialschema.geometry.DirectPosition point)
                                                    throws org.opengis.referencing.operation.TransformException
Gets the derivative of this transform at a point.

Specified by:
derivative in interface org.opengis.referencing.operation.MathTransform
Overrides:
derivative in class AbstractMathTransform
Parameters:
point - The coordinate point where to evaluate the derivative.
Returns:
The derivative at the specified point (never ).
Throws:
org.opengis.referencing.operation.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. This a way too conservative aproach, but it it doesn't hurt since ConcatenatedTransform should not have been created if it were to result in an identity transform (this case should have been detected earlier).

Specified by:
isIdentity in interface org.opengis.referencing.operation.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(java.lang.Object object)
Compares the specified object with this math transform for equality.

Overrides:
equals in class AbstractMathTransform

formatWKT

protected java.lang.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.


Copyright © GeoTools. All Rights Reserved.