Object
SimpleIdentifiedObject
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 Summary
Modifier and TypeFieldDescriptionprotected final CoordinateReferenceSystem
The source CRS, which determine the number of source dimensions.protected final CoordinateReferenceSystem
The target CRS, which determine the number of target dimensions.Fields inherited from class SimpleIdentifiedObject
authority, code
Fields inherited from interface CoordinateOperation
COORDINATE_OPERATION_ACCURACY_KEY, DOMAIN_OF_VALIDITY_KEY, OPERATION_VERSION_KEY, SCOPE_KEY
Fields inherited from interface IdentifiedObject
ALIAS_KEY, IDENTIFIERS_KEY, NAME_KEY, REMARKS_KEY
Fields inherited from interface Identifier
AUTHORITY_KEY, CODE_KEY, CODESPACE_KEY, DESCRIPTION_KEY, VERSION_KEY
-
Constructor Summary
ModifierConstructorDescriptionprotected
SimpleTransform
(Citation authority, String name, CoordinateReferenceSystem sourceCRS, CoordinateReferenceSystem targetCRS) Creates a new operation for the given name and CRS. -
Method Summary
Modifier and TypeMethodDescriptionderivative
(DirectPosition point) Gets the derivative of this transform at a point.boolean
Compares this transform with the given object for equality.Gets the math transform, which is represented directly bythis
implementation class since it does not distinguish operation and transform.Version of the coordinate transformation (i.e., instantiation due to the stochastic nature of the parameters).Returns the source CRS.int
Gets the dimension of input points.Returns the target CRS.int
Gets the dimension of target points.inverse()
Creates the inverse transform of this object.boolean
Tests whether this transform does not move any points.void
transform
(double[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts) Transforms a list of coordinate point ordinal values.void
transform
(double[] srcPts, int srcOff, float[] dstPts, int dstOff, int numPts) Transforms a list of coordinate point ordinal values.void
transform
(float[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts) Transforms a list of coordinate point ordinal values.void
transform
(float[] srcPts, int srcOff, float[] dstPts, int dstOff, int numPts) Transforms a list of coordinate point ordinal values.abstract DirectPosition
transform
(DirectPosition ptSrc, DirectPosition ptDst) Transforms the specifiedptSrc
and stores the result inptDst
.Methods inherited from class SimpleIdentifiedObject
getAuthority, getCode, getCodeSpace, getDomainOfValidity, getName, getScope, hashCode, toString, toWKT
Methods inherited from interface CoordinateOperation
getCoordinateOperationAccuracy, getDomainOfValidity, getScope
Methods inherited from interface IdentifiedObject
getAlias, getIdentifiers, getName, getRemarks, toWKT
Methods inherited from interface Identifier
getDescription, getVersion
Methods inherited from interface MathTransform
toWKT
-
Field Details
-
sourceCRS
The source CRS, which determine the number of source dimensions.- See Also:
-
targetCRS
The target CRS, which determine the number of target dimensions.- See Also:
-
-
Constructor Details
-
SimpleTransform
protected SimpleTransform(Citation authority, String name, CoordinateReferenceSystem sourceCRS, CoordinateReferenceSystem targetCRS) Creates a new operation for the given name and CRS.- Parameters:
authority
- organization responsible for definition of the name, ornull
.name
- the name of the new operation.sourceCRS
- the source CRS to be returned bygetSourceCRS()
.targetCRS
- the target CRS to be returned bygetTargetCRS()
.
-
-
Method Details
-
getSourceCRS
Returns the source CRS.- Specified by:
getSourceCRS
in interfaceCoordinateOperation
- Returns:
- the source CRS, or
null
if not available. - See Also:
-
getTargetCRS
Returns the target CRS.- Specified by:
getTargetCRS
in interfaceCoordinateOperation
- 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 interfaceMathTransform
- 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 interfaceMathTransform
- Returns:
- the dimension of input points.
- See Also:
-
getMathTransform
Gets the math transform, which is represented directly bythis
implementation class since it does not distinguish operation and transform.- Specified by:
getMathTransform
in interfaceCoordinateOperation
- Returns:
- the transform from source to target CRS.
-
transform
public abstract DirectPosition transform(DirectPosition ptSrc, DirectPosition ptDst) throws MismatchedDimensionException, TransformException Transforms the specifiedptSrc
and stores the result inptDst
. IfptDst
isnull
, a newDirectPosition
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. IfptSrc
andptDst
are the same object, the input point is correctly overwritten with the transformed point.- Specified by:
transform
in interfaceMathTransform
- Parameters:
ptSrc
- the specified coordinate point to be transformed.ptDst
- the specified coordinate point that stores the result of transformingptSrc
, ornull
.- Returns:
- the coordinate point after transforming
ptSrc
and storing the result inptDst
, or a newly created point ifptDst
was null. - Throws:
MismatchedDimensionException
- ifptSrc
orptDst
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 interfaceMathTransform
- 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 thansrcPts
.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 interfaceMathTransform
- 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 thansrcPts
.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 interfaceMathTransform
- 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 thansrcPts
.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 interfaceMathTransform
- 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 thansrcPts
.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
Gets the derivative of this transform at a point. The default implementation throws an exception in all cases.- Specified by:
derivative
in interfaceMathTransform
- 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 interfaceMathTransform
- 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 interfaceMathTransform
- Returns:
true
if thisMathTransform
is an identity transform;false
otherwise.- See Also:
-
getOperationVersion
Version of the coordinate transformation (i.e., instantiation due to the stochastic nature of the parameters). The default implementation returnsnull
.- Specified by:
getOperationVersion
in interfaceCoordinateOperation
- Returns:
- the coordinate operation version, or
null
in none.
-
equals
Compares this transform with the given object for equality.- Overrides:
equals
in classSimpleIdentifiedObject
- Parameters:
object
- the object to compare with thisSimpleTransform
.- Returns:
true
if the given object is equal to this object.
-