Class 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
    • 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 does 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 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 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:
        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 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:
        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 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:
        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 not be inverted.