/*$************************************************************************************************
 **
 ** $Id: MathTransform2D.java 831 2006-05-01 00:27:23Z Desruisseaux $
 **
 ** $URL: http://svn.code.sf.net/p/geoapi/code/branches/2.0.x/geoapi/src/main/java/org/opengis/referencing/operation/MathTransform2D.java $
 **
 ** Copyright (C) 2003-2005 Open GIS Consortium, Inc.
 ** All Rights Reserved. http://www.opengis.org/legal/
 **
 *************************************************************************************************/
package org.opengis.referencing.operation;

// J2SE direct dependencies
import java.awt.Shape;
import java.awt.geom.Point2D;

// Annotations
import org.opengis.annotation.Extension;


/**
 * Transforms two-dimensional coordinate points.
 * {@link CoordinateOperation#getMathTransform} may returns instance of this
 * interface when source and destination coordinate systems are both two dimensional.
 * {@code MathTransform2D} extends {@link MathTransform} by adding some methods
 * for easier interoperability with
 *
 * Java2D.
 *
 * If the transformation is affine, then {@code MathTransform} shall be an
 * immutable instance of {@link java.awt.geom.AffineTransform}.
 *
 * @author Martin Desruisseaux (IRD)
 * @since GeoAPI 1.0
 */
@Extension
public interface MathTransform2D extends MathTransform {
    /**
     * Transforms the specified {@code ptSrc} and stores the result in {@code ptDst}.
     * If {@code ptDst} is {@code null}, a new {@link Point2D} object is allocated
     * and then the result of the transformation is stored in this object. In either case,
     * {@code ptDst}, which contains the transformed point, is returned for convenience.
     * If {@code ptSrc} and {@code ptDst} are the same object, the input point is
     * correctly overwritten with the transformed point.
     *
     * @param ptSrc the specified coordinate point to be transformed.
     * @param ptDst the specified coordinate point that stores the
     *              result of transforming {@code ptSrc}, or
     *              {@code null}.
     * @return the coordinate point after transforming {@code ptSrc}
     *         and stroring the result in {@code ptDst}.
     * @throws TransformException if the point can't be transformed.
     */
    Point2D transform(final Point2D ptSrc, final Point2D ptDst) throws TransformException;

    /**
     * Transform the specified shape. This method may replace straight lines by
     * quadratic curves when applicable. It may also do the opposite (replace
     * curves by straight lines). The returned shape doesn't need to have the
     * same number of points than the original shape.
     *
     * @param  shape Shape to transform.
     * @return Transformed shape, or {@code shape} if
     *         this transform is the identity transform.
     * @throws TransformException if a transform failed.
     */
    @Extension
    Shape createTransformedShape(final Shape shape) throws TransformException;

    /**
     * Gets the derivative of this transform at a point. The derivative is the
     * matrix of the non-translating portion of the approximate affine map at
     * the point.
     *
     * @param  point The coordinate point where to evaluate the derivative. Null value is
     *         accepted only if the derivative is the same everywhere. For example affine
     *         transform accept null value since they produces identical derivative no
     *         matter the coordinate value. But most map projection will requires a non-null
     *         value.
     * @return The derivative at the specified point as a 2×2 matrix.  This method
     *         never returns an internal object: changing the matrix will not change the
     *         state of this math transform.
     * @throws NullPointerException if the derivative dependents on coordinate
     *         and {@code point} is {@code null}.
     * @throws TransformException if the derivative can't be evaluated at the
     *         specified point.
     */
    Matrix derivative(final Point2D point) throws TransformException;
}

 

Ads help maintain this website.