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 int
The input and output dimension.private static final LinearTransform[]
Identity transforms for dimensions ranging from to 0 to 7.private static final long
Serial number for inter-operability with different versions.Fields inherited from class org.apache.sis.referencing.operation.transform.AbstractLinearTransform
inverse
Fields inherited from class org.apache.sis.referencing.operation.transform.AbstractMathTransform
MAXIMUM_BUFFER_SIZE, MAXIMUM_FAILURES
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
IdentityTransform
(int dimension) Constructs an identity transform of the specified dimension. -
Method Summary
Modifier and TypeMethodDescriptionstatic LinearTransform
create
(int dimension) Returns an identity transform of the specified dimension.org.opengis.referencing.operation.Matrix
derivative
(org.opengis.geometry.DirectPosition point) Gets the derivative of this transform at a point.protected boolean
equalsSameClass
(Object object) Compares this math transform with an object which is known to be an instance of the same class.double
getElement
(int row, int column) Returns the matrix element at the given row and column.int
Gets the dimension of input points.int
Gets the dimension of output points.inverse()
Returns the inverse transform of this object, which is this transform itself.boolean
isAffine()
Returnstrue
since this transform is affine.boolean
Returnstrue
since this transform does not move any points.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.void
transform
(double[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts) Transforms many positions in a list of coordinate values.void
transform
(double[] srcPts, int srcOff, float[] dstPts, int dstOff, int numPts) Transforms many positions in a list of coordinate values.void
transform
(float[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts) Transforms many positions in a list of coordinate values.void
transform
(float[] srcPts, int srcOff, float[] dstPts, int dstOff, int numPts) Transforms many positions in a list of coordinate values.org.opengis.geometry.DirectPosition
transform
(org.opengis.geometry.DirectPosition ptSrc, org.opengis.geometry.DirectPosition ptDst) Copies the values fromptSrc
toptDst
.Methods inherited from class org.apache.sis.referencing.operation.transform.AbstractLinearTransform
clone, createInverse, deltaTransform, equals, getMatrix, getNumCol, getNumRow, getParameterDescriptors, getParameterValues, setElement, toString, tryConcatenate
Methods inherited from class org.apache.sis.referencing.operation.transform.AbstractMathTransform
beforeFormat, computeHashCode, equals, formatTo, getContextualParameters, getDomain, hashCode, isInverseEquals, mismatchedDimension
Methods inherited from class org.apache.sis.io.wkt.FormattableObject
print, toString, toWKT
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods 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 ofLinearTransform1D
orAffineTransform2D
respectively.- Parameters:
dimension
- the dimension of the transform to be returned.- Returns:
- an identity transform of the specified dimension.
- See Also:
-
isAffine
public boolean isAffine()Returnstrue
since this transform is affine.- Specified by:
isAffine
in interfaceLinearTransform
- Overrides:
isAffine
in classAbstractLinearTransform
- Returns:
true
if this transform is affine, orfalse
otherwise.- See Also:
-
isIdentity
public boolean isIdentity()Returnstrue
since this transform does not move any points.- Specified by:
isIdentity
in interfaceorg.opengis.referencing.operation.MathTransform
- Specified by:
isIdentity
in interfaceorg.opengis.referencing.operation.Matrix
- Overrides:
isIdentity
in classAbstractMathTransform
-
getSourceDimensions
public int getSourceDimensions()Gets the dimension of input points.- Specified by:
getSourceDimensions
in interfaceorg.opengis.referencing.operation.MathTransform
- Specified by:
getSourceDimensions
in classAbstractMathTransform
- Returns:
- the number of dimensions of input points.
- See Also:
-
getTargetDimensions
public int getTargetDimensions()Gets the dimension of output points.- Specified by:
getTargetDimensions
in interfaceorg.opengis.referencing.operation.MathTransform
- Specified by:
getTargetDimensions
in 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:
derivative
in interfaceorg.opengis.referencing.operation.MathTransform
- Overrides:
derivative
in 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 fromptSrc
toptDst
. Overrides the super-class method for performance reason.- Specified by:
transform
in interfaceorg.opengis.referencing.operation.MathTransform
- Overrides:
transform
in 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
ptSrc
and storing the result inptDst
, or a newly created point ifptDst
was 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:
transform
in 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 benull
if only the derivative matrix is desired.dstOff
- the offset to the location of the transformed point that is stored in the destination array.derivate
-true
for computing the derivative, orfalse
if not needed.- Returns:
- the matrix of the transform derivative at the given source position,
or
null
if thederivate
argument 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:
transform
in interfaceorg.opengis.referencing.operation.MathTransform
- 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(float[] srcPts, int srcOff, float[] dstPts, int dstOff, int numPts) Transforms many positions in a list of coordinate values.- Specified by:
transform
in interfaceorg.opengis.referencing.operation.MathTransform
- 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, float[] dstPts, int dstOff, int numPts) Transforms many positions in a list of coordinate values.- Specified by:
transform
in interfaceorg.opengis.referencing.operation.MathTransform
- 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.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:
transform
in interfaceorg.opengis.referencing.operation.MathTransform
- 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.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:
inverse
in interfaceLinearTransform
- Specified by:
inverse
in interfaceorg.opengis.referencing.operation.MathTransform
- Overrides:
inverse
in 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:
equalsSameClass
in classAbstractLinearTransform
- Parameters:
object
- the object to compare with this transform.- Returns:
true
if the given object is considered equals to this math transform.
-