Statistics
| Revision:

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 / GeometryManager.java @ 47762

History | View | Annotate | Download (50.6 KB)

1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 3
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.fmap.geom;
25

    
26
import java.awt.geom.PathIterator;
27
import java.io.Reader;
28
import java.util.List;
29
import org.cresques.cts.IProjection;
30

    
31
import org.gvsig.fmap.geom.aggregate.MultiCurve;
32
import org.gvsig.fmap.geom.aggregate.MultiLine;
33
import org.gvsig.fmap.geom.aggregate.MultiPoint;
34
import org.gvsig.fmap.geom.aggregate.MultiPolygon;
35
import org.gvsig.fmap.geom.aggregate.MultiPrimitive;
36
import org.gvsig.fmap.geom.aggregate.MultiSurface;
37
import org.gvsig.fmap.geom.exception.CreateEnvelopeException;
38
import org.gvsig.fmap.geom.exception.CreateGeometryException;
39
import org.gvsig.fmap.geom.operation.GeometryOperation;
40
import org.gvsig.fmap.geom.operation.GeometryOperationContext;
41
import org.gvsig.fmap.geom.operation.GeometryOperationException;
42
import org.gvsig.fmap.geom.operation.GeometryOperationNotSupportedException;
43
import org.gvsig.fmap.geom.primitive.Curve;
44
import org.gvsig.fmap.geom.primitive.Envelope;
45
import org.gvsig.fmap.geom.primitive.GeneralPathX;
46
import org.gvsig.fmap.geom.primitive.IGeneralPathX;
47
import org.gvsig.fmap.geom.primitive.Line;
48
import org.gvsig.fmap.geom.primitive.NullGeometry;
49
import org.gvsig.fmap.geom.primitive.OrientablePrimitive;
50
import org.gvsig.fmap.geom.primitive.Point;
51
import org.gvsig.fmap.geom.primitive.Polygon;
52
import org.gvsig.fmap.geom.primitive.Surface;
53
import org.gvsig.fmap.geom.type.GeometryType;
54
import org.gvsig.fmap.geom.type.GeometryTypeNotSupportedException;
55
import org.gvsig.fmap.geom.type.GeometryTypeNotValidException;
56
import org.gvsig.tools.dynobject.DynObject;
57
import org.gvsig.tools.service.Manager;
58
import org.gvsig.tools.service.ServiceException;
59
import org.gvsig.tools.service.spi.ServiceManager;
60

    
61
/**
62
 * This singleton provides a centralized access to gvSIG's Geometry Model.
63
 * Its responsibilities are:<br>
64
 *
65
 * <ul>
66
 * <li>Offering a set of convenient methods for registering and retrieving
67
 * geometry types.
68
 * <li>Offering a set of convenient methods for registering and retrieving
69
 * geometry operations associated to one or more geometry types.
70
 * <li>Offering a set of convenient methods for registering and retrieving new
71
 * geometries.
72
 * </ul>
73
 *
74
 * @author jiyarza
75
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
76
 */
