/* * Geotools 2 - OpenSource mapping toolkit * (C) 2003, Geotools Project Managment Committee (PMC) * (C) 2001, Institut de Recherche pour le Développement * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * * This package contains documentation from OpenGIS specifications. * OpenGIS consortium's work is fully acknowledged here. */ package org.geotools.ct; // OpenGIS dependencies import java.awt.Shape; import java.awt.geom.AffineTransform; import java.awt.geom.Point2D; import javax.media.jai.PerspectiveTransform; import org.geotools.pt.Matrix; import org.opengis.referencing.operation.TransformException; /** * Transforms two-dimensional coordinate points. * {@link CoordinateTransformation#getMathTransform} may returns instance of this * interface when source and destination coordinate systems are both two dimensional. * MathTransform2D extends {@link MathTransform} by adding some methods * for easier interoperability with * * Java2D. * * If the transformation is affine, then MathTransform shall be an * immutable instance of {@link AffineTransform}. * * @version 1.00 * @author OpenGIS (www.opengis.org) * @author Martin Desruisseaux * * @see AffineTransform * @see PerspectiveTransform * * @deprecated Replaced by {@link org.opengis.referencing.operation.MathTransform2D} * in the org.opengis.referencing.operation package. */ public interface MathTransform2D extends MathTransform { /** * The two dimensional identity transform. */ public static final MathTransform2D IDENTITY = new AffineTransform2D(new AffineTransform()); /** * Transforms the specified ptSrc and stores the result in ptDst. * If ptDst is null, a new {@link 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. * * @param ptSrc the specified coordinate point to be transformed. * @param ptDst the specified coordinate point that stores the * result of transforming ptSrc, or * null. * @return the coordinate point after transforming ptSrc * and stroring the result in ptDst. * @throws TransformException if the point can't be transformed. */ public abstract 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 shape if * this transform is the identity transform. * @throws TransformException if a transform failed. */ public abstract 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 point is null. * @throws TransformException if the derivative can't be evaluated at the * specified point. */ public abstract Matrix derivative(final Point2D point) throws TransformException; }