svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.fmap.geometry / org.gvsig.fmap.geometry.api / src / main / java / org / gvsig / fmap / geom / Geometry.java @ 42309
History | View | Annotate | Download (25.5 KB)
1 |
/**
|
---|---|
2 |
* gvSIG. Desktop Geographic Information System.
|
3 |
*
|
4 |
* Copyright (C) 2007-2013 gvSIG Association.
|
5 |
*
|
6 |
* 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 3
|
9 |
* of the License, or (at your option) any later version.
|
10 |
*
|
11 |
* 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 |
*
|
16 |
* 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 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 |
* MA 02110-1301, USA.
|
20 |
*
|
21 |
* For any additional information, do not hesitate to contact us
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
23 |
*/
|
24 |
|
25 |
package org.gvsig.fmap.geom; |
26 |
|
27 |
import java.awt.Shape; |
28 |
import java.awt.geom.AffineTransform; |
29 |
import java.awt.geom.PathIterator; |
30 |
import java.awt.geom.Rectangle2D; |
31 |
import java.io.Serializable; |
32 |
|
33 |
import org.cresques.cts.ICoordTrans; |
34 |
|
35 |
import org.gvsig.fmap.geom.aggregate.MultiLine; |
36 |
import org.gvsig.fmap.geom.aggregate.MultiPoint; |
37 |
import org.gvsig.fmap.geom.aggregate.MultiPolygon; |
38 |
import org.gvsig.fmap.geom.handler.Handler; |
39 |
import org.gvsig.fmap.geom.operation.GeometryOperationContext; |
40 |
import org.gvsig.fmap.geom.operation.GeometryOperationException; |
41 |
import org.gvsig.fmap.geom.operation.GeometryOperationNotSupportedException; |
42 |
import org.gvsig.fmap.geom.primitive.Envelope; |
43 |
import org.gvsig.fmap.geom.primitive.GeneralPathX; |
44 |
import org.gvsig.fmap.geom.primitive.Point; |
45 |
import org.gvsig.fmap.geom.type.GeometryType; |
46 |
|
47 |
/**
|
48 |
* <p>
|
49 |
* 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 |
* </p>
|
54 |
* <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 |
* </p>
|
59 |
* <p>
|
60 |
* 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 |
* <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 |
* @see <a href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=26012"
|
72 |
* >ISO 19107< /a>
|
73 |
*/
|
74 |
public interface Geometry extends Shape, Serializable, Comparable { |
75 |
|
76 |
/**
|
77 |
* Predefined geometry types in the model.
|
78 |
*/
|
79 |
public interface TYPES { |
80 |
|
81 |
/**
|
82 |
* Any geometry.
|
83 |
*/
|
84 |
|
85 |
public final static int GEOMETRY = 0; |
86 |
|
87 |
/**
|
88 |
* A geometric element that has zero dimensions and a location
|
89 |
* determinable by an ordered set of coordinates.
|
90 |
*/
|
91 |
public final static int POINT = 1; |
92 |
|
93 |
/**
|
94 |
* 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 |
*/
|
97 |
public final static int CURVE = 2; |
98 |
|
99 |
/**
|
100 |
* A closed plane figure bounded by straight lines.
|
101 |
*/
|
102 |
public final static int SURFACE = 3; |
103 |
|
104 |
/**
|
105 |
* Solids in 3D.
|
106 |
*/
|
107 |
public final static int SOLID = 4; |
108 |
|
109 |
/**
|
110 |
* A set that can contain points, lines and polygons. This is usual in
|
111 |
* <i>CAD</i> layers <i>(dxf, dgn, dwg)</i>.
|
112 |
*/
|
113 |
public final static int AGGREGATE = 6; |
114 |
/**
|
115 |
* A set of points.
|
116 |
*/
|
117 |
public final static int MULTIPOINT = 7; |
118 |
|
119 |
/**
|
120 |
* A set of lines.
|
121 |
*/
|
122 |
public final static int MULTICURVE = 8; |
123 |
|
124 |
/**
|
125 |
* A set of polygons.
|
126 |
*/
|
127 |
public final static int MULTISURFACE = 9; |
128 |
|
129 |
/**
|
130 |
* A set of solids.
|
131 |
*/
|
132 |
public final static int MULTISOLID = 10; |
133 |
|
134 |
/**
|
135 |
* A closed plane curve every point of which is equidistant from a fixed
|
136 |
* point within the curve.
|
137 |
*/
|
138 |
public final static int CIRCLE = 11; |
139 |
|
140 |
/**
|
141 |
* A continuous portion (as of a circle or ellipse) of a curved line.
|
142 |
*/
|
143 |
public final static int ARC = 12; |
144 |
|
145 |
/**
|
146 |
* 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 |
*/
|
150 |
public final static int ELLIPSE = 13; |
151 |
|
152 |
public final static int SPLINE = 14; |
153 |
|
154 |
public final static int ELLIPTICARC = 15; |
155 |
|
156 |
/**
|
157 |
* NO DATA geometry.
|
158 |
*/
|
159 |
public final static int NULL = 16; |
160 |
|
161 |
public final static int COMPLEX = 17; |
162 |
|
163 |
public final static int LINE = 18; |
164 |
|
165 |
public final static int POLYGON = 19; |
166 |
|
167 |
public final static int RING = 20; |
168 |
|
169 |
public final static int MULTILINE = 21; |
170 |
|
171 |
public final static int MULTIPOLYGON = 22; |
172 |
|
173 |
public final static int CIRCUMFERENCE = 23; |
174 |
|
175 |
public final static int PERIELLIPSE = 24; |
176 |
|
177 |
public final static int FILLEDSPLINE = 25; |
178 |
|
179 |
} |
180 |
|
181 |
public interface DIMENSIONS { |
182 |
public final static int X = 0; |
183 |
public final static int Y = 1; |
184 |
public final static int Z = 2; |
185 |
} |
186 |
|
187 |
/**
|
188 |
* The subtype of a geometry is related with the dimension of the geometry,
|
189 |
* that is a combination between the spatial dimension (2D, 2ZD, 3D) and the
|
190 |
* M coordinate or "measure".
|
191 |
*
|
192 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
|
193 |
*/
|
194 |
public interface SUBTYPES { |
195 |
|
196 |
/**
|
197 |
* Geometries with two dimensions.
|
198 |
*/
|
199 |
public final static int GEOM2D = 0; |
200 |
|
201 |
/**
|
202 |
* Geometries with three dimensions.
|
203 |
*/
|
204 |
public final static int GEOM3D = 1; |
205 |
|
206 |
/**
|
207 |
* Geometries with two dimensions and with the M coordinate.
|
208 |
*/
|
209 |
public final static int GEOM2DM = 2; |
210 |
|
211 |
/**
|
212 |
* Geometries with three dimensions and with the M coordinate.
|
213 |
*/
|
214 |
public final static int GEOM3DM = 3; |
215 |
|
216 |
/**
|
217 |
* The subtype us unknown.
|
218 |
*/
|
219 |
public final static int UNKNOWN = 4; |
220 |
} |
221 |
|
222 |
/**
|
223 |
* Initial value for new geometry types (it must not overlap with the basic
|
224 |
* ones defined in TYPES).
|
225 |
*/
|
226 |
public static final int EXTENDED_GEOMTYPE_OFFSET = 17; |
227 |
|
228 |
/**
|
229 |
* Initial value for new geometry subtypes (it must not overlap with the
|
230 |
* basic ones defined in SUBTYPES).
|
231 |
*/
|
232 |
public static final int EXTENDED_GEOMSUBTYPE_OFFSET = 6; |
233 |
|
234 |
public interface OPERATIONS { |
235 |
public final static String CONVERTTOWKT = "toWKT"; |
236 |
public final static String CONVERTTOWKB = "toWKB"; |
237 |
public final static String BUFFER = "buffer"; |
238 |
public final static String DISTANCE = "Distance"; |
239 |
public final static String CONTAINS = "Contains"; |
240 |
public final static String OVERLAPS = "OVERLAPS"; |
241 |
public final static String CONVEXHULL = "ConvexHull"; |
242 |
public final static String COVERS = "Covers"; |
243 |
public final static String CROSSES = "Crosses"; |
244 |
public final static String DIFFERENCE = "Difference"; |
245 |
public final static String DISJOIN = "Disjoin"; |
246 |
public final static String INTERSECTION = "Intersaction"; |
247 |
public final static String INTERSECTS = "Intersects"; |
248 |
public final static String TOUCHES = "Touches"; |
249 |
public final static String UNION = "Union"; |
250 |
public final static String WITHIN = "Within"; |
251 |
public final static String COVEREDBY = "CoveredBy"; |
252 |
} |
253 |
|
254 |
public interface ValidationStatus { |
255 |
|
256 |
public static final int VALID = 0; |
257 |
public static final int CURRUPTED = 1; |
258 |
public static final int UNKNOW = 2; |
259 |
public static final int DISCONNECTED_INTERIOR = 10; |
260 |
public static final int DUPLICATE_RINGS = 11; |
261 |
public static final int HOLE_OUTSIDE_SHELL = 12; |
262 |
public static final int INVALID_COORDINATE = 13; |
263 |
public static final int NESTED_HOLES = 14; |
264 |
public static final int NESTED_SHELLS = 15; |
265 |
public static final int RING_NOT_CLOSED = 17; |
266 |
public static final int RING_SELF_INTERSECTION = 18; |
267 |
public static final int SELF_INTERSECTION = 19; |
268 |
public static final int TOO_FEW_POINTS = 20; |
269 |
|
270 |
/**
|
271 |
* True if the geoemtry are valid.
|
272 |
*
|
273 |
* @return true form valid geometries
|
274 |
*/
|
275 |
public boolean isValid(); |
276 |
|
277 |
/**
|
278 |
* Return the status code results of validate the geometry.
|
279 |
*
|
280 |
* @return validation code
|
281 |
*/
|
282 |
public int getStatusCode(); |
283 |
|
284 |
/**
|
285 |
* Return the nearest point to the problem when validate the geometry.
|
286 |
*
|
287 |
* If the geometry is valid, this return null.
|
288 |
*
|
289 |
* @return the nearest point to the problem or null.
|
290 |
*/
|
291 |
public Point getProblemLocation(); |
292 |
|
293 |
/**
|
294 |
* Return a human readable message explaining the cause of the problem.
|
295 |
*
|
296 |
* If the geometry is valid this is null.
|
297 |
*
|
298 |
* @return the message cause of the problem.
|
299 |
*/
|
300 |
public String getMessage(); |
301 |
} |
302 |
|
303 |
public static int BEST = 0; |
304 |
/**
|
305 |
* North.
|
306 |
*/
|
307 |
public static int N = 1; |
308 |
|
309 |
/**
|
310 |
* North - East.
|
311 |
*/
|
312 |
public static int NE = 2; |
313 |
|
314 |
/**
|
315 |
* East.
|
316 |
*/
|
317 |
public static int E = 3; |
318 |
|
319 |
/**
|
320 |
* South - East.
|
321 |
*/
|
322 |
public static int SE = 4; |
323 |
|
324 |
/**
|
325 |
* South.
|
326 |
*/
|
327 |
public static int S = 5; |
328 |
|
329 |
/**
|
330 |
* South - West.
|
331 |
*/
|
332 |
public static int SW = 6; |
333 |
|
334 |
/**
|
335 |
* West.
|
336 |
*/
|
337 |
public static int W = 7; |
338 |
|
339 |
/**
|
340 |
* North - West.
|
341 |
*/
|
342 |
public static int NW = 8; |
343 |
|
344 |
public static int SELECTHANDLER = 0; |
345 |
public static int STRETCHINGHANDLER = 1; |
346 |
|
347 |
/**
|
348 |
* If this geometry is a predefined interface then this method returns one
|
349 |
* of {@link Geometry.TYPES} contants.<br>
|
350 |
* If this geometry is an extended type then this method returns a runtime
|
351 |
* constant that identifies its type. By convention this value is stored in
|
352 |
* a constant called .CODE within the geometry class, for instance:
|
353 |
* Point2D.CODE.
|
354 |
*
|
355 |
* @return If this geometry is a predefined interface then one of
|
356 |
* {@link Geometry.TYPES} or a runtime constant if it is an extended
|
357 |
* type.
|
358 |
*/
|
359 |
public int getType(); |
360 |
|
361 |
/**
|
362 |
* Creates a clone of this geometry.
|
363 |
*
|
364 |
* @return A clone of this geometry.
|
365 |
*/
|
366 |
public Geometry cloneGeometry();
|
367 |
|
368 |
/**
|
369 |
* Returns true if this geometry intersects the rectangle passed as
|
370 |
* parameter.
|
371 |
*
|
372 |
* @param r
|
373 |
* Rectangle.
|
374 |
*
|
375 |
* @return True, if <code>this</code> intersects <code>r</code>.
|
376 |
*/
|
377 |
public boolean intersects(Rectangle2D r); |
378 |
|
379 |
/**
|
380 |
* Used by the drawing strategies to quickly test whether this geometry
|
381 |
* intersects with the visible rectangle.
|
382 |
*
|
383 |
* @param x
|
384 |
* The minimum X coordinate.
|
385 |
* @param y
|
386 |
* The minimum Y coordinate.
|
387 |
* @param w
|
388 |
* The width of the envelope.
|
389 |
* @param h
|
390 |
* The height of the envelope.
|
391 |
* @return true if <code>this</code> intersects the rectangle defined by the
|
392 |
* parameters.
|
393 |
*/
|
394 |
public boolean fastIntersects(double x, double y, double w, double h); |
395 |
|
396 |
/**
|
397 |
* <p>
|
398 |
* Returns the minimum bounding box for this Geometry. This shall be the
|
399 |
* coordinate region spanning the minimum and maximum value for each
|
400 |
* ordinate taken on by DirectPositions in this Geometry. The simplest
|
401 |
* representation for an envelope consists of two DirectPositions, the first
|
402 |
* one containing all the minimums for each ordinate, and second one
|
403 |
* containing all the maximums.
|
404 |
* </p>
|
405 |
*
|
406 |
* @return The minimum bounding box for this Geometry.
|
407 |
*/
|
408 |
public Envelope getEnvelope();
|
409 |
|
410 |
/**
|
411 |
* Reprojects this geometry by the coordinate transformer passed as
|
412 |
* parameter.
|
413 |
*
|
414 |
* @param ct
|
415 |
* Coordinate Transformer.
|
416 |
*/
|
417 |
public void reProject(ICoordTrans ct); |
418 |
|
419 |
/**
|
420 |
* It applies an affine transformation to the geometry.
|
421 |
* If parameter value is null, it will be considered an
|
422 |
* empty transformation, therefore equivalent to the identity
|
423 |
* transformation.
|
424 |
*
|
425 |
* @param at
|
426 |
* The transformation to apply.
|
427 |
*/
|
428 |
public void transform(AffineTransform at); |
429 |
/**
|
430 |
* Returns the largest number n such that each direct position in a
|
431 |
* geometric set can be associated with a subset that has the direct
|
432 |
* position in its interior and is similar (isomorphic) to Rn, Euclidean
|
433 |
* n-space.
|
434 |
*
|
435 |
* @return The dimension.
|
436 |
*/
|
437 |
public int getDimension(); |
438 |
|
439 |
/**
|
440 |
* Returns <code>true</code> if this Geometry has no interior point of
|
441 |
* self-intersection or self-tangency. In mathematical formalisms, this
|
442 |
* means that every point in the interior of the object must have a metric
|
443 |
* neighborhood whose intersection with the object is isomorphic to an
|
444 |
* n-sphere, where n is the dimension of this Geometry.
|
445 |
*
|
446 |
* @return If the geometry is simple.
|
447 |
*/
|
448 |
public boolean isSimple(); |
449 |
|
450 |
public boolean isCCW() |
451 |
throws GeometryOperationNotSupportedException,
|
452 |
GeometryOperationException; |
453 |
|
454 |
/**
|
455 |
* Invokes a geometry operation given its index and context.
|
456 |
*
|
457 |
* @param index
|
458 |
* Unique index of the operation. Operation code.
|
459 |
* @param ctx
|
460 |
* The context of the geometry operation.
|
461 |
* @return Object returned by the operation.
|
462 |
* @throws GeometryOperationNotSupportedException
|
463 |
* It is thrown when the operation has been not registered for
|
464 |
* this geometry.
|
465 |
* @throws GeometryOperationException
|
466 |
* It is thrown when there is an error executing the operation.
|
467 |
*/
|
468 |
public Object invokeOperation(int index, GeometryOperationContext ctx) |
469 |
throws GeometryOperationNotSupportedException,
|
470 |
GeometryOperationException; |
471 |
|
472 |
/**
|
473 |
* Invokes a geometry operation given its name and context.
|
474 |
*
|
475 |
* @param opName
|
476 |
* Operation name.
|
477 |
* @param ctx
|
478 |
* The context of the geometry operation.
|
479 |
* @return Object returned by the operation.
|
480 |
* @throws GeometryOperationNotSupportedException
|
481 |
* It is thrown when the operation has been not registered for
|
482 |
* this geometry.
|
483 |
* @throws GeometryOperationException
|
484 |
* It is thrown when there is an error executing the operation.
|
485 |
*/
|
486 |
public Object invokeOperation(String opName, GeometryOperationContext ctx) |
487 |
throws GeometryOperationNotSupportedException,
|
488 |
GeometryOperationException; |
489 |
|
490 |
/**
|
491 |
* Instance of the GeometryType associated to this geometry.
|
492 |
*
|
493 |
* @return The geometry type.
|
494 |
*/
|
495 |
public GeometryType getGeometryType();
|
496 |
|
497 |
/**
|
498 |
* Return a byte array with the equivalent in WKB format of the Geometry.
|
499 |
*
|
500 |
* Utility method to wrap the invocation to the operation
|
501 |
* {@link OPERATIONS#CONVERTTOWKB}.
|
502 |
*
|
503 |
* @return the WKB version of the geometry
|
504 |
*/
|
505 |
public byte[] convertToWKB() throws GeometryOperationNotSupportedException, |
506 |
GeometryOperationException; |
507 |
|
508 |
public byte[] convertToWKB(int srs) |
509 |
throws GeometryOperationNotSupportedException, GeometryOperationException;
|
510 |
|
511 |
public byte[] convertToWKBForcingType(int srs, int type) |
512 |
throws GeometryOperationNotSupportedException, GeometryOperationException;
|
513 |
|
514 |
/**
|
515 |
* Return a string with the equivalent in WKT format of the Geometry.
|
516 |
*
|
517 |
* This is a utility method to wrap the invocation to the operation
|
518 |
* {@link OPERATIONS#CONVERTTOWKT}.
|
519 |
*
|
520 |
* @return the WKT version of the geometry.
|
521 |
*
|
522 |
* @throws GeometryOperationNotSupportedException
|
523 |
* @throws GeometryOperationException
|
524 |
*/
|
525 |
public String convertToWKT() throws GeometryOperationNotSupportedException, |
526 |
GeometryOperationException; |
527 |
|
528 |
/**
|
529 |
* Computes a buffer area around this geometry having the given width
|
530 |
*
|
531 |
* This is a utility method to wrap the invocation to the operation
|
532 |
* {@link OPERATIONS#BUFFER}.
|
533 |
*
|
534 |
* @param distance
|
535 |
* the width of the buffer
|
536 |
*
|
537 |
* @return a new Geometry with the computed buffer.
|
538 |
*
|
539 |
* @throws GeometryOperationNotSupportedException
|
540 |
* @throws GeometryOperationException
|
541 |
*/
|
542 |
public Geometry buffer(double distance) |
543 |
throws GeometryOperationNotSupportedException,
|
544 |
GeometryOperationException; |
545 |
|
546 |
/**
|
547 |
* Tests whether this geometry contains the specified geometry.
|
548 |
*
|
549 |
* This is a utility method to wrap the invocation to the operation
|
550 |
* {@link OPERATIONS#CONTAINS}.
|
551 |
*
|
552 |
* @param geometry
|
553 |
* the Geometry with which to compare this Geometry
|
554 |
*
|
555 |
* @return if this Geometry contains the specified geometry
|
556 |
*
|
557 |
* @throws GeometryOperationNotSupportedException
|
558 |
* @throws GeometryOperationException
|
559 |
*/
|
560 |
public boolean contains(Geometry geometry) |
561 |
throws GeometryOperationNotSupportedException,
|
562 |
GeometryOperationException; |
563 |
|
564 |
/**
|
565 |
* Returns the minimum distance between this Geometry and the specified
|
566 |
* geometry.
|
567 |
*
|
568 |
* This is a utility method to wrap the invocation to the operation
|
569 |
* {@link OPERATIONS#DISTANCE}.
|
570 |
*
|
571 |
* @param geometry
|
572 |
* the Geometry from which to compute the distance
|
573 |
*
|
574 |
* @return the distance between the geometries
|
575 |
*
|
576 |
* @throws GeometryOperationNotSupportedException
|
577 |
* @throws GeometryOperationException
|
578 |
*/
|
579 |
public double distance(Geometry other) |
580 |
throws GeometryOperationNotSupportedException,
|
581 |
GeometryOperationException; |
582 |
|
583 |
public Geometry[] closestPoints(Geometry other) |
584 |
throws GeometryOperationNotSupportedException,
|
585 |
GeometryOperationException; |
586 |
|
587 |
boolean isWithinDistance(Geometry other, double distance) |
588 |
throws GeometryOperationNotSupportedException,
|
589 |
GeometryOperationException; |
590 |
|
591 |
/**
|
592 |
* Tests whether this geometry overlaps the specified geometry.
|
593 |
*
|
594 |
* This is a utility method to wrap the invocation to the operation
|
595 |
* {@link OPERATIONS#OVERLAPS}.
|
596 |
*
|
597 |
* @param geometry
|
598 |
* the Geometry with which to compare this Geometry
|
599 |
*
|
600 |
* @return true if the two geometries overlap.
|
601 |
*
|
602 |
* @throws GeometryOperationNotSupportedException
|
603 |
* @throws GeometryOperationException
|
604 |
*/
|
605 |
public boolean overlaps(Geometry geometry) |
606 |
throws GeometryOperationNotSupportedException,
|
607 |
GeometryOperationException; |
608 |
|
609 |
public Geometry convexHull() throws GeometryOperationNotSupportedException, |
610 |
GeometryOperationException; |
611 |
|
612 |
public boolean coveredBy(Geometry geometry) |
613 |
throws GeometryOperationNotSupportedException,
|
614 |
GeometryOperationException; |
615 |
|
616 |
public boolean covers(Geometry geometry) |
617 |
throws GeometryOperationNotSupportedException,
|
618 |
GeometryOperationException; |
619 |
|
620 |
public boolean crosses(Geometry geometry) |
621 |
throws GeometryOperationNotSupportedException,
|
622 |
GeometryOperationException; |
623 |
|
624 |
public Geometry difference(Geometry other)
|
625 |
throws GeometryOperationNotSupportedException,
|
626 |
GeometryOperationException; |
627 |
|
628 |
public boolean disjoint(Geometry geometry) |
629 |
throws GeometryOperationNotSupportedException,
|
630 |
GeometryOperationException; |
631 |
|
632 |
public Geometry intersection(Geometry other)
|
633 |
throws GeometryOperationNotSupportedException,
|
634 |
GeometryOperationException; |
635 |
|
636 |
public boolean intersects(Geometry geometry) |
637 |
throws GeometryOperationNotSupportedException,
|
638 |
GeometryOperationException; |
639 |
|
640 |
public Geometry snapTo(Geometry other, double snapTolerance) |
641 |
throws GeometryOperationNotSupportedException,
|
642 |
GeometryOperationException; |
643 |
|
644 |
public boolean touches(Geometry geometry) |
645 |
throws GeometryOperationNotSupportedException,
|
646 |
GeometryOperationException; |
647 |
|
648 |
public Geometry union(Geometry other)
|
649 |
throws GeometryOperationNotSupportedException,
|
650 |
GeometryOperationException; |
651 |
|
652 |
public boolean within(Geometry geometry) |
653 |
throws GeometryOperationNotSupportedException,
|
654 |
GeometryOperationException; |
655 |
|
656 |
public Point centroid() throws GeometryOperationNotSupportedException, GeometryOperationException; |
657 |
|
658 |
/**
|
659 |
* This method returns a point which is inside the geometry.
|
660 |
* This is useful for mathematical purposes but it is very unlikely
|
661 |
* to be a suitable place for a label, for example.
|
662 |
*
|
663 |
*
|
664 |
* @return an interior point
|
665 |
* @throws GeometryOperationNotSupportedException
|
666 |
* @throws GeometryOperationException
|
667 |
*/
|
668 |
public Point getInteriorPoint() throws GeometryOperationNotSupportedException, GeometryOperationException; |
669 |
|
670 |
public double area() throws GeometryOperationNotSupportedException, GeometryOperationException; |
671 |
|
672 |
public double perimeter() throws GeometryOperationNotSupportedException, GeometryOperationException; |
673 |
|
674 |
|
675 |
|
676 |
|
677 |
/**
|
678 |
* Rotates the geometry by radAngle radians using the given
|
679 |
* coordinates as center of rotation. Rotating with a positive
|
680 |
* angle rotates points on the positive x axis toward the
|
681 |
* positive y axis. In most cases, we assume x increases
|
682 |
* rightwards and y increases upwards, so in most cases,
|
683 |
* a positive angle will mean counter-clockwise rotation.
|
684 |
*
|
685 |
* @param radAngle the amount of rotation, in radians
|
686 |
* @param basex x coordinate of center of rotation
|
687 |
* @param basey y coordinate of center of rotation
|
688 |
*/
|
689 |
public void rotate(double radAngle, double basex, double basey); |
690 |
|
691 |
/**
|
692 |
* Shifts geometry by given amount in x and y axes
|
693 |
*
|
694 |
* @param dx
|
695 |
* @param dy
|
696 |
*/
|
697 |
public void move(double dx, double dy); |
698 |
|
699 |
|
700 |
/**
|
701 |
* Scales geometry in x and y axes by given scale factors
|
702 |
* using the given point as center of projection.
|
703 |
*
|
704 |
* @param basePoint
|
705 |
* @param sx scale factor in x axis
|
706 |
* @param sy scale factor in y axis
|
707 |
*/
|
708 |
public void scale(Point basePoint, double sx, double sy); |
709 |
|
710 |
/**
|
711 |
* Check if the geometry is valid.
|
712 |
*
|
713 |
* @return true if the geometry is valid.
|
714 |
*/
|
715 |
public boolean isValid(); |
716 |
|
717 |
/**
|
718 |
* Check if the geometry is valid and returns the validation status.
|
719 |
*
|
720 |
* @return the ValidationStatus
|
721 |
*/
|
722 |
public ValidationStatus getValidationStatus();
|
723 |
|
724 |
/**
|
725 |
* Try to fix the geometry and return the new geometry.
|
726 |
* If the geometry is valid return the same geometry.
|
727 |
* If the geometry is corrupt or can't fix it, return null.
|
728 |
*
|
729 |
* @return the new fixed geometry
|
730 |
*/
|
731 |
public Geometry makeValid();
|
732 |
|
733 |
//
|
734 |
// ===============================================
|
735 |
//
|
736 |
|
737 |
|
738 |
/**
|
739 |
* @return the awt shape used to display the geometry. It
|
740 |
* applies a tranformation before to return the coordinates
|
741 |
* of the shape
|
742 |
* @deprecated this class inherits of {@link Shape} by historical
|
743 |
* reasons. This method has been added just to control the usage of
|
744 |
* the {@link Shape} class but it will removed in a future.
|
745 |
*/
|
746 |
public Shape getShape(AffineTransform affineTransform); |
747 |
|
748 |
/**
|
749 |
* @return the awt shape used to display the geometry.
|
750 |
* @deprecated this class inherits of {@link Shape} by historical
|
751 |
* reasons. This method has been added just to control the usage of
|
752 |
* the {@link Shape} class but it will removed in a future.
|
753 |
*/
|
754 |
public Shape getShape(); |
755 |
|
756 |
/**
|
757 |
* Returns this geometry's boundary rectangle.
|
758 |
*
|
759 |
* @deprecated use getEnvelope.
|
760 |
* @return Boundary rectangle.
|
761 |
*/
|
762 |
public Rectangle2D getBounds2D(); |
763 |
|
764 |
/**
|
765 |
* If applies an affine transformation and returns the GeneralPathXIterator
|
766 |
* with this geometry's information.
|
767 |
*
|
768 |
* @param at
|
769 |
* The transformation to apply.
|
770 |
* @return The GeneralPathXIterator with this geometry's information.
|
771 |
* @deprecated don't use PathIterator over geometries, use instead specific API for each operation. If not has API for that operation let the project team.
|
772 |
*
|
773 |
*/
|
774 |
public PathIterator getPathIterator(AffineTransform at); |
775 |
|
776 |
/**
|
777 |
* It returns the handlers of the geometry, these they can be of two types
|
778 |
* is straightening and of selection.
|
779 |
*
|
780 |
* @param type
|
781 |
* Type of handlers.
|
782 |
*
|
783 |
* @deprecated don't use Handlers over geometries, use instead specific API for each operation. If not has API for that operation let the project team.
|
784 |
* @return The handlers.
|
785 |
*/
|
786 |
public Handler[] getHandlers(int type); |
787 |
|
788 |
|
789 |
/**
|
790 |
* If applies an affine transformation and returns the GeneralPathXIterator
|
791 |
* with this geometry's information.
|
792 |
*
|
793 |
* @param at
|
794 |
* The affine transformation.
|
795 |
* @param flatness
|
796 |
*
|
797 |
* @return The GeneralPathXIterator with this geometry's information.
|
798 |
* @deprecated don't use PathIterator over geometries, use instead specific API for each operation. If not has API for that operation let the project team.
|
799 |
*/
|
800 |
PathIterator getPathIterator(AffineTransform at, double flatness); |
801 |
|
802 |
/**
|
803 |
* Useful to have the real shape behind the scenes. May be uses to edit it
|
804 |
* knowing it it is a Circle, Ellipse, etc.
|
805 |
*
|
806 |
* @return The awt shape
|
807 |
* @deprecated
|
808 |
*/
|
809 |
public Shape getInternalShape(); |
810 |
|
811 |
|
812 |
/**
|
813 |
* Get GeneralPathIterator, to do registered operations to it.
|
814 |
*
|
815 |
* @return The GeneralPathX.
|
816 |
* @deprecated don't use GeneralPathX over geometries, use instead specific API for each operation. If not has API for that operation let the project team.
|
817 |
*/
|
818 |
public GeneralPathX getGeneralPath();
|
819 |
|
820 |
|
821 |
/**
|
822 |
* Converts the geometry to be points and makes with them a multiPoint
|
823 |
*
|
824 |
* @return MultiPoint
|
825 |
* @throws GeometryException
|
826 |
*/
|
827 |
public MultiPoint toPoints() throws GeometryException; |
828 |
|
829 |
/**
|
830 |
* Converts the geometry to be lines and makes with them a multiLine
|
831 |
* @return
|
832 |
* @throws GeometryException
|
833 |
*/
|
834 |
public MultiLine toLines() throws GeometryException; |
835 |
|
836 |
/**
|
837 |
* Converts the geometry to be polygons and makes with them a multiPolygon
|
838 |
* @return
|
839 |
* @throws GeometryException
|
840 |
*/
|
841 |
public MultiPolygon toPolygons() throws GeometryException; |
842 |
|
843 |
public void flip() throws GeometryOperationNotSupportedException, GeometryOperationException; |
844 |
|
845 |
public boolean ensureOrientation(boolean ccw) throws GeometryOperationNotSupportedException, GeometryOperationException; |
846 |
|
847 |
public boolean out(Geometry geometry) throws GeometryOperationNotSupportedException, GeometryOperationException; |
848 |
} |