001 //$HeadURL: svn+ssh://rbezema@svn.wald.intevation.org/deegree/base/tags/2.1/src/org/deegree/model/spatialschema/Geometry.java $
002 /*---------------- FILE HEADER ------------------------------------------
003
004 This file is part of deegree.
005 Copyright (C) 2001-2006 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 53115 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 package org.deegree.model.spatialschema;
044
045 import java.io.Serializable;
046
047 import org.deegree.model.crs.CoordinateSystem;
048
049
050 /**
051 *
052 * The basic interface for all geometries. it declares the methods that
053 * are common to all geometries. this doesn't means for example that all
054 * geometries defines a valid boundary but is there asked for they should
055 * be able to answer (with null).
056 *
057 * <p>-----------------------------------------------------</p>
058 *
059 * @author Andreas Poth
060 * @version $Revision: 6259 $ $Date: 2007-03-20 10:15:15 +0100 (Di, 20 Mär 2007) $
061 * <p>
062 */
063 public interface Geometry extends Serializable {
064 /*#CS_CoordinateSystem lnkCS_CoordinateSystem;*/
065
066 /**
067 * returns the bounding box of a geometry
068 */
069 Envelope getEnvelope();
070
071 /**
072 * returns the boundary of a geometry
073 */
074 Boundary getBoundary();
075
076 /**
077 * The operation "dimension" shall return the inherent dimension of this
078 * Geometry, which shall be less than or equal to the coordinate dimension.
079 * The dimension of a collection of geometric objects shall be the largest
080 * dimension of any of its pieces. Points are 0-dimensional, curves are
081 * 1-dimensional, surfaces are 2-dimensional, and solids are 3-dimensional.
082 */
083 int getDimension();
084
085 /**
086 * The operation "coordinateDimension" shall return the dimension of the
087 * coordinates that define this Geometry, which must be the same as the
088 * coordinate dimension of the coordinate reference system for this Geometry.
089 */
090 int getCoordinateDimension();
091
092 /**
093 * returns the spatial reference system of a geometry
094 */
095 CoordinateSystem getCoordinateSystem();
096
097
098 /**
099 * returns true if no geometry values resp. points stored
100 * within the geometry.
101 */
102 boolean isEmpty();
103
104 /**
105 * The operation "distance" shall return the distance between this Geometry
106 * and another Geometry. This distance is defined to be the greatest lower
107 * bound of the set of distances between all pairs of points that include
108 * one each from each of the two Geometries. A "distance" value shall be a
109 * positive number associated to distance units such as meters or standard
110 * foot. If necessary, the second geometric object shall be transformed into
111 * the same coordinate reference system as the first before the distance is
112 * calculated.<p></p>
113 * If the geometric objects overlap, or touch, then their distance apart
114 * shall be zero. Some current implementations use a "negative" distance for
115 * such cases, but the approach is neither consistent between implementations,
116 * nor theoretically viable.
117 */
118 double distance(Geometry gmo);
119
120 /**
121 * translate a geometry by the submitted values. if the length
122 * of <tt>d</tt> is smaller then the dimension of the geometry
123 * only the first d.length'th coordinates will be translated.
124 * If the length of <tt>d</tt> is larger then the dimension of
125 * the geometry an ArrayIndexOutOfBoundExceptions raises.
126 */
127 void translate(double[] d);
128
129 /**
130 * The operation "centroid" shall return the mathematical centroid for this
131 * Geometry. The result is not guaranteed to be on the object. For heterogeneous
132 * collections of primitives, the centroid only takes into account those of the
133 * largest dimension. For example, when calculating the centroid of surfaces,
134 * an average is taken weighted by area. Since curves have no area they do not
135 * contribute to the average.
136 */
137 Point getCentroid();
138
139 /**
140 * The operation "convexHull" shall return a Geometry that represents the
141 * convex hull of this Geometry.
142 */
143 Geometry getConvexHull();
144
145 /**
146 * The operation "buffer" shall return a Geometry containing all points whose
147 * distance from this Geometry is less than or equal to the "distance" passed
148 * as a parameter. The Geometry returned is in the same reference system as
149 * this original Geometry. The dimension of the returned Geometry is normally
150 * the same as the coordinate dimension - a collection of Surfaces in 2D
151 * space and a collection of Solids in 3D space, but this may be application
152 * defined.
153 */
154 Geometry getBuffer(double distance);
155
156 /**
157 * The Boolean valued operation "contains" shall return TRUE if this Geometry
158 * contains another Geometry.
159 */
160 boolean contains(Geometry gmo);
161
162 /**
163 * The Boolean valued operation "contains" shall return TRUE if this Geometry
164 * contains a single point given by a coordinate.
165 */
166 boolean contains(Position position);
167
168 /**
169 * The Boolean valued operation "intersects" shall return TRUE if this Geometry
170 * intersects another Geometry. Within a Complex, the Primitives do not
171 * intersect one another. In general, topologically structured data uses shared
172 * geometric objects to capture intersection information.
173 */
174 boolean intersects(Geometry gmo);
175
176 /**
177 * The "union" operation shall return the set theoretic union of this Geometry
178 * and the passed Geometry.
179 */
180 Geometry union(Geometry gmo);
181
182 /**
183 * The "intersection" operation shall return the set theoretic intersection
184 * of this Geometry and the passed Geometry.
185 */
186 Geometry intersection(Geometry gmo) throws GeometryException;
187
188 /**
189 * The "difference" operation shall return the set theoretic difference of
190 * this Geometry and the passed Geometry.
191 */
192 Geometry difference(Geometry gmo);
193
194 /**
195 provide optimized proximity queries within for a distance .
196 calvin added on 10/21/2003
197 */
198 boolean isWithinDistance(Geometry gmo, double distance);
199
200 /**
201 * sets tolerance value use for topological operations
202 * @param tolerance
203 */
204 void setTolerance(double tolerance);
205
206 /**
207 * returns the tolerance value use for topological operations
208 * @return tolerance value use for topological operations
209 */
210 double getTolerance();
211
212 }
213 /* ********************************************************************
214 Changes to this class. What the people have been up to:
215 $Log$
216 Revision 1.10 2007/02/22 11:24:19 poth
217 support for tolerance added form some topological operations
218
219 Revision 1.9 2006/11/27 09:07:51 poth
220 JNI integration of proj4 has been removed. The CRS functionality now will be done by native deegree code.
221
222 Revision 1.8 2006/07/12 14:46:15 poth
223 comment footer added
224
225 ********************************************************************** */