Class IdentityTransform

All Implemented Interfaces:
Serializable, Parameterized, LinearTransform, LenientComparable, org.opengis.referencing.operation.MathTransform, org.opengis.referencing.operation.Matrix

final class IdentityTransform extends AbstractLinearTransform
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
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      Serial number for inter-operability with different versions.
      See Also:
    • IDENTITIES

      private static final LinearTransform[] 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 dimension
      The 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

      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.
      See Also:
    • isAffine

      public boolean isAffine()
      Returns true since this transform is affine.
      Specified by:
      isAffine in interface LinearTransform
      Overrides:
      isAffine in class AbstractLinearTransform
      Returns:
      true if this transform is affine, or false otherwise.
      See Also:
    • isIdentity

      public boolean isIdentity()
      Returns true since this transform does not move any points.
      Specified by:
      isIdentity in interface org.opengis.referencing.operation.MathTransform
      Specified by:
      isIdentity in interface org.opengis.referencing.operation.Matrix
      Overrides:
      isIdentity in class AbstractMathTransform
    • getSourceDimensions

      public int getSourceDimensions()
      Gets the dimension of input points.
      Specified by:
      getSourceDimensions in interface org.opengis.referencing.operation.MathTransform
      Specified by:
      getSourceDimensions in class AbstractMathTransform
      Returns:
      the number of dimensions of input points.
      See Also:
    • getTargetDimensions

      public int getTargetDimensions()
      Gets the dimension of output points.
      Specified by:
      getTargetDimensions in interface org.opengis.referencing.operation.MathTransform
      Specified by:
      getTargetDimensions in class AbstractMathTransform
      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 interface org.opengis.referencing.operation.MathTransform
      Overrides:
      derivative in class AbstractMathTransform
      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 from ptSrc to ptDst. Overrides the super-class method for performance reason.
      Specified by:
      transform in interface org.opengis.referencing.operation.MathTransform
      Overrides:
      transform in class AbstractMathTransform
      Parameters:
      ptSrc - the coordinate tuple to be transformed.
      ptDst - the coordinate tuple that stores the result of transforming ptSrc, or null.
      Returns:
      the coordinate tuple after transforming ptSrc and storing the result in ptDst, or a newly created point if ptDst 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 class AbstractMathTransform
      Parameters:
      srcPts - the array containing the source coordinates (cannot be null).
      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 than srcPts. May be null 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, or false if not needed.
      Returns:
      the matrix of the transform derivative at the given source position, or null if the derivate argument is false.
      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 interface org.opengis.referencing.operation.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 positions in a list of coordinate values.
      Specified by:
      transform in interface org.opengis.referencing.operation.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 positions in a list of coordinate values.
      Specified by:
      transform in interface org.opengis.referencing.operation.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 positions in a list of coordinate values.
      Specified by:
      transform in interface org.opengis.referencing.operation.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 LinearTransform inverse()
      Returns the inverse transform of this object, which is this transform itself.
      Specified by:
      inverse in interface LinearTransform
      Specified by:
      inverse in interface org.opengis.referencing.operation.MathTransform
      Overrides:
      inverse in class AbstractLinearTransform
      Returns:
      the inverse transform.
      See Also:
    • equalsSameClass

      protected boolean equalsSameClass(Object object)
      Compares this math transform with an object which is known to be an instance of the same class.
      Specified by:
      equalsSameClass in class AbstractLinearTransform
      Parameters:
      object - the object to compare with this transform.
      Returns:
      true if the given object is considered equals to this math transform.