Class IdentityTransform
- Object
-
- Formattable
-
- AbstractMathTransform
-
- IdentityTransform
-
- All Implemented Interfaces:
Serializable
,MathTransform
,LinearTransform
public class IdentityTransform extends AbstractMathTransform implements LinearTransform, Serializable
The identity transform. The data are only copied without any transformation. This class is used for identity transform of dimension greater than 2. For 1D and 2D identity transforms,LinearTransform1D
andAffineTransform
already provide their own optimisations.- Since:
- 2.0
- Author:
- Martin Desruisseaux (IRD)
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class AbstractMathTransform
AbstractMathTransform.Inverse
-
-
Field Summary
-
Fields inherited from class Formattable
SINGLE_LINE
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
IdentityTransform(int dimension)
Constructs an identity transform of the specified dimension.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static LinearTransform
create(int dimension)
Constructs an identity transform of the specified dimension.Matrix
derivative(Position point)
Gets the derivative of this transform at a point.boolean
equals(Object object)
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.int
hashCode()
Returns a hash value for this transform.MathTransform
inverse()
Returns the inverse transform of this object, which is this transform itselfboolean
isIdentity()
Tests whether this transform does not move any points.boolean
isIdentity(double tolerance)
Tests whether this transform does not move any points.void
transform(double[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts)
Transforms an array of floating point coordinates by this transform.void
transform(float[] srcPts, int srcOff, float[] dstPts, int dstOff, int numPts)
Transforms an array of floating point coordinates by this transform.Position
transform(Position ptSrc, Position ptDst)
Copies the values fromptSrc
toptDst
.-
Methods inherited from class AbstractMathTransform
createTransformedShape, derivative, ensureNonNull, formatWKT, getName, needCopy, normalizeAngle, rollLongitude, transform, transform, transform
-
Methods inherited from class Formattable
cleanupThreadLocals, toString, toWKT, toWKT, toWKT, toWKT
-
Methods inherited from interface MathTransform
toWKT, transform, transform
-
-
-
-
Method Detail
-
create
public static LinearTransform create(int dimension)
Constructs an identity transform of the specified dimension.
-
isIdentity
public boolean isIdentity()
Tests whether this transform does not move any points. This implementation always returnstrue
.- Specified by:
isIdentity
in interfaceMathTransform
- Overrides:
isIdentity
in classAbstractMathTransform
- Returns:
true
if thisMathTransform
is an identity transform;false
otherwise.
-
isIdentity
public boolean isIdentity(double tolerance)
Tests whether this transform does not move any points. This implementation always returnstrue
.- Specified by:
isIdentity
in interfaceLinearTransform
- Parameters:
tolerance
- The tolerance factor.- Returns:
true
if this transform is the identity one
-
getSourceDimensions
public int getSourceDimensions()
Gets the dimension of input points.- Specified by:
getSourceDimensions
in interfaceMathTransform
- Specified by:
getSourceDimensions
in classAbstractMathTransform
- Returns:
- The dimension of input points.
-
getTargetDimensions
public int getTargetDimensions()
Gets the dimension of output points.- Specified by:
getTargetDimensions
in interfaceMathTransform
- Specified by:
getTargetDimensions
in classAbstractMathTransform
- Returns:
- The dimension of output points.
-
getParameterDescriptors
public ParameterDescriptorGroup getParameterDescriptors()
Returns the parameter descriptors for this math transform.- Overrides:
getParameterDescriptors
in classAbstractMathTransform
- 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.- Overrides:
getParameterValues
in classAbstractMathTransform
- Returns:
- A copy of the parameter values for this math transform.
- See Also:
Operation.getParameterValues()
-
getMatrix
public Matrix getMatrix()
Returns a copy of the identity matrix.- Specified by:
getMatrix
in interfaceLinearTransform
- Returns:
- A copy of the underlying matrix.
-
derivative
public Matrix derivative(Position point)
Gets the derivative of this transform at a point. For an identity transform, the derivative is the same everywhere.- Specified by:
derivative
in interfaceMathTransform
- Overrides:
derivative
in classAbstractMathTransform
- Parameters:
point
- The coordinate point where to evaluate the derivative.- Returns:
- The derivative at the specified point (never
null
).
-
transform
public Position transform(Position ptSrc, Position ptDst)
Copies the values fromptSrc
toptDst
. Overrides the super-class method for performance reason.- Specified by:
transform
in interfaceMathTransform
- Overrides:
transform
in 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
ptSrc
and storing the result inptDst
, or a newly created point ifptDst
was null. - Since:
- 2.2
-
transform
public void transform(float[] srcPts, int srcOff, float[] dstPts, int dstOff, int numPts)
Transforms an array of floating point coordinates by this transform.- Specified by:
transform
in interfaceMathTransform
- Overrides:
transform
in 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.
-
transform
public void transform(double[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts)
Transforms an array of floating point coordinates by this transform.- Specified by:
transform
in 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.
-
inverse
public MathTransform inverse()
Returns the inverse transform of this object, which is this transform itself- Specified by:
inverse
in interfaceMathTransform
- Overrides:
inverse
in classAbstractMathTransform
- Returns:
- The inverse transform.
-
hashCode
public int hashCode()
Returns a hash value for this transform. This value need not remain consistent between different implementations of the same class.- Overrides:
hashCode
in classAbstractMathTransform
-
equals
public boolean equals(Object object)
Compares the specified object with this math transform for equality.- Overrides:
equals
in classAbstractMathTransform
- 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.
-
-