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 @ 40435
History | View | Annotate | Download (21.4 KB)
1 | 40435 | jjdelcerro | /* gvSIG. Geographic Information System of the Valencian Government
|
---|---|---|---|
2 | *
|
||
3 | * Copyright (C) 2007-2008 Infrastructures and Transports Department
|
||
4 | * of the Valencian Government (CIT)
|
||
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 2
|
||
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 | */
|
||
22 | |||
23 | /*
|
||
24 | * AUTHORS (In addition to CIT):
|
||
25 | * 2009 {Iver T.I.} {Task}
|
||
26 | */
|
||
27 | |||
28 | 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 | import org.cresques.cts.ICoordTrans; |
||
37 | |||
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 | |||
162 | 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 | |||
168 | /**
|
||
169 | * 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 | * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
|
||
174 | */
|
||
175 | public interface SUBTYPES { |
||
176 | |||
177 | /**
|
||
178 | * Geometries with two dimensions.
|
||
179 | */
|
||
180 | public final static int GEOM2D = 0; |
||
181 | |||
182 | /**
|
||
183 | * Geometries with three dimensions.
|
||
184 | */
|
||
185 | public final static int GEOM3D = 1; |
||
186 | |||
187 | /**
|
||
188 | * Geometries with two dimensions and with the M coordinate.
|
||
189 | */
|
||
190 | public final static int GEOM2DM = 2; |
||
191 | |||
192 | /**
|
||
193 | * Geometries with three dimensions and with the M coordinate.
|
||
194 | */
|
||
195 | public final static int GEOM3DM = 3; |
||
196 | |||
197 | /**
|
||
198 | * The subtype us unknown.
|
||
199 | */
|
||
200 | public final static int UNKNOWN = 4; |
||
201 | } |
||
202 | |||
203 | /**
|
||
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 | |||
209 | /**
|
||
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 | 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 | public static int BEST = 0; |
||
236 | /**
|
||
237 | * North.
|
||
238 | */
|
||
239 | public static int N = 1; |
||
240 | |||
241 | /**
|
||
242 | * North - East.
|
||
243 | */
|
||
244 | public static int NE = 2; |
||
245 | |||
246 | /**
|
||
247 | * East.
|
||
248 | */
|
||
249 | public static int E = 3; |
||
250 | |||
251 | /**
|
||
252 | * South - East.
|
||
253 | */
|
||
254 | public static int SE = 4; |
||
255 | |||
256 | /**
|
||
257 | * South.
|
||
258 | */
|
||
259 | public static int S = 5; |
||
260 | |||
261 | /**
|
||
262 | * South - West.
|
||
263 | */
|
||
264 | public static int SW = 6; |
||
265 | |||
266 | /**
|
||
267 | * West.
|
||
268 | */
|
||
269 | public static int W = 7; |
||
270 | |||
271 | /**
|
||
272 | * North - West.
|
||
273 | */
|
||
274 | public static int NW = 8; |
||
275 | |||
276 | public static int SELECTHANDLER = 0; |
||
277 | public static int STRETCHINGHANDLER = 1; |
||
278 | |||
279 | /**
|
||
280 | * 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 | */
|
||
291 | public int getType(); |
||
292 | |||
293 | /**
|
||
294 | * Creates a clone of this geometry.
|
||
295 | *
|
||
296 | * @return A clone of this geometry.
|
||
297 | */
|
||
298 | public Geometry cloneGeometry();
|
||
299 | |||
300 | /**
|
||
301 | * Returns true if this geometry intersects the rectangle passed as
|
||
302 | * parameter.
|
||
303 | *
|
||
304 | * @param r
|
||
305 | * Rectangle.
|
||
306 | *
|
||
307 | * @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 | *
|
||
315 | * @param x
|
||
316 | * The minimum X coordinate.
|
||
317 | * @param y
|
||
318 | * 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 | */
|
||
326 | public boolean fastIntersects(double x, double y, double w, double h); |
||
327 | |||
328 | /**
|
||
329 | * <p>
|
||
330 | * Returns the minimum bounding box for this Geometry. This shall be the
|
||
331 | * coordinate region spanning the minimum and maximum value for each
|
||
332 | * ordinate taken on by DirectPositions in this Geometry. The simplest
|
||
333 | * representation for an envelope consists of two DirectPositions, the first
|
||
334 | * one containing all the minimums for each ordinate, and second one
|
||
335 | * containing all the maximums.
|
||
336 | * </p>
|
||
337 | *
|
||
338 | * @return The minimum bounding box for this Geometry.
|
||
339 | */
|
||
340 | public Envelope getEnvelope();
|
||
341 | |||
342 | /**
|
||
343 | * Reprojects this geometry by the coordinate transformer passed as
|
||
344 | * parameter.
|
||
345 | *
|
||
346 | * @param ct
|
||
347 | * Coordinate Transformer.
|
||
348 | */
|
||
349 | public void reProject(ICoordTrans ct); |
||
350 | |||
351 | /**
|
||
352 | * It applies an affine transformation to the geometry.
|
||
353 | * If parameter value is null, it will be considered an
|
||
354 | * empty transformation, therefore equivalent to the identity
|
||
355 | * transformation.
|
||
356 | *
|
||
357 | * @param at
|
||
358 | * The transformation to apply.
|
||
359 | */
|
||
360 | public void transform(AffineTransform at); |
||
361 | /**
|
||
362 | * Returns the largest number n such that each direct position in a
|
||
363 | * geometric set can be associated with a subset that has the direct
|
||
364 | * position in its interior and is similar (isomorphic) to Rn, Euclidean
|
||
365 | * n-space.
|
||
366 | *
|
||
367 | * @return The dimension.
|
||
368 | */
|
||
369 | public int getDimension(); |
||
370 | |||
371 | /**
|
||
372 | * Returns <code>true</code> if this Geometry has no interior point of
|
||
373 | * self-intersection or self-tangency. In mathematical formalisms, this
|
||
374 | * means that every point in the interior of the object must have a metric
|
||
375 | * neighborhood whose intersection with the object is isomorphic to an
|
||
376 | * n-sphere, where n is the dimension of this Geometry.
|
||
377 | *
|
||
378 | * @return If the geometry is simple.
|
||
379 | */
|
||
380 | public boolean isSimple(); |
||
381 | |||
382 | /**
|
||
383 | * Invokes a geometry operation given its index and context.
|
||
384 | *
|
||
385 | * @param index
|
||
386 | * Unique index of the operation. Operation code.
|
||
387 | * @param ctx
|
||
388 | * The context of the geometry operation.
|
||
389 | * @return Object returned by the operation.
|
||
390 | * @throws GeometryOperationNotSupportedException
|
||
391 | * It is thrown when the operation has been not registered for
|
||
392 | * this geometry.
|
||
393 | * @throws GeometryOperationException
|
||
394 | * It is thrown when there is an error executing the operation.
|
||
395 | */
|
||
396 | public Object invokeOperation(int index, GeometryOperationContext ctx) |
||
397 | throws GeometryOperationNotSupportedException,
|
||
398 | GeometryOperationException; |
||
399 | |||
400 | /**
|
||
401 | * Invokes a geometry operation given its name and context.
|
||
402 | *
|
||
403 | * @param opName
|
||
404 | * Operation name.
|
||
405 | * @param ctx
|
||
406 | * The context of the geometry operation.
|
||
407 | * @return Object returned by the operation.
|
||
408 | * @throws GeometryOperationNotSupportedException
|
||
409 | * It is thrown when the operation has been not registered for
|
||
410 | * this geometry.
|
||
411 | * @throws GeometryOperationException
|
||
412 | * It is thrown when there is an error executing the operation.
|
||
413 | */
|
||
414 | public Object invokeOperation(String opName, GeometryOperationContext ctx) |
||
415 | throws GeometryOperationNotSupportedException,
|
||
416 | GeometryOperationException; |
||
417 | |||
418 | /**
|
||
419 | * Instance of the GeometryType associated to this geometry.
|
||
420 | *
|
||
421 | * @return The geometry type.
|
||
422 | */
|
||
423 | public GeometryType getGeometryType();
|
||
424 | |||
425 | /**
|
||
426 | * Return a byte array with the equivalent in WKB format of the Geometry.
|
||
427 | *
|
||
428 | * Utility method to wrap the invocation to the operation
|
||
429 | * {@link OPERATIONS#CONVERTTOWKB}.
|
||
430 | *
|
||
431 | * @return the WKB version of the geometry
|
||
432 | */
|
||
433 | public byte[] convertToWKB() throws GeometryOperationNotSupportedException, |
||
434 | GeometryOperationException; |
||
435 | |||
436 | public byte[] convertToWKB(int srs) |
||
437 | throws GeometryOperationNotSupportedException, GeometryOperationException;
|
||
438 | |||
439 | public byte[] convertToWKBForcingType(int srs, int type) |
||
440 | throws GeometryOperationNotSupportedException, GeometryOperationException;
|
||
441 | |||
442 | /**
|
||
443 | * Return a string with the equivalent in WKT format of the Geometry.
|
||
444 | *
|
||
445 | * This is a utility method to wrap the invocation to the operation
|
||
446 | * {@link OPERATIONS#CONVERTTOWKT}.
|
||
447 | *
|
||
448 | * @return the WKT version of the geometry.
|
||
449 | *
|
||
450 | * @throws GeometryOperationNotSupportedException
|
||
451 | * @throws GeometryOperationException
|
||
452 | */
|
||
453 | public String convertToWKT() throws GeometryOperationNotSupportedException, |
||
454 | GeometryOperationException; |
||
455 | |||
456 | /**
|
||
457 | * Computes a buffer area around this geometry having the given width
|
||
458 | *
|
||
459 | * This is a utility method to wrap the invocation to the operation
|
||
460 | * {@link OPERATIONS#BUFFER}.
|
||
461 | *
|
||
462 | * @param distance
|
||
463 | * the width of the buffer
|
||
464 | *
|
||
465 | * @return a new Geometry with the computed buffer.
|
||
466 | *
|
||
467 | * @throws GeometryOperationNotSupportedException
|
||
468 | * @throws GeometryOperationException
|
||
469 | */
|
||
470 | public Geometry buffer(double distance) |
||
471 | throws GeometryOperationNotSupportedException,
|
||
472 | GeometryOperationException; |
||
473 | |||
474 | /**
|
||
475 | * Tests whether this geometry contains the specified geometry.
|
||
476 | *
|
||
477 | * This is a utility method to wrap the invocation to the operation
|
||
478 | * {@link OPERATIONS#CONTAINS}.
|
||
479 | *
|
||
480 | * @param geometry
|
||
481 | * the Geometry with which to compare this Geometry
|
||
482 | *
|
||
483 | * @return if this Geometry contains the specified geometry
|
||
484 | *
|
||
485 | * @throws GeometryOperationNotSupportedException
|
||
486 | * @throws GeometryOperationException
|
||
487 | */
|
||
488 | public boolean contains(Geometry geometry) |
||
489 | throws GeometryOperationNotSupportedException,
|
||
490 | GeometryOperationException; |
||
491 | |||
492 | /**
|
||
493 | * Returns the minimum distance between this Geometry and the specified
|
||
494 | * geometry.
|
||
495 | *
|
||
496 | * This is a utility method to wrap the invocation to the operation
|
||
497 | * {@link OPERATIONS#DISTANCE}.
|
||
498 | *
|
||
499 | * @param geometry
|
||
500 | * the Geometry from which to compute the distance
|
||
501 | *
|
||
502 | * @return the distance between the geometries
|
||
503 | *
|
||
504 | * @throws GeometryOperationNotSupportedException
|
||
505 | * @throws GeometryOperationException
|
||
506 | */
|
||
507 | public double distance(Geometry other) |
||
508 | throws GeometryOperationNotSupportedException,
|
||
509 | GeometryOperationException; |
||
510 | |||
511 | public Geometry[] closestPoints(Geometry other) |
||
512 | throws GeometryOperationNotSupportedException,
|
||
513 | GeometryOperationException; |
||
514 | |||
515 | boolean isWithinDistance(Geometry other, double distance) |
||
516 | throws GeometryOperationNotSupportedException,
|
||
517 | GeometryOperationException; |
||
518 | |||
519 | /**
|
||
520 | * Tests whether this geometry overlaps the specified geometry.
|
||
521 | *
|
||
522 | * This is a utility method to wrap the invocation to the operation
|
||
523 | * {@link OPERATIONS#OVERLAPS}.
|
||
524 | *
|
||
525 | * @param geometry
|
||
526 | * the Geometry with which to compare this Geometry
|
||
527 | *
|
||
528 | * @return true if the two geometries overlap.
|
||
529 | *
|
||
530 | * @throws GeometryOperationNotSupportedException
|
||
531 | * @throws GeometryOperationException
|
||
532 | */
|
||
533 | public boolean overlaps(Geometry geometry) |
||
534 | throws GeometryOperationNotSupportedException,
|
||
535 | GeometryOperationException; |
||
536 | |||
537 | public Geometry convexHull() throws GeometryOperationNotSupportedException, |
||
538 | GeometryOperationException; |
||
539 | |||
540 | public boolean coveredBy(Geometry geometry) |
||
541 | throws GeometryOperationNotSupportedException,
|
||
542 | GeometryOperationException; |
||
543 | |||
544 | public boolean crosses(Geometry geometry) |
||
545 | throws GeometryOperationNotSupportedException,
|
||
546 | GeometryOperationException; |
||
547 | |||
548 | public Geometry difference(Geometry other)
|
||
549 | throws GeometryOperationNotSupportedException,
|
||
550 | GeometryOperationException; |
||
551 | |||
552 | public boolean disjoint(Geometry geometry) |
||
553 | throws GeometryOperationNotSupportedException,
|
||
554 | GeometryOperationException; |
||
555 | |||
556 | public Geometry intersection(Geometry other)
|
||
557 | throws GeometryOperationNotSupportedException,
|
||
558 | GeometryOperationException; |
||
559 | |||
560 | public boolean intersects(Geometry geometry) |
||
561 | throws GeometryOperationNotSupportedException,
|
||
562 | GeometryOperationException; |
||
563 | |||
564 | public Geometry snapTo(Geometry other, double snapTolerance) |
||
565 | throws GeometryOperationNotSupportedException,
|
||
566 | GeometryOperationException; |
||
567 | |||
568 | public boolean touches(Geometry geometry) |
||
569 | throws GeometryOperationNotSupportedException,
|
||
570 | GeometryOperationException; |
||
571 | |||
572 | public Geometry union(Geometry other)
|
||
573 | throws GeometryOperationNotSupportedException,
|
||
574 | GeometryOperationException; |
||
575 | |||
576 | public boolean within(Geometry geometry) |
||
577 | throws GeometryOperationNotSupportedException,
|
||
578 | GeometryOperationException; |
||
579 | |||
580 | public Point centroid() throws GeometryOperationNotSupportedException, GeometryOperationException; |
||
581 | |||
582 | /**
|
||
583 | * This method returns a point which is inside the geometry.
|
||
584 | * This is useful for mathematical purposes but it is very unlikely
|
||
585 | * to be a suitable place for a label, for example.
|
||
586 | *
|
||
587 | *
|
||
588 | * @return an interior point
|
||
589 | * @throws GeometryOperationNotSupportedException
|
||
590 | * @throws GeometryOperationException
|
||
591 | */
|
||
592 | public Point getInteriorPoint() throws GeometryOperationNotSupportedException, GeometryOperationException; |
||
593 | |||
594 | public double area() throws GeometryOperationNotSupportedException, GeometryOperationException; |
||
595 | |||
596 | public double perimeter() throws GeometryOperationNotSupportedException, GeometryOperationException; |
||
597 | |||
598 | |||
599 | |||
600 | |||
601 | /**
|
||
602 | * Rotates the geometry by radAngle radians using the given
|
||
603 | * coordinates as center of rotation. Rotating with a positive
|
||
604 | * angle rotates points on the positive x axis toward the
|
||
605 | * positive y axis. In most cases, we assume x increases
|
||
606 | * rightwards and y increases upwards, so in most cases,
|
||
607 | * a positive angle will mean counter-clockwise rotation.
|
||
608 | *
|
||
609 | * @param radAngle the amount of rotation, in radians
|
||
610 | * @param basex x coordinate of center of rotation
|
||
611 | * @param basey y coordinate of center of rotation
|
||
612 | */
|
||
613 | public void rotate(double radAngle, double basex, double basey); |
||
614 | |||
615 | /**
|
||
616 | * Shifts geometry by given amount in x and y axes
|
||
617 | *
|
||
618 | * @param dx
|
||
619 | * @param dy
|
||
620 | */
|
||
621 | public void move(double dx, double dy); |
||
622 | |||
623 | |||
624 | /**
|
||
625 | * Scales geometry in x and y axes by given scale factors
|
||
626 | * using the given point as center of projection.
|
||
627 | *
|
||
628 | * @param basePoint
|
||
629 | * @param sx scale factor in x axis
|
||
630 | * @param sy scale factor in y axis
|
||
631 | */
|
||
632 | public void scale(Point basePoint, double sx, double sy); |
||
633 | |||
634 | |||
635 | |||
636 | |||
637 | //
|
||
638 | // ===============================================
|
||
639 | //
|
||
640 | |||
641 | |||
642 | /**
|
||
643 | * @return the awt shape used to display the geometry. It
|
||
644 | * applies a tranformation before to return the coordinates
|
||
645 | * of the shape
|
||
646 | * @deprecated this class inherits of {@link Shape} by historical
|
||
647 | * reasons. This method has been added just to control the usage of
|
||
648 | * the {@link Shape} class but it will removed in a future.
|
||
649 | */
|
||
650 | public Shape getShape(AffineTransform affineTransform); |
||
651 | |||
652 | /**
|
||
653 | * @return the awt shape used to display the geometry.
|
||
654 | * @deprecated this class inherits of {@link Shape} by historical
|
||
655 | * reasons. This method has been added just to control the usage of
|
||
656 | * the {@link Shape} class but it will removed in a future.
|
||
657 | */
|
||
658 | public Shape getShape(); |
||
659 | |||
660 | /**
|
||
661 | * Returns this geometry's boundary rectangle.
|
||
662 | *
|
||
663 | * @deprecated use getEnvelope.
|
||
664 | * @return Boundary rectangle.
|
||
665 | */
|
||
666 | public Rectangle2D getBounds2D(); |
||
667 | |||
668 | /**
|
||
669 | * If applies an affine transformation and returns the GeneralPathXIterator
|
||
670 | * with this geometry's information.
|
||
671 | *
|
||
672 | * @param at
|
||
673 | * The transformation to apply.
|
||
674 | * @return The GeneralPathXIterator with this geometry's information.
|
||
675 | * @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.
|
||
676 | *
|
||
677 | */
|
||
678 | public PathIterator getPathIterator(AffineTransform at); |
||
679 | |||
680 | /**
|
||
681 | * It returns the handlers of the geometry, these they can be of two types
|
||
682 | * is straightening and of selection.
|
||
683 | *
|
||
684 | * @param type
|
||
685 | * Type of handlers.
|
||
686 | *
|
||
687 | * @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.
|
||
688 | * @return The handlers.
|
||
689 | */
|
||
690 | public Handler[] getHandlers(int type); |
||
691 | |||
692 | |||
693 | /**
|
||
694 | * If applies an affine transformation and returns the GeneralPathXIterator
|
||
695 | * with this geometry's information.
|
||
696 | *
|
||
697 | * @param at
|
||
698 | * The affine transformation.
|
||
699 | * @param flatness
|
||
700 | *
|
||
701 | * @return The GeneralPathXIterator with this geometry's information.
|
||
702 | * @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.
|
||
703 | */
|
||
704 | PathIterator getPathIterator(AffineTransform at, double flatness); |
||
705 | |||
706 | /**
|
||
707 | * Useful to have the real shape behind the scenes. May be uses to edit it
|
||
708 | * knowing it it is a Circle, Ellipse, etc.
|
||
709 | *
|
||
710 | * @return The awt shape
|
||
711 | * @deprecated
|
||
712 | */
|
||
713 | public Shape getInternalShape(); |
||
714 | |||
715 | |||
716 | /**
|
||
717 | * Get GeneralPathIterator, to do registered operations to it.
|
||
718 | *
|
||
719 | * @return The GeneralPathX.
|
||
720 | * @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.
|
||
721 | */
|
||
722 | public GeneralPathX getGeneralPath();
|
||
723 | |||
724 | } |