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) LinearTransformThe inverse transform, ornullif not yet created.private static final longFor 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.Matrixclone()Returns a copy of the matrix that user can modify.(package private) LinearTransformInvoked byinverse()the first time that the inverse transform needs to be computed.voiddeltaTransform(double[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts) Transforms an array of relative distance vectors.final booleanequals(Object object, ComparisonMode mode) Compares the specified object with this linear transform for equality.protected abstract booleanequalsSameClass(Object object) Compares this math transform with an object which is known to be of the same class.final org.opengis.referencing.operation.MatrixReturns an immutable view of the matrix for this transform.intGets the number of columns in the matrix.intGets the number of rows in the matrix.org.opengis.parameter.ParameterDescriptorGroupReturns the parameter descriptors for this math transform.org.opengis.parameter.ParameterValueGroupReturns the matrix elements as a group of parameter values.inverse()Returns the inverse transform of this object.booleanisAffine()Returnstrueif this transform is affine.final voidsetElement(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.MathTransformtryConcatenate(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, transformMethods inherited from class org.apache.sis.io.wkt.FormattableObject
print, toString, toWKTMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.opengis.referencing.operation.MathTransform
derivative, getSourceDimensions, getTargetDimensions, isIdentity, toWKT, transform, transform, transform, transform, transformMethods 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, ornullif 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()Returnstrueif this transform is affine.- Specified by:
isAffinein interfaceLinearTransform- Returns:
trueif this transform is affine, orfalseotherwise.- 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:
getMatrixin 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:
getNumRowin interfaceorg.opengis.referencing.operation.Matrix
-
getNumCol
public int getNumCol()Gets the number of columns in the matrix.- Specified by:
getNumColin 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:
tryConcatenatein classAbstractMathTransform- Parameters:
applyOtherFirst-trueif the transformation order isotherfollowed bythis, orfalseif the transformation order isthisfollowed byother.other- the other math transform to (pre-)concatenate with this transform.factory- the factory which is (indirectly) invoking this method, ornullif none.- Returns:
- the math transforms combined in an optimized way, or
nullif 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:
inversein interfaceLinearTransform- Specified by:
inversein interfaceorg.opengis.referencing.operation.MathTransform- Overrides:
inversein 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:
getParameterDescriptorsin interfaceParameterized- Overrides:
getParameterDescriptorsin classAbstractMathTransform- Returns:
- the parameter descriptors for this math transform, or
nullif 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:
getParameterValuesin interfaceParameterized- Overrides:
getParameterValuesin 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:
setElementin 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:
deltaTransformin 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 theobjectargument to their subclass.- Parameters:
object- the object to compare with this transform.- Returns:
trueif the given object is considered equals to this math transform.
-
equals
Compares the specified object with this linear transform for equality. This implementation returnstrueif the following conditions are met:- In
STRICTmode, 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:
equalsin interfaceLenientComparable- Overrides:
equalsin classAbstractMathTransform- Parameters:
object- the object to compare with this transform.mode- the strictness level of the comparison. Default toSTRICT.- Returns:
trueif the given object is considered equals to this math transform.- See Also:
- In
-
toString
Returns a string representation of the matrix.- Overrides:
toStringin classFormattableObject- Returns:
- the Well Known Text (WKT) or an alternative representation of this object.
-