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 and
AffineTransform already provide their own optimisations.- Since:
- 2.0
- Author:
- Martin Desruisseaux (IRD)
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class AbstractMathTransform
AbstractMathTransform.Inverse -
Field Summary
Fields inherited from class Formattable
SINGLE_LINE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedIdentityTransform(int dimension) Constructs an identity transform of the specified dimension. -
Method Summary
Modifier and TypeMethodDescriptionstatic LinearTransformcreate(int dimension) Constructs an identity transform of the specified dimension.derivative(Position point) Gets the derivative of this transform at a point.booleanCompares the specified object with this math transform for equality.Returns a copy of the identity matrix.Returns the parameter descriptors for this math transform.Returns the matrix elements as a group of parameters values.intGets the dimension of input points.intGets the dimension of output points.inthashCode()Returns a hash value for this transform.inverse()Returns the inverse transform of this object, which is this transform itselfbooleanTests whether this transform does not move any points.booleanisIdentity(double tolerance) Tests whether this transform does not move any points.voidtransform(double[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts) Transforms an array of floating point coordinates by this transform.voidtransform(float[] srcPts, int srcOff, float[] dstPts, int dstOff, int numPts) Transforms an array of floating point coordinates by this transform.Copies the values fromptSrctoptDst.Methods inherited from class AbstractMathTransform
createTransformedShape, derivative, ensureNonNull, formatWKT, getName, needCopy, normalizeAngle, rollLongitude, transform, transform, transformMethods inherited from class Formattable
cleanupThreadLocals, toString, toWKT, toWKT, toWKT, toWKTMethods inherited from interface MathTransform
toWKT, transform, transform
-
Constructor Details
-
IdentityTransform
protected IdentityTransform(int dimension) Constructs an identity transform of the specified dimension.
-
-
Method Details
-
create
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:
isIdentityin interfaceMathTransform- Overrides:
isIdentityin classAbstractMathTransform- Returns:
trueif thisMathTransformis an identity transform;falseotherwise.
-
isIdentity
public boolean isIdentity(double tolerance) Tests whether this transform does not move any points. This implementation always returnstrue.- Specified by:
isIdentityin interfaceLinearTransform- Parameters:
tolerance- The tolerance factor.- Returns:
trueif this transform is the identity one
-
getSourceDimensions
public int getSourceDimensions()Gets the dimension of input points.- Specified by:
getSourceDimensionsin interfaceMathTransform- Specified by:
getSourceDimensionsin classAbstractMathTransform- Returns:
- The dimension of input points.
-
getTargetDimensions
public int getTargetDimensions()Gets the dimension of output points.- Specified by:
getTargetDimensionsin interfaceMathTransform- Specified by:
getTargetDimensionsin classAbstractMathTransform- Returns:
- The dimension of output points.
-
getParameterDescriptors
Returns the parameter descriptors for this math transform.- Overrides:
getParameterDescriptorsin classAbstractMathTransform- Returns:
- The parameter descriptors for this math transform, or
null. - See Also:
-
getParameterValues
Returns the matrix elements as a group of parameters values.- Overrides:
getParameterValuesin classAbstractMathTransform- Returns:
- A copy of the parameter values for this math transform.
- See Also:
-
getMatrix
Returns a copy of the identity matrix.- Specified by:
getMatrixin interfaceLinearTransform- Returns:
- A copy of the underlying matrix.
-
derivative
Gets the derivative of this transform at a point. For an identity transform, the derivative is the same everywhere.- 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).
-
transform
Copies the values fromptSrctoptDst. Overrides the super-class method for performance reason.- 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. - 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:
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.
-
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:
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.
-
inverse
Returns the inverse transform of this object, which is this transform itself- Specified by:
inversein interfaceMathTransform- Overrides:
inversein 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:
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.
-