Class AbstractLinearTransform
java.lang.Object
org.apache.sis.io.wkt.FormattableObject
org.apache.sis.referencing.operation.transform.AbstractMathTransform
org.apache.sis.referencing.operation.transform.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:
Matrix.getElement(int, int)
equalsSameClass(Object)
- Since:
- 0.6
- Version:
- 1.1
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.sis.referencing.operation.transform.AbstractMathTransform
AbstractMathTransform.Inverse
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) LinearTransform
The inverse transform, ornull
if not yet created.private static final long
For cross-version compatibility.Fields inherited from class org.apache.sis.referencing.operation.transform.AbstractMathTransform
MAXIMUM_BUFFER_SIZE, MAXIMUM_FAILURES
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal org.opengis.referencing.operation.Matrix
clone()
Returns a copy of the matrix that user can modify.(package private) LinearTransform
Invoked byinverse()
the first time that the inverse transform needs to be computed.void
deltaTransform
(double[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts) Transforms an array of relative distance vectors.final boolean
equals
(Object object, ComparisonMode mode) Compares the specified object with this linear transform for equality.protected abstract boolean
equalsSameClass
(Object object) Compares this math transform with an object which is known to be of the same class.final org.opengis.referencing.operation.Matrix
Returns an immutable view of the matrix for this transform.int
Gets the number of columns in the matrix.int
Gets the number of rows in the matrix.org.opengis.parameter.ParameterDescriptorGroup
Returns the parameter descriptors for this math transform.org.opengis.parameter.ParameterValueGroup
Returns the matrix elements as a group of parameter values.inverse()
Returns the inverse transform of this object.boolean
isAffine()
Returnstrue
if this transform is affine.final void
setElement
(int row, int column, double value) Unsupported operation, since this matrix is unmodifiable.toString()
Returns a string representation of the matrix.protected final org.opengis.referencing.operation.MathTransform
tryConcatenate
(boolean applyOtherFirst, org.opengis.referencing.operation.MathTransform other, org.opengis.referencing.operation.MathTransformFactory factory) Returns an identity transform if this transform is the inverse of the given transform.Methods inherited from class org.apache.sis.referencing.operation.transform.AbstractMathTransform
beforeFormat, computeHashCode, derivative, equals, formatTo, getContextualParameters, getDomain, getSourceDimensions, getTargetDimensions, hashCode, isIdentity, isInverseEquals, mismatchedDimension, transform, transform, transform, transform, transform, transform
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
derivative, getSourceDimensions, getTargetDimensions, isIdentity, toWKT, transform, transform, transform, transform, transform
Methods inherited from interface org.opengis.referencing.operation.Matrix
getElement, isIdentity
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDFor cross-version compatibility.- See Also:
-
inverse
The inverse transform, ornull
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()Returnstrue
if this transform is affine.- Specified by:
isAffine
in interfaceLinearTransform
- Returns:
true
if this transform is affine, orfalse
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. -
getMatrix
public final org.opengis.referencing.operation.Matrix getMatrix()Returns an immutable view of the matrix for this transform.- Specified by:
getMatrix
in interfaceLinearTransform
- 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 interfaceorg.opengis.referencing.operation.Matrix
-
getNumCol
public int getNumCol()Gets the number of columns in the matrix.- Specified by:
getNumCol
in interfaceorg.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 returnsnull
.- Overrides:
tryConcatenate
in classAbstractMathTransform
- Parameters:
applyOtherFirst
-true
if the transformation order isother
followed bythis
, orfalse
if the transformation order isthis
followed byother
.other
- the other math transform to (pre-)concatenate with this transform.factory
- the factory which is (indirectly) invoking this method, ornull
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.NoninvertibleTransformExceptionReturns the inverse transform of this object. This method invokescreateInverse()
when first needed, then caches the result.- Specified by:
inverse
in interfaceLinearTransform
- Specified by:
inverse
in interfaceorg.opengis.referencing.operation.MathTransform
- Overrides:
inverse
in classAbstractMathTransform
- 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.NoninvertibleTransformExceptionInvoked byinverse()
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 interfaceParameterized
- Overrides:
getParameterDescriptors
in classAbstractMathTransform
- 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 interfaceParameterized
- Overrides:
getParameterValues
in classAbstractMathTransform
- 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 interfaceorg.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 interfaceLinearTransform
- 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 thansrcPts
.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
Compares this math transform with an object which is known to be of the same class. Implementers can safely cast theobject
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
Compares the specified object with this linear transform for equality. This implementation returnstrue
if the following conditions are met:- In
STRICT
mode, the objects are of the same class andequalsSameClass(Object)
returnstrue
. - In other modes, the matrix are equals or approximately equals (depending on the mode).
- Specified by:
equals
in interfaceLenientComparable
- Overrides:
equals
in classAbstractMathTransform
- Parameters:
object
- the object to compare with this transform.mode
- the strictness level of the comparison. Default toSTRICT
.- Returns:
true
if the given object is considered equals to this math transform.- See Also:
- In
-
toString
Returns a string representation of the matrix.- Overrides:
toString
in classFormattableObject
- Returns:
- the Well Known Text (WKT) or an alternative representation of this object.
-