001    //$HeadURL: svn+ssh://rbezema@svn.wald.intevation.org/deegree/base/tags/2.1/src/org/deegree/model/csct/ct/MathTransform2D.java $
002    /*----------------    FILE HEADER  ------------------------------------------
003    
004    This file is part of deegree.
005    Copyright (C) 2001 by:
006    EXSE, Department of Geography, University of Bonn
007    http://www.giub.uni-bonn.de/exse/
008    lat/lon GmbH
009    http://www.lat-lon.de
010    
011    It has been implemented within SEAGIS - An OpenSource implementation of OpenGIS specification
012    (C) 2001, Institut de Recherche pour le D�veloppement (http://sourceforge.net/projects/seagis/)
013    SEAGIS Contacts:  Surveillance de l'Environnement Assist�e par Satellite
014                      Institut de Recherche pour le D�veloppement / US-Espace
015                      mailto:seasnet@teledetection.fr
016    
017    
018    This library is free software; you can redistribute it and/or
019    modify it under the terms of the GNU Lesser General Public
020    License as published by the Free Software Foundation; either
021    version 2.1 of the License, or (at your option) any later version.
022    
023    This library is distributed in the hope that it will be useful,
024    but WITHOUT ANY WARRANTY; without even the implied warranty of
025    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
026    Lesser General Public License for more details.
027    
028    You should have received a copy of the GNU Lesser General Public
029    License along with this library; if not, write to the Free Software
030    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
031    
032    Contact:
033    
034    Andreas Poth
035    lat/lon GmbH
036    Aennchenstr. 19
037    53115 Bonn
038    Germany
039    E-Mail: poth@lat-lon.de
040    
041    Klaus Greve
042    Department of Geography
043    University of Bonn
044    Meckenheimer Allee 166
045    53115 Bonn
046    Germany
047    E-Mail: klaus.greve@uni-bonn.de
048    
049                     
050     ---------------------------------------------------------------------------*/
051    package org.deegree.model.csct.ct;
052    
053    // Miscellaneous
054    import java.awt.Shape;
055    import java.awt.geom.AffineTransform;
056    import java.awt.geom.Point2D;
057    
058    import org.deegree.model.csct.pt.Matrix;
059    
060    
061    /**
062     * Transforms two-dimensional coordinate points. {@link CoordinateTransformation#getMathTransform}
063     * may returns instance of this interface when source and destination coordinate systems are both two
064     * dimensional. <code>MathTransform2D</code> extends {@link MathTransform} by adding some methods
065     * for easier interoperability with <A HREF="http://java.sun.com/products/java-media/2D/">Java2D</A>.
066     * If the transformation is affine, then <code>MathTransform</code> shall be an immutable instance of
067     * {@link AffineTransform}.
068     *
069     * @version 1.00
070     * @author OpenGIS (www.opengis.org)
071     * @author Martin Desruisseaux
072     */
073    public interface MathTransform2D extends MathTransform
074    {
075        /**
076         * Transforms the specified <code>ptSrc</code> and stores the result in <code>ptDst</code>.
077         * If <code>ptDst</code> is <code>null</code>, a new {@link Point2D} object is allocated
078         * and then the result of the transformation is stored in this object. In either case,
079         * <code>ptDst</code>, which contains the transformed point, is returned for convenience.
080         * If <code>ptSrc</code> and <code>ptDst</code> are the same object, the input point is
081         * correctly overwritten with the transformed point.
082         *
083         * @param ptSrc the specified coordinate point to be transformed.
084         * @param ptDst the specified coordinate point that stores the
085         *              result of transforming <code>ptSrc</code>, or
086         *              <code>null</code>.
087         * @return the coordinate point after transforming <code>ptSrc</code>
088         *         and stroring the result in <code>ptDst</code>.
089         * @throws TransformException if the point can't be transformed.
090         */
091        public abstract Point2D transform(final Point2D ptSrc, final Point2D ptDst) throws TransformException;
092    
093        /**
094         * Transform the specified shape. This method may replace straight lines by
095         * quadratic curves when applicable. It may also do the opposite (replace
096         * curves by straight lines). The returned shape doesn't need to have the
097         * same number of points than the original shape.
098         *
099         * @param  shape Shape to transform.
100         * @return Transformed shape, or <code>shape</code> if
101         *         this transform is the identity transform.
102         * @throws TransformException if a transform failed.
103         */
104        public abstract Shape createTransformedShape(final Shape shape) throws TransformException;
105    
106        /**
107         * Gets the derivative of this transform at a point. The derivative is the
108         * matrix of the non-translating portion of the approximate affine map at
109         * the point.
110         *
111         * @param  point The coordinate point where to evaluate the derivative. Null value is
112         *         accepted only if the derivative is the same everywhere. For example affine
113         *         transform accept null value since they produces identical derivative no
114         *         matter the coordinate value. But most map projection will requires a non-null
115         *         value.
116         * @return The derivative at the specified point as a 2&times;2 matrix.  This method
117         *         never returns an internal object: changing the matrix will not change the
118         *         state of this math transform.
119         * @throws NullPointerException if the derivative dependents on coordinate and <code>point</code> is <code>null</code>.
120         * @throws TransformException if the derivative can't be evaluated at the specified point.
121         */
122        public abstract Matrix derivative(final Point2D point) throws TransformException;
123    }