77
public interface GeometryManager extends Manager, ServiceManager {
78

    
79
//    
80
//  Spatial index "Quadtree" is faster in creation but don't 
81
//  support of nearest query.
82
//    
83
//  Spatial index "RTree" is faster in queries and support 
84
//  nearest queries.
85
//  
86
//  The library expose a default implementation for RTree and QuadTree
87
//    
88
    public static final String SPATIALINDEX_DEFAULT_RTREE = "JSIRTree";
89
    public static final String SPATIALINDEX_DEFAULT_QUADTREE = "JTSQuadtree";
90

    
91
    
92
    public interface OPERATIONS {
93

    
94
        public final static String FROMWKT = "FromWKT";
95
        public final static String FROMWKB = "FromWKB";
96
        public final static String FROMEWKB = "FromEWKB";
97

    
98
        public final static String TOWKT = "ToWKT";
99
        public final static String TOWKB = "ToWKB";
100
        public final static String TOEWKB = "ToEWKB";
101
    }
102

    
103
    /**
104
     * <p>
105
     * Registers a GeometryOperation associated to a GeometryType. Returns an
106
     * unique index that is used later to identify and invoke the operation.
107
     * </p>
108
     * <p>
109
     * By convention this index should be in a final and static variable in the
110
     * class that implements the operation. The value of this variable must be
111
     * set using the method
112
     * {@link GeometryManager#getGeometryOperationCode(String)}:<BR>
113
     *
114
     * <pre>
115
     *
116
     * public class MyOperation extends GeometryOperation {
117
     *
118
     *     public static final int CODE = GeometryLocator.getGeometryManager()
119
     *         .getGeometryOperationCode(&quot;MyOperation&quot;);
120
     * }
121
     * </pre>
122
     *
123
     * </p>
124
     *
125
     * @param geomOpName
126
     *            Operation's unique name
127
     * @param geomOp
128
     *            Specific GeometryOperation's instance implementing this
129
     *            operation
130
     * @param geomType
131
     *            GeometryType instance to which this operation should be
132
     *            associated
133
     * @return Index assigned to this operation. This index is used later to
134
     *         access the operation.
135
     *
136
     */
137
    public int registerGeometryOperation(String geomOpName,
138
        GeometryOperation geomOp, GeometryType geomType);
139

    
140
    /**
141
     * <p>
142
     * Registers a GeometryOperation that is common for all GeometryType
143
     * (registered yet or not). Returns an unique index that is used later to
144
     * identify and invoke the operation.
145
     * </p>
146
     * <p>
147
     * By convention this index should be in a final and static variable in the
148
     * class that implements the operation. The value of this variable must be
149
     * set using the method
150
     * {@link GeometryManager#getGeometryOperationCode(String)}:<BR>
151
     *
152
     * <pre>
153
     *
154
     * public class MyOperation extends GeometryOperation {
155
     *
156
     *     public static final int CODE = GeometryLocator.getGeometryManager()
157
     *         .getGeometryOperationCode(&quot;MyOperation&quot;);
158
     * }
159
     * </pre>
160
     *
161
     * </p>
162
     *
163
     * @param geomOpName
164
     *            Operation's unique name
165
     * @param geomOp
166
     *            Specific GeometryOperation's instance implementing this
167
     *            operation
168
     * @return Index assigned to this operation. This index is used later to
169
     *         access the operation.
170
     */
171
    public int registerGeometryOperation(String geomOpName,
172
        GeometryOperation geomOp);
173

    
174
    /**
175
     * <p>
176
     * Registers a GeometryOperation associated to a GeometryType, that has been
177
     * specified using the type code and the subtype code. Returns an unique
178
     * index that is used later to identify and invoke the operation.
179
     * </p>
180
     * <p>
181
     * By convention this index should be in a final and static variable in the
182
     * class that implements the operation. The value of this variable must be
183
     * set using the method
184
     * {@link GeometryManager#getGeometryOperationCode(String)}:<BR>
185
     *
186
     * <pre>
187
     *
188
     * public class MyOperation extends GeometryOperation {
189
     *
190
     *     public static final int CODE = GeometryLocator.getGeometryManager()
191
     *         .getGeometryOperationCode(&quot;MyOperation&quot;);
192
     * }
193
     * </pre>
194
     *
195
     * </p>
196
     * <p>
197
     * This method is only used if you have not a reference to the GeometryType
198
     * associated to the geometry class. If you have such reference then it is
199
     * slightly faster to use the method that receives the GeometryType.<br>
200
     * </p>
201
     *
202
     * @param geomOpName
203
     *            Operation's unique name
204
     * @param geomOp
205
     *            Specific GeometryOperation's instance implementing this
206
     *            operation
207
     * @param type
208
     *            Type of geometry. Must be a value defined in
209
     *            {@link Geometry.TYPES}
210
     * @param subType
211
     *            SubType of geometry. Must be a value defined in
212
     *            {@link Geometry.SUBTYPES}
213
     * @return Index assigned to this operation. This index is used later to
214
     *         access the operation.
215
     * @throws GeometryTypeNotSupportedException
216
     *             Returns this exception if there is not a registered geometry
217
     *             with
218
     *             these type and subtype
219
     * @throws GeometryTypeNotValidException
220
     *             Returns if the type and subtype are not valid
221
     */
222
    public int registerGeometryOperation(String geomOpName,
223
        GeometryOperation geomOp, int type, int subType)
224
        throws GeometryTypeNotSupportedException, GeometryTypeNotValidException;
225

    
226
    /**
227
     * <p>
228
     * Registers a GeometryOperation associated to all the geometries with a
229
     * concrete type. Returns an unique index that is used later to identify and
230
     * invoke the operation.<br>
231
     * </p>
232
     * <p>
233
     * By convention this index should be in a final and static variable in the
234
     * class that implements the operation. The value of this variable must be
235
     * set using the method
236
     * {@link GeometryManager#getGeometryOperationCode(String)}:<BR>
237
     *
238
     * <pre>
239
     *
240
     * public class MyOperation extends GeometryOperation {
241
     *
242
     *     public static final int CODE = GeometryLocator.getGeometryManager()
243
     *         .getGeometryOperationCode(&quot;MyOperation&quot;);
244
     * }
245
     * </pre>
246
     *
247
     * </p>
248
     *
249
     * @param geomOpName
250
     *            Operation's unique name
251
     * @param geomOp
252
     *            Specific GeometryOperation's instance implementing this
253
     *            operation
254
     * @param type
255
     *            Type of geometry. Must be a value defined in
256
     *            {@link Geometry.TYPES}
257
     * @return Index assigned to this operation. This index is used later to
258
     *         access the operation.
259
     */
260
    public int registerGeometryOperation(String geomOpName,
261
        GeometryOperation geomOp, int type);
262

    
263
    /**
264
     * <p>
265
     * Registers a GeometryOperation associated to all the geometries which
266
     * super type matches with a concrete type. Returns an unique index that
267
     * is used later to identify and invoke the operation.<br>
268
     * </p>
269
     * <p>
270
     * By convention this index should be in a final and static variable in the
271
     * class that implements the operation. The value of this variable must be
272
     * set using the method
273
     * {@link GeometryManager#getGeometryOperationCode(String)}:<BR>
274
     *
275
     * <pre>
276
     *
277
     * public class MyOperation extends GeometryOperation {
278
     *
279
     *     public static final int CODE = GeometryLocator.getGeometryManager()
280
     *         .getGeometryOperationCode(&quot;MyOperation&quot;);
281
     * }
282
     * </pre>
283
     *
284
     * </p>
285
     *
286
     * @param geomOpName
287
     *            Operation's unique name
288
     * @param geomOp
289
     *            Specific GeometryOperation's instance implementing this
290
     *            operation
291
     * @param superType
292
     *            super type of geometries that is used to register
293
     *            the operation. Must be a value defined in
294
     *            {@link Geometry.TYPES}
295
     * @return Index assigned to this operation. This index is used later to
296
     *         access the operation.
297
     */
298
    public int registerGeometryOperationBySuperType(String geomOpName,
299
        GeometryOperation geomOp, int superType);
300

    
301
    /**
302
     * <p>
303
     * Registers a GeometryOperation associated to all the geometries which
304
     * super subType matches with a concrete subType. Returns an unique index that
305
     * is used later to identify and invoke the operation.<br>
306
     * </p>
307
     * <p>
308
     * By convention this index should be in a final and static variable in the
309
     * class that implements the operation. The value of this variable must be
310
     * set using the method
311
     * {@link GeometryManager#getGeometryOperationCode(String)}:<BR>
312
     *
313
     * <pre>
314
     *
315
     * public class MyOperation extends GeometryOperation {
316
     *
317
     *     public static final int CODE = GeometryLocator.getGeometryManager()
318
     *         .getGeometryOperationCode(&quot;MyOperation&quot;);
319
     * }
320
     * </pre>
321
     *
322
     * </p>
323
     *
324
     * @param geomOpName
325
     *            Operation's unique name
326
     * @param geomOp
327
     *            Specific GeometryOperation's instance implementing this
328
     *            operation
329
     * @param superSubType
330
     *            super subType of geometries that is used to register
331
     *            the operation. Must be a value defined in
332
     *            {@link Geometry.SUBTYPES}
333
     * @return Index assigned to this operation. This index is used later to
334
     *         access the operation.
335
     */
336
    public int registerGeometryOperationBySuperSubType(String geomOpName,
337
        GeometryOperation geomOp, int superSubType);
338

    
339
    /**
340
     * <p>
341
     * Registers a GeometryOperation associated to all the geometries with a
342
     * concrete subtype. Returns an unique index that is used later to identify
343
     * and invoke the operation.<br>
344
     * </p>
345
     * <p>
346
     * By convention this index should be in a final and static variable in the
347
     * class that implements the operation. The value of this variable must be
348
     * set using the method
349
     * {@link GeometryManager#getGeometryOperationCode(String)}:<BR>
350
     *
351
     * <pre>
352
     *
353
     * public class MyOperation extends GeometryOperation {
354
     *
355
     *     public static final int CODE = GeometryLocator.getGeometryManager()
356
     *         .getGeometryOperationCode(&quot;MyOperation&quot;);
357
     * }
358
     * </pre>
359
     *
360
     * </p>
361
     *
362
     * @param geomOpName
363
     *            Operation's unique name
364
     * @param geomOp
365
     *            Specific GeometryOperation's instance implementing this
366
     *            operation
367
     * @param subType
368
     *            SubType of geometry. Must be a value defined in
369
     *            {@link Geometry.SUBTYPES}
370
     * @return Index assigned to this operation. This index is used later to
371
     *         access the operation.
372
     */
373
    public int registerGeometryOperationBySubtype(String geomOpName,
374
        GeometryOperation geomOp, int subType);
375

    
376
    /**
377
     * <p>
378
     * Registers a GeometryType instance.
379
     * </p>
380
     *
381
     * @param geometryType
382
     *            A {@link GeometryType} instance to create {@link Geometry} objects
383
     */
384
    public GeometryType registerGeometryType(GeometryType geometryType);
385

    
386
    /**
387
     * <p>
388
     * Registers a Geometry implementation class with a predefined geometry type
389
     * and returns the associated GeometryType instance. Available predefined
390
     * types are defined in {@link Geometry.TYPES} and the subtypes are defined
391
     * in {@link Geometry.SUBTYPES}.
392
     * </p>
393
     * <p>
394
     * How to register a geometry class with a predefined type:
395
     *
396
     * <pre>
397
     *
398
     * GeometryType geomType = GeometryLocator.getGeometryManager()
399
     *     .registerBasicGeometryType(Point2D.class, &quot;Point2D&quot;, Geometry.TYPES.POINT,
400
     *         Geometry.SYBTYPES.GEOM2D);
401
     * </pre>
402
     *
403
     * </p>
404
     *
405
     * @param geomClass
406
     *            Geometry subclass. It must not be null and must implement
407
     *            Geometry, otherwise an exception
408
     *            is raised.
409
     * @param name
410
     *            Symbolic name for the geometry type, it can be null. If it is
411
     *            null then the symbolic name
412
     *            will be the simple class name.
413
     * @param type
414
     *            Type of geometry. Must be a value defined in
415
     *            {@link Geometry.TYPES}
416
     * @param subType
417
     *            SubType of geometry. Must be a value defined in
418
     *            {@link Geometry.SUBTYPES}
419
     * @return Instance of GeometryType associated to the Geometry
420
     *         implementation class
421
     *         geomClass
422
     * @throws IllegalArgumentException
423
     *             If geomClass is null or does not implement Geometry
424
     */
425
    public GeometryType registerGeometryType(Class geomClass, String name,
426
        int type, int subType);
427

    
428
    /**
429
     * <p>
430
     * Registers a Geometry implementation class with a predefined geometry type
431
     * and returns the associated GeometryType instance. Available predefined
432
     * types are defined in {@link Geometry.TYPES} and the subtypes are defined
433
     * in {@link Geometry.SUBTYPES}.
434
     * </p>
435
     * <p>
436
     * It adds also the super type and the super subType of the geometry, that
437
     * can be used to check if the type (or the subtype) inherits of other
438
     * type (or subType)
439
     * </p>
440
     * <p>
441
     * How to register a geometry class with a predefined type:
442
     *
443
     * <pre>
444
     *
445
     * GeometryType geomType = GeometryLocator.getGeometryManager()
446
     *     .registerBasicGeometryType(Arc3D.class, &quot;Arc3D&quot;, Geometry.TYPES.ARC,
447
     *         Geometry.SYBTYPES.GEOM3D, Geometry.TYPES.CURVE, Geometry.SYBTYPES.GEOM2D);
448
     * </pre>
449
     *
450
     * </p>
451
     *
452
     * @param geomClass
453
     *            Geometry subclass. It must not be null and must implement
454
     *            Geometry, otherwise an exception
455
     *            is raised.
456
     * @param name
457
     *            Symbolic name for the geometry type, it can be null. If it is
458
     *            null then the symbolic name
459
     *            will be the simple class name.
460
     * @param type
461
     *            Type of geometry. Must be a value defined in
462
     *            {@link Geometry.TYPES}
463
     * @param subType
464
     *            SubType of geometry. Must be a value defined in
465
     *            {@link Geometry.SUBTYPES}
466
     * @param superType
467
     *              Super type of a geometry. Must be a value defined in
468
     *            {@link Geometry.TYPES}
469
     * @param superSubType
470
     *             Super subType of a geometry. Must be a value defined in
471
     *            {@link Geometry.SUBTYPES}
472
     * @return Instance of GeometryType associated to the Geometry
473
     *         implementation class
474
     *         geomClass
475
     * @throws IllegalArgumentException
476
     *             If geomClass is null or does not implement Geometry
477
     */
478
    public GeometryType registerGeometryType(Class geomClass, String name,
479
        int type, int subType, int superType, int superSubType);
480

    
481
    /**
482
     * <p>
483
     * Registers a Geometry implementation class with a predefined geometry type
484
     * and returns the associated GeometryType instance. Available predefined
485
     * types are defined in {@link Geometry.TYPES} and the subtypes are defined
486
     * in {@link Geometry.SUBTYPES}.
487
     * </p>
488
     * <p>
489
     * It adds also the super type of the geometry, that can be used to
490
     * check if the type inherits of other type.
491
     * </p>
492
     * <p>
493
     * How to register a geometry class with a predefined type:
494
     *
495
     * <pre>
496
     *
497
     * GeometryType geomType = GeometryLocator.getGeometryManager()
498
     *     .registerBasicGeometryType(Arc3D.class, &quot;Arc3D&quot;, Geometry.TYPES.ARC,
499
     *         Geometry.SYBTYPES.GEOM3D, Geometry.TYPES.CURVE);
500
     * </pre>
501
     *
502
     * </p>
503
     *
504
     * @param geomClass
505
     *            Geometry subclass. It must not be null and must implement
506
     *            Geometry, otherwise an exception
507
     *            is raised.
508
     * @param name
509
     *            Symbolic name for the geometry type, it can be null. If it is
510
     *            null then the symbolic name
511
     *            will be the simple class name.
512
     * @param type
513
     *            Type of geometry. Must be a value defined in
514
     *            {@link Geometry.TYPES}
515
     * @param subType
516
     *            SubType of geometry. Must be a value defined in
517
     *            {@link Geometry.SUBTYPES}
518
     * @param superType
519
     *              Super type of a geometry. Must be a value defined in
520
     *            {@link Geometry.TYPES}
521
     * @return Instance of GeometryType associated to the Geometry
522
     *         implementation class
523
     *         geomClass
524
     * @throws IllegalArgumentException
525
     *             If geomClass is null or does not implement Geometry
526
     */
527
    public GeometryType registerGeometryType(Class geomClass, String name,
528
        int type, int subType, int superType);
529

    
530
    /**
531
     * <p>
532
     * Registers a Geometry implementation class with a predefined geometry type
533
     * and returns the associated GeometryType instance. Available predefined
534
     * types are defined in {@link Geometry.TYPES} and the subtypes are defined
535
     * in {@link Geometry.SUBTYPES}.
536
     * </p>
537
     * <p>
538
     * It adds also the super types and the super subTypes of the geometry, that
539
     * can be used to check if the type (or the subtype) inherits of other
540
     * types (or subTypes)
541
     * </p>
542
     * <p>
543
     * How to register a geometry class with a predefined type:
544
     *
545
     * <pre>
546
     *
547
     * GeometryType geomType = GeometryLocator.getGeometryManager()
548
     *     .registerBasicGeometryType(Circle3DM.class, &quot;Circle3DM&quot;, Geometry.TYPES.CIRCLE,
549
     *         Geometry.SYBTYPES.GEOM3DM,
550
     *         new int[]{Geometry.TYPES.CURVE, Geometry.TYPES.GEOMETRY},
551
     *         new int[]{Geometry.SYBTYPES.GEOM2D, Geometry.SYBTYPES.GEOM3D});
552
     * </pre>
553
     *
554
     * </p>
555
     *
556
     * @param geomClass
557
     *            Geometry subclass. It must not be null and must implement
558
     *            Geometry, otherwise an exception
559
     *            is raised.
560
     * @param name
561
     *            Symbolic name for the geometry type, it can be null. If it is
562
     *            null then the symbolic name
563
     *            will be the simple class name.
564
     * @param type
565
     *            Type of geometry. Must be a value defined in
566
     *            {@link Geometry.TYPES}
567
     * @param subType
568
     *            SubType of geometry. Must be a value defined in
569
     *            {@link Geometry.SUBTYPES}
570
     * @param superTypes
571
     *              List of the super types of a geometry. Must be a value defined in
572
     *            {@link Geometry.TYPES}
573
     * @param superSubTypes
574
     *             List of the super subType of a geometry. Must be a value defined in
575
     *            {@link Geometry.SUBTYPES}
576
     * @return Instance of GeometryType associated to the Geometry
577
     *         implementation class
578
     *         geomClass
579
     * @throws IllegalArgumentException
580
     *             If geomClass is null or does not implement Geometry
581
     */
582
    public GeometryType registerGeometryType(Class geomClass, String name,
583
        int type, int subType, int[] superTypes, int superSubTypes[]);
584

    
585
    /**
586
     * <p>
587
     * Registers a Geometry implementation class with a predefined geometry type
588
     * and returns the associated GeometryType instance. Available predefined
589
     * types are defined in {@link Geometry.TYPES} and the subtypes are defined
590
     * in {@link Geometry.SUBTYPES}.
591
     * </p>
592
     * <p>
593
     * It adds also the super types and the super subTypes of the geometry, that
594
     * can be used to check if the type inherits of other types.
595
     * </p>
596
     * <p>
597
     * How to register a geometry class with a predefined type:
598
     *
599
     * <pre>
600
     *
601
     * GeometryType geomType = GeometryLocator.getGeometryManager()
602
     *     .registerBasicGeometryType(Circle2D.class, &quot;Circle2DM&quot;, Geometry.TYPES.CIRCLE,
603
     *         Geometry.SYBTYPES.GEOM2D,
604
     *         new int[]{Geometry.TYPES.CURVE, Geometry.TYPES.SURFACE});
605
     * </pre>
606
     *
607
     * </p>
608
     *
609
     * @param geomClass
610
     *            Geometry subclass. It must not be null and must implement
611
     *            Geometry, otherwise an exception
612
     *            is raised.
613
     * @param name
614
     *            Symbolic name for the geometry type, it can be null. If it is
615
     *            null then the symbolic name
616
     *            will be the simple class name.
617
     * @param type
618
     *            Type of geometry. Must be a value defined in
619
     *            {@link Geometry.TYPES}
620
     * @param subType
621
     *            SubType of geometry. Must be a value defined in
622
     *            {@link Geometry.SUBTYPES}
623
     * @param superTypes
624
     *              List of the super types of a geometry. Must be a value defined in
625
     *            {@link Geometry.TYPES}
626
     * @return Instance of GeometryType associated to the Geometry
627
     *         implementation class
628
     *         geomClass
629
     * @throws IllegalArgumentException
630
     *             If geomClass is null or does not implement Geometry
631
     */
632
    public GeometryType registerGeometryType(Class geomClass, String name,
633
        int type, int subType, int[] superTypes);
634

    
635
    /**
636
     * <p>
637
     * Registers a Geometry implementation class with a predefined geometry type
638
     * and returns the associated GeometryType instance. Available predefined
639
     * types are defined in {@link Geometry.TYPES} and the subtypes are defined
640
     * in {@link Geometry.SUBTYPES}.
641
     * </p>
642
     * <p>
643
     * In this case the symbolic name will be the geometry's simple class name
644
     * </p>
645
     * How to register a new geometry type:
646
     *
647
     * <pre>
648
     *
649
     * GeometryType geomType = GeometryLocator.getGeometryManager()
650
     *     .registerBasicGeometryType(Point2D.class, Geometry.TYPES.POINT,
651
     *         Geometry.SYBTYPES.GEOM2D);
652
     * </pre>
653
     *
654
     * @param geomClass
655
     *            Geometry implementation class. It must not be null and must
656
     *            implement Geometry,
657
     *            otherwise an exception is thrown.
658
     * @param type
659
     *            Type of geometry. Must be a value defined in
660
     *            {@link Geometry.TYPES}
661
     * @param subType
662
     *            SubType of geometry. Must be a value defined in
663
     *            {@link Geometry.SUBTYPES}
664
     * @return Instance of GeometryType associated to the Geometry
665
     *         implementation class
666
     * @throws IllegalArgumentException
667
     *             If geomClass is null or does not implement Geometry
668
     */
669
    public GeometryType registerGeometryType(Class geomClass, int type,
670
        int subType);
671

    
672
    public GeometryType getGeometryType(String typeName) throws GeometryTypeNotSupportedException,
673
        GeometryTypeNotValidException;
674

    
675
    /**
676
     * <p>
677
     * Returns an instance of GeometryType given the Geometry type and the
678
     * subtype.
679
     * </p>
680
     *
681
     * @param type
682
     *            Type of geometry. Must be a value defined in
683
     *            {@link Geometry.TYPES}
684
     * @param subType
685
     *            SubType of geometry. Must be a value defined in
686
     *            {@link Geometry.SUBTYPES}
687
     * @return Instance of GeometryType associated to the type and the subtype
688
     * @throws GeometryTypeNotSupportedException
689
     *             Returns this exception if there is not a registered geometry
690
     *             with
691
     *             these type and subtype
692
     * @throws GeometryTypeNotValidException
693
     *             Returns if the type and subtype are not valid
694
     */
695
    public GeometryType getGeometryType(int type, int subType)
696
        throws GeometryTypeNotSupportedException, GeometryTypeNotValidException;
697

    
698
    /**
699
     * <p>
700
     * This method creates a {@link Geometry} with the type specified by this
701
     * GeometryType. The geometry is empty, and all the internal attributes must
702
     * be assigned to a value when the geometry has been created.
703
     * </p>
704
     * <p>
705
     * This example creates a point2D and sets the coordinates to 1,1:
706
     *
707
     * <pre>
708
     * Point point =
709
     *     (Point) GeometryLocator.getGeometryManager().create(GEOMETRY.TYPES.POINT,
710
     *         GEOMETRY.SUBTYPES.GEOM2D);
711
     * point.setX(1);
712
     * point.setY(1);
713
     * </pre>
714
     *
715
     * </p>
716
     *
717
     * @param geomType
718
     *            The geometry type
719
     * @return
720
     *         A instance of a geometry.
721
     * @throws CreateGeometryException
722
     *             This exception is thrown when the manager can not create
723
     *             the geometry.
724
     */
725
    public Geometry create(GeometryType geomType)
726
        throws CreateGeometryException;
727

    
728
    /**
729
     * <p>
730
     * Creates a Envelope with a concrete subtype. The envelope is empty and it
731
     * have to be filled with the corners once has been created.
732
     * </p>
733
     *
734
     * @param subType
735
     *            SubType of envelope. Must be a value defined in
736
     *            {@link Geometry.SUBTYPES}
737
     * @return
738
     *         A Envelope
739
     * @throws CreateEnvelopeException
740
     *             If it is not possible to create the envelope.
741
     */
742
    public Envelope createEnvelope(int subType) throws CreateEnvelopeException;
743

    
744
    /**
745
     * <p>
746
     * Creates a Envelope with a concrete subtype. It sets the values for the
747
     * lower corner and the upper corner (in 2D) using the method parameters.
748
     * </p>
749
     *
750
     * @param minX
751
     *            The minimum value for the X coordinate.
752
     * @param minY
753
     *            The minimum value for the Y coordinate.
754
     * @param maxX
755
     *            The maximum value for the X coordinate.
756
     * @param maxY
757
     *            The maximum value for the Y coordinate.
758
     * @param subType
759
     *            SubType of envelope. Must be a value defined in
760
     *            {@link Geometry.SUBTYPES}
761
     * @return
762
     * @throws CreateEnvelopeException
763
     */
764
    public Envelope createEnvelope(double minX, double minY, double maxX,
765
        double maxY, int subType) throws CreateEnvelopeException;
766

    
767
    /**
768
     * <p>
769
     * This method creates a {@link Geometry} with the type specified by this
770
     * name. If a geometry with this name doesn't exist, a
771
     * {@link IllegalArgumentException} is thrown. The geometry is empty, and
772
     * all the internal attributes must be assigned to a value when the geometry
773
     * has been created.
774
     * </p>
775
     * <p>
776
     * This example creates a point2D and sets the coordinates to 1,1: It
777
     * supposes that there is a Point2D class with name "Point2D".
778
     * </p>
779
     *
780
     * <pre>
781
     * Point point = (Point) GeometryLocator.getGeometryManager().create(&quot;Point2D&quot;);
782
     * point.setX(1);
783
     * point.setY(1);
784
     * </pre>
785
     *
786
     * @param name
787
     *            The name of the geometry type
788
     * @return
789
     *         A instance of a geometry.
790
     * @throws CreateGeometryException
791
     *             This exception is thrown when the manager can not create
792
     *             the geometry.
793
     */
794
    public Geometry create(String name) throws CreateGeometryException;
795

    
796
    /**
797
     * 
798
     * @param data
799
     * @return
800
     * @throws CreateGeometryException
801
     * @throws GeometryException 
802
     */
803
    public Geometry createFrom(Object data)
804
        throws CreateGeometryException, GeometryException;
805

    
806
    /**
807
     * Create a geometry from a WKT definition.
808
     * This is a utility method to wrap the invocation to the operation {@link OPERATIONS#FROMWKT}.
809
     *
810
     * @param wkt geometry in Well-known text format
811
     * @param srs
812
     *
813
     * @return the geometry as a Geometry
814
     *
815
     * @throws CreateGeometryException
816
     * @throws GeometryException
817
     */
818
    public Geometry createFrom(String wkt, String srs)
819
        throws CreateGeometryException, GeometryException;
820

    
821
    public Geometry createFrom(String wkt, IProjection srs)
822
        throws CreateGeometryException, GeometryException;
823

    
824
    public Geometry createFrom(Reader geom, IProjection srs) 
825
        throws GeometryException;
826

    
827
    /**
828
     * Create a geometry from a WKT or HexWKB definition.
829
     * 
830
     *
831
     * @param wkt geometry in WKT or HexWKB text format. If null return null.
832
     *
833
     * @return the geometry as a Geometry
834
     *
835
     * @throws CreateGeometryException
836
     * @throws GeometryException
837
     */
838
    public Geometry createFrom(String wkt) throws CreateGeometryException,
839
        GeometryException;
840

    
841
    public Geometry createFromQuietly(String wkt);
842
    
843
    /**
844
     * Create a geometry from a WKB definition.
845
     *
846
     * This is a utility method to wrap the invocation to the operation
847
     * {@link OPERATIONS#FROMWKB}.
848
     *
849
     * @param wkb
850
     *            geometry in well-known binary format
851
     *
852
     * @return the geometry as a Geometry
853
     *
854
     * @throws CreateGeometryException
855
     * @throws GeometryException
856
     */
857
    public Geometry createFrom(byte[] wkb) throws CreateGeometryException,
858
        GeometryException;
859

    
860
    public Geometry createFrom(byte[] wkb, IProjection srs) throws CreateGeometryException,
861
        GeometryException;
862
    
863
    /**
864
     * <p>
865
     * This method creates a {@link Geometry} with a concrete type and subtype.
866
     * The geometry is empty, and all the internal attributes must be assigned
867
     * to a value when the geometry has been created.
868
     * </p>
869
     * <p>
870
     * This example creates a point2D and sets the coordinates to 1,1. It
871
     * supposes that there is a Point2D class with the id 1.
872
     * </p>
873
     *
874
     * <pre>
875
     * Point point =
876
     *     (Point) GeometryLocator.getGeometryManager().create(Geometry.TYPES.POINT,
877
     *         Geometry.SYBTYPES.GEOM2D);
878
     * point.setX(1);
879
     * point.setY(1);
880
     * </pre>
881
     *
882
     * @param type
883
     *            Type of geometry. Must be a value defined in
884
     *            {@link Geometry.TYPES}
885
     * @param subType
886
     *            SubType of geometry. Must be a value defined in
887
     *            {@link Geometry.SUBTYPES}
888
     * @return
889
     *         A instance of a geometry.
890
     * @throws CreateGeometryException
891
     *             This exception is thrown when the manager can not create
892
     *             the geometry.
893
     */
894
    public Geometry create(int type, int subType)
895
        throws CreateGeometryException;
896

    
897
    /**
898
     * <p>
899
     * It creates a null geometry with a concrete subtype.
900
     * <p>
901
     *
902
     * @param subType
903
     *            SubType of geometry. Must be a value defined in
904
     *            {@link Geometry.SUBTYPES}
905
     * @return
906
     *         A NullGeometry
907
     * @throws CreateGeometryException
908
     *             This exception is thrown when the manager can not create
909
     *             the geometry.
910
     * @deprecated use null instead. This method can be removed in next revisions
911
     */
912
    public NullGeometry createNullGeometry(int subType)
913
        throws CreateGeometryException;
914

    
915
    /**
916
     * <p>
917
     * Create a new point with a concrete type and sets the value for the X and
918
     * the Y.
919
     * </p>
920
     *
921
     * @param x
922
     *            The X coordinate
923
     * @param y
924
     *            The y coordinate
925
     * @param subType
926
     *            SubType of geometry. Must be a value defined in
927
     *            {@link Geometry.SUBTYPES}
928
     * @throws CreateGeometryException
929
     *             This exception is thrown when the manager can not create
930
     *             the geometry.
931
     * @return
932
     *         The Point
933
     */
934
    public Point createPoint(double x, double y, int subType)
935
        throws CreateGeometryException;
936

    
937
    /**
938
     * Create a new line with a concrete type. Use later addVertex to add
939
     * vertex to te line.
940
     *
941
     * @param subType SubType of geometry. Must be a value defined in {@link Geometry.SUBTYPES}
942
     * @return a line
943
     * @throws CreateGeometryException
944
     *             This exception is thrown when the manager can not create
945
     *             the geometry.
946
     */
947
    public Line createLine(int subType) throws CreateGeometryException;
948

    
949
    /**
950
     * @deprecated use createLine
951
     */
952
    public Curve createCurve(int subType) throws CreateGeometryException;
953

    
954
    /**
955
     * Create a new polygon with a concrete type.
956
     * Use later addVertex to add vertex to te polygon.
957
     *
958
     * @param subType
959
     *            SubType of geometry. Must be a value defined in
960
     *            {@link Geometry.SUBTYPES}
961
     * @return
962
     *         A polygon
963
     * @throws CreateGeometryException
964
     *             This exception is thrown when the manager can not create
965
     *             the geometry.
966
     */
967
    public Polygon createPolygon(int subType)
968
        throws CreateGeometryException;
969

    
970
    /**
971
     * @deprecated use createPolygon
972
     */
973
    public Surface createSurface(int subType)
974
        throws CreateGeometryException;
975

    
976
    /**
977
     * Create a new multipoint with a concrete subtype.
978
     * Use addPrimitive to populate the multipoint.
979
     *
980
     * @param subType
981
     *            SubType of geometry. Must be a value defined in
982
     *            {@link Geometry.SUBTYPES}
983
     * @return A multipoint
984
     * @throws CreateGeometryException
985
     *             This exception is thrown when the manager can not create the
986
     *             geometry.
987
     */
988
    public MultiPoint createMultiPoint(int subType)
989
        throws CreateGeometryException;
990

    
991
    /**
992
     * Create a new multicurve with a concrete subtype.
993
     * Use addPrimitive to populate the multicurve.
994
     *
995
     * @param subType
996
     *            SubType of geometry. Must be a value defined in
997
     *            {@link Geometry.SUBTYPES}
998
     * @return A multicurve
999
     * @throws CreateGeometryException
1000
     *             This exception is thrown when the manager can not create the
1001
     *             geometry.
1002
     */
1003
    public MultiCurve createMultiCurve(int subType) throws CreateGeometryException;
1004

    
1005
    public MultiLine createMultiLine(int subType) throws CreateGeometryException;
1006

    
1007
    /**
1008
     * Create a new multisurface with a concrete subtype.
1009
     * Use later addPrimitive to populate.
1010
     *
1011
     * @param subType
1012
     *            SubType of geometry. Must be a value defined in
1013
     *            {@link Geometry.SUBTYPES}
1014
     * @return A multisurface
1015
     * @throws CreateGeometryException
1016
     *             This exception is thrown when the manager can not create the
1017
     *             geometry.
1018
     */
1019
    public MultiSurface createMultiSurface(int subType) throws CreateGeometryException;
1020

    
1021
    public MultiPolygon createMultiPolygon(int subType) throws CreateGeometryException;
1022

    
1023
    /**
1024
     * <p>
1025
     * Returns an operation given the Geometry type, the Geometry subtype and
1026
     * and the operation code. If opCode corresponds to a common operation (a
1027
     * common operation is an operation registered for all geometries), then
1028
     * this method returns the common operation.
1029
     * </p>
1030
     * <p>
1031
     * For better performance, if you need to call an operation multiple times,
1032
     * use this method only once and keep the returned object in a local
1033
     * variable over which you can iterate. For instance:
1034
     *
1035
     * <pre>
1036
     * // Get the operation you need
1037
     * GeometryManager gm = GeometryLocator.getGeometryManager()
1038
     * GeometryOperation geomOp = null;
1039
     * try {
1040
     *    geomOp = gm.getGeometryOperation(Draw2D.CODE, Geometry.TYPES.POINT,
1041
     *    Geometry.SUBTYPES.GEOM2D);
1042
     * } catch (GeometryTypeNotSupportedException gtnse) {
1043
     *    // treat exception
1044
     * } catch (GeometryOperationNotSupportedException gonse) {
1045
     *    // treat exception
1046
     * }
1047
     *
1048
     *  // Fill the operation context with required params
1049
     * GeometryOperationContext ctx = new GeometryOperationContext();
1050
     *
1051
     *  // Here is the main loop where you call the operation
1052
     * for (int i=0; i<myGeometries.length; i++) {
1053
     *    Object result = geomOp.invoke(myGeometries[i], ctx);
1054
     * }
1055
     * </pre>
1056
     *
1057
     * </p>
1058
     *
1059
     * @param opCode
1060
     *            The operation code
1061
     * @param type
1062
     *            Type of geometry. Must be a value defined in
1063
     *            {@link Geometry.TYPES}
1064
     * @param subType
1065
     *            SubType of geometry. Must be a value defined in
1066
     *            {@link Geometry.SUBTYPES}
1067
     * @return Geometry operation
1068
     * @throws GeometryTypeNotSupportedException
1069
     *             Returns this exception if there is not a registered geometry
1070
     *             with
1071
     *             these type and subtype
1072
     * @throws GeometryTypeNotValidException
1073
     *             Returns this exception if the type and subtype are not valid
1074
     * @throws GeometryOperationNotSupportedException
1075
     *             Returns this exception if there is not a registered operation
1076
     *             with
1077
     *             this operation code
1078
     */
1079
    public GeometryOperation getGeometryOperation(int opCode, int type,
1080
        int subType) throws GeometryTypeNotSupportedException,
1081
        GeometryOperationNotSupportedException, GeometryTypeNotValidException;
1082

    
1083
    /**
1084
     * <p>
1085
     * Returns an common operation with given operation code. A common operation
1086
     * is an operation registered for all geometries.
1087
     * </p>
1088
     * <p>
1089
     * For better performance, if you need to call an operation multiple times,
1090
     * use this method only once and keep the returned object in a local
1091
     * variable over which you can iterate. For instance:
1092
     *
1093
     * <pre>
1094
     * // Get the operation you need
1095
     * GeometryManager gm = GeometryLocator.getGeometryManager()
1096
     * GeometryOperation geomOp = null;
1097
     * try {
1098
     *    geomOp = gm.getGeometryOperation(FromWKB.CODE);
1099
     * } catch (GeometryOperationNotSupportedException gonse) {
1100
     *    // treat exception
1101
     * }
1102
     *
1103
     *  // Fill the operation context with required params
1104
     * FromWKBGeometryOperationContext ctx = new FromWKBGeometryOperationContext();
1105
     *
1106
     *  // Here is the main loop where you call the operation
1107
     * for (int i=0; i<myGeometriesWKB.length; i++) {
1108
     *    ctx.setData(myGeometriesWKB[i]);
1109
     *    Object result = geomOp.invoke(null, ctx);
1110
     * }
1111
     * </pre>
1112
     *
1113
     * </p>
1114
     *
1115
     * @param opCode
1116
     *            The operation code
1117
     * @return Geometry operation
1118
     * @throws GeometryOperationNotSupportedException
1119
     *             Returns this exception if there is not a registered operation
1120
     *             with
1121
     *             this operation code
1122
     */
1123
    public GeometryOperation getGeometryOperation(int opCode)
1124
        throws GeometryOperationNotSupportedException;
1125

    
1126
    /**
1127
     * <p>
1128
     * Invokes an operation given its code, the geometry and the operation
1129
     * context holding the parameters required for the operation.
1130
     * </p>
1131
     *
1132
     * @param opCode
1133
     *            Operation code.
1134
     * @param geom
1135
     *            Geometry to which apply the operation
1136
     * @param ctx
1137
     *            Context holding the operation parameters
1138
     * @return
1139
     *         The object returned by an operation, depends on each operation.
1140
     */
1141
    public Object invokeOperation(int opCode, Geometry geom,
1142
        GeometryOperationContext ctx)
1143
        throws GeometryOperationNotSupportedException,
1144
        GeometryOperationException;
1145

    
1146
    /**
1147
     * <p>
1148
     * Invokes an operation given its code, the geometry and the operation
1149
     * context holding the parameters required for the operation.
1150
     * </p>
1151
     *
1152
     * @param geomOpName
1153
     *            Operation name.
1154
     * @param geom
1155
     *            Geometry to which apply the operation
1156
     * @param ctx
1157
     *            Context holding the operation parameters
1158
     * @return
1159
     *         The object returned by an operation, depends on each operation.
1160
     */
1161
    public Object invokeOperation(String geomOpName, Geometry geom,
1162
        GeometryOperationContext ctx)
1163
        throws GeometryOperationNotSupportedException,
1164
        GeometryOperationException;
1165

    
1166
    /**
1167
     * <p>
1168
     * Invokes an operation given its code, and the operation context holding
1169
     * the parameters required for the operation.
1170
     * </p>
1171
     *
1172
     * @param geomOpName
1173
     *            Operation name.
1174
     * @param ctx
1175
     *            Context holding the operation parameters
1176
     * @return
1177
     *         The object returned by an operation, depends on each operation.
1178
     */
1179
    public Object invokeOperation(String geomOpName,
1180
        GeometryOperationContext ctx)
1181
        throws GeometryOperationNotSupportedException,
1182
        GeometryOperationException;
1183

    
1184
    /**
1185
     * <p>
1186
     * Registers the unique name of one operation. If it already exists then
1187
     * this method does nothing but returning the name's corresponding index.
1188
     * </p>
1189
     * <p>
1190
     * By convention this method is used to set the value of the final and
1191
     * static variable that is located in the classes that implements the
1192
     * operation:<BR>
1193
     *
1194
     * <pre>
1195
     *
1196
     * public class MyOperation extends GeometryOperation {
1197
     *
1198
     *     public static final int CODE = GeometryLocator.getGeometryManager()
1199
     *         .getGeometryOperationCode(&quot;MyOperation&quot;);
1200
     * }
1201
     * </pre>
1202
     *
1203
     * </p>
1204
     *
1205
     * @param geomOpName
1206
     *            Name used to register the geometry operation
1207
     * @return
1208
     *         Index assigned to the operation name passed as parameter
1209
     */
1210
    public int getGeometryOperationCode(String geomOpName);
1211

    
1212
    /**
1213
     * Returns a list with the name of the operations that have been
1214
     * registered.
1215
     *
1216
     * @return
1217
     *         A list of the registered operations.
1218
     */
1219
    public List getGeometryOperationNames();
1220

    
1221
    /**
1222
     * Returns the flatness used to convert a curve is a set
1223
     * of points.
1224
     *
1225
     * @return
1226
     *         The flatness.
1227
     */
1228
    public double getFlatness();
1229

    
1230
    /**
1231
     * Sets the application flatness.
1232
     *
1233
     * @param flatness
1234
     *            The flatness to set
1235
     */
1236
    public void setFlatness(double flatness);
1237

    
1238
    /**
1239
     * Create a memory spatial index with the default implementation.
1240
     *
1241
     * @return a new SpatialIndex
1242
     */
1243
    public SpatialIndex createDefaultMemorySpatialIndex() throws ServiceException;
1244

    
1245

    
1246
    /**
1247
     * Create a spatial index with the implementation specified as name.
1248
     * If the creation of index don't requery parameters can be passed a null.
1249
     *
1250
     * @param name of the type of spatial index to create
1251
     * @param parameters used to create the index or null.
1252
     * @return the new SpatialIndex or null if not exists the type of index.
1253
     * @throws GeometryException
1254
     */
1255
    public SpatialIndex createSpatialIndex(String name, DynObject parameters) throws ServiceException;
1256

    
1257
    /**
1258
     * Return the name of the factory of the spatial index required.
1259
     *
1260
     * @param name of the spatial index factory
1261
     * @return the SpatialIndexFactory required or null if not exists
1262
     */
1263
    public SpatialIndexFactory getSpatialIndexFactory(String name);
1264

    
1265
    /**
1266
     * Create a GeneralPathX to populate a geometry.
1267
     * This method is deprecated, instead use OrientablePrimitive#addVertex(Point) to add vertex to
1268
     * primitive geometries or {@link MultiPrimitive#addPrimitive(org.gvsig.fmap.geom.primitive.Primitive)} to add geometries to an aggregate.
1269
     *
1270
     * @param rule
1271
     * @param pathIterator , can be null
1272
     * @return a GeneralPathX
1273
     * @deprecated use method of Geometry to handle this
1274
     * @see OrientablePrimitive#addVertex(Point) or {@link MultiPrimitive#addPrimitive(org.gvsig.fmap.geom.primitive.Primitive)}
1275
     *
1276
     */
1277
    public IGeneralPathX createGeneralPath(int rule, PathIterator pathIterator);
1278

    
1279
        /**
1280
         * <p>
1281
         * Create a new curve with a concrete type and sets the value for the
1282
         * coordinates using a GeneralPathX.
1283
         * </p>
1284
         *
1285
         * @param generalPathX
1286
         *            It is used to set the values for the X and Y coordinates.
1287
         * @param subType
1288
         *            SubType of geometry. Must be a value defined in
1289
         *            {@link Geometry.SUBTYPES}
1290
         * @return
1291
         *         A curve
1292
         * @throws CreateGeometryException
1293
         *             This exception is thrown when the manager can not create
1294
         *             the geometry.
1295
         * @deprecated use {@link #createCurve(int)} and OrientablePrimitive#addVertex(Point)
1296
         */
1297
        public Curve createCurve(GeneralPathX generalPathX, int subType)
1298
            throws CreateGeometryException;
1299

    
1300
         /**
1301
     * <p>
1302
     * Create a new multipoint with a concrete type and sets the value for the
1303
     * coordinates using a GeneralPathX.
1304
     * </p>
1305
     *
1306
     * @param generalPathX
1307
     *            It is used to set the values for the X and Y coordinates.
1308
     * @param subType
1309
     *            SubType of geometry. Must be a value defined in
1310
     *            {@link Geometry.SUBTYPES}
1311
     * @return A multipoint
1312
     * @throws CreateGeometryException
1313
     *             This exception is thrown when the manager can not create the
1314
     *             geometry.
1315
     * @deprecated use {@link #createMultiCurve(int)} and {@link MultiPrimitive#addPrimitive(org.gvsig.fmap.geom.primitive.Primitive)}
1316
     */
1317
    public MultiPoint createMultiPoint(GeneralPathX generalPathX, int subType)
1318
            throws CreateGeometryException;
1319
        /**
1320
         * <p>
1321
         * Create a new multicurve with a concrete type and sets the value for the
1322
         * coordinates using a GeneralPathX.
1323
         * </p>
1324
         *
1325
         * @param generalPathX
1326
         *            It is used to set the values for the X and Y coordinates.
1327
         * @param subType
1328
         *            SubType of geometry. Must be a value defined in
1329
         *            {@link Geometry.SUBTYPES}
1330
         * @return A multicurve
1331
         * @throws CreateGeometryException
1332
         *             This exception is thrown when the manager can not create the
1333
         *             geometry.
1334
         * @deprecated use {@link #createMultiCurve(int)} and {@link MultiPrimitive#addPrimitive(org.gvsig.fmap.geom.primitive.Primitive)}
1335
         */
1336
        public MultiCurve createMultiCurve(GeneralPathX generalPathX, int subType)
1337
                throws CreateGeometryException;
1338

    
1339
        /**
1340
         * <p>
1341
         * Create a new surface with a concrete type and sets the value for the
1342
         * coordinates using a GeneralPathX.
1343
         * </p>
1344
         *
1345
         * @param generalPathX
1346
         *            It is used to set the values for the X and Y coordinates.
1347
         * @param subType
1348
         *            SubType of geometry. Must be a value defined in
1349
         *            {@link Geometry.SUBTYPES}
1350
         * @return
1351
         *         A surface
1352
         * @throws CreateGeometryException
1353
         *             This exception is thrown when the manager can not create
1354
         *             the geometry.
1355
         * @deprecated use {@link #createSurface(int)} and OrientablePrimitive#addVertex(Point)
1356
         */
1357
        public Surface createSurface(GeneralPathX generalPathX, int subType)
1358
            throws CreateGeometryException;
1359

    
1360
        /**
1361
         * <p>
1362
         * Create a new multisurface with a concrete type and sets the value for the
1363
         * coordinates using a GeneralPathX.
1364
         * </p>
1365
         *
1366
         * @param generalPathX
1367
         *            It is used to set the values for the X and Y coordinates.
1368
         * @param subType
1369
         *            SubType of geometry. Must be a value defined in
1370
         *            {@link Geometry.SUBTYPES}
1371
         * @return A multisurface
1372
         * @throws CreateGeometryException
1373
         *             This exception is thrown when the manager can not create the
1374
         *             geometry.
1375
         * @deprecated use {@link #createMultiSurface(int)} and {@link MultiPrimitive#addPrimitive(org.gvsig.fmap.geom.primitive.Primitive)}
1376
         */
1377
        public MultiSurface createMultiSurface(GeneralPathX generalPathX,
1378
            int subType) throws CreateGeometryException;
1379
        
1380
    public InformationbuilderWithGeometrySupport createInformacionBuilder();
1381
    
1382
    /**
1383
     * Check if geomTypeChild is a geoemtry type deribed of geomTypeParent
1384
     * 
1385
     * @param geomTypeParent
1386
     * @param geomTypeChild
1387
     * @return 
1388
     */
1389
    public boolean isSubtype(int geomTypeParent, int geomTypeChild);
1390
    
1391
    /**
1392
     * Check if geomTypeParent is a Multigeometry and geomTypeChild is compatible
1393
     * 
1394
     * @param geomTypeParent
1395
     * @param geomTypeChild
1396
     * @return 
1397
     */
1398
    public boolean canAggregate(int geomTypeParent, int geomTypeChild);
1399
    
1400
    public GeometryCoercionContext createGeometryCoercionContext();
1401

    
1402
    public MultiPrimitive createMultiPrimitive(GeometryType geometryType) throws CreateGeometryException;
1403
    
1404
}