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 @ 45425

History | View | Annotate | Download (50.2 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.util.List;
28
import org.cresques.cts.IProjection;
29

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
792
    /**
793
     * 
794
     * @param data
795
     * @return
796
     * @throws CreateGeometryException
797
     * @throws GeometryException 
798
     */
799
    public Geometry createFrom(Object data)
800
        throws CreateGeometryException, GeometryException;
801

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

    
817
    public Geometry createFrom(String wkt, IProjection srs)
818
        throws CreateGeometryException, GeometryException;
819

    
820
    /**
821
     * Create a geometry from a WKT or HexWKB definition.
822
     * 
823
     *
824
     * @param wkt geometry in WKT or HexWKB text format. If null return null.
825
     *
826
     * @return the geometry as a Geometry
827
     *
828
     * @throws CreateGeometryException
829
     * @throws GeometryException
830
     */
831
    public Geometry createFrom(String wkt) throws CreateGeometryException,
832
        GeometryException;
833

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

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

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

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

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

    
942
    /**
943
     * @deprecated use createLine
944
     */
945
    public Curve createCurve(int subType) throws CreateGeometryException;
946

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

    
963
    /**
964
     * @deprecated use createPolygon
965
     */
966
    public Surface createSurface(int subType)
967
        throws CreateGeometryException;
968

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

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

    
998
    public MultiLine createMultiLine(int subType) throws CreateGeometryException;
999

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

    
1014
    public MultiPolygon createMultiPolygon(int subType) throws CreateGeometryException;
1015

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

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

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

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

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

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

    
1205
    /**
1206
     * Returns a list with the name of the operations that have been
1207
     * registered.
1208
     *
1209
     * @return
1210
     *         A list of the registered operations.
1211
     */
1212
    public List getGeometryOperationNames();
1213

    
1214
    /**
1215
     * Returns the flatness used to convert a curve is a set
1216
     * of points.
1217
     *
1218
     * @return
1219
     *         The flatness.
1220
     */
1221
    public double getFlatness();
1222

    
1223
    /**
1224
     * Sets the application flatness.
1225
     *
1226
     * @param flatness
1227
     *            The flatness to set
1228
     */
1229
    public void setFlatness(double flatness);
1230

    
1231
    /**
1232
     * Create a memory spatial index with the default implementation.
1233
     *
1234
     * @return a new SpatialIndex
1235
     */
1236
    public SpatialIndex createDefaultMemorySpatialIndex() throws ServiceException;
1237

    
1238

    
1239
    /**
1240
     * Create a spatial index with the implementation specified as name.
1241
     * If the creation of index don't requery parameters can be passed a null.
1242
     *
1243
     * @param name of the type of spatial index to create
1244
     * @param parameters used to create the index or null.
1245
     * @return the new SpatialIndex or null if not exists the type of index.
1246
     * @throws GeometryException
1247
     */
1248
    public SpatialIndex createSpatialIndex(String name, DynObject parameters) throws ServiceException;
1249

    
1250
    /**
1251
     * Return the name of the factory of the spatial index required.
1252
     *
1253
     * @param name of the spatial index factory
1254
     * @return the SpatialIndexFactory required or null if not exists
1255
     */
1256
    public SpatialIndexFactory getSpatialIndexFactory(String name);
1257

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

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

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

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

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

    
1393
}