Class SimpleTransform

All Implemented Interfaces:
Identifier, IdentifiedObject, CoordinateOperation, MathTransform, ReferenceIdentifier
Direct Known Subclasses:
ProjectiveTransform, SimpleTransform2D

public abstract class SimpleTransform extends SimpleIdentifiedObject implements CoordinateOperation, MathTransform
A CoordinateOperation abstract base class. This class does not make distinction between Coordinate Operation and Math Transform, so we implement the two interfaces by the same class.

Subclasses must implement the transform(DirectPosition, DirectPosition) method. All other transform methods are defined in terms of the above-cited method. However, the other transform methods may be overridden for performances reasons.

Since:
3.1
  • Field Details

  • Constructor Details

  • Method Details

    • getSourceCRS

      public CoordinateReferenceSystem getSourceCRS()
      Returns the source CRS.
      Specified by:
      getSourceCRS in interface CoordinateOperation
      Returns:
      the source CRS, or null if not available.
      See Also:
    • getTargetCRS

      public CoordinateReferenceSystem getTargetCRS()
      Returns the target CRS.
      Specified by:
      getTargetCRS in interface CoordinateOperation
      Returns:
      the target CRS, or null if not available.
      See Also:
    • getSourceDimensions

      public int getSourceDimensions()
      Gets the dimension of input points. The default implementation returns the dimension of the source CRS.
      Specified by:
      getSourceDimensions in interface MathTransform
      Returns:
      the dimension of input points.
      See Also:
    • getTargetDimensions

      public int getTargetDimensions()
      Gets the dimension of target points. The default implementation returns the dimension of the target CRS.
      Specified by:
      getTargetDimensions in interface MathTransform
      Returns:
      the dimension of input points.
      See Also:
    • getMathTransform

      public MathTransform getMathTransform()
      Gets the math transform, which is represented directly by this implementation class since it does not distinguish operation and transform.
      Specified by:
      getMathTransform in interface CoordinateOperation
      Returns:
      the transform from source to target CRS.
    • transform

      Transforms the specified ptSrc and stores the result in ptDst. If ptDst is null, a new DirectPosition object is allocated and the result of the transformation is stored in this object. In either case, ptDst, which contains the transformed point, is returned for convenience. If ptSrc and ptDst are the same object, the input point is correctly overwritten with the transformed point.
      Specified by:
      transform in interface MathTransform
      Parameters:
      ptSrc - the specified coordinate point to be transformed.
      ptDst - the specified coordinate point that stores the result of transforming ptSrc, or null.
      Returns:
      the coordinate point after transforming ptSrc and storing the result in ptDst, or a newly created point if ptDst was null.
      Throws:
      MismatchedDimensionException - if ptSrc or ptDst does not have the expected dimension.
      TransformException - if the point cannot be transformed.
    • transform

      public void transform(double[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts) throws TransformException
      Transforms a list of coordinate point ordinal values.
      Specified by:
      transform in interface MathTransform
      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.
      Throws:
      TransformException - if a point cannot be transformed.
      See Also:
    • transform

      public void transform(float[] srcPts, int srcOff, float[] dstPts, int dstOff, int numPts) throws TransformException
      Transforms a list of coordinate point ordinal values.
      Specified by:
      transform in interface MathTransform
      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.
      Throws:
      TransformException - if a point cannot be transformed.
      See Also:
    • transform

      public void transform(float[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts) throws TransformException
      Transforms a list of coordinate point ordinal values.
      Specified by:
      transform in interface MathTransform
      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.
      Throws:
      TransformException - if a point cannot be transformed.
      See Also:
    • transform

      public void transform(double[] srcPts, int srcOff, float[] dstPts, int dstOff, int numPts) throws TransformException
      Transforms a list of coordinate point ordinal values.
      Specified by:
      transform in interface MathTransform
      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.
      Throws:
      TransformException - if a point cannot be transformed.
      See Also:
    • derivative

      public Matrix derivative(DirectPosition point) throws TransformException
      Gets the derivative of this transform at a point. The default implementation throws an exception in all cases.
      Specified by:
      derivative in interface MathTransform
      Parameters:
      point - the coordinate point where to evaluate the derivative.
      Returns:
      the derivative at the specified point (never null).
      Throws:
      TransformException - if the derivative cannot be evaluated at the specified point.
    • inverse

      Creates the inverse transform of this object. The default implementation throws an exception in all cases.
      Specified by:
      inverse in interface MathTransform
      Returns:
      the inverse transform.
      Throws:
      NoninvertibleTransformException - if the transform cannot be inverted.
      See Also:
    • isIdentity

      public boolean isIdentity()
      Tests whether this transform does not move any points. The default implementation tests if the source and target CRS are equals.
      Specified by:
      isIdentity in interface MathTransform
      Returns:
      true if this MathTransform is an identity transform; false otherwise.
      See Also:
    • getOperationVersion

      public String getOperationVersion()
      Version of the coordinate transformation (i.e., instantiation due to the stochastic nature of the parameters). The default implementation returns null.
      Specified by:
      getOperationVersion in interface CoordinateOperation
      Returns:
      the coordinate operation version, or null in none.
    • equals

      public boolean equals(Object object)
      Compares this transform with the given object for equality.
      Overrides:
      equals in class SimpleIdentifiedObject
      Parameters:
      object - the object to compare with this SimpleTransform.
      Returns:
      true if the given object is equal to this object.