root / branches / v2_0_0_prep / libraries / libFMap_geometries / src / org / gvsig / fmap / geom / Geometry.java @ 38595
History | View | Annotate | Download (18.5 KB)
1 | 28996 | jpiera | /* gvSIG. Geographic Information System of the Valencian Government
|
---|---|---|---|
2 | 20861 | jiyarza | *
|
3 | 28996 | jpiera | * Copyright (C) 2007-2008 Infrastructures and Transports Department
|
4 | * of the Valencian Government (CIT)
|
||
5 | *
|
||
6 | 20861 | jiyarza | * This program is free software; you can redistribute it and/or
|
7 | * modify it under the terms of the GNU General Public License
|
||
8 | * as published by the Free Software Foundation; either version 2
|
||
9 | * of the License, or (at your option) any later version.
|
||
10 | 28996 | jpiera | *
|
11 | 20861 | jiyarza | * This program is distributed in the hope that it will be useful,
|
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
14 | * GNU General Public License for more details.
|
||
15 | 28996 | jpiera | *
|
16 | 20861 | jiyarza | * You should have received a copy of the GNU General Public License
|
17 | * along with this program; if not, write to the Free Software
|
||
18 | 28996 | jpiera | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 | * MA 02110-1301, USA.
|
||
20 | *
|
||
21 | 20861 | jiyarza | */
|
22 | 28996 | jpiera | |
23 | /*
|
||
24 | * AUTHORS (In addition to CIT):
|
||
25 | * 2009 {Iver T.I.} {Task}
|
||
26 | */
|
||
27 | |||
28 | 20761 | jmvivo | package org.gvsig.fmap.geom; |
29 | |||
30 | import java.awt.Shape; |
||
31 | import java.awt.geom.AffineTransform; |
||
32 | import java.awt.geom.PathIterator; |
||
33 | import java.awt.geom.Rectangle2D; |
||
34 | import java.io.Serializable; |
||
35 | |||
36 | 21870 | vcaballero | import org.cresques.cts.ICoordTrans; |
37 | 34140 | jpiera | |
38 | 20761 | jmvivo | import org.gvsig.fmap.geom.handler.Handler; |
39 | import org.gvsig.fmap.geom.operation.GeometryOperationContext; |
||
40 | import org.gvsig.fmap.geom.operation.GeometryOperationException; |
||
41 | 21000 | jiyarza | import org.gvsig.fmap.geom.operation.GeometryOperationNotSupportedException; |
42 | 21425 | vcaballero | import org.gvsig.fmap.geom.primitive.Envelope; |
43 | 21382 | csanchez | import org.gvsig.fmap.geom.primitive.GeneralPathX; |
44 | 33262 | jpiera | import org.gvsig.fmap.geom.primitive.Point; |
45 | 20761 | jmvivo | import org.gvsig.fmap.geom.type.GeometryType; |
46 | |||
47 | /**
|
||
48 | 28996 | jpiera | * <p>
|
49 | 32924 | jjdelcerro | * This interface is equivalent to the GM_Object specified in <a href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=26012"
|
50 | * >ISO 19107</a>. It is the root class of the geometric object taxonomy and
|
||
51 | * supports interfaces common to all geographically referenced geometric
|
||
52 | * objects.
|
||
53 | 28996 | jpiera | * </p>
|
54 | 32924 | jjdelcerro | * <p>
|
55 | * Geometry instances are sets of direct positions in a particular coordinate
|
||
56 | * reference system. A Geometry can be regarded as an infinite set of points
|
||
57 | * that satisfies the set operation interfaces for a set of direct positions.
|
||
58 | 28996 | jpiera | * </p>
|
59 | * <p>
|
||
60 | 32924 | jjdelcerro | * A geometric object shall be a combination of a coordinate geometry and a
|
61 | * coordinate reference system. In all of the operations, all geometric
|
||
62 | * calculations shall be done in the coordinate reference system of the first
|
||
63 | * geometric object accessed, which is normally the object whose operation is
|
||
64 | * being invoked. Returned objects shall be in the coordinate reference system
|
||
65 | * in which the calculations are done unless explicitly stated otherwise.
|
||
66 | * </p>
|
||
67 | 35346 | jpiera | * <p>
|
68 | * This class extends of the {@link Shape} class by historical reasons but this
|
||
69 | * inheritance will disappear in future versions.
|
||
70 | * </p>
|
||
71 | 32924 | jjdelcerro | * @see <a href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=26012"
|
72 | * >ISO 19107< /a>
|
||
73 | 20761 | jmvivo | */
|
74 | 22238 | vcaballero | public interface Geometry extends Shape, Serializable, Comparable { |
75 | 20895 | jiyarza | |
76 | 21047 | jiyarza | /**
|
77 | 29166 | jpiera | * Predefined geometry types in the model.
|
78 | 21047 | jiyarza | */
|
79 | 20918 | jiyarza | public interface TYPES { |
80 | 32924 | jjdelcerro | |
81 | 20918 | jiyarza | /**
|
82 | 29166 | jpiera | * Any geometry.
|
83 | 21771 | jiyarza | */
|
84 | 32924 | jjdelcerro | |
85 | 21771 | jiyarza | public final static int GEOMETRY = 0; |
86 | 32924 | jjdelcerro | |
87 | 21771 | jiyarza | /**
|
88 | 32924 | jjdelcerro | * A geometric element that has zero dimensions and a location
|
89 | * determinable by an ordered set of coordinates.
|
||
90 | 20918 | jiyarza | */
|
91 | public final static int POINT = 1; |
||
92 | 32924 | jjdelcerro | |
93 | 20918 | jiyarza | /**
|
94 | 32924 | jjdelcerro | * A straight or curved geometric element that is generated by a moving
|
95 | * point and that has extension only along the path of the point.
|
||
96 | 20918 | jiyarza | */
|
97 | public final static int CURVE = 2; |
||
98 | 32924 | jjdelcerro | |
99 | 20918 | jiyarza | /**
|
100 | * A closed plane figure bounded by straight lines.
|
||
101 | */
|
||
102 | 31020 | cordinyana | public final static int SURFACE = 3; |
103 | 32924 | jjdelcerro | |
104 | 20918 | jiyarza | /**
|
105 | 29166 | jpiera | * Solids in 3D.
|
106 | 20918 | jiyarza | */
|
107 | 31020 | cordinyana | public final static int SOLID = 4; |
108 | 32924 | jjdelcerro | |
109 | 34904 | jpiera | /**
|
110 | 32924 | jjdelcerro | * A set that can contain points, lines and polygons. This is usual in
|
111 | * <i>CAD</i> layers <i>(dxf, dgn, dwg)</i>.
|
||
112 | 20918 | jiyarza | */
|
113 | 34905 | jpiera | public final static int AGGREGATE = 6; |
114 | 20918 | jiyarza | /**
|
115 | * A set of points.
|
||
116 | */
|
||
117 | 34905 | jpiera | public final static int MULTIPOINT = 7; |
118 | 32924 | jjdelcerro | |
119 | 20918 | jiyarza | /**
|
120 | * A set of lines.
|
||
121 | */
|
||
122 | 34905 | jpiera | public final static int MULTICURVE = 8; |
123 | 32924 | jjdelcerro | |
124 | 20918 | jiyarza | /**
|
125 | * A set of polygons.
|
||
126 | */
|
||
127 | 34905 | jpiera | public final static int MULTISURFACE = 9; |
128 | 32924 | jjdelcerro | |
129 | 20918 | jiyarza | /**
|
130 | * A set of solids.
|
||
131 | */
|
||
132 | 34905 | jpiera | public final static int MULTISOLID = 10; |
133 | 32924 | jjdelcerro | |
134 | 20918 | jiyarza | /**
|
135 | 32924 | jjdelcerro | * A closed plane curve every point of which is equidistant from a fixed
|
136 | * point within the curve.
|
||
137 | 20918 | jiyarza | */
|
138 | 34905 | jpiera | public final static int CIRCLE = 11; |
139 | 32924 | jjdelcerro | |
140 | 20918 | jiyarza | /**
|
141 | * A continuous portion (as of a circle or ellipse) of a curved line.
|
||
142 | */
|
||
143 | 34905 | jpiera | public final static int ARC = 12; |
144 | 32924 | jjdelcerro | |
145 | 20918 | jiyarza | /**
|
146 | 32924 | jjdelcerro | * A closed plane curve generated by a point moving in such a way that
|
147 | * the sums of its distances from two fixed points is a constant : a
|
||
148 | * plane section of a right circular cone that is a closed curve.
|
||
149 | 20918 | jiyarza | */
|
150 | 34905 | jpiera | public final static int ELLIPSE = 13; |
151 | 32924 | jjdelcerro | |
152 | 34905 | jpiera | public final static int SPLINE = 14; |
153 | 32924 | jjdelcerro | |
154 | 34905 | jpiera | public final static int ELLIPTICARC = 15; |
155 | 32924 | jjdelcerro | |
156 | 31020 | cordinyana | /**
|
157 | * NO DATA geometry.
|
||
158 | */
|
||
159 | 34905 | jpiera | public final static int NULL = 16; |
160 | 20918 | jiyarza | } |
161 | 32924 | jjdelcerro | |
162 | 31343 | jjdelcerro | public interface DIMENSIONS { |
163 | public final static int X = 0; |
||
164 | public final static int Y = 1; |
||
165 | public final static int Z = 2; |
||
166 | } |
||
167 | 32924 | jjdelcerro | |
168 | 28996 | jpiera | /**
|
169 | 32924 | jjdelcerro | * The subtype of a geometry is related with the dimension of the geometry,
|
170 | * that is a combination between the spatial dimension (2D, 2ZD, 3D) and the
|
||
171 | * M coordinate or "measure".
|
||
172 | *
|
||
173 | 28996 | jpiera | * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
|
174 | */
|
||
175 | 32924 | jjdelcerro | public interface SUBTYPES { |
176 | |||
177 | 28996 | jpiera | /**
|
178 | 29166 | jpiera | * Geometries with two dimensions.
|
179 | 28996 | jpiera | */
|
180 | 31020 | cordinyana | public final static int GEOM2D = 0; |
181 | 32924 | jjdelcerro | |
182 | 28996 | jpiera | /**
|
183 | 29166 | jpiera | * Geometries with three dimensions.
|
184 | 28996 | jpiera | */
|
185 | 34899 | jpiera | public final static int GEOM3D = 1; |
186 | 32924 | jjdelcerro | |
187 | 28996 | jpiera | /**
|
188 | 32924 | jjdelcerro | * Geometries with two dimensions and with the M coordinate.
|
189 | 28996 | jpiera | */
|
190 | 34899 | jpiera | public final static int GEOM2DM = 2; |
191 | 32924 | jjdelcerro | |
192 | 28996 | jpiera | /**
|
193 | 32924 | jjdelcerro | * Geometries with three dimensions and with the M coordinate.
|
194 | 28996 | jpiera | */
|
195 | 34899 | jpiera | public final static int GEOM3DM = 3; |
196 | 31020 | cordinyana | |
197 | /**
|
||
198 | * The subtype us unknown.
|
||
199 | */
|
||
200 | 34899 | jpiera | public final static int UNKNOWN = 4; |
201 | 26866 | jpiera | } |
202 | 21870 | vcaballero | |
203 | 31020 | cordinyana | /**
|
204 | * Initial value for new geometry types (it must not overlap with the basic
|
||
205 | * ones defined in TYPES).
|
||
206 | */
|
||
207 | public static final int EXTENDED_GEOMTYPE_OFFSET = 17; |
||
208 | 21039 | vcaballero | |
209 | 31020 | cordinyana | /**
|
210 | * Initial value for new geometry subtypes (it must not overlap with the
|
||
211 | * basic ones defined in SUBTYPES).
|
||
212 | */
|
||
213 | public static final int EXTENDED_GEOMSUBTYPE_OFFSET = 6; |
||
214 | |||
215 | 32924 | jjdelcerro | public interface OPERATIONS { |
216 | public final static String CONVERTTOWKT = "toWKT"; |
||
217 | public final static String CONVERTTOWKB = "toWKB"; |
||
218 | public final static String BUFFER = "buffer"; |
||
219 | public final static String DISTANCE = "Distance"; |
||
220 | public final static String CONTAINS = "Contains"; |
||
221 | public final static String OVERLAPS = "OVERLAPS"; |
||
222 | public final static String CONVEXHULL = "ConvexHull"; |
||
223 | public final static String COVERS = "Covers"; |
||
224 | public final static String CROSSES = "Crosses"; |
||
225 | public final static String DIFFERENCE = "Difference"; |
||
226 | public final static String DISJOIN = "Disjoin"; |
||
227 | public final static String INTERSECTION = "Intersaction"; |
||
228 | public final static String INTERSECTS = "Intersects"; |
||
229 | public final static String TOUCHES = "Touches"; |
||
230 | public final static String UNION = "Union"; |
||
231 | public final static String WITHIN = "Within"; |
||
232 | public final static String COVEREDBY = "CoveredBy"; |
||
233 | } |
||
234 | |||
235 | 20761 | jmvivo | public static int BEST = 0; |
236 | 28996 | jpiera | /**
|
237 | 29166 | jpiera | * North.
|
238 | 28996 | jpiera | */
|
239 | 20761 | jmvivo | public static int N = 1; |
240 | 32924 | jjdelcerro | |
241 | 28996 | jpiera | /**
|
242 | 29166 | jpiera | * North - East.
|
243 | 28996 | jpiera | */
|
244 | 20761 | jmvivo | public static int NE = 2; |
245 | 32924 | jjdelcerro | |
246 | 28996 | jpiera | /**
|
247 | 29166 | jpiera | * East.
|
248 | 28996 | jpiera | */
|
249 | 20761 | jmvivo | public static int E = 3; |
250 | 32924 | jjdelcerro | |
251 | 28996 | jpiera | /**
|
252 | 29166 | jpiera | * South - East.
|
253 | 28996 | jpiera | */
|
254 | 20761 | jmvivo | public static int SE = 4; |
255 | 32924 | jjdelcerro | |
256 | 28996 | jpiera | /**
|
257 | 29166 | jpiera | * South.
|
258 | 28996 | jpiera | */
|
259 | 20761 | jmvivo | public static int S = 5; |
260 | 32924 | jjdelcerro | |
261 | 28996 | jpiera | /**
|
262 | 29166 | jpiera | * South - West.
|
263 | 28996 | jpiera | */
|
264 | 20761 | jmvivo | public static int SW = 6; |
265 | 32924 | jjdelcerro | |
266 | 28996 | jpiera | /**
|
267 | 29166 | jpiera | * West.
|
268 | 28996 | jpiera | */
|
269 | 20761 | jmvivo | public static int W = 7; |
270 | 32924 | jjdelcerro | |
271 | 28996 | jpiera | /**
|
272 | 29166 | jpiera | * North - West.
|
273 | 28996 | jpiera | */
|
274 | 20761 | jmvivo | public static int NW = 8; |
275 | |||
276 | 32924 | jjdelcerro | public static int SELECTHANDLER = 0; |
277 | public static int STRETCHINGHANDLER = 1; |
||
278 | 21039 | vcaballero | |
279 | 20761 | jmvivo | /**
|
280 | 32924 | jjdelcerro | * If this geometry is a predefined interface then this method returns one
|
281 | * of {@link Geometry.TYPES} contants.<br>
|
||
282 | * If this geometry is an extended type then this method returns a runtime
|
||
283 | * constant that identifies its type. By convention this value is stored in
|
||
284 | * a constant called .CODE within the geometry class, for instance:
|
||
285 | * Point2D.CODE.
|
||
286 | *
|
||
287 | * @return If this geometry is a predefined interface then one of
|
||
288 | * {@link Geometry.TYPES} or a runtime constant if it is an extended
|
||
289 | * type.
|
||
290 | 20895 | jiyarza | */
|
291 | 20918 | jiyarza | public int getType(); |
292 | 20761 | jmvivo | |
293 | /**
|
||
294 | 29166 | jpiera | * Creates a clone of this geometry.
|
295 | 32924 | jjdelcerro | *
|
296 | 21047 | jiyarza | * @return A clone of this geometry.
|
297 | 20761 | jmvivo | */
|
298 | public Geometry cloneGeometry();
|
||
299 | |||
300 | /**
|
||
301 | 32924 | jjdelcerro | * Returns true if this geometry intersects the rectangle passed as
|
302 | * parameter.
|
||
303 | *
|
||
304 | * @param r
|
||
305 | * Rectangle.
|
||
306 | *
|
||
307 | 21775 | vcaballero | * @return True, if <code>this</code> intersects <code>r</code>.
|
308 | */
|
||
309 | public boolean intersects(Rectangle2D r); |
||
310 | |||
311 | /**
|
||
312 | * Used by the drawing strategies to quickly test whether this geometry
|
||
313 | * intersects with the visible rectangle.
|
||
314 | 32924 | jjdelcerro | *
|
315 | 21775 | vcaballero | * @param x
|
316 | 32924 | jjdelcerro | * The minimum X coordinate.
|
317 | 21775 | vcaballero | * @param y
|
318 | 32924 | jjdelcerro | * The minimum Y coordinate.
|
319 | * @param w
|
||
320 | * The width of the envelope.
|
||
321 | * @param h
|
||
322 | * The height of the envelope.
|
||
323 | * @return true if <code>this</code> intersects the rectangle defined by the
|
||
324 | * parameters.
|
||
325 | 21775 | vcaballero | */
|
326 | public boolean fastIntersects(double x, double y, double w, double h); |
||
327 | |||
328 | /**
|
||
329 | 21047 | jiyarza | * Returns this geometry's boundary rectangle.
|
330 | 32924 | jjdelcerro | *
|
331 | 21425 | vcaballero | * @deprecated use getEnvelope.
|
332 | 21047 | jiyarza | * @return Boundary rectangle.
|
333 | 20761 | jmvivo | */
|
334 | public Rectangle2D getBounds2D(); |
||
335 | 32924 | jjdelcerro | |
336 | 28996 | jpiera | /**
|
337 | * <p>
|
||
338 | 32924 | jjdelcerro | * Returns the minimum bounding box for this Geometry. This shall be the
|
339 | * coordinate region spanning the minimum and maximum value for each
|
||
340 | * ordinate taken on by DirectPositions in this Geometry. The simplest
|
||
341 | * representation for an envelope consists of two DirectPositions, the first
|
||
342 | * one containing all the minimums for each ordinate, and second one
|
||
343 | * containing all the maximums.
|
||
344 | 28996 | jpiera | * </p>
|
345 | 32924 | jjdelcerro | *
|
346 | * @return The minimum bounding box for this Geometry.
|
||
347 | 28996 | jpiera | */
|
348 | 21425 | vcaballero | public Envelope getEnvelope();
|
349 | 20761 | jmvivo | |
350 | /**
|
||
351 | 32924 | jjdelcerro | * Reprojects this geometry by the coordinate transformer passed as
|
352 | * parameter.
|
||
353 | *
|
||
354 | * @param ct
|
||
355 | * Coordinate Transformer.
|
||
356 | 20761 | jmvivo | */
|
357 | public void reProject(ICoordTrans ct); |
||
358 | |||
359 | /**
|
||
360 | 32924 | jjdelcerro | * If applies an affine transformation and returns the GeneralPathXIterator
|
361 | * with this geometry's information.
|
||
362 | *
|
||
363 | 28996 | jpiera | * @param at
|
364 | 32924 | jjdelcerro | * The transformation to apply.
|
365 | * @return The GeneralPathXIterator with this geometry's information.
|
||
366 | 20761 | jmvivo | */
|
367 | public PathIterator getPathIterator(AffineTransform at); |
||
368 | |||
369 | 32924 | jjdelcerro | /**
|
370 | * It returns the handlers of the geometry, these they can be of two types
|
||
371 | * is straightening and of selection.
|
||
372 | *
|
||
373 | 28996 | jpiera | * @param type
|
374 | 32924 | jjdelcerro | * Type of handlers.
|
375 | *
|
||
376 | * @return The handlers.
|
||
377 | 20761 | jmvivo | */
|
378 | public Handler[] getHandlers(int type); |
||
379 | |||
380 | 28996 | jpiera | /**
|
381 | * It applies an affine transformation to the geometry.
|
||
382 | *
|
||
383 | * @param at
|
||
384 | 32924 | jjdelcerro | * The transformation to apply.
|
385 | 28996 | jpiera | */
|
386 | 20761 | jmvivo | public void transform(AffineTransform at); |
387 | |||
388 | 28996 | jpiera | /**
|
389 | 32924 | jjdelcerro | * If applies an affine transformation and returns the GeneralPathXIterator
|
390 | * with this geometry's information.
|
||
391 | *
|
||
392 | 28996 | jpiera | * @param at
|
393 | 32924 | jjdelcerro | * The affine transformation.
|
394 | * @param flatness
|
||
395 | 29166 | jpiera | *
|
396 | 32924 | jjdelcerro | * @return The GeneralPathXIterator with this geometry's information.
|
397 | 28996 | jpiera | */
|
398 | 20761 | jmvivo | PathIterator getPathIterator(AffineTransform at, double flatness); |
399 | |||
400 | /**
|
||
401 | 32924 | jjdelcerro | * Useful to have the real shape behind the scenes. May be uses to edit it
|
402 | * knowing it it is a Circle, Ellipse, etc.
|
||
403 | *
|
||
404 | * @return The awt shape
|
||
405 | 20761 | jmvivo | */
|
406 | public Shape getInternalShape(); |
||
407 | 21039 | vcaballero | |
408 | 28996 | jpiera | /**
|
409 | 32924 | jjdelcerro | * Returns the largest number n such that each direct position in a
|
410 | * geometric set can be associated with a subset that has the direct
|
||
411 | * position in its interior and is similar (isomorphic) to Rn, Euclidean
|
||
412 | * n-space.
|
||
413 | *
|
||
414 | * @return The dimension.
|
||
415 | 28996 | jpiera | */
|
416 | 26788 | jpiera | public int getDimension(); |
417 | 21039 | vcaballero | |
418 | 28996 | jpiera | /**
|
419 | 32924 | jjdelcerro | * Returns <code>true</code> if this Geometry has no interior point of
|
420 | * self-intersection or self-tangency. In mathematical formalisms, this
|
||
421 | * means that every point in the interior of the object must have a metric
|
||
422 | * neighborhood whose intersection with the object is isomorphic to an
|
||
423 | 28996 | jpiera | * n-sphere, where n is the dimension of this Geometry.
|
424 | 32924 | jjdelcerro | *
|
425 | * @return If the geometry is simple.
|
||
426 | 28996 | jpiera | */
|
427 | 20761 | jmvivo | public boolean isSimple(); |
428 | |||
429 | /**
|
||
430 | 29166 | jpiera | * Invokes a geometry operation given its index and context.
|
431 | 32924 | jjdelcerro | *
|
432 | 28996 | jpiera | * @param index
|
433 | 32924 | jjdelcerro | * Unique index of the operation. Operation code.
|
434 | 29166 | jpiera | * @param ctx
|
435 | 32924 | jjdelcerro | * The context of the geometry operation.
|
436 | * @return Object returned by the operation.
|
||
437 | 29166 | jpiera | * @throws GeometryOperationNotSupportedException
|
438 | 32924 | jjdelcerro | * It is thrown when the operation has been not registered for
|
439 | * this geometry.
|
||
440 | 29166 | jpiera | * @throws GeometryOperationException
|
441 | 32924 | jjdelcerro | * It is thrown when there is an error executing the operation.
|
442 | 20761 | jmvivo | */
|
443 | 32924 | jjdelcerro | public Object invokeOperation(int index, GeometryOperationContext ctx) |
444 | throws GeometryOperationNotSupportedException,
|
||
445 | GeometryOperationException; |
||
446 | |||
447 | 27230 | jpiera | /**
|
448 | 29166 | jpiera | * Invokes a geometry operation given its name and context.
|
449 | 32924 | jjdelcerro | *
|
450 | * @param opName
|
||
451 | * Operation name.
|
||
452 | 29166 | jpiera | * @param ctx
|
453 | 32924 | jjdelcerro | * The context of the geometry operation.
|
454 | * @return Object returned by the operation.
|
||
455 | * @throws GeometryOperationNotSupportedException
|
||
456 | * It is thrown when the operation has been not registered for
|
||
457 | * this geometry.
|
||
458 | 29166 | jpiera | * @throws GeometryOperationException
|
459 | 32924 | jjdelcerro | * It is thrown when there is an error executing the operation.
|
460 | 27230 | jpiera | */
|
461 | 32924 | jjdelcerro | public Object invokeOperation(String opName, GeometryOperationContext ctx) |
462 | throws GeometryOperationNotSupportedException,
|
||
463 | GeometryOperationException; |
||
464 | 21039 | vcaballero | |
465 | 21047 | jiyarza | /**
|
466 | 29166 | jpiera | * Instance of the GeometryType associated to this geometry.
|
467 | 32924 | jjdelcerro | *
|
468 | * @return The geometry type.
|
||
469 | 21047 | jiyarza | */
|
470 | 20761 | jmvivo | public GeometryType getGeometryType();
|
471 | 21425 | vcaballero | |
472 | 21382 | csanchez | /**
|
473 | 28996 | jpiera | * Get GeneralPathIterator, to do registered operations to it.
|
474 | 32924 | jjdelcerro | *
|
475 | * @return The GeneralPathX.
|
||
476 | 21382 | csanchez | */
|
477 | public GeneralPathX getGeneralPath();
|
||
478 | 32924 | jjdelcerro | |
479 | /**
|
||
480 | * Return a byte array with the equivalent in WKB format of the Geometry.
|
||
481 | *
|
||
482 | * Utility method to wrap the invocation to the operation
|
||
483 | * {@link OPERATIONS#CONVERTTOWKB}.
|
||
484 | *
|
||
485 | * @return the WKB version of the geometry
|
||
486 | */
|
||
487 | public byte[] convertToWKB() throws GeometryOperationNotSupportedException, |
||
488 | GeometryOperationException; |
||
489 | |||
490 | /**
|
||
491 | * Return a string with the equivalent in WKT format of the Geometry.
|
||
492 | *
|
||
493 | * This is a utility method to wrap the invocation to the operation
|
||
494 | * {@link OPERATIONS#CONVERTTOWKT}.
|
||
495 | *
|
||
496 | * @return the WKT version of the geometry.
|
||
497 | *
|
||
498 | * @throws GeometryOperationNotSupportedException
|
||
499 | * @throws GeometryOperationException
|
||
500 | */
|
||
501 | public String convertToWKT() throws GeometryOperationNotSupportedException, |
||
502 | GeometryOperationException; |
||
503 | |||
504 | /**
|
||
505 | * Computes a buffer area around this geometry having the given width
|
||
506 | *
|
||
507 | * This is a utility method to wrap the invocation to the operation
|
||
508 | * {@link OPERATIONS#BUFFER}.
|
||
509 | *
|
||
510 | * @param distance
|
||
511 | * the width of the buffer
|
||
512 | *
|
||
513 | * @return a new Geometry with the computed buffer.
|
||
514 | *
|
||
515 | * @throws GeometryOperationNotSupportedException
|
||
516 | * @throws GeometryOperationException
|
||
517 | */
|
||
518 | public Geometry buffer(double distance) |
||
519 | throws GeometryOperationNotSupportedException,
|
||
520 | GeometryOperationException; |
||
521 | |||
522 | /**
|
||
523 | * Tests whether this geometry contains the specified geometry.
|
||
524 | *
|
||
525 | * This is a utility method to wrap the invocation to the operation
|
||
526 | * {@link OPERATIONS#CONTAINS}.
|
||
527 | *
|
||
528 | * @param geometry
|
||
529 | * the Geometry with which to compare this Geometry
|
||
530 | *
|
||
531 | * @return if this Geometry contains the specified geometry
|
||
532 | *
|
||
533 | * @throws GeometryOperationNotSupportedException
|
||
534 | * @throws GeometryOperationException
|
||
535 | */
|
||
536 | public boolean contains(Geometry geometry) |
||
537 | throws GeometryOperationNotSupportedException,
|
||
538 | GeometryOperationException; |
||
539 | |||
540 | /**
|
||
541 | * Returns the minimum distance between this Geometry and the specified
|
||
542 | * geometry.
|
||
543 | *
|
||
544 | * This is a utility method to wrap the invocation to the operation
|
||
545 | * {@link OPERATIONS#DISTANCE}.
|
||
546 | *
|
||
547 | * @param geometry
|
||
548 | * the Geometry from which to compute the distance
|
||
549 | *
|
||
550 | * @return the distance between the geometries
|
||
551 | *
|
||
552 | * @throws GeometryOperationNotSupportedException
|
||
553 | * @throws GeometryOperationException
|
||
554 | */
|
||
555 | public double distance(Geometry geometry) |
||
556 | throws GeometryOperationNotSupportedException,
|
||
557 | GeometryOperationException; |
||
558 | |||
559 | /**
|
||
560 | * Tests whether this geometry overlaps the specified geometry.
|
||
561 | *
|
||
562 | * This is a utility method to wrap the invocation to the operation
|
||
563 | * {@link OPERATIONS#OVERLAPS}.
|
||
564 | *
|
||
565 | * @param geometry
|
||
566 | * the Geometry with which to compare this Geometry
|
||
567 | *
|
||
568 | * @return true if the two geometries overlap.
|
||
569 | *
|
||
570 | * @throws GeometryOperationNotSupportedException
|
||
571 | * @throws GeometryOperationException
|
||
572 | */
|
||
573 | public boolean overlaps(Geometry geometry) |
||
574 | throws GeometryOperationNotSupportedException,
|
||
575 | GeometryOperationException; |
||
576 | |||
577 | public Geometry convexHull() throws GeometryOperationNotSupportedException, |
||
578 | GeometryOperationException; |
||
579 | |||
580 | public boolean coveredBy(Geometry geometry) |
||
581 | throws GeometryOperationNotSupportedException,
|
||
582 | GeometryOperationException; |
||
583 | |||
584 | public boolean crosses(Geometry geometry) |
||
585 | throws GeometryOperationNotSupportedException,
|
||
586 | GeometryOperationException; |
||
587 | |||
588 | public Geometry difference(Geometry other)
|
||
589 | throws GeometryOperationNotSupportedException,
|
||
590 | GeometryOperationException; |
||
591 | |||
592 | public boolean disjoint(Geometry geometry) |
||
593 | throws GeometryOperationNotSupportedException,
|
||
594 | GeometryOperationException; |
||
595 | |||
596 | public Geometry intersection(Geometry other)
|
||
597 | throws GeometryOperationNotSupportedException,
|
||
598 | GeometryOperationException; |
||
599 | |||
600 | public boolean intersects(Geometry geometry) |
||
601 | throws GeometryOperationNotSupportedException,
|
||
602 | GeometryOperationException; |
||
603 | |||
604 | public boolean touches(Geometry geometry) |
||
605 | throws GeometryOperationNotSupportedException,
|
||
606 | GeometryOperationException; |
||
607 | |||
608 | public Geometry union(Geometry other)
|
||
609 | throws GeometryOperationNotSupportedException,
|
||
610 | GeometryOperationException; |
||
611 | |||
612 | public boolean within(Geometry geometry) |
||
613 | throws GeometryOperationNotSupportedException,
|
||
614 | GeometryOperationException; |
||
615 | |||
616 | 33262 | jpiera | public Point centroid() throws GeometryOperationNotSupportedException, GeometryOperationException; |
617 | 34140 | jpiera | |
618 | public double area() throws GeometryOperationNotSupportedException, GeometryOperationException; |
||
619 | |||
620 | public double perimeter() throws GeometryOperationNotSupportedException, GeometryOperationException; |
||
621 | 35346 | jpiera | |
622 | /**
|
||
623 | 35472 | jpiera | * @return the awt shape used to display the geometry. It
|
624 | * applies a tranformation before to return the coordinates
|
||
625 | * of the shape
|
||
626 | * @deprecated this class inherits of {@link Shape} by historical
|
||
627 | * reasons. This method has been added just to control the usage of
|
||
628 | * the {@link Shape} class but it will removed in a future.
|
||
629 | */
|
||
630 | public Shape getShape(AffineTransform affineTransform); |
||
631 | |||
632 | /**
|
||
633 | 35346 | jpiera | * @return the awt shape used to display the geometry.
|
634 | * @deprecated this class inherits of {@link Shape} by historical
|
||
635 | * reasons. This method has been added just to control the usage of
|
||
636 | * the {@link Shape} class but it will removed in a future.
|
||
637 | */
|
||
638 | public Shape getShape(); |
||
639 | 20761 | jmvivo | } |