Class AbstractMathTransform1D
java.lang.Object
org.apache.sis.io.wkt.FormattableObject
org.apache.sis.referencing.operation.transform.AbstractMathTransform
org.apache.sis.referencing.operation.transform.AbstractMathTransform1D
- All Implemented Interfaces:
Parameterized,LenientComparable,org.opengis.referencing.operation.MathTransform,org.opengis.referencing.operation.MathTransform1D
- Direct Known Subclasses:
ExponentialTransform1D,LinearInterpolator1D,LinearTransform1D,LogarithmicTransform1D,PowerTransform1D
public abstract class AbstractMathTransform1D
extends AbstractMathTransform
implements org.opengis.referencing.operation.MathTransform1D
Base class for math transforms that are known to be one-dimensional in all cases.
One-dimensional math transforms are not required to extend this class,
however doing so may simplify their implementation.
The simplest way to implement this abstract class is to provide an implementation for the following methods only:
Immutability and thread safety
All Apache SIS implementations ofMathTransform1D are immutable and thread-safe.
It is highly recommended that third-party implementations be immutable and thread-safe too.
This means that unless otherwise noted in the javadoc, MathTransform1D instances can
be shared by many objects and passed between threads without synchronization.
Serialization
MathTransform1D may or may not be serializable, at implementation choices.
Most Apache SIS implementations are serializable, but the serialized objects are not guaranteed to be compatible
with future SIS versions. Serialization should be used only for short term storage or RMI between applications
running the same SIS version.- Since:
- 0.5
- Version:
- 0.5
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classBase class for implementation of inverse math transforms. -
Field Summary
Fields inherited from class org.apache.sis.referencing.operation.transform.AbstractMathTransform
MAXIMUM_BUFFER_SIZE, MAXIMUM_FAILURES -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract doublederivative(double value) Gets the derivative of this function at a value.org.opengis.referencing.operation.Matrixderivative(org.opengis.geometry.DirectPosition point) Gets the derivative of this transform at a point.final intReturns the dimension of input points, which is always 1.final intReturns the dimension of output points, which is always 1.org.opengis.referencing.operation.MathTransform1Dinverse()Returns the inverse transform of this object.abstract doubletransform(double value) Transforms the specified value.org.opengis.referencing.operation.Matrixtransform(double[] srcPts, int srcOff, double[] dstPts, int dstOff, boolean derivate) Transforms a single point in the given array and opportunistically computes its derivative if requested.Methods inherited from class org.apache.sis.referencing.operation.transform.AbstractMathTransform
beforeFormat, computeHashCode, equals, equals, formatTo, getContextualParameters, getDomain, getParameterDescriptors, getParameterValues, hashCode, isIdentity, isInverseEquals, mismatchedDimension, transform, transform, transform, transform, transform, tryConcatenateMethods inherited from class org.apache.sis.io.wkt.FormattableObject
print, toString, toString, toWKTMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.opengis.referencing.operation.MathTransform
isIdentity, toWKT, transform, transform, transform, transform, transform
-
Constructor Details
-
AbstractMathTransform1D
protected AbstractMathTransform1D()Constructor for subclasses.
-
-
Method Details
-
getSourceDimensions
public final int getSourceDimensions()Returns the dimension of input points, which is always 1.- Specified by:
getSourceDimensionsin interfaceorg.opengis.referencing.operation.MathTransform- Specified by:
getSourceDimensionsin classAbstractMathTransform- Returns:
- the number of dimensions of input points.
- See Also:
-
getTargetDimensions
public final int getTargetDimensions()Returns the dimension of output points, which is always 1.- Specified by:
getTargetDimensionsin interfaceorg.opengis.referencing.operation.MathTransform- Specified by:
getTargetDimensionsin classAbstractMathTransform- Returns:
- the number of dimensions of output points.
- See Also:
-
transform
public abstract double transform(double value) throws org.opengis.referencing.operation.TransformException Transforms the specified value.- Specified by:
transformin interfaceorg.opengis.referencing.operation.MathTransform1D- Parameters:
value- the value to transform.- Returns:
- the transformed value.
- Throws:
org.opengis.referencing.operation.TransformException- if the value cannot be transformed.
-
transform
public org.opengis.referencing.operation.Matrix transform(double[] srcPts, int srcOff, double[] dstPts, int dstOff, boolean derivate) throws org.opengis.referencing.operation.TransformException Transforms a single point in the given array and opportunistically computes its derivative if requested. The default implementation delegates totransform(double)and potentially toderivative(double). Subclasses may override this method for performance reason.- Specified by:
transformin classAbstractMathTransform- Parameters:
srcPts- the array containing the source coordinates (cannot benull).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 thansrcPts. May benullif only the derivative matrix is desired.dstOff- the offset to the location of the transformed point that is stored in the destination array.derivate-truefor computing the derivative, orfalseif not needed.- Returns:
- the matrix of the transform derivative at the given source position,
or
nullif thederivateargument isfalse. - Throws:
org.opengis.referencing.operation.TransformException- if the point cannot be transformed or if a problem occurred while calculating the derivative.- See Also:
-
derivative
public abstract double derivative(double value) throws org.opengis.referencing.operation.TransformException Gets the derivative of this function at a value. The derivative is the 1×1 matrix of the non-translating portion of the approximate affine map at the value.- Specified by:
derivativein interfaceorg.opengis.referencing.operation.MathTransform1D- Parameters:
value- the value where to evaluate the derivative.- Returns:
- the derivative at the specified point.
- Throws:
org.opengis.referencing.operation.TransformException- if the derivative cannot be evaluated at the specified point.
-
derivative
public org.opengis.referencing.operation.Matrix derivative(org.opengis.geometry.DirectPosition point) throws org.opengis.referencing.operation.TransformException Gets the derivative of this transform at a point. The default implementation ensures thatpointis one-dimensional, then delegates toderivative(double).- Specified by:
derivativein interfaceorg.opengis.referencing.operation.MathTransform- Overrides:
derivativein classAbstractMathTransform- Parameters:
point- the position where to evaluate the derivative, ornull.- Returns:
- the derivative at the specified point (never
null). - Throws:
org.opengis.geometry.MismatchedDimensionException- ifpointdoes not have the expected dimension.org.opengis.referencing.operation.TransformException- if the derivative cannot be evaluated at the specified point.
-
inverse
public org.opengis.referencing.operation.MathTransform1D inverse() throws org.opengis.referencing.operation.NoninvertibleTransformExceptionReturns the inverse transform of this object. The default implementation returnsthisif this transform is an identity transform, or throws an exception otherwise. Subclasses should override this method.- Specified by:
inversein interfaceorg.opengis.referencing.operation.MathTransform- Specified by:
inversein interfaceorg.opengis.referencing.operation.MathTransform1D- Overrides:
inversein classAbstractMathTransform- Throws:
org.opengis.referencing.operation.NoninvertibleTransformException
-