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

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

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

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

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

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

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

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

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

    
821
    public Geometry createFrom(Reader geom, IProjection srs) 
822
        throws GeometryException;
823

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

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

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

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

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

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

    
946
    /**
947
     * @deprecated use createLine
948
     */
949
    public Curve createCurve(int subType) throws CreateGeometryException;
950

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

    
967
    /**
968
     * @deprecated use createPolygon
969
     */
970
    public Surface createSurface(int subType)
971
        throws CreateGeometryException;
972

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

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

    
1002
    public MultiLine createMultiLine(int subType) throws CreateGeometryException;
1003

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

    
1018
    public MultiPolygon createMultiPolygon(int subType) throws CreateGeometryException;
1019

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

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

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

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

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

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

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

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

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

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

    
1242

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

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

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

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

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

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

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

    
1399
    public MultiPrimitive createMultiPrimitive(GeometryType geometryType) throws CreateGeometryException;
1400
    
1401
}