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