org.geotoolkit.referencing.operation.transform
Class IdentityTransform

Object
  extended by FormattableObject
      extended by AbstractMathTransform
          extended by IdentityTransform
All Implemented Interfaces:
Serializable, Formattable, LinearTransform, Parameterized, LenientComparable, MathTransform

@Immutable
public class IdentityTransform
extends AbstractMathTransform
implements LinearTransform, Serializable

The identity transform. The data are only copied without any transformation. Instance of this class are created for identity transform of dimension greater than 2. For 1D and 2D identity transforms, LinearTransform1D and AffineTransform2D already provide their own optimizations.

Since:
2.0
Version:
3.18
Author:
Martin Desruisseaux (IRD, Geomatys)
See Also:
Serialized Form
Module:
referencing/geotk-referencing (download)    View source code for this class

Nested Class Summary
 
Nested classes/interfaces inherited from class AbstractMathTransform
AbstractMathTransform.Inverse
 
Field Summary
 
Fields inherited from class FormattableObject
EPSG, GEOTIFF, INTERNAL, OGC, SINGLE_LINE
 
Constructor Summary
protected IdentityTransform(int dimension)
          Constructs an identity transform of the specified dimension.
 
Method Summary
static LinearTransform create(int dimension)
          Returns an identity transform of the specified dimension.
 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.
 Matrix getMatrix()
          Returns a copy of the identity matrix.
 ParameterDescriptorGroup getParameterDescriptors()
          Returns the parameter descriptors for this math transform.
 ParameterValueGroup getParameterValues()
          Returns the matrix elements as a group of parameters values.
 int getSourceDimensions()
          Gets the dimension of input points.
 int getTargetDimensions()
          Gets the dimension of output points.
 MathTransform inverse()
          Returns the inverse transform of this object, which is this transform itself
 boolean isIdentity()
          Tests whether this transform does not move any points.
 boolean isIdentity(double tolerance)
          Tests whether this transform does not move any points.
 DirectPosition transform(DirectPosition ptSrc, DirectPosition ptDst)
          Copies the values from ptSrc to ptDst.
protected  void transform(double[] srcPts, int srcOff, double[] dstPts, int dstOff)
          Transforms a single coordinate in a list of ordinal values.
 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.
 
Methods inherited from class AbstractMathTransform
computeHashCode, createTransformedShape, derivative, ensureNonNull, equals, formatWKT, getName, hashCode, rollLongitude, transform
 
Methods inherited from class FormattableObject
getDefaultIndentation, print, setDefaultIndentation, toString, toWKT, toWKT, toWKT
 
Methods inherited from class Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface MathTransform
toWKT
 
Methods inherited from interface LenientComparable
equals
 

Constructor Detail

IdentityTransform

protected IdentityTransform(int dimension)
Constructs an identity transform of the specified dimension.

Parameters:
dimension - The dimension of the transform to be created.
See Also:
create(int)
Method Detail

create

public static LinearTransform create(int dimension)
Returns an identity transform of the specified dimension. In the special case of dimension 1 and 2, this method returns instances of LinearTransform1D or AffineTransform2D respectively.

Parameters:
dimension - The dimension of the transform to be returned.
Returns:
An identity transform of the specified dimension.

isIdentity

public boolean isIdentity()
Tests whether this transform does not move any points. This implementation always returns true.

Specified by:
isIdentity in interface MathTransform
Overrides:
isIdentity in class AbstractMathTransform

isIdentity

public boolean isIdentity(double tolerance)
Tests whether this transform does not move any points. This implementation always returns true.

Specified by:
isIdentity in interface LinearTransform
Parameters:
tolerance - The tolerance factor.
Returns:
true if this transform is the identity one
See Also:
MatrixFactory.getMatrix(MathTransform), XMatrix.isIdentity(double)

getSourceDimensions

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

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

getTargetDimensions

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

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

getParameterDescriptors

public ParameterDescriptorGroup getParameterDescriptors()
Returns the parameter descriptors for this math transform.

Specified by:
getParameterDescriptors in interface Parameterized
Overrides:
getParameterDescriptors in class AbstractMathTransform
Returns:
The parameter descriptors for this math transform, or null.
See Also:
OperationMethod.getParameters()

getParameterValues

public ParameterValueGroup getParameterValues()
Returns the matrix elements as a group of parameters values.

Specified by:
getParameterValues in interface Parameterized
Overrides:
getParameterValues in class AbstractMathTransform
Returns:
A copy of the parameter values for this math transform.
See Also:
SingleOperation.getParameterValues()

getMatrix

public Matrix getMatrix()
Returns a copy of the identity matrix.

Specified by:
getMatrix in interface LinearTransform
Returns:
A copy of the underlying matrix.

derivative

public Matrix derivative(DirectPosition point)
Gets the derivative of this transform at a point. For an identity transform, the derivative is the same everywhere.

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).

transform

public DirectPosition transform(DirectPosition ptSrc,
                                DirectPosition ptDst)
Copies the values from ptSrc to ptDst. Overrides the super-class method for performance reason.

Specified by:
transform in interface MathTransform
Overrides:
transform in class AbstractMathTransform
Parameters:
ptSrc - the coordinate point to be transformed.
ptDst - the coordinate point that stores the result of transforming ptSrc, or null.
Returns:
the coordinate point after transforming ptSrc and storing the result in ptDst, or a newly created point if ptDst was null.
Since:
2.2

transform

protected void transform(double[] srcPts,
                         int srcOff,
                         double[] dstPts,
                         int dstOff)
Transforms a single coordinate in a list of ordinal values.

Specified by:
transform in class AbstractMathTransform
Parameters:
srcPts - The array containing the source point coordinates.
srcOff - The offset to the point to be transformed in the source array.
dstPts - the array into which the transformed point coordinate are returned. May be the same than srcPts.
dstOff - The offset to the location of the transformed point that is stored in the destination array.

transform

public void transform(double[] srcPts,
                      int srcOff,
                      double[] dstPts,
                      int dstOff,
                      int numPts)
Transforms many coordinates in a list of ordinal values.

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

transform

public void transform(float[] srcPts,
                      int srcOff,
                      float[] dstPts,
                      int dstOff,
                      int numPts)
Transforms many coordinates in a list of ordinal values.

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

transform

public void transform(double[] srcPts,
                      int srcOff,
                      float[] dstPts,
                      int dstOff,
                      int numPts)
Transforms many coordinates in a list of ordinal values.

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

transform

public void transform(float[] srcPts,
                      int srcOff,
                      double[] dstPts,
                      int dstOff,
                      int numPts)
Transforms many coordinates in a list of ordinal values.

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

inverse

public MathTransform inverse()
Returns the inverse transform of this object, which is this transform itself

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

equals

public boolean equals(Object object,
                      ComparisonMode mode)
Compares the specified object with this math transform for equality. The default implementation returns true if the following conditions are meet:

The parameter values are not compared because subclasses can typically compare those values more efficiently by accessing to their member fields.

Specified by:
equals in interface LinearTransform
Specified by:
equals in interface LenientComparable
Overrides:
equals in class AbstractMathTransform
Parameters:
object - The object to compare with this transform.
mode - The strictness level of the comparison. Default to STRICT.
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.


Copyright © 2009-2011 Geotoolkit.org. All Rights Reserved.