Class IdentityTransform
java.lang.Object
org.apache.sis.io.wkt.FormattableObject
org.apache.sis.referencing.operation.transform.AbstractMathTransform
org.apache.sis.referencing.operation.transform.AbstractLinearTransform
org.apache.sis.referencing.operation.transform.IdentityTransform
- All Implemented Interfaces:
Serializable,Parameterized,LinearTransform,LenientComparable,org.opengis.referencing.operation.MathTransform,org.opengis.referencing.operation.Matrix
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:
- 0.5
- Version:
- 0.6
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.sis.referencing.operation.transform.AbstractMathTransform
AbstractMathTransform.Inverse -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final intThe input and output dimension.private static final LinearTransform[]Identity transforms for dimensions ranging from to 0 to 7.private static final longSerial number for inter-operability with different versions.Fields inherited from class org.apache.sis.referencing.operation.transform.AbstractLinearTransform
inverseFields inherited from class org.apache.sis.referencing.operation.transform.AbstractMathTransform
MAXIMUM_BUFFER_SIZE, MAXIMUM_FAILURES -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateIdentityTransform(int dimension) Constructs an identity transform of the specified dimension. -
Method Summary
Modifier and TypeMethodDescriptionstatic LinearTransformcreate(int dimension) Returns an identity transform of the specified dimension.org.opengis.referencing.operation.Matrixderivative(org.opengis.geometry.DirectPosition point) Gets the derivative of this transform at a point.protected booleanequalsSameClass(Object object) Compares this math transform with an object which is known to be an instance of the same class.doublegetElement(int row, int column) Returns the matrix element at the given row and column.intGets the dimension of input points.intGets the dimension of output points.inverse()Returns the inverse transform of this object, which is this transform itself.booleanisAffine()Returnstruesince this transform is affine.booleanReturnstruesince this transform does not move any points.org.opengis.referencing.operation.Matrixtransform(double[] srcPts, int srcOff, double[] dstPts, int dstOff, boolean derivate) Transforms a single position in a list of coordinate values, and optionally returns the derivative at that location.voidtransform(double[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts) Transforms many positions in a list of coordinate values.voidtransform(double[] srcPts, int srcOff, float[] dstPts, int dstOff, int numPts) Transforms many positions in a list of coordinate values.voidtransform(float[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts) Transforms many positions in a list of coordinate values.voidtransform(float[] srcPts, int srcOff, float[] dstPts, int dstOff, int numPts) Transforms many positions in a list of coordinate values.org.opengis.geometry.DirectPositiontransform(org.opengis.geometry.DirectPosition ptSrc, org.opengis.geometry.DirectPosition ptDst) Copies the values fromptSrctoptDst.Methods inherited from class org.apache.sis.referencing.operation.transform.AbstractLinearTransform
clone, createInverse, deltaTransform, equals, getMatrix, getNumCol, getNumRow, getParameterDescriptors, getParameterValues, setElement, toString, tryConcatenateMethods inherited from class org.apache.sis.referencing.operation.transform.AbstractMathTransform
beforeFormat, computeHashCode, equals, formatTo, getContextualParameters, getDomain, hashCode, isInverseEquals, mismatchedDimensionMethods inherited from class org.apache.sis.io.wkt.FormattableObject
print, toString, toWKTMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.opengis.referencing.operation.MathTransform
toWKT
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDSerial number for inter-operability with different versions.- See Also:
-
IDENTITIES
Identity transforms for dimensions ranging from to 0 to 7. Elements in this array will be created only when first requested.- See Also:
-
dimension
private final int dimensionThe input and output dimension.
-
-
Constructor Details
-
IdentityTransform
private IdentityTransform(int dimension) Constructs an identity transform of the specified dimension.- Parameters:
dimension- the dimension of the transform to be created.- See Also:
-
-
Method Details
-
create
Returns an identity transform of the specified dimension. In the special case of dimension 1 and 2, this method returns instances ofLinearTransform1DorAffineTransform2Drespectively.- Parameters:
dimension- the dimension of the transform to be returned.- Returns:
- an identity transform of the specified dimension.
- See Also:
-
isAffine
public boolean isAffine()Returnstruesince this transform is affine.- Specified by:
isAffinein interfaceLinearTransform- Overrides:
isAffinein classAbstractLinearTransform- Returns:
trueif this transform is affine, orfalseotherwise.- See Also:
-
isIdentity
public boolean isIdentity()Returnstruesince this transform does not move any points.- Specified by:
isIdentityin interfaceorg.opengis.referencing.operation.MathTransform- Specified by:
isIdentityin interfaceorg.opengis.referencing.operation.Matrix- Overrides:
isIdentityin classAbstractMathTransform
-
getSourceDimensions
public int getSourceDimensions()Gets the dimension of input points.- Specified by:
getSourceDimensionsin interfaceorg.opengis.referencing.operation.MathTransform- Specified by:
getSourceDimensionsin classAbstractMathTransform- Returns:
- the number of dimensions of input points.
- See Also:
-
getTargetDimensions
public int getTargetDimensions()Gets the dimension of output points.- Specified by:
getTargetDimensionsin interfaceorg.opengis.referencing.operation.MathTransform- Specified by:
getTargetDimensionsin classAbstractMathTransform- Returns:
- the number of dimensions of output points.
- See Also:
-
getElement
public double getElement(int row, int column) Returns the matrix element at the given row and column. -
derivative
public org.opengis.referencing.operation.Matrix derivative(org.opengis.geometry.DirectPosition point) Gets the derivative of this transform at a point. For an identity transform, the derivative is the same everywhere.- Specified by:
derivativein interfaceorg.opengis.referencing.operation.MathTransform- Overrides:
derivativein classAbstractMathTransform- Parameters:
point- the coordinate tuple where to evaluate the derivative.- Returns:
- the derivative at the specified point (never
null).
-
transform
public org.opengis.geometry.DirectPosition transform(org.opengis.geometry.DirectPosition ptSrc, org.opengis.geometry.DirectPosition ptDst) Copies the values fromptSrctoptDst. Overrides the super-class method for performance reason.- Specified by:
transformin interfaceorg.opengis.referencing.operation.MathTransform- Overrides:
transformin classAbstractMathTransform- Parameters:
ptSrc- the coordinate tuple to be transformed.ptDst- the coordinate tuple that stores the result of transformingptSrc, ornull.- Returns:
- the coordinate tuple after transforming
ptSrcand storing the result inptDst, or a newly created point ifptDstwas null.
-
transform
public org.opengis.referencing.operation.Matrix transform(double[] srcPts, int srcOff, double[] dstPts, int dstOff, boolean derivate) Transforms a single position in a list of coordinate values, and optionally returns the derivative at that location.- Specified by:
transformin classAbstractMathTransform- Parameters:
srcPts- the array containing the source coordinates (cannot benull).srcOff- the offset to the point to be transformed in the source array.dstPts- the array into which the transformed coordinates is returned. May be the same thansrcPts. May benullif only the derivative matrix is desired.dstOff- the offset to the location of the transformed point that is stored in the destination array.derivate-truefor computing the derivative, orfalseif not needed.- Returns:
- the matrix of the transform derivative at the given source position,
or
nullif thederivateargument isfalse. - See Also:
-
transform
public void transform(double[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts) Transforms many positions in a list of coordinate values.- Specified by:
transformin interfaceorg.opengis.referencing.operation.MathTransform- 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(float[] srcPts, int srcOff, float[] dstPts, int dstOff, int numPts) Transforms many positions in a list of coordinate values.- Specified by:
transformin interfaceorg.opengis.referencing.operation.MathTransform- 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, float[] dstPts, int dstOff, int numPts) Transforms many positions in a list of coordinate values.- Specified by:
transformin interfaceorg.opengis.referencing.operation.MathTransform- 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.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 positions in a list of coordinate values.- Specified by:
transformin interfaceorg.opengis.referencing.operation.MathTransform- 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.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 interfaceLinearTransform- Specified by:
inversein interfaceorg.opengis.referencing.operation.MathTransform- Overrides:
inversein classAbstractLinearTransform- Returns:
- the inverse transform.
- See Also:
-
equalsSameClass
Compares this math transform with an object which is known to be an instance of the same class.- Specified by:
equalsSameClassin classAbstractLinearTransform- Parameters:
object- the object to compare with this transform.- Returns:
trueif the given object is considered equals to this math transform.
-