001    //$HeadURL: svn+ssh://jwilden@svn.wald.intevation.org/deegree/base/branches/2.5_testing/src/org/deegree/model/spatialschema/Envelope.java $
002    /*----------------------------------------------------------------------------
003     This file is part of deegree, http://deegree.org/
004     Copyright (C) 2001-2009 by:
005       Department of Geography, University of Bonn
006     and
007       lat/lon GmbH
008    
009     This library is free software; you can redistribute it and/or modify it under
010     the terms of the GNU Lesser General Public License as published by the Free
011     Software Foundation; either version 2.1 of the License, or (at your option)
012     any later version.
013     This library is distributed in the hope that it will be useful, but WITHOUT
014     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
015     FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
016     details.
017     You should have received a copy of the GNU Lesser General Public License
018     along with this library; if not, write to the Free Software Foundation, Inc.,
019     59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
020    
021     Contact information:
022    
023     lat/lon GmbH
024     Aennchenstr. 19, 53177 Bonn
025     Germany
026     http://lat-lon.de/
027    
028     Department of Geography, University of Bonn
029     Prof. Dr. Klaus Greve
030     Postfach 1147, 53001 Bonn
031     Germany
032     http://www.geographie.uni-bonn.de/deegree/
033    
034     e-mail: info@deegree.org
035    ----------------------------------------------------------------------------*/
036    
037    package org.deegree.model.spatialschema;
038    
039    import org.deegree.model.crs.CoordinateSystem;
040    
041    /**
042     * a boundingbox as child of a Polygon isn't part of the iso19107 spec but it simplifies the geometry handling
043     *
044     *
045     * @version $Revision: 18195 $
046     * @author <a href="mailto:poth@lat-lon.de">Andreas Poth</a>
047     * @author last edited by: $Author: mschneider $
048     *
049     * @version 1.0. $Revision: 18195 $, $Date: 2009-06-18 17:55:39 +0200 (Do, 18 Jun 2009) $
050     *
051     * @since 2.0
052     */
053    public interface Envelope {
054    
055        /**
056         * returns the spatial reference system of a geometry
057         *
058         * @return the spatial reference system of a geometry
059         */
060        CoordinateSystem getCoordinateSystem();
061    
062        /**
063         * returns the width of bounding box
064         *
065         * @return the width of bounding box
066         */
067        double getWidth();
068    
069        /**
070         * returns the height of bounding box
071         *
072         * @return the height of bounding box
073         */
074        double getHeight();
075    
076        /**
077         * returns the minimum coordinates of bounding box
078         *
079         * @return the minimum coordinates of bounding box
080         */
081        Position getMin();
082    
083        /**
084         * returns the maximum coordinates of bounding box
085         *
086         * @return the maximum coordinates of bounding box
087         */
088        Position getMax();
089    
090        /**
091         * returns true if the bounding box contains the submitted position
092         *
093         * @param position
094         *            the position to find
095         * @return true if the bounding box contains the submitted position
096         */
097        boolean contains( Position position );
098    
099        /**
100         * returns true if this envelope intersects the submitted envelope
101         *
102         * @param bb
103         *            another Envelope
104         * @return true if this envelope intersects the submitted envelope
105         */
106        boolean intersects( Envelope bb );
107    
108        /**
109         * returns true if all positions of the submitted bounding box are within this bounding box
110         *
111         * @param bb
112         *            another boundingbox
113         * @return true if all positions of the submitted bounding box are within this bounding box
114         */
115        boolean contains( Envelope bb );
116    
117        /**
118         * returns a new Envelope object representing the intersection of this Envelope with the specified Envelope.
119         *
120         * @param bb
121         *            another boundingbox
122         * @return a new Envelope object representing the intersection of this Envelope with the specified Envelope.
123         */
124        Envelope createIntersection( Envelope bb );
125    
126        /**
127         * merges two Envelops and returns the minimum envelope containing both.
128         *
129         * @param envelope
130         *            another envelope to merge with this one
131         *
132         * @return the minimum envelope containing both.
133         * @throws GeometryException
134         *             if the coordinatesystems are not equal
135         */
136        Envelope merge( Envelope envelope )
137                                throws GeometryException;
138    
139        /**
140         * creates a new envelope
141         *
142         * @param b
143         *            an extra bound around the Envelope
144         * @return a new Envelope
145         */
146        Envelope getBuffer( double b );
147    
148        /**
149         * ensures that the passed Envepole is contained within this.Envelope
150         *
151         * @param other
152         *            to expand this Envelope.
153         */
154        void expandToContain( Envelope other );
155    
156        /**
157         * translate a envelope in the direction defined by the two passed values and retiurns the resulting envelope
158         *
159         * @param x
160         *            coordinate
161         * @param y
162         *            coordinate
163         * @return the resulting translated Envelope
164         */
165        Envelope translate( double x, double y );
166    
167        /**
168         * returns the centroid of an Envelope
169         *
170         * @return centroid of an Envelope
171         */
172        Point getCentroid();
173    
174    }