Object
SimpleIdentifiedObject
SimpleTransform
SimpleTransform2D
- All Implemented Interfaces:
Identifier
,IdentifiedObject
,CoordinateOperation
,MathTransform
,MathTransform2D
,ReferenceIdentifier
A
CoordinateOperation
working only on two-dimensional points.
Subclasses must implement the transform(Point2D, Point2D)
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
Fields inherited from class SimpleTransform
sourceCRS, targetCRS
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
SimpleTransform2D
(Citation authority, String name, CoordinateReferenceSystem sourceCRS, CoordinateReferenceSystem targetCRS) Creates a new operation for the given name and CRS. -
Method Summary
Modifier and TypeMethodDescriptioncreateTransformedShape
(Shape shape) Transforms the specified shape.derivative
(Point2D point) Gets the derivative of this transform at a point.derivative
(DirectPosition point) Gets the derivative of this transform at a point.final int
Returns the number of source dimensions, which is fixed to 2.final int
Returns the number of target dimensions, which is fixed to 2.inverse()
Creates the inverse transform of this object.abstract Point2D
Transforms the specifiedptSrc
and stores the result inptDst
.transform
(DirectPosition ptSrc, DirectPosition ptDst) Transforms the specified point by delegating totransform(Point2D, Point2D)
.Methods inherited from class SimpleTransform
equals, getMathTransform, getOperationVersion, getSourceCRS, getTargetCRS, isIdentity, transform, transform, transform, transform
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
isIdentity, toWKT, transform, transform, transform, transform
-
Constructor Details
-
SimpleTransform2D
protected SimpleTransform2D(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 bySimpleTransform.getSourceCRS()
.targetCRS
- the target CRS to be returned bySimpleTransform.getTargetCRS()
.
-
-
Method Details
-
getSourceDimensions
public final int getSourceDimensions()Returns the number of source dimensions, which is fixed to 2.- Specified by:
getSourceDimensions
in interfaceMathTransform
- Overrides:
getSourceDimensions
in classSimpleTransform
- Returns:
- the dimension of input points.
- See Also:
-
getTargetDimensions
public final int getTargetDimensions()Returns the number of target dimensions, which is fixed to 2.- Specified by:
getTargetDimensions
in interfaceMathTransform
- Overrides:
getTargetDimensions
in classSimpleTransform
- Returns:
- the dimension of input points.
- See Also:
-
transform
public DirectPosition transform(DirectPosition ptSrc, DirectPosition ptDst) throws MismatchedDimensionException, TransformException Transforms the specified point by delegating totransform(Point2D, Point2D)
.- Specified by:
transform
in interfaceMathTransform
- Specified by:
transform
in classSimpleTransform
- 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
Transforms the specifiedptSrc
and stores the result inptDst
. IfptDst
isnull
, a newPoint2D
object is allocated and then 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 interfaceMathTransform2D
- Parameters:
ptSrc
- the coordinate point to be transformed.ptDst
- the coordinate point that stores the result of transformingptSrc
, ornull
if a new point shall be created.- Returns:
- the coordinate point after transforming
ptSrc
and storing the result inptDst
or in a new point ifptDst
was null. - Throws:
TransformException
- if the point cannot be transformed.- See Also:
-
createTransformedShape
Transforms the specified shape. The default implementation returns a new shape with the transform of all control points.- Specified by:
createTransformedShape
in interfaceMathTransform2D
- Parameters:
shape
- the Shape to transform.- Returns:
- the transformed shape.
- Throws:
TransformException
- if a transform failed.- See Also:
-
derivative
Gets the derivative of this transform at a point. This method ensures that the given position is two-dimensional, then delegates toderivative(Point2D)
.- Specified by:
derivative
in interfaceMathTransform
- Overrides:
derivative
in classSimpleTransform
- 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.
-
derivative
Gets the derivative of this transform at a point. The default implementation throws an exception in all cases.- Specified by:
derivative
in interfaceMathTransform2D
- 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
- Specified by:
inverse
in interfaceMathTransform2D
- Overrides:
inverse
in classSimpleTransform
- Returns:
- the inverse transform.
- Throws:
NoninvertibleTransformException
- if the transform cannot be inverted.- See Also:
-