Package org.opengis.example.referencing
Class SimpleTransform
- Object
-
- SimpleIdentifiedObject
-
- SimpleTransform
-
- All Implemented Interfaces:
Serializable,Identifier,IdentifiedObject,CoordinateOperation,MathTransform,ReferenceIdentifier
- Direct Known Subclasses:
ProjectiveTransform,SimpleTransform2D
public abstract class SimpleTransform extends SimpleIdentifiedObject implements CoordinateOperation, MathTransform
ACoordinateOperationabstract 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 othertransformmethods may be overridden for performances reasons.- Since:
- 3.1
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected CoordinateReferenceSystemsourceCRSThe source CRS, which determine the number of source dimensions.protected CoordinateReferenceSystemtargetCRSThe 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
Constructors Modifier Constructor Description protectedSimpleTransform(Citation authority, String name, CoordinateReferenceSystem sourceCRS, CoordinateReferenceSystem targetCRS)Creates a new operation for the given name and CRS.
-
Method Summary
Modifier and Type Method Description Matrixderivative(DirectPosition point)Gets the derivative of this transform at a point.booleanequals(Object object)Compares this transform with the given object for equality.MathTransformgetMathTransform()Gets the math transform, which is represented directly bythisimplementation class since it does not distinguish operation and transform.StringgetOperationVersion()Version of the coordinate transformation (i.e., instantiation due to the stochastic nature of the parameters).CoordinateReferenceSystemgetSourceCRS()Returns the source CRS.intgetSourceDimensions()Gets the dimension of input points.CoordinateReferenceSystemgetTargetCRS()Returns the target CRS.intgetTargetDimensions()Gets the dimension of target points.MathTransforminverse()Creates the inverse transform of this object.booleanisIdentity()Tests whether this transform does not move any points.voidtransform(double[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts)Transforms a list of coordinate point ordinal values.voidtransform(double[] srcPts, int srcOff, float[] dstPts, int dstOff, int numPts)Transforms a list of coordinate point ordinal values.voidtransform(float[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts)Transforms a list of coordinate point ordinal values.voidtransform(float[] srcPts, int srcOff, float[] dstPts, int dstOff, int numPts)Transforms a list of coordinate point ordinal values.abstract DirectPositiontransform(DirectPosition ptSrc, DirectPosition ptDst)Transforms the specifiedptSrcand 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 Detail
-
sourceCRS
protected final CoordinateReferenceSystem sourceCRS
The source CRS, which determine the number of source dimensions.- See Also:
getSourceCRS(),getSourceDimensions()
-
targetCRS
protected final CoordinateReferenceSystem targetCRS
The target CRS, which determine the number of target dimensions.- See Also:
getTargetCRS(),getTargetDimensions()
-
-
Constructor Detail
-
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 Detail
-
getSourceCRS
public CoordinateReferenceSystem getSourceCRS()
Returns the source CRS.- Specified by:
getSourceCRSin interfaceCoordinateOperation- Returns:
- the source CRS, or
nullif not available.
-
getTargetCRS
public CoordinateReferenceSystem getTargetCRS()
Returns the target CRS.- Specified by:
getTargetCRSin interfaceCoordinateOperation- Returns:
- the target CRS, or
nullif not available.
-
getSourceDimensions
public int getSourceDimensions()
Gets the dimension of input points. The default implementation returns the dimension of the source CRS.- Specified by:
getSourceDimensionsin interfaceMathTransform- Returns:
- the dimension of input points.
-
getTargetDimensions
public int getTargetDimensions()
Gets the dimension of target points. The default implementation returns the dimension of the target CRS.- Specified by:
getTargetDimensionsin interfaceMathTransform- Returns:
- the dimension of input points.
-
getMathTransform
public MathTransform getMathTransform()
Gets the math transform, which is represented directly bythisimplementation class since it does not distinguish operation and transform.- Specified by:
getMathTransformin interfaceCoordinateOperation- Returns:
- the transform from source to target CRS.
-
transform
public abstract DirectPosition transform(DirectPosition ptSrc, DirectPosition ptDst) throws MismatchedDimensionException, TransformException
Transforms the specifiedptSrcand stores the result inptDst. IfptDstisnull, a newDirectPositionobject 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. IfptSrcandptDstare the same object, the input point is correctly overwritten with the transformed point.- Specified by:
transformin 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
ptSrcand storing the result inptDst, or a newly created point ifptDstwas null. - Throws:
MismatchedDimensionException- ifptSrcorptDstdoes not have the expected dimension.TransformException- if the point can not be transformed.
-
transform
public void transform(double[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts) throws TransformExceptionTransforms a list of coordinate point ordinal values.- Specified by:
transformin 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 can not be transformed.
-
transform
public void transform(float[] srcPts, int srcOff, float[] dstPts, int dstOff, int numPts) throws TransformExceptionTransforms a list of coordinate point ordinal values.- Specified by:
transformin 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 can not be transformed.
-
transform
public void transform(float[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts) throws TransformExceptionTransforms a list of coordinate point ordinal values.- Specified by:
transformin 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 can not be transformed.
-
transform
public void transform(double[] srcPts, int srcOff, float[] dstPts, int dstOff, int numPts) throws TransformExceptionTransforms a list of coordinate point ordinal values.- Specified by:
transformin 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 can not be transformed.
-
derivative
public Matrix derivative(DirectPosition point) throws TransformException
Gets the derivative of this transform at a point. The default implementation throws an exception in all cases.- Specified by:
derivativein 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 can not be evaluated at the specified point.
-
inverse
public MathTransform inverse() throws NoninvertibleTransformException
Creates the inverse transform of this object. The default implementation throws an exception in all cases.- Specified by:
inversein interfaceMathTransform- Returns:
- the inverse transform.
- Throws:
NoninvertibleTransformException- if the transform can not be inverted.
-
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:
isIdentityin interfaceMathTransform- Returns:
trueif thisMathTransformis an identity transform;falseotherwise.
-
getOperationVersion
public String getOperationVersion()
Version of the coordinate transformation (i.e., instantiation due to the stochastic nature of the parameters). The default implementation returnsnull.- Specified by:
getOperationVersionin interfaceCoordinateOperation- Returns:
- the coordinate operation version, or
nullin none.
-
equals
public boolean equals(Object object)
Compares this transform with the given object for equality.- Overrides:
equalsin classSimpleIdentifiedObject- Parameters:
object- the object to compare with thisSimpleTransform.- Returns:
trueif the given object is equals to this object.
-
-