Class AbstractLinearTransform

All Implemented Interfaces:
Serializable, Parameterized, LinearTransform, LenientComparable, org.opengis.referencing.operation.MathTransform, org.opengis.referencing.operation.Matrix
Direct Known Subclasses:
CopyTransform, IdentityTransform, ProjectiveTransform, ScaleTransform, TranslationTransform

abstract class AbstractLinearTransform extends AbstractMathTransform implements LinearTransform, org.opengis.referencing.operation.Matrix, Serializable
Base class of linear transforms. For efficiency reasons, this transform implements itself the matrix to be returned by getMatrix().

Subclasses need to implement the following methods:

Since:
0.6
Version:
1.1
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      For cross-version compatibility.
      See Also:
    • inverse

      volatile LinearTransform inverse
      The inverse transform, or null if not yet created. This field is part of the serialization form in order to avoid rounding errors if a user asks for the inverse of the inverse (i.e. the original transform) after deserialization.
      See Also:
  • Constructor Details

    • AbstractLinearTransform

      AbstractLinearTransform()
      Constructs a transform.
  • Method Details

    • isAffine

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

      public final org.opengis.referencing.operation.Matrix clone()
      Returns a copy of the matrix that user can modify. The object returned by this method is not of the same class than this object.
      Specified by:
      clone in interface org.opengis.referencing.operation.Matrix
      Overrides:
      clone in class Object
    • getMatrix

      public final org.opengis.referencing.operation.Matrix getMatrix()
      Returns an immutable view of the matrix for this transform.
      Specified by:
      getMatrix in interface LinearTransform
      Returns:
      the coefficients of this linear transform as a matrix.
      See Also:
    • getNumRow

      public int getNumRow()
      Gets the number of rows in the matrix.
      Specified by:
      getNumRow in interface org.opengis.referencing.operation.Matrix
    • getNumCol

      public int getNumCol()
      Gets the number of columns in the matrix.
      Specified by:
      getNumCol in interface org.opengis.referencing.operation.Matrix
    • tryConcatenate

      protected final org.opengis.referencing.operation.MathTransform tryConcatenate(boolean applyOtherFirst, org.opengis.referencing.operation.MathTransform other, org.opengis.referencing.operation.MathTransformFactory factory) throws org.opengis.util.FactoryException
      Returns an identity transform if this transform is the inverse of the given transform. If this method is unsure, it conservatively returns null.
      Overrides:
      tryConcatenate in class AbstractMathTransform
      Parameters:
      applyOtherFirst - true if the transformation order is other followed by this, or false if the transformation order is this followed by other.
      other - the other math transform to (pre-)concatenate with this transform.
      factory - the factory which is (indirectly) invoking this method, or null if none.
      Returns:
      the math transforms combined in an optimized way, or null if no such optimization is available.
      Throws:
      org.opengis.util.FactoryException - if an error occurred while combining the transforms.
      See Also:
    • inverse

      public LinearTransform inverse() throws org.opengis.referencing.operation.NoninvertibleTransformException
      Returns the inverse transform of this object. This method invokes createInverse() when first needed, then caches the result.
      Specified by:
      inverse in interface LinearTransform
      Specified by:
      inverse in interface org.opengis.referencing.operation.MathTransform
      Overrides:
      inverse in class AbstractMathTransform
      Returns:
      the inverse transform.
      Throws:
      org.opengis.referencing.operation.NoninvertibleTransformException - if the transform cannot be inverted.
      See Also:
    • createInverse

      LinearTransform createInverse() throws org.opengis.referencing.operation.NoninvertibleTransformException
      Invoked by inverse() the first time that the inverse transform needs to be computed.
      Throws:
      org.opengis.referencing.operation.NoninvertibleTransformException
    • getParameterDescriptors

      public org.opengis.parameter.ParameterDescriptorGroup getParameterDescriptors()
      Returns the parameter descriptors for this math transform.
      Specified by:
      getParameterDescriptors in interface Parameterized
      Overrides:
      getParameterDescriptors in class AbstractMathTransform
      Returns:
      the parameter descriptors for this math transform, or null if unspecified.
      See Also:
    • getParameterValues

      public org.opengis.parameter.ParameterValueGroup getParameterValues()
      Returns the matrix elements as a group of parameter values. The number of parameters depends on the matrix size. Only matrix elements different from their default value will be included in this group.
      Specified by:
      getParameterValues in interface Parameterized
      Overrides:
      getParameterValues in class AbstractMathTransform
      Returns:
      the parameter values for this math transform.
      See Also:
    • setElement

      public final void setElement(int row, int column, double value)
      Unsupported operation, since this matrix is unmodifiable.
      Specified by:
      setElement in interface org.opengis.referencing.operation.Matrix
    • deltaTransform

      public void deltaTransform(double[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts)
      Transforms an array of relative distance vectors. Distance vectors are transformed without applying the translation components. The default implementation is not very efficient, but it should not be an issue since this method is not invoked often.
      Specified by:
      deltaTransform in interface LinearTransform
      Parameters:
      srcPts - the array containing the source vectors.
      srcOff - the offset to the first vector to be transformed in the source array.
      dstPts - the array into which the transformed vectors are returned. Can be the same than srcPts.
      dstOff - the offset to the location of the first transformed vector that is stored in the destination array.
      numPts - the number of vector objects to be transformed.
      Since:
      0.7
      See Also:
    • equalsSameClass

      protected abstract boolean equalsSameClass(Object object)
      Compares this math transform with an object which is known to be of the same class. Implementers can safely cast the object argument to their subclass.
      Parameters:
      object - the object to compare with this transform.
      Returns:
      true if the given object is considered equals to this math transform.
    • equals

      public final boolean equals(Object object, ComparisonMode mode)
      Compares the specified object with this linear transform for equality. This implementation returns true if the following conditions are met:
      • In STRICT mode, the objects are of the same class and equalsSameClass(Object) returns true.
      • In other modes, the matrix are equals or approximately equals (depending on the mode).
      Specified by:
      equals in interface LenientComparable
      Overrides:
      equals in class AbstractMathTransform
      Parameters:
      object - the object to compare with this transform.
      mode - the strictness level of the comparison. Default to STRICT.
      Returns:
      true if the given object is considered equals to this math transform.
      See Also:
    • toString

      public String toString()
      Returns a string representation of the matrix.
      Overrides:
      toString in class FormattableObject
      Returns:
      the Well Known Text (WKT) or an alternative representation of this object.