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