Revision 41756
tags/org.gvsig.desktop-2.0.60/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.api/src/main/resources/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.fmap.geom.GeometryLibrary |
tags/org.gvsig.desktop-2.0.60/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.api/src/main/java/org/gvsig/fmap/geom/Geometry.java | ||
---|---|---|
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.handler.Handler; |
|
36 |
import org.gvsig.fmap.geom.operation.GeometryOperationContext; |
|
37 |
import org.gvsig.fmap.geom.operation.GeometryOperationException; |
|
38 |
import org.gvsig.fmap.geom.operation.GeometryOperationNotSupportedException; |
|
39 |
import org.gvsig.fmap.geom.primitive.Envelope; |
|
40 |
import org.gvsig.fmap.geom.primitive.GeneralPathX; |
|
41 |
import org.gvsig.fmap.geom.primitive.Point; |
|
42 |
import org.gvsig.fmap.geom.type.GeometryType; |
|
43 |
|
|
44 |
/** |
|
45 |
* <p> |
|
46 |
* 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" |
|
47 |
* >ISO 19107</a>. It is the root class of the geometric object taxonomy and |
|
48 |
* supports interfaces common to all geographically referenced geometric |
|
49 |
* objects. |
|
50 |
* </p> |
|
51 |
* <p> |
|
52 |
* Geometry instances are sets of direct positions in a particular coordinate |
|
53 |
* reference system. A Geometry can be regarded as an infinite set of points |
|
54 |
* that satisfies the set operation interfaces for a set of direct positions. |
|
55 |
* </p> |
|
56 |
* <p> |
|
57 |
* A geometric object shall be a combination of a coordinate geometry and a |
|
58 |
* coordinate reference system. In all of the operations, all geometric |
|
59 |
* calculations shall be done in the coordinate reference system of the first |
|
60 |
* geometric object accessed, which is normally the object whose operation is |
|
61 |
* being invoked. Returned objects shall be in the coordinate reference system |
|
62 |
* in which the calculations are done unless explicitly stated otherwise. |
|
63 |
* </p> |
|
64 |
* <p> |
|
65 |
* This class extends of the {@link Shape} class by historical reasons but this |
|
66 |
* inheritance will disappear in future versions. |
|
67 |
* </p> |
|
68 |
* @see <a href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=26012" |
|
69 |
* >ISO 19107< /a> |
|
70 |
*/ |
|
71 |
public interface Geometry extends Shape, Serializable, Comparable { |
|
72 |
|
|
73 |
/** |
|
74 |
* Predefined geometry types in the model. |
|
75 |
*/ |
|
76 |
public interface TYPES { |
|
77 |
|
|
78 |
/** |
|
79 |
* Any geometry. |
|
80 |
*/ |
|
81 |
|
|
82 |
public final static int GEOMETRY = 0; |
|
83 |
|
|
84 |
/** |
|
85 |
* A geometric element that has zero dimensions and a location |
|
86 |
* determinable by an ordered set of coordinates. |
|
87 |
*/ |
|
88 |
public final static int POINT = 1; |
|
89 |
|
|
90 |
/** |
|
91 |
* A straight or curved geometric element that is generated by a moving |
|
92 |
* point and that has extension only along the path of the point. |
|
93 |
*/ |
|
94 |
public final static int CURVE = 2; |
|
95 |
|
|
96 |
/** |
|
97 |
* A closed plane figure bounded by straight lines. |
|
98 |
*/ |
|
99 |
public final static int SURFACE = 3; |
|
100 |
|
|
101 |
/** |
|
102 |
* Solids in 3D. |
|
103 |
*/ |
|
104 |
public final static int SOLID = 4; |
|
105 |
|
|
106 |
/** |
|
107 |
* A set that can contain points, lines and polygons. This is usual in |
|
108 |
* <i>CAD</i> layers <i>(dxf, dgn, dwg)</i>. |
|
109 |
*/ |
|
110 |
public final static int AGGREGATE = 6; |
|
111 |
/** |
|
112 |
* A set of points. |
|
113 |
*/ |
|
114 |
public final static int MULTIPOINT = 7; |
|
115 |
|
|
116 |
/** |
|
117 |
* A set of lines. |
|
118 |
*/ |
|
119 |
public final static int MULTICURVE = 8; |
|
120 |
|
|
121 |
/** |
|
122 |
* A set of polygons. |
|
123 |
*/ |
|
124 |
public final static int MULTISURFACE = 9; |
|
125 |
|
|
126 |
/** |
|
127 |
* A set of solids. |
|
128 |
*/ |
|
129 |
public final static int MULTISOLID = 10; |
|
130 |
|
|
131 |
/** |
|
132 |
* A closed plane curve every point of which is equidistant from a fixed |
|
133 |
* point within the curve. |
|
134 |
*/ |
|
135 |
public final static int CIRCLE = 11; |
|
136 |
|
|
137 |
/** |
|
138 |
* A continuous portion (as of a circle or ellipse) of a curved line. |
|
139 |
*/ |
|
140 |
public final static int ARC = 12; |
|
141 |
|
|
142 |
/** |
|
143 |
* A closed plane curve generated by a point moving in such a way that |
|
144 |
* the sums of its distances from two fixed points is a constant : a |
|
145 |
* plane section of a right circular cone that is a closed curve. |
|
146 |
*/ |
|
147 |
public final static int ELLIPSE = 13; |
|
148 |
|
|
149 |
public final static int SPLINE = 14; |
|
150 |
|
|
151 |
public final static int ELLIPTICARC = 15; |
|
152 |
|
|
153 |
/** |
|
154 |
* NO DATA geometry. |
|
155 |
*/ |
|
156 |
public final static int NULL = 16; |
|
157 |
|
|
158 |
public final static int COMPLEX = 17; |
|
159 |
|
|
160 |
|
|
161 |
public final static int LINE = 18; |
|
162 |
|
|
163 |
public final static int POLYGON = 19; |
|
164 |
} |
|
165 |
|
|
166 |
public interface DIMENSIONS { |
|
167 |
public final static int X = 0; |
|
168 |
public final static int Y = 1; |
|
169 |
public final static int Z = 2; |
|
170 |
} |
|
171 |
|
|
172 |
/** |
|
173 |
* The subtype of a geometry is related with the dimension of the geometry, |
|
174 |
* that is a combination between the spatial dimension (2D, 2ZD, 3D) and the |
|
175 |
* M coordinate or "measure". |
|
176 |
* |
|
177 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a> |
|
178 |
*/ |
|
179 |
public interface SUBTYPES { |
|
180 |
|
|
181 |
/** |
|
182 |
* Geometries with two dimensions. |
|
183 |
*/ |
|
184 |
public final static int GEOM2D = 0; |
|
185 |
|
|
186 |
/** |
|
187 |
* Geometries with three dimensions. |
|
188 |
*/ |
|
189 |
public final static int GEOM3D = 1; |
|
190 |
|
|
191 |
/** |
|
192 |
* Geometries with two dimensions and with the M coordinate. |
|
193 |
*/ |
|
194 |
public final static int GEOM2DM = 2; |
|
195 |
|
|
196 |
/** |
|
197 |
* Geometries with three dimensions and with the M coordinate. |
|
198 |
*/ |
|
199 |
public final static int GEOM3DM = 3; |
|
200 |
|
|
201 |
/** |
|
202 |
* The subtype us unknown. |
|
203 |
*/ |
|
204 |
public final static int UNKNOWN = 4; |
|
205 |
} |
|
206 |
|
|
207 |
/** |
|
208 |
* Initial value for new geometry types (it must not overlap with the basic |
|
209 |
* ones defined in TYPES). |
|
210 |
*/ |
|
211 |
public static final int EXTENDED_GEOMTYPE_OFFSET = 17; |
|
212 |
|
|
213 |
/** |
|
214 |
* Initial value for new geometry subtypes (it must not overlap with the |
|
215 |
* basic ones defined in SUBTYPES). |
|
216 |
*/ |
|
217 |
public static final int EXTENDED_GEOMSUBTYPE_OFFSET = 6; |
|
218 |
|
|
219 |
public interface OPERATIONS { |
|
220 |
public final static String CONVERTTOWKT = "toWKT"; |
|
221 |
public final static String CONVERTTOWKB = "toWKB"; |
|
222 |
public final static String BUFFER = "buffer"; |
|
223 |
public final static String DISTANCE = "Distance"; |
|
224 |
public final static String CONTAINS = "Contains"; |
|
225 |
public final static String OVERLAPS = "OVERLAPS"; |
|
226 |
public final static String CONVEXHULL = "ConvexHull"; |
|
227 |
public final static String COVERS = "Covers"; |
|
228 |
public final static String CROSSES = "Crosses"; |
|
229 |
public final static String DIFFERENCE = "Difference"; |
|
230 |
public final static String DISJOIN = "Disjoin"; |
|
231 |
public final static String INTERSECTION = "Intersaction"; |
|
232 |
public final static String INTERSECTS = "Intersects"; |
|
233 |
public final static String TOUCHES = "Touches"; |
|
234 |
public final static String UNION = "Union"; |
|
235 |
public final static String WITHIN = "Within"; |
|
236 |
public final static String COVEREDBY = "CoveredBy"; |
|
237 |
} |
|
238 |
|
|
239 |
public interface ValidationStatus { |
|
240 |
|
|
241 |
public static final int VALID = 0; |
|
242 |
public static final int CURRUPTED = 1; |
|
243 |
public static final int UNKNOW = 2; |
|
244 |
public static final int DISCONNECTED_INTERIOR = 10; |
|
245 |
public static final int DUPLICATE_RINGS = 11; |
|
246 |
public static final int HOLE_OUTSIDE_SHELL = 12; |
|
247 |
public static final int INVALID_COORDINATE = 13; |
|
248 |
public static final int NESTED_HOLES = 14; |
|
249 |
public static final int NESTED_SHELLS = 15; |
|
250 |
public static final int RING_NOT_CLOSED = 17; |
|
251 |
public static final int RING_SELF_INTERSECTION = 18; |
|
252 |
public static final int SELF_INTERSECTION = 19; |
|
253 |
public static final int TOO_FEW_POINTS = 20; |
|
254 |
|
|
255 |
/** |
|
256 |
* True if the geoemtry are valid. |
|
257 |
* |
|
258 |
* @return true form valid geometries |
|
259 |
*/ |
|
260 |
public boolean isValid(); |
|
261 |
|
|
262 |
/** |
|
263 |
* Return the status code results of validate the geometry. |
|
264 |
* |
|
265 |
* @return validation code |
|
266 |
*/ |
|
267 |
public int getStatusCode(); |
|
268 |
|
|
269 |
/** |
|
270 |
* Return the nearest point to the problem when validate the geometry. |
|
271 |
* |
|
272 |
* If the geometry is valid, this return null. |
|
273 |
* |
|
274 |
* @return the nearest point to the problem or null. |
|
275 |
*/ |
|
276 |
public Point getProblemLocation(); |
|
277 |
|
|
278 |
/** |
|
279 |
* Return a human readable message explaining the cause of the problem. |
|
280 |
* |
|
281 |
* If the geometry is valid this is null. |
|
282 |
* |
|
283 |
* @return the message cause of the problem. |
|
284 |
*/ |
|
285 |
public String getMessage(); |
|
286 |
} |
|
287 |
|
|
288 |
public static int BEST = 0; |
|
289 |
/** |
|
290 |
* North. |
|
291 |
*/ |
|
292 |
public static int N = 1; |
|
293 |
|
|
294 |
/** |
|
295 |
* North - East. |
|
296 |
*/ |
|
297 |
public static int NE = 2; |
|
298 |
|
|
299 |
/** |
|
300 |
* East. |
|
301 |
*/ |
|
302 |
public static int E = 3; |
|
303 |
|
|
304 |
/** |
|
305 |
* South - East. |
|
306 |
*/ |
|
307 |
public static int SE = 4; |
|
308 |
|
|
309 |
/** |
|
310 |
* South. |
|
311 |
*/ |
|
312 |
public static int S = 5; |
|
313 |
|
|
314 |
/** |
|
315 |
* South - West. |
|
316 |
*/ |
|
317 |
public static int SW = 6; |
|
318 |
|
|
319 |
/** |
|
320 |
* West. |
|
321 |
*/ |
|
322 |
public static int W = 7; |
|
323 |
|
|
324 |
/** |
|
325 |
* North - West. |
|
326 |
*/ |
|
327 |
public static int NW = 8; |
|
328 |
|
|
329 |
public static int SELECTHANDLER = 0; |
|
330 |
public static int STRETCHINGHANDLER = 1; |
|
331 |
|
|
332 |
/** |
|
333 |
* If this geometry is a predefined interface then this method returns one |
|
334 |
* of {@link Geometry.TYPES} contants.<br> |
|
335 |
* If this geometry is an extended type then this method returns a runtime |
|
336 |
* constant that identifies its type. By convention this value is stored in |
|
337 |
* a constant called .CODE within the geometry class, for instance: |
|
338 |
* Point2D.CODE. |
|
339 |
* |
|
340 |
* @return If this geometry is a predefined interface then one of |
|
341 |
* {@link Geometry.TYPES} or a runtime constant if it is an extended |
|
342 |
* type. |
|
343 |
*/ |
|
344 |
public int getType(); |
|
345 |
|
|
346 |
/** |
|
347 |
* Creates a clone of this geometry. |
|
348 |
* |
|
349 |
* @return A clone of this geometry. |
|
350 |
*/ |
|
351 |
public Geometry cloneGeometry(); |
|
352 |
|
|
353 |
/** |
|
354 |
* Returns true if this geometry intersects the rectangle passed as |
|
355 |
* parameter. |
|
356 |
* |
|
357 |
* @param r |
|
358 |
* Rectangle. |
|
359 |
* |
|
360 |
* @return True, if <code>this</code> intersects <code>r</code>. |
|
361 |
*/ |
|
362 |
public boolean intersects(Rectangle2D r); |
|
363 |
|
|
364 |
/** |
|
365 |
* Used by the drawing strategies to quickly test whether this geometry |
|
366 |
* intersects with the visible rectangle. |
|
367 |
* |
|
368 |
* @param x |
|
369 |
* The minimum X coordinate. |
|
370 |
* @param y |
|
371 |
* The minimum Y coordinate. |
|
372 |
* @param w |
|
373 |
* The width of the envelope. |
|
374 |
* @param h |
|
375 |
* The height of the envelope. |
|
376 |
* @return true if <code>this</code> intersects the rectangle defined by the |
|
377 |
* parameters. |
|
378 |
*/ |
|
379 |
public boolean fastIntersects(double x, double y, double w, double h); |
|
380 |
|
|
381 |
/** |
|
382 |
* <p> |
|
383 |
* Returns the minimum bounding box for this Geometry. This shall be the |
|
384 |
* coordinate region spanning the minimum and maximum value for each |
|
385 |
* ordinate taken on by DirectPositions in this Geometry. The simplest |
|
386 |
* representation for an envelope consists of two DirectPositions, the first |
|
387 |
* one containing all the minimums for each ordinate, and second one |
|
388 |
* containing all the maximums. |
|
389 |
* </p> |
|
390 |
* |
|
391 |
* @return The minimum bounding box for this Geometry. |
|
392 |
*/ |
|
393 |
public Envelope getEnvelope(); |
|
394 |
|
|
395 |
/** |
|
396 |
* Reprojects this geometry by the coordinate transformer passed as |
|
397 |
* parameter. |
|
398 |
* |
|
399 |
* @param ct |
|
400 |
* Coordinate Transformer. |
|
401 |
*/ |
|
402 |
public void reProject(ICoordTrans ct); |
|
403 |
|
|
404 |
/** |
|
405 |
* It applies an affine transformation to the geometry. |
|
406 |
* If parameter value is null, it will be considered an |
|
407 |
* empty transformation, therefore equivalent to the identity |
|
408 |
* transformation. |
|
409 |
* |
|
410 |
* @param at |
|
411 |
* The transformation to apply. |
|
412 |
*/ |
|
413 |
public void transform(AffineTransform at); |
|
414 |
/** |
|
415 |
* Returns the largest number n such that each direct position in a |
|
416 |
* geometric set can be associated with a subset that has the direct |
|
417 |
* position in its interior and is similar (isomorphic) to Rn, Euclidean |
|
418 |
* n-space. |
|
419 |
* |
|
420 |
* @return The dimension. |
|
421 |
*/ |
|
422 |
public int getDimension(); |
|
423 |
|
|
424 |
/** |
|
425 |
* Returns <code>true</code> if this Geometry has no interior point of |
|
426 |
* self-intersection or self-tangency. In mathematical formalisms, this |
|
427 |
* means that every point in the interior of the object must have a metric |
|
428 |
* neighborhood whose intersection with the object is isomorphic to an |
|
429 |
* n-sphere, where n is the dimension of this Geometry. |
|
430 |
* |
|
431 |
* @return If the geometry is simple. |
|
432 |
*/ |
|
433 |
public boolean isSimple(); |
|
434 |
|
|
435 |
public boolean isCCW() |
|
436 |
throws GeometryOperationNotSupportedException, |
|
437 |
GeometryOperationException; |
|
438 |
|
|
439 |
/** |
|
440 |
* Invokes a geometry operation given its index and context. |
|
441 |
* |
|
442 |
* @param index |
|
443 |
* Unique index of the operation. Operation code. |
|
444 |
* @param ctx |
|
445 |
* The context of the geometry operation. |
|
446 |
* @return Object returned by the operation. |
|
447 |
* @throws GeometryOperationNotSupportedException |
|
448 |
* It is thrown when the operation has been not registered for |
|
449 |
* this geometry. |
|
450 |
* @throws GeometryOperationException |
|
451 |
* It is thrown when there is an error executing the operation. |
|
452 |
*/ |
|
453 |
public Object invokeOperation(int index, GeometryOperationContext ctx) |
|
454 |
throws GeometryOperationNotSupportedException, |
|
455 |
GeometryOperationException; |
|
456 |
|
|
457 |
/** |
|
458 |
* Invokes a geometry operation given its name and context. |
|
459 |
* |
|
460 |
* @param opName |
|
461 |
* Operation name. |
|
462 |
* @param ctx |
|
463 |
* The context of the geometry operation. |
|
464 |
* @return Object returned by the operation. |
|
465 |
* @throws GeometryOperationNotSupportedException |
|
466 |
* It is thrown when the operation has been not registered for |
|
467 |
* this geometry. |
|
468 |
* @throws GeometryOperationException |
|
469 |
* It is thrown when there is an error executing the operation. |
|
470 |
*/ |
|
471 |
public Object invokeOperation(String opName, GeometryOperationContext ctx) |
|
472 |
throws GeometryOperationNotSupportedException, |
|
473 |
GeometryOperationException; |
|
474 |
|
|
475 |
/** |
|
476 |
* Instance of the GeometryType associated to this geometry. |
|
477 |
* |
|
478 |
* @return The geometry type. |
|
479 |
*/ |
|
480 |
public GeometryType getGeometryType(); |
|
481 |
|
|
482 |
/** |
|
483 |
* Return a byte array with the equivalent in WKB format of the Geometry. |
|
484 |
* |
|
485 |
* Utility method to wrap the invocation to the operation |
|
486 |
* {@link OPERATIONS#CONVERTTOWKB}. |
|
487 |
* |
|
488 |
* @return the WKB version of the geometry |
|
489 |
*/ |
|
490 |
public byte[] convertToWKB() throws GeometryOperationNotSupportedException, |
|
491 |
GeometryOperationException; |
|
492 |
|
|
493 |
public byte[] convertToWKB(int srs) |
|
494 |
throws GeometryOperationNotSupportedException, GeometryOperationException; |
|
495 |
|
|
496 |
public byte[] convertToWKBForcingType(int srs, int type) |
|
497 |
throws GeometryOperationNotSupportedException, GeometryOperationException; |
|
498 |
|
|
499 |
/** |
|
500 |
* Return a string with the equivalent in WKT format of the Geometry. |
|
501 |
* |
|
502 |
* This is a utility method to wrap the invocation to the operation |
|
503 |
* {@link OPERATIONS#CONVERTTOWKT}. |
|
504 |
* |
|
505 |
* @return the WKT version of the geometry. |
|
506 |
* |
|
507 |
* @throws GeometryOperationNotSupportedException |
|
508 |
* @throws GeometryOperationException |
|
509 |
*/ |
|
510 |
public String convertToWKT() throws GeometryOperationNotSupportedException, |
|
511 |
GeometryOperationException; |
|
512 |
|
|
513 |
/** |
|
514 |
* Computes a buffer area around this geometry having the given width |
|
515 |
* |
|
516 |
* This is a utility method to wrap the invocation to the operation |
|
517 |
* {@link OPERATIONS#BUFFER}. |
|
518 |
* |
|
519 |
* @param distance |
|
520 |
* the width of the buffer |
|
521 |
* |
|
522 |
* @return a new Geometry with the computed buffer. |
|
523 |
* |
|
524 |
* @throws GeometryOperationNotSupportedException |
|
525 |
* @throws GeometryOperationException |
|
526 |
*/ |
|
527 |
public Geometry buffer(double distance) |
|
528 |
throws GeometryOperationNotSupportedException, |
|
529 |
GeometryOperationException; |
|
530 |
|
|
531 |
/** |
|
532 |
* Tests whether this geometry contains the specified geometry. |
|
533 |
* |
|
534 |
* This is a utility method to wrap the invocation to the operation |
|
535 |
* {@link OPERATIONS#CONTAINS}. |
|
536 |
* |
|
537 |
* @param geometry |
|
538 |
* the Geometry with which to compare this Geometry |
|
539 |
* |
|
540 |
* @return if this Geometry contains the specified geometry |
|
541 |
* |
|
542 |
* @throws GeometryOperationNotSupportedException |
|
543 |
* @throws GeometryOperationException |
|
544 |
*/ |
|
545 |
public boolean contains(Geometry geometry) |
|
546 |
throws GeometryOperationNotSupportedException, |
|
547 |
GeometryOperationException; |
|
548 |
|
|
549 |
/** |
|
550 |
* Returns the minimum distance between this Geometry and the specified |
|
551 |
* geometry. |
|
552 |
* |
|
553 |
* This is a utility method to wrap the invocation to the operation |
|
554 |
* {@link OPERATIONS#DISTANCE}. |
|
555 |
* |
|
556 |
* @param geometry |
|
557 |
* the Geometry from which to compute the distance |
|
558 |
* |
|
559 |
* @return the distance between the geometries |
|
560 |
* |
|
561 |
* @throws GeometryOperationNotSupportedException |
|
562 |
* @throws GeometryOperationException |
|
563 |
*/ |
|
564 |
public double distance(Geometry other) |
|
565 |
throws GeometryOperationNotSupportedException, |
|
566 |
GeometryOperationException; |
|
567 |
|
|
568 |
public Geometry[] closestPoints(Geometry other) |
|
569 |
throws GeometryOperationNotSupportedException, |
|
570 |
GeometryOperationException; |
|
571 |
|
|
572 |
boolean isWithinDistance(Geometry other, double distance) |
|
573 |
throws GeometryOperationNotSupportedException, |
|
574 |
GeometryOperationException; |
|
575 |
|
|
576 |
/** |
|
577 |
* Tests whether this geometry overlaps the specified geometry. |
|
578 |
* |
|
579 |
* This is a utility method to wrap the invocation to the operation |
|
580 |
* {@link OPERATIONS#OVERLAPS}. |
|
581 |
* |
|
582 |
* @param geometry |
|
583 |
* the Geometry with which to compare this Geometry |
|
584 |
* |
|
585 |
* @return true if the two geometries overlap. |
|
586 |
* |
|
587 |
* @throws GeometryOperationNotSupportedException |
|
588 |
* @throws GeometryOperationException |
|
589 |
*/ |
|
590 |
public boolean overlaps(Geometry geometry) |
|
591 |
throws GeometryOperationNotSupportedException, |
|
592 |
GeometryOperationException; |
|
593 |
|
|
594 |
public Geometry convexHull() throws GeometryOperationNotSupportedException, |
|
595 |
GeometryOperationException; |
|
596 |
|
|
597 |
public boolean coveredBy(Geometry geometry) |
|
598 |
throws GeometryOperationNotSupportedException, |
|
599 |
GeometryOperationException; |
|
600 |
|
|
601 |
public boolean covers(Geometry geometry) |
|
602 |
throws GeometryOperationNotSupportedException, |
|
603 |
GeometryOperationException; |
|
604 |
|
|
605 |
public boolean crosses(Geometry geometry) |
|
606 |
throws GeometryOperationNotSupportedException, |
|
607 |
GeometryOperationException; |
|
608 |
|
|
609 |
public Geometry difference(Geometry other) |
|
610 |
throws GeometryOperationNotSupportedException, |
|
611 |
GeometryOperationException; |
|
612 |
|
|
613 |
public boolean disjoint(Geometry geometry) |
|
614 |
throws GeometryOperationNotSupportedException, |
|
615 |
GeometryOperationException; |
|
616 |
|
|
617 |
public Geometry intersection(Geometry other) |
|
618 |
throws GeometryOperationNotSupportedException, |
|
619 |
GeometryOperationException; |
|
620 |
|
|
621 |
public boolean intersects(Geometry geometry) |
|
622 |
throws GeometryOperationNotSupportedException, |
|
623 |
GeometryOperationException; |
|
624 |
|
|
625 |
public Geometry snapTo(Geometry other, double snapTolerance) |
|
626 |
throws GeometryOperationNotSupportedException, |
|
627 |
GeometryOperationException; |
|
628 |
|
|
629 |
public boolean touches(Geometry geometry) |
|
630 |
throws GeometryOperationNotSupportedException, |
|
631 |
GeometryOperationException; |
|
632 |
|
|
633 |
public Geometry union(Geometry other) |
|
634 |
throws GeometryOperationNotSupportedException, |
|
635 |
GeometryOperationException; |
|
636 |
|
|
637 |
public boolean within(Geometry geometry) |
|
638 |
throws GeometryOperationNotSupportedException, |
|
639 |
GeometryOperationException; |
|
640 |
|
|
641 |
public Point centroid() throws GeometryOperationNotSupportedException, GeometryOperationException; |
|
642 |
|
|
643 |
/** |
|
644 |
* This method returns a point which is inside the geometry. |
|
645 |
* This is useful for mathematical purposes but it is very unlikely |
|
646 |
* to be a suitable place for a label, for example. |
|
647 |
* |
|
648 |
* |
|
649 |
* @return an interior point |
|
650 |
* @throws GeometryOperationNotSupportedException |
|
651 |
* @throws GeometryOperationException |
|
652 |
*/ |
|
653 |
public Point getInteriorPoint() throws GeometryOperationNotSupportedException, GeometryOperationException; |
|
654 |
|
|
655 |
public double area() throws GeometryOperationNotSupportedException, GeometryOperationException; |
|
656 |
|
|
657 |
public double perimeter() throws GeometryOperationNotSupportedException, GeometryOperationException; |
|
658 |
|
|
659 |
|
|
660 |
|
|
661 |
|
|
662 |
/** |
|
663 |
* Rotates the geometry by radAngle radians using the given |
|
664 |
* coordinates as center of rotation. Rotating with a positive |
|
665 |
* angle rotates points on the positive x axis toward the |
|
666 |
* positive y axis. In most cases, we assume x increases |
|
667 |
* rightwards and y increases upwards, so in most cases, |
|
668 |
* a positive angle will mean counter-clockwise rotation. |
|
669 |
* |
|
670 |
* @param radAngle the amount of rotation, in radians |
|
671 |
* @param basex x coordinate of center of rotation |
|
672 |
* @param basey y coordinate of center of rotation |
|
673 |
*/ |
|
674 |
public void rotate(double radAngle, double basex, double basey); |
|
675 |
|
|
676 |
/** |
|
677 |
* Shifts geometry by given amount in x and y axes |
|
678 |
* |
|
679 |
* @param dx |
|
680 |
* @param dy |
|
681 |
*/ |
|
682 |
public void move(double dx, double dy); |
|
683 |
|
|
684 |
|
|
685 |
/** |
|
686 |
* Scales geometry in x and y axes by given scale factors |
|
687 |
* using the given point as center of projection. |
|
688 |
* |
|
689 |
* @param basePoint |
|
690 |
* @param sx scale factor in x axis |
|
691 |
* @param sy scale factor in y axis |
|
692 |
*/ |
|
693 |
public void scale(Point basePoint, double sx, double sy); |
|
694 |
|
|
695 |
/** |
|
696 |
* Check if the geometry is valid. |
|
697 |
* |
|
698 |
* @return true if the geometry is valid. |
|
699 |
*/ |
|
700 |
public boolean isValid(); |
|
701 |
|
|
702 |
/** |
|
703 |
* Check if the geometry is valid and returns the validation status. |
|
704 |
* |
|
705 |
* @return the ValidationStatus |
|
706 |
*/ |
|
707 |
public ValidationStatus getValidationStatus(); |
|
708 |
|
|
709 |
/** |
|
710 |
* Try to fix the geometry and return the new geometry. |
|
711 |
* If the geometry is valid return the same geometry. |
|
712 |
* If the geometry is corrupt or can't fix it, return null. |
|
713 |
* |
|
714 |
* @return the new fixed geometry |
|
715 |
*/ |
|
716 |
public Geometry makeValid(); |
|
717 |
|
|
718 |
// |
|
719 |
// =============================================== |
|
720 |
// |
|
721 |
|
|
722 |
|
|
723 |
/** |
|
724 |
* @return the awt shape used to display the geometry. It |
|
725 |
* applies a tranformation before to return the coordinates |
|
726 |
* of the shape |
|
727 |
* @deprecated this class inherits of {@link Shape} by historical |
|
728 |
* reasons. This method has been added just to control the usage of |
|
729 |
* the {@link Shape} class but it will removed in a future. |
|
730 |
*/ |
|
731 |
public Shape getShape(AffineTransform affineTransform); |
|
732 |
|
|
733 |
/** |
|
734 |
* @return the awt shape used to display the geometry. |
|
735 |
* @deprecated this class inherits of {@link Shape} by historical |
|
736 |
* reasons. This method has been added just to control the usage of |
|
737 |
* the {@link Shape} class but it will removed in a future. |
|
738 |
*/ |
|
739 |
public Shape getShape(); |
|
740 |
|
|
741 |
/** |
|
742 |
* Returns this geometry's boundary rectangle. |
|
743 |
* |
|
744 |
* @deprecated use getEnvelope. |
|
745 |
* @return Boundary rectangle. |
|
746 |
*/ |
|
747 |
public Rectangle2D getBounds2D(); |
|
748 |
|
|
749 |
/** |
|
750 |
* If applies an affine transformation and returns the GeneralPathXIterator |
|
751 |
* with this geometry's information. |
|
752 |
* |
|
753 |
* @param at |
|
754 |
* The transformation to apply. |
|
755 |
* @return The GeneralPathXIterator with this geometry's information. |
|
756 |
* @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. |
|
757 |
* |
|
758 |
*/ |
|
759 |
public PathIterator getPathIterator(AffineTransform at); |
|
760 |
|
|
761 |
/** |
|
762 |
* It returns the handlers of the geometry, these they can be of two types |
|
763 |
* is straightening and of selection. |
|
764 |
* |
|
765 |
* @param type |
|
766 |
* Type of handlers. |
|
767 |
* |
|
768 |
* @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. |
|
769 |
* @return The handlers. |
|
770 |
*/ |
|
771 |
public Handler[] getHandlers(int type); |
|
772 |
|
|
773 |
|
|
774 |
/** |
|
775 |
* If applies an affine transformation and returns the GeneralPathXIterator |
|
776 |
* with this geometry's information. |
|
777 |
* |
|
778 |
* @param at |
|
779 |
* The affine transformation. |
|
780 |
* @param flatness |
|
781 |
* |
|
782 |
* @return The GeneralPathXIterator with this geometry's information. |
|
783 |
* @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. |
|
784 |
*/ |
|
785 |
PathIterator getPathIterator(AffineTransform at, double flatness); |
|
786 |
|
|
787 |
/** |
|
788 |
* Useful to have the real shape behind the scenes. May be uses to edit it |
|
789 |
* knowing it it is a Circle, Ellipse, etc. |
|
790 |
* |
|
791 |
* @return The awt shape |
|
792 |
* @deprecated |
|
793 |
*/ |
|
794 |
public Shape getInternalShape(); |
|
795 |
|
|
796 |
|
|
797 |
/** |
|
798 |
* Get GeneralPathIterator, to do registered operations to it. |
|
799 |
* |
|
800 |
* @return The GeneralPathX. |
|
801 |
* @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. |
|
802 |
*/ |
|
803 |
public GeneralPathX getGeneralPath(); |
|
804 |
|
|
805 |
} |
|
0 | 806 |
tags/org.gvsig.desktop-2.0.60/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.api/src/main/java/org/gvsig/fmap/geom/handler/Handler.java | ||
---|---|---|
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 |
package org.gvsig.fmap.geom.handler; |
|
25 |
|
|
26 |
import java.awt.geom.Point2D; |
|
27 |
|
|
28 |
|
|
29 |
/** |
|
30 |
* <p>In a <i>FMap</i> graphic layer, each geometry drawn has control points named <i>handlers</i> |
|
31 |
* that allow user to move, modify, set, ... that geometry.</p> |
|
32 |
* |
|
33 |
* <p>Each geometry will have its own handlers, and each one can have different behavior |
|
34 |
* according its nature.</p> |
|
35 |
* |
|
36 |
* <p>The <code>Handler</code> interface defines the least set of common methods for all |
|
37 |
* geometry handlers.</p> |
|
38 |
*/ |
|
39 |
public interface Handler { |
|
40 |
/** |
|
41 |
* <p>Generic method of moving in 2D a handler of a geometry using two numbers that |
|
42 |
* represent the 2D coordinates.</p> |
|
43 |
* |
|
44 |
* <p>Each handler of each geometry adapts this method to its own behavior in that |
|
45 |
* geometry, that implies that could not be implemented.</p> |
|
46 |
* |
|
47 |
* @param x first dimension coordinate |
|
48 |
* @param y second dimension coordinate |
|
49 |
* |
|
50 |
* @see #set(double, double) |
|
51 |
*/ |
|
52 |
public void move(double x, double y); |
|
53 |
/** |
|
54 |
* <p>Generic method of situating in 2D a handler of a geometry using two numbers |
|
55 |
* that represent the 2D coordinates.</p> |
|
56 |
* |
|
57 |
* <p>Each handler of each geometry adapts this method to its own behavior in that |
|
58 |
* geometry, that implies that could not be implemented.</p> |
|
59 |
* |
|
60 |
* @param x first dimension coordinate |
|
61 |
* @param y second dimension coordinate |
|
62 |
* |
|
63 |
* @see #move(double, double) |
|
64 |
* @see #getPoint() |
|
65 |
*/ |
|
66 |
public void set(double x, double y); |
|
67 |
|
|
68 |
/** |
|
69 |
* <p>Generic method of getting the 2D point that represents a handler of a geometry.</p> |
|
70 |
* |
|
71 |
* <p>Each handler of each geometry adapts this method to its own behavior in that |
|
72 |
* geometry, that implies that could not be implemented.</p> |
|
73 |
* |
|
74 |
* @return point 2D that represents this handler of geometry |
|
75 |
* |
|
76 |
* @see #set(double, double) |
|
77 |
* @see #move(double, double) |
|
78 |
*/ |
|
79 |
public Point2D getPoint(); |
|
80 |
/** |
|
81 |
* <p>Returns <code>true</code> if the object is a <code>Handler</code> and has the |
|
82 |
* same coordinates as this one.</p> |
|
83 |
* |
|
84 |
* @param obj the reference object with which to compare |
|
85 |
* @return <code>true</code> if this object is the same as the <code>obj</code> |
|
86 |
* argument; <code>false</code> otherwise |
|
87 |
* |
|
88 |
* @see #getPoint() |
|
89 |
*/ |
|
90 |
public boolean equalsPoint(Object obj); |
|
91 |
} |
|
0 | 92 |
tags/org.gvsig.desktop-2.0.60/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.api/src/main/java/org/gvsig/fmap/geom/handler/CenterHandler.java | ||
---|---|---|
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 |
package org.gvsig.fmap.geom.handler; |
|
25 |
|
|
26 |
|
|
27 |
|
|
28 |
/** |
|
29 |
* Center handlers. |
|
30 |
* |
|
31 |
* @author Vicente Caballero Navarro |
|
32 |
*/ |
|
33 |
public interface CenterHandler extends Handler { |
|
34 |
} |
|
0 | 35 |
tags/org.gvsig.desktop-2.0.60/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.api/src/main/java/org/gvsig/fmap/geom/handler/CuadrantHandler.java | ||
---|---|---|
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 |
package org.gvsig.fmap.geom.handler; |
|
25 |
|
|
26 |
/** |
|
27 |
* Cuadrant handlers. |
|
28 |
* |
|
29 |
* @author Vicente Caballero Navarro |
|
30 |
*/ |
|
31 |
public interface CuadrantHandler extends Handler { |
|
32 |
} |
|
0 | 33 |
tags/org.gvsig.desktop-2.0.60/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.api/src/main/java/org/gvsig/fmap/geom/handler/AbstractHandler.java | ||
---|---|---|
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 |
package org.gvsig.fmap.geom.handler; |
|
25 |
|
|
26 |
import java.awt.geom.Point2D; |
|
27 |
|
|
28 |
|
|
29 |
|
|
30 |
/** |
|
31 |
* This class expands the <code>Handler</code> interface adding support for selection, and |
|
32 |
* identifying a handler of a geometry. |
|
33 |
* |
|
34 |
* @see Handler |
|
35 |
* |
|
36 |
* @author Vicente Caballero Navarro |
|
37 |
*/ |
|
38 |
public abstract class AbstractHandler implements Handler { |
|
39 |
/** |
|
40 |
* Identifies each handler of a geometry. |
|
41 |
*/ |
|
42 |
protected int index; |
|
43 |
/** |
|
44 |
* Position of this handler. |
|
45 |
* |
|
46 |
* @see #getPoint() |
|
47 |
* @see Handler#set(double, double) |
|
48 |
* @see Handler#move(double, double) |
|
49 |
*/ |
|
50 |
protected Point2D point; |
|
51 |
/** |
|
52 |
* True when the handler is selected. |
|
53 |
* |
|
54 |
* @see #select |
|
55 |
* @see #isSelected() |
|
56 |
*/ |
|
57 |
private boolean select=false; |
|
58 |
/* |
|
59 |
* (non-Javadoc) |
|
60 |
* @see com.iver.cit.gvsig.fmap.core.Handler#getPoint() |
|
61 |
*/ |
|
62 |
public Point2D getPoint() { |
|
63 |
return point; |
|
64 |
} |
|
65 |
/** |
|
66 |
* Sets the state of the handler. <code>True</code> if is selected, <code>false</code> if it's not. |
|
67 |
* |
|
68 |
* @param b <code>true</code> if the handler is selected, <code>false</code> otherwise |
|
69 |
* |
|
70 |
* @see #isSelected() |
|
71 |
*/ |
|
72 |
public void select(boolean b) { |
|
73 |
select=b; |
|
74 |
} |
|
75 |
/** |
|
76 |
* Returns the state of the handler. <code>True</code> if is selected, <code>false</code> if it's not. |
|
77 |
* |
|
78 |
* @return <code>true</code> if the handler is selected,<code>false</code> otherwise |
|
79 |
* |
|
80 |
* @see #select(boolean) |
|
81 |
*/ |
|
82 |
public boolean isSelected(){ |
|
83 |
return select; |
|
84 |
} |
|
85 |
/* |
|
86 |
* (non-Javadoc) |
|
87 |
* @see com.iver.cit.gvsig.fmap.core.Handler#equalsPoint(java.lang.Object) |
|
88 |
*/ |
|
89 |
public boolean equalsPoint(Object obj) { |
|
90 |
Point2D p1=this.getPoint(); |
|
91 |
Point2D p2=((Handler)obj).getPoint(); |
|
92 |
if (p1.getX()==p2.getX() && p1.getY()==p2.getY()) { |
|
93 |
return true; |
|
94 |
} |
|
95 |
return false; |
|
96 |
} |
|
97 |
} |
|
0 | 98 |
tags/org.gvsig.desktop-2.0.60/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.api/src/main/java/org/gvsig/fmap/geom/handler/FinalHandler.java | ||
---|---|---|
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 |
package org.gvsig.fmap.geom.handler; |
|
25 |
|
|
26 |
/** |
|
27 |
* Final handlers. |
|
28 |
* |
|
29 |
* @author Vicente Caballero Navarro |
|
30 |
*/ |
|
31 |
public interface FinalHandler extends Handler { |
|
32 |
} |
|
0 | 33 |
tags/org.gvsig.desktop-2.0.60/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.api/src/main/java/org/gvsig/fmap/geom/DataTypes.java | ||
---|---|---|
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 |
package org.gvsig.fmap.geom; |
|
25 |
|
|
26 |
/** |
|
27 |
* This interface defines a set of constants for all data types supported by the |
|
28 |
* DAL. |
|
29 |
* |
|
30 |
* @author gvSIG Team |
|
31 |
* @version $Id$ |
|
32 |
* |
|
33 |
*/ |
|
34 |
public interface DataTypes extends org.gvsig.tools.dataTypes.DataTypes { |
|
35 |
|
|
36 |
/* |
|
37 |
* |
|
38 |
*/ |
|
39 |
public static final int GEOMETRY = OBJECT + 2; |
|
40 |
public static final int ENVELOPE = OBJECT + 3; |
|
41 |
} |
|
0 | 42 |
tags/org.gvsig.desktop-2.0.60/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.api/src/main/java/org/gvsig/fmap/geom/DirectPosition.java | ||
---|---|---|
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 |
package org.gvsig.fmap.geom; |
|
25 |
|
|
26 |
/** |
|
27 |
* <p> |
|
28 |
* DirectPosition object data types hold the coordinates for |
|
29 |
* a position within some coordinate reference system. |
|
30 |
* The coordinate reference system is described in |
|
31 |
* <a href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=41126">ISO 19111</a>. |
|
32 |
* </p> |
|
33 |
* @see <a href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=26012">ISO 19107</a> |
|
34 |
* @see <a http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=41126">ISO 19111</a> |
|
35 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a> |
|
36 |
*/ |
|
37 |
public interface DirectPosition { |
|
38 |
|
|
39 |
/** |
|
40 |
* Returns the length of coordinate. This is determined by |
|
41 |
* the reference system. |
|
42 |
* @return |
|
43 |
* The dimension |
|
44 |
*/ |
|
45 |
public int getDimension(); |
|
46 |
|
|
47 |
/** |
|
48 |
* Returns the ordinate of the given dimension. |
|
49 |
* @param dimension |
|
50 |
* The dimension to retrieve |
|
51 |
* @return |
|
52 |
* The value of the ordinate |
|
53 |
*/ |
|
54 |
public double getOrdinate(int dimension); |
|
55 |
|
|
56 |
} |
|
0 | 57 |
tags/org.gvsig.desktop-2.0.60/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.api/src/main/java/org/gvsig/fmap/geom/type/GeometryType.java | ||
---|---|---|
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 |
package org.gvsig.fmap.geom.type; |
|
25 |
|
|
26 |
import org.gvsig.fmap.geom.Geometry; |
|
27 |
import org.gvsig.fmap.geom.exception.CreateGeometryException; |
|
28 |
import org.gvsig.fmap.geom.operation.GeometryOperation; |
|
29 |
|
|
30 |
/** |
|
31 |
* This class represents the type of a geometry. All the geometries |
|
32 |
* has to have a type that can be retrieved using the |
|
33 |
* {@link Geometry}{@link #getGeometryType()} method. |
|
34 |
* |
|
35 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a> |
|
36 |
*/ |
|
37 |
public interface GeometryType { |
|
38 |
|
|
39 |
/** |
|
40 |
* @return the name of the geometry type. |
|
41 |
*/ |
|
42 |
public String getName(); |
|
43 |
|
|
44 |
/** |
|
45 |
* @return the type of the geometry. It is a constant value |
|
46 |
* that has to be one of the values in {@link Geometry.TYPES} |
|
47 |
* The type is an abstract representation of the object (Point, Curve...) |
|
48 |
* but it is not a concrete representation (Point2D, Point3D...). |
|
49 |
*/ |
|
50 |
public int getType(); |
|
51 |
|
|
52 |
/** |
|
53 |
* @return the subtype of the geometry. It is a constant value |
|
54 |
* that has to be one of the values in {@link Geometry.SUBTYPES}. |
|
55 |
* The subtype represents a set of geometries with a |
|
56 |
* dimensional relationship (2D, 3D, 2DM...) |
|
57 |
*/ |
|
58 |
public int getSubType(); |
|
59 |
|
|
60 |
/** |
|
61 |
* Check if a geometry type inherits of other type. E.g: |
|
62 |
* the super type of an arc could be a a curve, the super |
|
63 |
* type of a circle could be a surface... |
|
64 |
* @param geometryType |
|
65 |
* the value of the {@link Geometry.TYPES} to check if is |
|
66 |
* it super type |
|
67 |
* @return |
|
68 |
* <true> if the the parameter is a super type of this |
|
69 |
* geometry type |
|
70 |
*/ |
|
71 |
public boolean isTypeOf(int geometryType); |
|
72 |
|
|
73 |
/** |
|
74 |
* Check if a geometry subType inherits of other subType. E.g: |
|
75 |
* the super Subtype of a geometry 3D could be a geometry 2D, |
|
76 |
* because the 3D extends the behavior of a geometry 2D. |
|
77 |
* @param geometrySubType |
|
78 |
* the value of the {@link Geometry.SUBTYPES} to check if is |
|
79 |
* it super subType |
|
80 |
* @return |
|
81 |
* <true> if the the parameter is a super subType of this |
|
82 |
* geometry type |
|
83 |
*/ |
|
84 |
public boolean isSubTypeOf(int geometrySubType); |
|
85 |
|
|
86 |
/** |
|
87 |
* Check if a geometry type inherits of other type. E.g: |
|
88 |
* the super type of an arc could be a a curve, the super |
|
89 |
* type of a circle could be a surface... |
|
90 |
* |
|
91 |
* @param geometryType |
|
92 |
* the geometry type to check if is it super type |
|
93 |
* @return |
|
94 |
* if the the parameter is a super type of this |
|
95 |
* geometry type |
|
96 |
*/ |
|
97 |
public boolean isTypeOf(GeometryType geometryType); |
|
98 |
|
|
99 |
/** |
|
100 |
* Check if a geometry subType inherits of other subType. E.g: |
|
101 |
* the super Subtype of a geometry 3D could be a geometry 2D, |
|
102 |
* because the 3D extends the behavior of a geometry 2D. |
|
103 |
* |
|
104 |
* @param geometryType |
|
105 |
* the geometry type to check if is it super subtype |
|
106 |
* @return |
|
107 |
* if the the parameter is a super subType of this |
|
108 |
* geometry type |
|
109 |
*/ |
|
110 |
public boolean isSubTypeOf(GeometryType geometryType); |
|
111 |
|
|
112 |
/** |
|
113 |
* This method creates a {@link Geometry} with the type specified |
|
114 |
* by this class. The geometry is empty, and all the internal |
|
115 |
* attributes must be assigned to a value when the geometry has |
|
116 |
* been created. |
|
117 |
* |
|
118 |
* @return |
|
119 |
* A empty geometry |
|
120 |
* @throws InstantiationException |
|
121 |
* This exception is maybe thrown when the application is trying |
|
122 |
* to instantiate the geometry |
|
123 |
* @throws IllegalAccessException |
|
124 |
* This exception is maybe thrown when the application is trying |
|
125 |
* to instantiate the geometry |
|
126 |
*/ |
|
127 |
public Geometry create() throws CreateGeometryException; |
|
128 |
|
|
129 |
/** |
|
130 |
* Registers an operation for this geometry type. |
|
131 |
* @param index |
|
132 |
* @param geomOp |
|
133 |
*/ |
|
134 |
public void setGeometryOperation(int index, GeometryOperation geomOp); |
|
135 |
|
|
136 |
/** |
|
137 |
* Get the operation for this geometry at a concrete position |
|
138 |
* @param index |
|
139 |
* The position of the operation |
|
140 |
* @return |
|
141 |
* A geometry operation |
|
142 |
*/ |
|
143 |
public GeometryOperation getGeometryOperation(int index); |
|
144 |
|
|
145 |
/** |
|
146 |
* @return the geometry as a String |
|
147 |
*/ |
|
148 |
public String toString(); |
|
149 |
|
|
150 |
} |
|
0 | 151 |
tags/org.gvsig.desktop-2.0.60/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.api/src/main/java/org/gvsig/fmap/geom/type/GeometryTypeNotValidException.java | ||
---|---|---|
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.type; |
|
26 |
|
|
27 |
import java.util.HashMap; |
|
28 |
import java.util.Map; |
|
29 |
|
|
30 |
import org.gvsig.fmap.geom.GeometryException; |
|
31 |
|
|
32 |
/** |
|
33 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a> |
|
34 |
*/ |
|
35 |
public class GeometryTypeNotValidException extends GeometryException { |
|
36 |
private static final long serialVersionUID = 2588983103873322295L; |
Also available in: Unified diff