Package org.opengis.example.referencing
Class SimpleTransform2D
- Object
-
- SimpleIdentifiedObject
-
- SimpleTransform
-
- SimpleTransform2D
-
- All Implemented Interfaces:
Serializable,Identifier,IdentifiedObject,CoordinateOperation,MathTransform,MathTransform2D,ReferenceIdentifier
public abstract class SimpleTransform2D extends SimpleTransform implements MathTransform2D
ACoordinateOperationworking 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 othertransformmethods may be overridden for performances reasons.- Since:
- 3.1
- See Also:
- Serialized Form
-
-
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
Constructors Modifier Constructor Description protectedSimpleTransform2D(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 ShapecreateTransformedShape(Shape shape)Transforms the specified shape.Matrixderivative(Point2D point)Gets the derivative of this transform at a point.Matrixderivative(DirectPosition point)Gets the derivative of this transform at a point.intgetSourceDimensions()Returns the number of source dimensions, which is fixed to 2.intgetTargetDimensions()Returns the number of target dimensions, which is fixed to 2.MathTransform2Dinverse()Creates the inverse transform of this object.abstract Point2Dtransform(Point2D ptSrc, Point2D ptDst)Transforms the specifiedptSrcand stores the result inptDst.DirectPositiontransform(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 Detail
-
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 Detail
-
getSourceDimensions
public final int getSourceDimensions()
Returns the number of source dimensions, which is fixed to 2.- Specified by:
getSourceDimensionsin interfaceMathTransform- Overrides:
getSourceDimensionsin classSimpleTransform- Returns:
- the dimension of input points.
-
getTargetDimensions
public final int getTargetDimensions()
Returns the number of target dimensions, which is fixed to 2.- Specified by:
getTargetDimensionsin interfaceMathTransform- Overrides:
getTargetDimensionsin classSimpleTransform- Returns:
- the dimension of input points.
-
transform
public DirectPosition transform(DirectPosition ptSrc, DirectPosition ptDst) throws MismatchedDimensionException, TransformException
Transforms the specified point by delegating totransform(Point2D, Point2D).- Specified by:
transformin interfaceMathTransform- Specified by:
transformin 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
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 abstract Point2D transform(Point2D ptSrc, Point2D ptDst) throws TransformException
Transforms the specifiedptSrcand stores the result inptDst. IfptDstisnull, a newPoint2Dobject 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. IfptSrcandptDstare the same object, the input point is correctly overwritten with the transformed point.- Specified by:
transformin interfaceMathTransform2D- Parameters:
ptSrc- the coordinate point to be transformed.ptDst- the coordinate point that stores the result of transformingptSrc, ornullif a new point shall be created.- Returns:
- the coordinate point after transforming
ptSrcand storing the result inptDstor in a new point ifptDstwas null. - Throws:
TransformException- if the point can not be transformed.
-
createTransformedShape
public Shape createTransformedShape(Shape shape) throws TransformException
Transforms the specified shape. The default implementation returns a new shape with the transform of all control points.- Specified by:
createTransformedShapein interfaceMathTransform2D- Parameters:
shape- the Shape to transform.- Returns:
- the transformed shape.
- Throws:
TransformException- if a transform failed.
-
derivative
public Matrix derivative(DirectPosition point) throws TransformException
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:
derivativein interfaceMathTransform- Overrides:
derivativein 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 can not be evaluated at the specified point.
-
derivative
public Matrix derivative(Point2D point) throws TransformException
Gets the derivative of this transform at a point. The default implementation throws an exception in all cases.- Specified by:
derivativein 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 can not be evaluated at the specified point.
-
inverse
public MathTransform2D inverse() throws NoninvertibleTransformException
Creates the inverse transform of this object. The default implementation throws an exception in all cases.- Specified by:
inversein interfaceMathTransform- Specified by:
inversein interfaceMathTransform2D- Overrides:
inversein classSimpleTransform- Returns:
- the inverse transform.
- Throws:
NoninvertibleTransformException- if the transform can not be inverted.
-
-