org.opengis.example.referencing
Class SimpleTransform2D

Object
  extended by SimpleIdentifiedObject
      extended by SimpleTransform
          extended by SimpleTransform2D
All Implemented Interfaces:
Serializable, Identifier, IdentifiedObject, CoordinateOperation, MathTransform, MathTransform2D, ReferenceIdentifier

public abstract class SimpleTransform2D
extends SimpleTransform
implements MathTransform2D

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
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
protected SimpleTransform2D(Citation authority, String name, CoordinateReferenceSystem sourceCRS, CoordinateReferenceSystem targetCRS)
          Creates a new operation for the given name and CRS.
 
Method Summary
 Shape createTransformedShape(Shape shape)
          Transforms the specified shape.
 Matrix derivative(DirectPosition point)
          Gets the derivative of this transform at a point.
 Matrix derivative(Point2D point)
          Gets the derivative of this transform at a point.
 int getSourceDimensions()
          Returns the number of source dimensions, which is fixed to 2.
 int getTargetDimensions()
          Returns the number of target dimensions, which is fixed to 2.
 MathTransform2D inverse()
          Creates the inverse transform of this object.
 DirectPosition transform(DirectPosition ptSrc, DirectPosition ptDst)
          Transforms the specified point by delegating to transform(Point2D, Point2D).
abstract  Point2D transform(Point2D ptSrc, Point2D ptDst)
          Transforms the specified ptSrc and stores the result in ptDst.
 
Methods inherited from class SimpleTransform
equals, getCoordinateOperationAccuracy, getMathTransform, getOperationVersion, getSourceCRS, getTargetCRS, isIdentity, transform, transform, transform, transform
 
Methods inherited from class SimpleIdentifiedObject
getAlias, getAuthority, getCode, getCodeSpace, getDescription, getDomainOfValidity, getIdentifiers, getName, getRemarks, getScope, getVersion, hashCode, toString, toWKT
 
Methods inherited from class Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface MathTransform
isIdentity, toWKT, transform, transform, transform, transform
 
Methods inherited from interface CoordinateOperation
getDomainOfValidity, getScope
 
Methods inherited from interface IdentifiedObject
getAlias, getIdentifiers, getName, getRemarks, toWKT
 

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, or null.
name - The name of the new operation.
sourceCRS - The source CRS to be returned by SimpleTransform.getSourceCRS().
targetCRS - The target CRS to be returned by SimpleTransform.getTargetCRS().
Method Detail

getSourceDimensions

public final int getSourceDimensions()
Returns the number of source dimensions, which is fixed to 2.

Specified by:
getSourceDimensions in interface MathTransform
Overrides:
getSourceDimensions in class SimpleTransform
Returns:
The dimension of input points.

getTargetDimensions

public final int getTargetDimensions()
Returns the number of target dimensions, which is fixed to 2.

Specified by:
getTargetDimensions in interface MathTransform
Overrides:
getTargetDimensions in class SimpleTransform
Returns:
The dimension of input points.

transform

public DirectPosition transform(DirectPosition ptSrc,
                                DirectPosition ptDst)
                         throws MismatchedDimensionException,
                                TransformException
Transforms the specified point by delegating to transform(Point2D, Point2D).

Specified by:
transform in interface MathTransform
Specified by:
transform in class SimpleTransform
Parameters:
ptSrc - the specified coordinate point to be transformed.
ptDst - the specified coordinate point that stores the result of transforming ptSrc, or null.
Returns:
the coordinate point after transforming ptSrc and storing the result in ptDst, or a newly created point if ptDst was null.
Throws:
MismatchedDimensionException - if ptSrc or ptDst doesn't have the expected dimension.
TransformException - if the point can't be transformed.

transform

public abstract Point2D transform(Point2D ptSrc,
                                  Point2D ptDst)
                           throws TransformException
Transforms the specified ptSrc and stores the result in ptDst. If ptDst is null, a new Point2D 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. If ptSrc and ptDst are the same object, the input point is correctly overwritten with the transformed point.

Specified by:
transform in interface MathTransform2D
Parameters:
ptSrc - the coordinate point to be transformed.
ptDst - the coordinate point that stores the result of transforming ptSrc, or null if a new point shall be created.
Returns:
the coordinate point after transforming ptSrc and storing the result in ptDst or in a new point if ptDst was null.
Throws:
TransformException - if the point can't 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:
createTransformedShape in interface MathTransform2D
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 to derivative(Point2D).

Specified by:
derivative in interface MathTransform
Overrides:
derivative in class SimpleTransform
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't 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:
derivative in interface MathTransform2D
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't 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:
inverse in interface MathTransform
Specified by:
inverse in interface MathTransform2D
Overrides:
inverse in class SimpleTransform
Returns:
The inverse transform.
Throws:
NoninvertibleTransformException - if the transform can't be inverted.


Copyright © 1994–2014 Open Geospatial Consortium. All rights reserved.