59 |
59 |
/**
|
60 |
60 |
* This singleton provides a centralized access to gvSIG's Geometry Model.
|
61 |
61 |
* Its responsibilities are:<br>
|
62 |
|
*
|
|
62 |
*
|
63 |
63 |
* <ul>
|
64 |
64 |
* <li>Offering a set of convenient methods for registering and retrieving
|
65 |
65 |
* geometry types.
|
... | ... | |
68 |
68 |
* <li>Offering a set of convenient methods for registering and retrieving new
|
69 |
69 |
* geometries.
|
70 |
70 |
* </ul>
|
71 |
|
*
|
|
71 |
*
|
72 |
72 |
* @author jiyarza
|
73 |
73 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
|
74 |
74 |
*/
|
... | ... | |
79 |
79 |
public final static String FROMWKT = "FromWKT";
|
80 |
80 |
public final static String FROMWKB = "FromWKB";
|
81 |
81 |
public final static String FROMEWKB = "FromEWKB";
|
82 |
|
|
|
82 |
|
83 |
83 |
public final static String TOWKT = "ToWKT";
|
84 |
84 |
public final static String TOWKB = "ToWKB";
|
85 |
85 |
public final static String TOEWKB = "ToEWKB";
|
... | ... | |
95 |
95 |
* class that implements the operation. The value of this variable must be
|
96 |
96 |
* set using the method
|
97 |
97 |
* {@link GeometryManager#getGeometryOperationCode(String)}:<BR>
|
98 |
|
*
|
|
98 |
*
|
99 |
99 |
* <pre>
|
100 |
|
*
|
|
100 |
*
|
101 |
101 |
* public class MyOperation extends GeometryOperation {
|
102 |
|
*
|
|
102 |
*
|
103 |
103 |
* public static final int CODE = GeometryLocator.getGeometryManager()
|
104 |
104 |
* .getGeometryOperationCode("MyOperation");
|
105 |
105 |
* }
|
106 |
106 |
* </pre>
|
107 |
|
*
|
|
107 |
*
|
108 |
108 |
* </p>
|
109 |
|
*
|
|
109 |
*
|
110 |
110 |
* @param geomOpName
|
111 |
111 |
* Operation's unique name
|
112 |
112 |
* @param geomOp
|
... | ... | |
117 |
117 |
* associated
|
118 |
118 |
* @return Index assigned to this operation. This index is used later to
|
119 |
119 |
* access the operation.
|
120 |
|
*
|
|
120 |
*
|
121 |
121 |
*/
|
122 |
122 |
public int registerGeometryOperation(String geomOpName,
|
123 |
123 |
GeometryOperation geomOp, GeometryType geomType);
|
... | ... | |
133 |
133 |
* class that implements the operation. The value of this variable must be
|
134 |
134 |
* set using the method
|
135 |
135 |
* {@link GeometryManager#getGeometryOperationCode(String)}:<BR>
|
136 |
|
*
|
|
136 |
*
|
137 |
137 |
* <pre>
|
138 |
|
*
|
|
138 |
*
|
139 |
139 |
* public class MyOperation extends GeometryOperation {
|
140 |
|
*
|
|
140 |
*
|
141 |
141 |
* public static final int CODE = GeometryLocator.getGeometryManager()
|
142 |
142 |
* .getGeometryOperationCode("MyOperation");
|
143 |
143 |
* }
|
144 |
144 |
* </pre>
|
145 |
|
*
|
|
145 |
*
|
146 |
146 |
* </p>
|
147 |
|
*
|
|
147 |
*
|
148 |
148 |
* @param geomOpName
|
149 |
149 |
* Operation's unique name
|
150 |
150 |
* @param geomOp
|
... | ... | |
167 |
167 |
* class that implements the operation. The value of this variable must be
|
168 |
168 |
* set using the method
|
169 |
169 |
* {@link GeometryManager#getGeometryOperationCode(String)}:<BR>
|
170 |
|
*
|
|
170 |
*
|
171 |
171 |
* <pre>
|
172 |
|
*
|
|
172 |
*
|
173 |
173 |
* public class MyOperation extends GeometryOperation {
|
174 |
|
*
|
|
174 |
*
|
175 |
175 |
* public static final int CODE = GeometryLocator.getGeometryManager()
|
176 |
176 |
* .getGeometryOperationCode("MyOperation");
|
177 |
177 |
* }
|
178 |
178 |
* </pre>
|
179 |
|
*
|
|
179 |
*
|
180 |
180 |
* </p>
|
181 |
181 |
* <p>
|
182 |
182 |
* This method is only used if you have not a reference to the GeometryType
|
183 |
183 |
* associated to the geometry class. If you have such reference then it is
|
184 |
184 |
* slightly faster to use the method that receives the GeometryType.<br>
|
185 |
185 |
* </p>
|
186 |
|
*
|
|
186 |
*
|
187 |
187 |
* @param geomOpName
|
188 |
188 |
* Operation's unique name
|
189 |
189 |
* @param geomOp
|
... | ... | |
219 |
219 |
* class that implements the operation. The value of this variable must be
|
220 |
220 |
* set using the method
|
221 |
221 |
* {@link GeometryManager#getGeometryOperationCode(String)}:<BR>
|
222 |
|
*
|
|
222 |
*
|
223 |
223 |
* <pre>
|
224 |
|
*
|
|
224 |
*
|
225 |
225 |
* public class MyOperation extends GeometryOperation {
|
226 |
|
*
|
|
226 |
*
|
227 |
227 |
* public static final int CODE = GeometryLocator.getGeometryManager()
|
228 |
228 |
* .getGeometryOperationCode("MyOperation");
|
229 |
229 |
* }
|
230 |
230 |
* </pre>
|
231 |
|
*
|
|
231 |
*
|
232 |
232 |
* </p>
|
233 |
|
*
|
|
233 |
*
|
234 |
234 |
* @param geomOpName
|
235 |
235 |
* Operation's unique name
|
236 |
236 |
* @param geomOp
|
... | ... | |
244 |
244 |
*/
|
245 |
245 |
public int registerGeometryOperation(String geomOpName,
|
246 |
246 |
GeometryOperation geomOp, int type);
|
247 |
|
|
|
247 |
|
248 |
248 |
/**
|
249 |
249 |
* <p>
|
250 |
250 |
* Registers a GeometryOperation associated to all the geometries which
|
251 |
|
* super type matches with a concrete type. Returns an unique index that
|
|
251 |
* super type matches with a concrete type. Returns an unique index that
|
252 |
252 |
* is used later to identify and invoke the operation.<br>
|
253 |
253 |
* </p>
|
254 |
254 |
* <p>
|
... | ... | |
256 |
256 |
* class that implements the operation. The value of this variable must be
|
257 |
257 |
* set using the method
|
258 |
258 |
* {@link GeometryManager#getGeometryOperationCode(String)}:<BR>
|
259 |
|
*
|
|
259 |
*
|
260 |
260 |
* <pre>
|
261 |
|
*
|
|
261 |
*
|
262 |
262 |
* public class MyOperation extends GeometryOperation {
|
263 |
|
*
|
|
263 |
*
|
264 |
264 |
* public static final int CODE = GeometryLocator.getGeometryManager()
|
265 |
265 |
* .getGeometryOperationCode("MyOperation");
|
266 |
266 |
* }
|
267 |
267 |
* </pre>
|
268 |
|
*
|
|
268 |
*
|
269 |
269 |
* </p>
|
270 |
|
*
|
|
270 |
*
|
271 |
271 |
* @param geomOpName
|
272 |
272 |
* Operation's unique name
|
273 |
273 |
* @param geomOp
|
... | ... | |
282 |
282 |
*/
|
283 |
283 |
public int registerGeometryOperationBySuperType(String geomOpName,
|
284 |
284 |
GeometryOperation geomOp, int superType);
|
285 |
|
|
|
285 |
|
286 |
286 |
/**
|
287 |
287 |
* <p>
|
288 |
288 |
* Registers a GeometryOperation associated to all the geometries which
|
289 |
|
* super subType matches with a concrete subType. Returns an unique index that
|
|
289 |
* super subType matches with a concrete subType. Returns an unique index that
|
290 |
290 |
* is used later to identify and invoke the operation.<br>
|
291 |
291 |
* </p>
|
292 |
292 |
* <p>
|
... | ... | |
294 |
294 |
* class that implements the operation. The value of this variable must be
|
295 |
295 |
* set using the method
|
296 |
296 |
* {@link GeometryManager#getGeometryOperationCode(String)}:<BR>
|
297 |
|
*
|
|
297 |
*
|
298 |
298 |
* <pre>
|
299 |
|
*
|
|
299 |
*
|
300 |
300 |
* public class MyOperation extends GeometryOperation {
|
301 |
|
*
|
|
301 |
*
|
302 |
302 |
* public static final int CODE = GeometryLocator.getGeometryManager()
|
303 |
303 |
* .getGeometryOperationCode("MyOperation");
|
304 |
304 |
* }
|
305 |
305 |
* </pre>
|
306 |
|
*
|
|
306 |
*
|
307 |
307 |
* </p>
|
308 |
|
*
|
|
308 |
*
|
309 |
309 |
* @param geomOpName
|
310 |
310 |
* Operation's unique name
|
311 |
311 |
* @param geomOp
|
... | ... | |
332 |
332 |
* class that implements the operation. The value of this variable must be
|
333 |
333 |
* set using the method
|
334 |
334 |
* {@link GeometryManager#getGeometryOperationCode(String)}:<BR>
|
335 |
|
*
|
|
335 |
*
|
336 |
336 |
* <pre>
|
337 |
|
*
|
|
337 |
*
|
338 |
338 |
* public class MyOperation extends GeometryOperation {
|
339 |
|
*
|
|
339 |
*
|
340 |
340 |
* public static final int CODE = GeometryLocator.getGeometryManager()
|
341 |
341 |
* .getGeometryOperationCode("MyOperation");
|
342 |
342 |
* }
|
343 |
343 |
* </pre>
|
344 |
|
*
|
|
344 |
*
|
345 |
345 |
* </p>
|
346 |
|
*
|
|
346 |
*
|
347 |
347 |
* @param geomOpName
|
348 |
348 |
* Operation's unique name
|
349 |
349 |
* @param geomOp
|
... | ... | |
360 |
360 |
|
361 |
361 |
/**
|
362 |
362 |
* <p>
|
363 |
|
* Registers a GeometryType instance.
|
|
363 |
* Registers a GeometryType instance.
|
364 |
364 |
* </p>
|
365 |
|
*
|
|
365 |
*
|
366 |
366 |
* @param geometryType
|
367 |
367 |
* A {@link GeometryType} instance to create {@link Geometry} objects
|
368 |
368 |
*/
|
369 |
369 |
public void registerGeometryType(GeometryType geometryType);
|
370 |
|
|
|
370 |
|
371 |
371 |
/**
|
372 |
372 |
* <p>
|
373 |
373 |
* Registers a Geometry implementation class with a predefined geometry type
|
... | ... | |
377 |
377 |
* </p>
|
378 |
378 |
* <p>
|
379 |
379 |
* How to register a geometry class with a predefined type:
|
380 |
|
*
|
|
380 |
*
|
381 |
381 |
* <pre>
|
382 |
|
*
|
|
382 |
*
|
383 |
383 |
* GeometryType geomType = GeometryLocator.getGeometryManager()
|
384 |
384 |
* .registerBasicGeometryType(Point2D.class, "Point2D", Geometry.TYPES.POINT,
|
385 |
385 |
* Geometry.SYBTYPES.GEOM2D);
|
386 |
386 |
* </pre>
|
387 |
|
*
|
|
387 |
*
|
388 |
388 |
* </p>
|
389 |
|
*
|
|
389 |
*
|
390 |
390 |
* @param geomClass
|
391 |
391 |
* Geometry subclass. It must not be null and must implement
|
392 |
392 |
* Geometry, otherwise an exception
|
... | ... | |
409 |
409 |
*/
|
410 |
410 |
public GeometryType registerGeometryType(Class geomClass, String name,
|
411 |
411 |
int type, int subType);
|
412 |
|
|
|
412 |
|
413 |
413 |
/**
|
414 |
414 |
* <p>
|
415 |
415 |
* Registers a Geometry implementation class with a predefined geometry type
|
416 |
416 |
* and returns the associated GeometryType instance. Available predefined
|
417 |
417 |
* types are defined in {@link Geometry.TYPES} and the subtypes are defined
|
418 |
|
* in {@link Geometry.SUBTYPES}.
|
|
418 |
* in {@link Geometry.SUBTYPES}.
|
419 |
419 |
* </p>
|
420 |
420 |
* <p>
|
421 |
421 |
* It adds also the super type and the super subType of the geometry, that
|
422 |
|
* can be used to check if the type (or the subtype) inherits of other
|
|
422 |
* can be used to check if the type (or the subtype) inherits of other
|
423 |
423 |
* type (or subType)
|
424 |
424 |
* </p>
|
425 |
425 |
* <p>
|
426 |
426 |
* How to register a geometry class with a predefined type:
|
427 |
|
*
|
|
427 |
*
|
428 |
428 |
* <pre>
|
429 |
|
*
|
|
429 |
*
|
430 |
430 |
* GeometryType geomType = GeometryLocator.getGeometryManager()
|
431 |
431 |
* .registerBasicGeometryType(Arc3D.class, "Arc3D", Geometry.TYPES.ARC,
|
432 |
432 |
* Geometry.SYBTYPES.GEOM3D, Geometry.TYPES.CURVE, Geometry.SYBTYPES.GEOM2D);
|
433 |
433 |
* </pre>
|
434 |
|
*
|
|
434 |
*
|
435 |
435 |
* </p>
|
436 |
|
*
|
|
436 |
*
|
437 |
437 |
* @param geomClass
|
438 |
438 |
* Geometry subclass. It must not be null and must implement
|
439 |
439 |
* Geometry, otherwise an exception
|
... | ... | |
462 |
462 |
*/
|
463 |
463 |
public GeometryType registerGeometryType(Class geomClass, String name,
|
464 |
464 |
int type, int subType, int superType, int superSubType);
|
465 |
|
|
|
465 |
|
466 |
466 |
/**
|
467 |
467 |
* <p>
|
468 |
468 |
* Registers a Geometry implementation class with a predefined geometry type
|
469 |
469 |
* and returns the associated GeometryType instance. Available predefined
|
470 |
470 |
* types are defined in {@link Geometry.TYPES} and the subtypes are defined
|
471 |
|
* in {@link Geometry.SUBTYPES}.
|
|
471 |
* in {@link Geometry.SUBTYPES}.
|
472 |
472 |
* </p>
|
473 |
473 |
* <p>
|
474 |
|
* It adds also the super type of the geometry, that can be used to
|
|
474 |
* It adds also the super type of the geometry, that can be used to
|
475 |
475 |
* check if the type inherits of other type.
|
476 |
476 |
* </p>
|
477 |
477 |
* <p>
|
478 |
478 |
* How to register a geometry class with a predefined type:
|
479 |
|
*
|
|
479 |
*
|
480 |
480 |
* <pre>
|
481 |
|
*
|
|
481 |
*
|
482 |
482 |
* GeometryType geomType = GeometryLocator.getGeometryManager()
|
483 |
483 |
* .registerBasicGeometryType(Arc3D.class, "Arc3D", Geometry.TYPES.ARC,
|
484 |
484 |
* Geometry.SYBTYPES.GEOM3D, Geometry.TYPES.CURVE);
|
485 |
485 |
* </pre>
|
486 |
|
*
|
|
486 |
*
|
487 |
487 |
* </p>
|
488 |
|
*
|
|
488 |
*
|
489 |
489 |
* @param geomClass
|
490 |
490 |
* Geometry subclass. It must not be null and must implement
|
491 |
491 |
* Geometry, otherwise an exception
|
... | ... | |
502 |
502 |
* {@link Geometry.SUBTYPES}
|
503 |
503 |
* @param superType
|
504 |
504 |
* Super type of a geometry. Must be a value defined in
|
505 |
|
* {@link Geometry.TYPES}
|
|
505 |
* {@link Geometry.TYPES}
|
506 |
506 |
* @return Instance of GeometryType associated to the Geometry
|
507 |
507 |
* implementation class
|
508 |
508 |
* geomClass
|
... | ... | |
511 |
511 |
*/
|
512 |
512 |
public GeometryType registerGeometryType(Class geomClass, String name,
|
513 |
513 |
int type, int subType, int superType);
|
514 |
|
|
|
514 |
|
515 |
515 |
/**
|
516 |
516 |
* <p>
|
517 |
517 |
* Registers a Geometry implementation class with a predefined geometry type
|
518 |
518 |
* and returns the associated GeometryType instance. Available predefined
|
519 |
519 |
* types are defined in {@link Geometry.TYPES} and the subtypes are defined
|
520 |
|
* in {@link Geometry.SUBTYPES}.
|
|
520 |
* in {@link Geometry.SUBTYPES}.
|
521 |
521 |
* </p>
|
522 |
522 |
* <p>
|
523 |
523 |
* It adds also the super types and the super subTypes of the geometry, that
|
524 |
|
* can be used to check if the type (or the subtype) inherits of other
|
|
524 |
* can be used to check if the type (or the subtype) inherits of other
|
525 |
525 |
* types (or subTypes)
|
526 |
526 |
* </p>
|
527 |
527 |
* <p>
|
528 |
528 |
* How to register a geometry class with a predefined type:
|
529 |
|
*
|
|
529 |
*
|
530 |
530 |
* <pre>
|
531 |
|
*
|
|
531 |
*
|
532 |
532 |
* GeometryType geomType = GeometryLocator.getGeometryManager()
|
533 |
533 |
* .registerBasicGeometryType(Circle3DM.class, "Circle3DM", Geometry.TYPES.CIRCLE,
|
534 |
534 |
* Geometry.SYBTYPES.GEOM3DM,
|
535 |
535 |
* new int[]{Geometry.TYPES.CURVE, Geometry.TYPES.GEOMETRY},
|
536 |
536 |
* new int[]{Geometry.SYBTYPES.GEOM2D, Geometry.SYBTYPES.GEOM3D});
|
537 |
537 |
* </pre>
|
538 |
|
*
|
|
538 |
*
|
539 |
539 |
* </p>
|
540 |
|
*
|
|
540 |
*
|
541 |
541 |
* @param geomClass
|
542 |
542 |
* Geometry subclass. It must not be null and must implement
|
543 |
543 |
* Geometry, otherwise an exception
|
... | ... | |
566 |
566 |
*/
|
567 |
567 |
public GeometryType registerGeometryType(Class geomClass, String name,
|
568 |
568 |
int type, int subType, int[] superTypes, int superSubTypes[]);
|
569 |
|
|
|
569 |
|
570 |
570 |
/**
|
571 |
571 |
* <p>
|
572 |
572 |
* Registers a Geometry implementation class with a predefined geometry type
|
573 |
573 |
* and returns the associated GeometryType instance. Available predefined
|
574 |
574 |
* types are defined in {@link Geometry.TYPES} and the subtypes are defined
|
575 |
|
* in {@link Geometry.SUBTYPES}.
|
|
575 |
* in {@link Geometry.SUBTYPES}.
|
576 |
576 |
* </p>
|
577 |
577 |
* <p>
|
578 |
578 |
* It adds also the super types and the super subTypes of the geometry, that
|
... | ... | |
580 |
580 |
* </p>
|
581 |
581 |
* <p>
|
582 |
582 |
* How to register a geometry class with a predefined type:
|
583 |
|
*
|
|
583 |
*
|
584 |
584 |
* <pre>
|
585 |
|
*
|
|
585 |
*
|
586 |
586 |
* GeometryType geomType = GeometryLocator.getGeometryManager()
|
587 |
587 |
* .registerBasicGeometryType(Circle2D.class, "Circle2DM", Geometry.TYPES.CIRCLE,
|
588 |
588 |
* Geometry.SYBTYPES.GEOM2D,
|
589 |
|
* new int[]{Geometry.TYPES.CURVE, Geometry.TYPES.SURFACE});
|
|
589 |
* new int[]{Geometry.TYPES.CURVE, Geometry.TYPES.SURFACE});
|
590 |
590 |
* </pre>
|
591 |
|
*
|
|
591 |
*
|
592 |
592 |
* </p>
|
593 |
|
*
|
|
593 |
*
|
594 |
594 |
* @param geomClass
|
595 |
595 |
* Geometry subclass. It must not be null and must implement
|
596 |
596 |
* Geometry, otherwise an exception
|
... | ... | |
628 |
628 |
* In this case the symbolic name will be the geometry's simple class name
|
629 |
629 |
* </p>
|
630 |
630 |
* How to register a new geometry type:
|
631 |
|
*
|
|
631 |
*
|
632 |
632 |
* <pre>
|
633 |
|
*
|
|
633 |
*
|
634 |
634 |
* GeometryType geomType = GeometryLocator.getGeometryManager()
|
635 |
635 |
* .registerBasicGeometryType(Point2D.class, Geometry.TYPES.POINT,
|
636 |
636 |
* Geometry.SYBTYPES.GEOM2D);
|
637 |
637 |
* </pre>
|
638 |
|
*
|
|
638 |
*
|
639 |
639 |
* @param geomClass
|
640 |
640 |
* Geometry implementation class. It must not be null and must
|
641 |
641 |
* implement Geometry,
|
... | ... | |
659 |
659 |
* Returns an instance of GeometryType given the Geometry type and the
|
660 |
660 |
* subtype.
|
661 |
661 |
* </p>
|
662 |
|
*
|
|
662 |
*
|
663 |
663 |
* @param type
|
664 |
664 |
* Type of geometry. Must be a value defined in
|
665 |
665 |
* {@link Geometry.TYPES}
|
... | ... | |
685 |
685 |
* </p>
|
686 |
686 |
* <p>
|
687 |
687 |
* This example creates a point2D and sets the coordinates to 1,1:
|
688 |
|
*
|
|
688 |
*
|
689 |
689 |
* <pre>
|
690 |
690 |
* Point point =
|
691 |
691 |
* (Point) GeometryLocator.getGeometryManager().create(GEOMETRY.TYPES.POINT,
|
... | ... | |
693 |
693 |
* point.setX(1);
|
694 |
694 |
* point.setY(1);
|
695 |
695 |
* </pre>
|
696 |
|
*
|
|
696 |
*
|
697 |
697 |
* </p>
|
698 |
|
*
|
|
698 |
*
|
699 |
699 |
* @param geomType
|
700 |
700 |
* The geometry type
|
701 |
701 |
* @return
|
... | ... | |
712 |
712 |
* Creates a Envelope with a concrete subtype. The envelope is empty and it
|
713 |
713 |
* have to be filled with the corners once has been created.
|
714 |
714 |
* </p>
|
715 |
|
*
|
|
715 |
*
|
716 |
716 |
* @param subType
|
717 |
717 |
* SubType of envelope. Must be a value defined in
|
718 |
718 |
* {@link Geometry.SUBTYPES}
|
... | ... | |
728 |
728 |
* Creates a Envelope with a concrete subtype. It sets the values for the
|
729 |
729 |
* lower corner and the upper corner (in 2D) using the method parameters.
|
730 |
730 |
* </p>
|
731 |
|
*
|
|
731 |
*
|
732 |
732 |
* @param minX
|
733 |
733 |
* The minimum value for the X coordinate.
|
734 |
734 |
* @param minY
|
... | ... | |
758 |
758 |
* This example creates a point2D and sets the coordinates to 1,1: It
|
759 |
759 |
* supposes that there is a Point2D class with name "Point2D".
|
760 |
760 |
* </p>
|
761 |
|
*
|
|
761 |
*
|
762 |
762 |
* <pre>
|
763 |
763 |
* Point point = (Point) GeometryLocator.getGeometryManager().create("Point2D");
|
764 |
764 |
* point.setX(1);
|
765 |
765 |
* point.setY(1);
|
766 |
766 |
* </pre>
|
767 |
|
*
|
|
767 |
*
|
768 |
768 |
* @param name
|
769 |
769 |
* The name of the geometry type
|
770 |
770 |
* @return
|
... | ... | |
777 |
777 |
|
778 |
778 |
/**
|
779 |
779 |
* Create a geometry from a WKT definition.
|
780 |
|
*
|
|
780 |
*
|
781 |
781 |
* This is a utility method to wrap the invocation to the operation
|
782 |
782 |
* {@link OPERATIONS#FROMWKT}.
|
783 |
|
*
|
|
783 |
*
|
784 |
784 |
* @param wkt
|
785 |
785 |
* geometry in Well-known text format
|
786 |
|
*
|
|
786 |
*
|
787 |
787 |
* @return the geometry as a Geometry
|
788 |
|
*
|
|
788 |
*
|
789 |
789 |
* @throws CreateGeometryException
|
790 |
790 |
* @throws GeometryException
|
791 |
791 |
*/
|
... | ... | |
797 |
797 |
|
798 |
798 |
/**
|
799 |
799 |
* Create a geometry from a WKB definition.
|
800 |
|
*
|
|
800 |
*
|
801 |
801 |
* This is a utility method to wrap the invocation to the operation
|
802 |
802 |
* {@link OPERATIONS#FROMWKB}.
|
803 |
|
*
|
|
803 |
*
|
804 |
804 |
* @param wkb
|
805 |
805 |
* geometry in well-known binary format
|
806 |
|
*
|
|
806 |
*
|
807 |
807 |
* @return the geometry as a Geometry
|
808 |
|
*
|
|
808 |
*
|
809 |
809 |
* @throws CreateGeometryException
|
810 |
810 |
* @throws GeometryException
|
811 |
811 |
*/
|
... | ... | |
822 |
822 |
* This example creates a point2D and sets the coordinates to 1,1. It
|
823 |
823 |
* supposes that there is a Point2D class with the id 1.
|
824 |
824 |
* </p>
|
825 |
|
*
|
|
825 |
*
|
826 |
826 |
* <pre>
|
827 |
827 |
* Point point =
|
828 |
828 |
* (Point) GeometryLocator.getGeometryManager().create(Geometry.TYPES.POINT,
|
... | ... | |
830 |
830 |
* point.setX(1);
|
831 |
831 |
* point.setY(1);
|
832 |
832 |
* </pre>
|
833 |
|
*
|
|
833 |
*
|
834 |
834 |
* @param type
|
835 |
835 |
* Type of geometry. Must be a value defined in
|
836 |
836 |
* {@link Geometry.TYPES}
|
... | ... | |
850 |
850 |
* <p>
|
851 |
851 |
* It creates a null geometry with a concrete subtype.
|
852 |
852 |
* <p>
|
853 |
|
*
|
|
853 |
*
|
854 |
854 |
* @param subType
|
855 |
855 |
* SubType of geometry. Must be a value defined in
|
856 |
856 |
* {@link Geometry.SUBTYPES}
|
... | ... | |
869 |
869 |
* Create a new point with a concrete type and sets the value for the X and
|
870 |
870 |
* the Y.
|
871 |
871 |
* </p>
|
872 |
|
*
|
|
872 |
*
|
873 |
873 |
* @param x
|
874 |
874 |
* The X coordinate
|
875 |
875 |
* @param y
|
... | ... | |
888 |
888 |
|
889 |
889 |
/**
|
890 |
890 |
* Create a new line with a concrete type. Use later addVertex to add
|
891 |
|
* vertex to te line.
|
892 |
|
*
|
|
891 |
* vertex to te line.
|
|
892 |
*
|
893 |
893 |
* @param subType SubType of geometry. Must be a value defined in {@link Geometry.SUBTYPES}
|
894 |
894 |
* @return a line
|
895 |
895 |
* @throws CreateGeometryException
|
... | ... | |
906 |
906 |
/**
|
907 |
907 |
* Create a new polygon with a concrete type.
|
908 |
908 |
* Use later addVertex to add vertex to te polygon.
|
909 |
|
*
|
|
909 |
*
|
910 |
910 |
* @param subType
|
911 |
911 |
* SubType of geometry. Must be a value defined in
|
912 |
912 |
* {@link Geometry.SUBTYPES}
|
... | ... | |
928 |
928 |
/**
|
929 |
929 |
* Create a new multipoint with a concrete subtype.
|
930 |
930 |
* Use addPrimitive to populate the multipoint.
|
931 |
|
*
|
|
931 |
*
|
932 |
932 |
* @param subType
|
933 |
933 |
* SubType of geometry. Must be a value defined in
|
934 |
934 |
* {@link Geometry.SUBTYPES}
|
... | ... | |
939 |
939 |
*/
|
940 |
940 |
public MultiPoint createMultiPoint(int subType)
|
941 |
941 |
throws CreateGeometryException;
|
942 |
|
|
|
942 |
|
943 |
943 |
/**
|
944 |
944 |
* Create a new multicurve with a concrete subtype.
|
945 |
945 |
* Use addPrimitive to populate the multicurve.
|
946 |
|
*
|
|
946 |
*
|
947 |
947 |
* @param subType
|
948 |
948 |
* SubType of geometry. Must be a value defined in
|
949 |
949 |
* {@link Geometry.SUBTYPES}
|
... | ... | |
959 |
959 |
/**
|
960 |
960 |
* Create a new multisurface with a concrete subtype.
|
961 |
961 |
* Use later addPrimitive to populate.
|
962 |
|
*
|
|
962 |
*
|
963 |
963 |
* @param subType
|
964 |
964 |
* SubType of geometry. Must be a value defined in
|
965 |
965 |
* {@link Geometry.SUBTYPES}
|
... | ... | |
983 |
983 |
* For better performance, if you need to call an operation multiple times,
|
984 |
984 |
* use this method only once and keep the returned object in a local
|
985 |
985 |
* variable over which you can iterate. For instance:
|
986 |
|
*
|
|
986 |
*
|
987 |
987 |
* <pre>
|
988 |
988 |
* // Get the operation you need
|
989 |
989 |
* GeometryManager gm = GeometryLocator.getGeometryManager()
|
990 |
990 |
* GeometryOperation geomOp = null;
|
991 |
991 |
* try {
|
992 |
|
* geomOp = gm.getGeometryOperation(Draw2D.CODE, Geometry.TYPES.POINT,
|
|
992 |
* geomOp = gm.getGeometryOperation(Draw2D.CODE, Geometry.TYPES.POINT,
|
993 |
993 |
* Geometry.SUBTYPES.GEOM2D);
|
994 |
994 |
* } catch (GeometryTypeNotSupportedException gtnse) {
|
995 |
995 |
* // treat exception
|
996 |
996 |
* } catch (GeometryOperationNotSupportedException gonse) {
|
997 |
997 |
* // treat exception
|
998 |
998 |
* }
|
999 |
|
*
|
|
999 |
*
|
1000 |
1000 |
* // Fill the operation context with required params
|
1001 |
1001 |
* GeometryOperationContext ctx = new GeometryOperationContext();
|
1002 |
|
*
|
|
1002 |
*
|
1003 |
1003 |
* // Here is the main loop where you call the operation
|
1004 |
1004 |
* for (int i=0; i<myGeometries.length; i++) {
|
1005 |
1005 |
* Object result = geomOp.invoke(myGeometries[i], ctx);
|
1006 |
1006 |
* }
|
1007 |
1007 |
* </pre>
|
1008 |
|
*
|
|
1008 |
*
|
1009 |
1009 |
* </p>
|
1010 |
|
*
|
|
1010 |
*
|
1011 |
1011 |
* @param opCode
|
1012 |
1012 |
* The operation code
|
1013 |
1013 |
* @param type
|
... | ... | |
1041 |
1041 |
* For better performance, if you need to call an operation multiple times,
|
1042 |
1042 |
* use this method only once and keep the returned object in a local
|
1043 |
1043 |
* variable over which you can iterate. For instance:
|
1044 |
|
*
|
|
1044 |
*
|
1045 |
1045 |
* <pre>
|
1046 |
1046 |
* // Get the operation you need
|
1047 |
1047 |
* GeometryManager gm = GeometryLocator.getGeometryManager()
|
... | ... | |
1051 |
1051 |
* } catch (GeometryOperationNotSupportedException gonse) {
|
1052 |
1052 |
* // treat exception
|
1053 |
1053 |
* }
|
1054 |
|
*
|
|
1054 |
*
|
1055 |
1055 |
* // Fill the operation context with required params
|
1056 |
1056 |
* FromWKBGeometryOperationContext ctx = new FromWKBGeometryOperationContext();
|
1057 |
|
*
|
|
1057 |
*
|
1058 |
1058 |
* // Here is the main loop where you call the operation
|
1059 |
1059 |
* for (int i=0; i<myGeometriesWKB.length; i++) {
|
1060 |
1060 |
* ctx.setData(myGeometriesWKB[i]);
|
1061 |
1061 |
* Object result = geomOp.invoke(null, ctx);
|
1062 |
1062 |
* }
|
1063 |
1063 |
* </pre>
|
1064 |
|
*
|
|
1064 |
*
|
1065 |
1065 |
* </p>
|
1066 |
|
*
|
|
1066 |
*
|
1067 |
1067 |
* @param opCode
|
1068 |
1068 |
* The operation code
|
1069 |
1069 |
* @return Geometry operation
|
... | ... | |
1080 |
1080 |
* Invokes an operation given its code, the geometry and the operation
|
1081 |
1081 |
* context holding the parameters required for the operation.
|
1082 |
1082 |
* </p>
|
1083 |
|
*
|
|
1083 |
*
|
1084 |
1084 |
* @param opCode
|
1085 |
1085 |
* Operation code.
|
1086 |
1086 |
* @param geom
|
... | ... | |
1100 |
1100 |
* Invokes an operation given its code, the geometry and the operation
|
1101 |
1101 |
* context holding the parameters required for the operation.
|
1102 |
1102 |
* </p>
|
1103 |
|
*
|
|
1103 |
*
|
1104 |
1104 |
* @param geomOpName
|
1105 |
1105 |
* Operation name.
|
1106 |
1106 |
* @param geom
|
... | ... | |
1120 |
1120 |
* Invokes an operation given its code, and the operation context holding
|
1121 |
1121 |
* the parameters required for the operation.
|
1122 |
1122 |
* </p>
|
1123 |
|
*
|
|
1123 |
*
|
1124 |
1124 |
* @param geomOpName
|
1125 |
1125 |
* Operation name.
|
1126 |
1126 |
* @param ctx
|
... | ... | |
1142 |
1142 |
* By convention this method is used to set the value of the final and
|
1143 |
1143 |
* static variable that is located in the classes that implements the
|
1144 |
1144 |
* operation:<BR>
|
1145 |
|
*
|
|
1145 |
*
|
1146 |
1146 |
* <pre>
|
1147 |
|
*
|
|
1147 |
*
|
1148 |
1148 |
* public class MyOperation extends GeometryOperation {
|
1149 |
|
*
|
|
1149 |
*
|
1150 |
1150 |
* public static final int CODE = GeometryLocator.getGeometryManager()
|
1151 |
1151 |
* .getGeometryOperationCode("MyOperation");
|
1152 |
1152 |
* }
|
1153 |
1153 |
* </pre>
|
1154 |
|
*
|
|
1154 |
*
|
1155 |
1155 |
* </p>
|
1156 |
|
*
|
|
1156 |
*
|
1157 |
1157 |
* @param geomOpName
|
1158 |
1158 |
* Name used to register the geometry operation
|
1159 |
1159 |
* @return
|
... | ... | |
1164 |
1164 |
/**
|
1165 |
1165 |
* Returns a list with the name of the operations that have been
|
1166 |
1166 |
* registered.
|
1167 |
|
*
|
|
1167 |
*
|
1168 |
1168 |
* @return
|
1169 |
1169 |
* A list of the registered operations.
|
1170 |
1170 |
*/
|
... | ... | |
1173 |
1173 |
/**
|
1174 |
1174 |
* Returns the flatness used to convert a curve is a set
|
1175 |
1175 |
* of points.
|
1176 |
|
*
|
|
1176 |
*
|
1177 |
1177 |
* @return
|
1178 |
1178 |
* The flatness.
|
1179 |
1179 |
*/
|
... | ... | |
1181 |
1181 |
|
1182 |
1182 |
/**
|
1183 |
1183 |
* Sets the application flatness.
|
1184 |
|
*
|
|
1184 |
*
|
1185 |
1185 |
* @param flatness
|
1186 |
1186 |
* The flatness to set
|
1187 |
1187 |
*/
|
1188 |
1188 |
public void setFlatness(double flatness);
|
1189 |
|
|
|
1189 |
|
1190 |
1190 |
/**
|
1191 |
1191 |
* Create a memory spatial index with the default implementation.
|
1192 |
|
*
|
|
1192 |
*
|
1193 |
1193 |
* @return a new SpatialIndex
|
1194 |
1194 |
*/
|
1195 |
1195 |
public SpatialIndex createDefaultMemorySpatialIndex() throws ServiceException;
|
1196 |
1196 |
|
1197 |
|
|
|
1197 |
|
1198 |
1198 |
/**
|
1199 |
1199 |
* Create a spatial index with the implementation specified as name.
|
1200 |
1200 |
* If the creation of index don't requery parameters can be passed a null.
|
1201 |
|
*
|
|
1201 |
*
|
1202 |
1202 |
* @param name of the type of spatial index to create
|
1203 |
1203 |
* @param parameters used to create the index or null.
|
1204 |
1204 |
* @return the new SpatialIndex or null if not exists the type of index.
|
1205 |
|
* @throws GeometryException
|
|
1205 |
* @throws GeometryException
|
1206 |
1206 |
*/
|
1207 |
1207 |
public SpatialIndex createSpatialIndex(String name, DynObject parameters) throws ServiceException;
|
1208 |
|
|
|
1208 |
|
1209 |
1209 |
/**
|
1210 |
1210 |
* Return the name of the factory of the spatial index required.
|
1211 |
|
*
|
|
1211 |
*
|
1212 |
1212 |
* @param name of the spatial index factory
|
1213 |
1213 |
* @return the SpatialIndexFactory required or null if not exists
|
1214 |
1214 |
*/
|
1215 |
1215 |
public SpatialIndexFactory getSpatialIndexFactory(String name);
|
1216 |
|
|
|
1216 |
|
1217 |
1217 |
/**
|
1218 |
1218 |
* Create a GeneralPathX to populate a geometry.
|
1219 |
|
* This method is deprecated, instead use OrientablePrimitive#addVertex(Point) to add vertex to
|
|
1219 |
* This method is deprecated, instead use OrientablePrimitive#addVertex(Point) to add vertex to
|
1220 |
1220 |
* primitive geometries or {@link MultiPrimitive#addPrimitive(org.gvsig.fmap.geom.primitive.Primitive)} to add geometries to an aggregate.
|
1221 |
|
*
|
|
1221 |
*
|
1222 |
1222 |
* @param rule
|
1223 |
1223 |
* @param pathIterator , can be null
|
1224 |
1224 |
* @return a GeneralPathX
|
1225 |
|
* @deprecated use method of Geometry to handle this
|
|
1225 |
* @deprecated use method of Geometry to handle this
|
1226 |
1226 |
* @see OrientablePrimitive#addVertex(Point) or {@link MultiPrimitive#addPrimitive(org.gvsig.fmap.geom.primitive.Primitive)}
|
1227 |
|
*
|
|
1227 |
*
|
1228 |
1228 |
*/
|
1229 |
1229 |
public IGeneralPathX createGeneralPath(int rule, PathIterator pathIterator);
|
1230 |
1230 |
|
... | ... | |
1233 |
1233 |
* Create a new curve with a concrete type and sets the value for the
|
1234 |
1234 |
* coordinates using a GeneralPathX.
|
1235 |
1235 |
* </p>
|
1236 |
|
*
|
|
1236 |
*
|
1237 |
1237 |
* @param generalPathX
|
1238 |
1238 |
* It is used to set the values for the X and Y coordinates.
|
1239 |
1239 |
* @param subType
|
... | ... | |
1244 |
1244 |
* @throws CreateGeometryException
|
1245 |
1245 |
* This exception is thrown when the manager can not create
|
1246 |
1246 |
* the geometry.
|
1247 |
|
* @deprecated use {@link #createCurve(int)} and OrientablePrimitive#addVertex(Point)
|
|
1247 |
* @deprecated use {@link #createCurve(int)} and OrientablePrimitive#addVertex(Point)
|
1248 |
1248 |
*/
|
1249 |
1249 |
public Curve createCurve(GeneralPathX generalPathX, int subType)
|
1250 |
1250 |
throws CreateGeometryException;
|
1251 |
|
|
|
1251 |
|
|
1252 |
/**
|
|
1253 |
* <p>
|
|
1254 |
* Create a new multipoint with a concrete type and sets the value for the
|
|
1255 |
* coordinates using a GeneralPathX.
|
|
1256 |
* </p>
|
|
1257 |
*
|
|
1258 |
* @param generalPathX
|
|
1259 |
* It is used to set the values for the X and Y coordinates.
|
|
1260 |
* @param subType
|
|
1261 |
* SubType of geometry. Must be a value defined in
|
|
1262 |
* {@link Geometry.SUBTYPES}
|
|
1263 |
* @return A multipoint
|
|
1264 |
* @throws CreateGeometryException
|
|
1265 |
* This exception is thrown when the manager can not create the
|
|
1266 |
* geometry.
|
|
1267 |
* @deprecated use {@link #createMultiCurve(int)} and {@link MultiPrimitive#addPrimitive(org.gvsig.fmap.geom.primitive.Primitive)}
|
|
1268 |
*/
|
|
1269 |
public MultiPoint createMultiPoint(GeneralPathX generalPathX, int subType)
|
|
1270 |
throws CreateGeometryException;
|
1252 |
1271 |
/**
|
1253 |
1272 |
* <p>
|
1254 |
1273 |
* Create a new multicurve with a concrete type and sets the value for the
|
1255 |
1274 |
* coordinates using a GeneralPathX.
|
1256 |
1275 |
* </p>
|
1257 |
|
*
|
|
1276 |
*
|
1258 |
1277 |
* @param generalPathX
|
1259 |
1278 |
* It is used to set the values for the X and Y coordinates.
|
1260 |
1279 |
* @param subType
|
... | ... | |
1268 |
1287 |
*/
|
1269 |
1288 |
public MultiCurve createMultiCurve(GeneralPathX generalPathX, int subType)
|
1270 |
1289 |
throws CreateGeometryException;
|
1271 |
|
|
|
1290 |
|
1272 |
1291 |
/**
|
1273 |
1292 |
* <p>
|
1274 |
1293 |
* Create a new surface with a concrete type and sets the value for the
|
1275 |
1294 |
* coordinates using a GeneralPathX.
|
1276 |
1295 |
* </p>
|
1277 |
|
*
|
|
1296 |
*
|
1278 |
1297 |
* @param generalPathX
|
1279 |
1298 |
* It is used to set the values for the X and Y coordinates.
|
1280 |
1299 |
* @param subType
|
... | ... | |
1289 |
1308 |
*/
|
1290 |
1309 |
public Surface createSurface(GeneralPathX generalPathX, int subType)
|
1291 |
1310 |
throws CreateGeometryException;
|
1292 |
|
|
|
1311 |
|
1293 |
1312 |
/**
|
1294 |
1313 |
* <p>
|
1295 |
1314 |
* Create a new multisurface with a concrete type and sets the value for the
|
1296 |
1315 |
* coordinates using a GeneralPathX.
|
1297 |
1316 |
* </p>
|
1298 |
|
*
|
|
1317 |
*
|
1299 |
1318 |
* @param generalPathX
|
1300 |
1319 |
* It is used to set the values for the X and Y coordinates.
|
1301 |
1320 |
* @param subType
|
... | ... | |
1309 |
1328 |
*/
|
1310 |
1329 |
public MultiSurface createMultiSurface(GeneralPathX generalPathX,
|
1311 |
1330 |
int subType) throws CreateGeometryException;
|
1312 |
|
|
|
1331 |
|
1313 |
1332 |
}
|