Revision 34708 branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/GeometryManager.java

View differences:

GeometryManager.java
63 63
/**
64 64
 * This singleton provides a centralized access to gvSIG's Geometry Model.
65 65
 * Its responsibilities are:<br>
66
 *
66
 * 
67 67
 * <ul>
68
 * <li>Offering a set of convenient methods for registering and retrieving geometry types.
69
 * <li>Offering a set of convenient methods for registering and retrieving geometry operations associated
70
 * to one or more geometry types.
71
 * <li>Offering a set of convenient methods for registering and retrieving new geometries.
68
 * <li>Offering a set of convenient methods for registering and retrieving
69
 * geometry types.
70
 * <li>Offering a set of convenient methods for registering and retrieving
71
 * geometry operations associated to one or more geometry types.
72
 * <li>Offering a set of convenient methods for registering and retrieving new
73
 * geometries.
72 74
 * </ul>
73
 *
75
 * 
74 76
 * @author jiyarza
75 77
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
76 78
 */
77 79
public interface GeometryManager {
78
	public interface OPERATIONS {
79
		public final static String FROMWKT = "FromWKT";
80
		public final static String FROMWKB = "FromWKB";
81
	}
82 80

  
83
	/**
84
	 * <p>
85
	 * Registers a GeometryOperation associated to a GeometryType.
86
	 * Returns an unique index that is used later to identify and invoke the operation.
87
	 * </p>
88
	 * <p>
89
	 * By convention this index should be in a final and static variable in the 
90
	 * class that implements the operation. The value of this variable must be set 
91
	 * using the method {@link GeometryManager#getGeometryOperationCode(String)}:<BR>	
92
	 * <pre>
93
	 * public class MyOperation extends GeometryOperation {
94
	 *   public static final int CODE =
95
	 *     GeometryLocator.getGeometryManager()
96
	 *        .getGeometryOperationCode("MyOperation");
97
	 * }
98
	 * </pre>
99
	 * </p>
100
	 * @param geomOpName Operation's unique name
101
	 * @param geomOp Specific GeometryOperation's instance implementing this operation
102
	 * @param geomType GeometryType instance to which this operation should be associated
103
	 * @return Index assigned to this operation. This index is used later to access the operation.
104
	 *
105
	 */
106
	public int registerGeometryOperation(String geomOpName,
107
			GeometryOperation geomOp, GeometryType geomType);
81
    public interface OPERATIONS {
108 82

  
109
	/**
110
	 * <p>
111
	 * Registers a GeometryOperation that is common for all GeometryType (registered yet or not).
112
	 * Returns an unique index that is used later to identify and invoke the operation.
113
	 * </p>
114
	 * <p>
115
	 * By convention this index should be in a final and static variable in the 
116
	 * class that implements the operation. The value of this variable must be set 
117
	 * using the method {@link GeometryManager#getGeometryOperationCode(String)}:<BR>	
118
	 * <pre>
119
	 * public class MyOperation extends GeometryOperation {
120
	 *   public static final int CODE =
121
	 *     GeometryLocator.getGeometryManager()
122
	 *        .getGeometryOperationCode("MyOperation");
123
	 * }
124
	 * </pre>
125
	 * </p>
126
	 * @param geomOpName Operation's unique name
127
	 * @param geomOp Specific GeometryOperation's instance implementing this operation
128
	 * @return Index assigned to this operation. This index is used later to access the operation.
129
	 */
130
	public int registerGeometryOperation(String geomOpName,
131
			GeometryOperation geomOp);
83
        public final static String FROMWKT = "FromWKT";
84
        public final static String FROMWKB = "FromWKB";
85
    }
132 86

  
133
	/**
134
	 * <p>
135
	 * Registers a GeometryOperation associated to a GeometryType, that has been specified
136
	 * using the type code and the subtype code.
137
	 * Returns an unique index that is used later to identify and invoke the operation.
138
	 * </p>
139
	 * <p>
140
	 * By convention this index should be in a final and static variable in the 
141
	 * class that implements the operation. The value of this variable must be set 
142
	 * using the method {@link GeometryManager#getGeometryOperationCode(String)}:<BR>	
143
	 * <pre>
144
	 * public class MyOperation extends GeometryOperation {
145
	 *   public static final int CODE =
146
	 *     GeometryLocator.getGeometryManager()
147
	 *        .getGeometryOperationCode("MyOperation");
148
	 * }
149
	 * </pre>
150
	 * </p>
151
	 * <p>
152
	 * This method is only used if you have not a reference to the GeometryType associated to the
153
	 * geometry class. If you have such reference then it is slightly faster to use the method that receives
154
	 * the GeometryType.<br>
155
	 * </p>
156
	 * @param geomOpName Operation's unique name
157
	 * @param geomOp Specific GeometryOperation's instance implementing this operation
158
	 * @param type
159
	 * Type of geometry. Must be a value defined in {@link Geometry.TYPES}
160
	 * @param subType
161
	 * SubType of geometry. Must be a value defined in {@link Geometry.SUBTYPES}
162
	 * @return Index assigned to this operation. This index is used later to access the operation.
163
	 * @throws GeometryTypeNotSupportedException
164
	 * Returns this exception if there is not a registered geometry with
165
	 * these type and subtype
166
	 * @throws GeometryTypeNotValidException
167
	 * Returns if the type and subtype are not valid
168
	 */
169
	public int registerGeometryOperation(String geomOpName,
170
			GeometryOperation geomOp, int type, int subType) throws GeometryTypeNotSupportedException, GeometryTypeNotValidException;
87
    /**
88
     * <p>
89
     * Registers a GeometryOperation associated to a GeometryType. Returns an
90
     * unique index that is used later to identify and invoke the operation.
91
     * </p>
92
     * <p>
93
     * By convention this index should be in a final and static variable in the
94
     * class that implements the operation. The value of this variable must be
95
     * set using the method
96
     * {@link GeometryManager#getGeometryOperationCode(String)}:<BR>
97
     * 
98
     * <pre>
99
     * 
100
     * public class MyOperation extends GeometryOperation {
101
     * 
102
     *     public static final int CODE = GeometryLocator.getGeometryManager()
103
     *         .getGeometryOperationCode(&quot;MyOperation&quot;);
104
     * }
105
     * </pre>
106
     * 
107
     * </p>
108
     * 
109
     * @param geomOpName
110
     *            Operation's unique name
111
     * @param geomOp
112
     *            Specific GeometryOperation's instance implementing this
113
     *            operation
114
     * @param geomType
115
     *            GeometryType instance to which this operation should be
116
     *            associated
117
     * @return Index assigned to this operation. This index is used later to
118
     *         access the operation.
119
     * 
120
     */
121
    public int registerGeometryOperation(String geomOpName,
122
        GeometryOperation geomOp, GeometryType geomType);
171 123

  
172
	/**
173
	 * <p>
174
	 * Registers a GeometryOperation associated to all the geometries with a concrete type.
175
	 * Returns an unique index that is used later to identify and invoke the operation.<br>
176
	 * </p>
177
	 * <p>
178
	 * By convention this index should be in a final and static variable in the 
179
	 * class that implements the operation. The value of this variable must be set 
180
	 * using the method {@link GeometryManager#getGeometryOperationCode(String)}:<BR>	
181
	 * <pre>
182
	 * public class MyOperation extends GeometryOperation {
183
	 *   public static final int CODE =
184
	 *     GeometryLocator.getGeometryManager()
185
	 *        .getGeometryOperationCode("MyOperation");
186
	 * }
187
	 * </pre>
188
	 * </p>
189
	 * @param geomOpName Operation's unique name
190
	 * @param geomOp Specific GeometryOperation's instance implementing this operation
191
	 * @param type
192
	 * Type of geometry. Must be a value defined in {@link Geometry.TYPES}
193
	 * @return Index assigned to this operation. This index is used later to access the operation.
194
	 */
195
	public int registerGeometryOperation(String geomOpName,
196
			GeometryOperation geomOp, int type);
124
    /**
125
     * <p>
126
     * Registers a GeometryOperation that is common for all GeometryType
127
     * (registered yet or not). Returns an unique index that is used later to
128
     * identify and invoke the operation.
129
     * </p>
130
     * <p>
131
     * By convention this index should be in a final and static variable in the
132
     * class that implements the operation. The value of this variable must be
133
     * set using the method
134
     * {@link GeometryManager#getGeometryOperationCode(String)}:<BR>
135
     * 
136
     * <pre>
137
     * 
138
     * public class MyOperation extends GeometryOperation {
139
     * 
140
     *     public static final int CODE = GeometryLocator.getGeometryManager()
141
     *         .getGeometryOperationCode(&quot;MyOperation&quot;);
142
     * }
143
     * </pre>
144
     * 
145
     * </p>
146
     * 
147
     * @param geomOpName
148
     *            Operation's unique name
149
     * @param geomOp
150
     *            Specific GeometryOperation's instance implementing this
151
     *            operation
152
     * @return Index assigned to this operation. This index is used later to
153
     *         access the operation.
154
     */
155
    public int registerGeometryOperation(String geomOpName,
156
        GeometryOperation geomOp);
197 157

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

  
199
	/**
200
	 * <p>
201
	 * Registers a GeometryOperation associated to all the geometries with a concrete subtype.
202
	 * Returns an unique index that is used later to identify and invoke the operation.<br>
203
	 * </p>
204
	 * <p>
205
	 * By convention this index should be in a final and static variable in the 
206
	 * class that implements the operation. The value of this variable must be set 
207
	 * using the method {@link GeometryManager#getGeometryOperationCode(String)}:<BR>	
208
	 * <pre>
209
	 * public class MyOperation extends GeometryOperation {
210
	 *   public static final int CODE =
211
	 *     GeometryLocator.getGeometryManager()
212
	 *        .getGeometryOperationCode("MyOperation");
213
	 * }
214
	 * </pre>
215
	 * </p>
216
	 * @param geomOpName Operation's unique name
217
	 * @param geomOp Specific GeometryOperation's instance implementing this operation
218
	 * @param subType
219
	 * SubType of geometry. Must be a value defined in {@link Geometry.SUBTYPES}
220
	 * @return Index assigned to this operation. This index is used later to access the operation.
221
	 */
222
	public int registerGeometryOperationBySubtype(String geomOpName,
223
			GeometryOperation geomOp, int subType);
210
    /**
211
     * <p>
212
     * Registers a GeometryOperation associated to all the geometries with a
213
     * concrete type. Returns an unique index that is used later to identify and
214
     * invoke the operation.<br>
215
     * </p>
216
     * <p>
217
     * By convention this index should be in a final and static variable in the
218
     * class that implements the operation. The value of this variable must be
219
     * set using the method
220
     * {@link GeometryManager#getGeometryOperationCode(String)}:<BR>
221
     * 
222
     * <pre>
223
     * 
224
     * public class MyOperation extends GeometryOperation {
225
     * 
226
     *     public static final int CODE = GeometryLocator.getGeometryManager()
227
     *         .getGeometryOperationCode(&quot;MyOperation&quot;);
228
     * }
229
     * </pre>
230
     * 
231
     * </p>
232
     * 
233
     * @param geomOpName
234
     *            Operation's unique name
235
     * @param geomOp
236
     *            Specific GeometryOperation's instance implementing this
237
     *            operation
238
     * @param type
239
     *            Type of geometry. Must be a value defined in
240
     *            {@link Geometry.TYPES}
241
     * @return Index assigned to this operation. This index is used later to
242
     *         access the operation.
243
     */
244
    public int registerGeometryOperation(String geomOpName,
245
        GeometryOperation geomOp, int type);
224 246

  
225
	/**
226
	 * <p>
227
	 * Registers a Geometry implementation class with a predefined geometry type and returns the
228
	 * associated GeometryType instance. Available predefined types are defined in {@link Geometry.TYPES}
229
	 * and the subtypes are defined in {@link Geometry.SUBTYPES}.
230
	 * </p>
231
	 * <p>
232
	 * How to register a geometry class with a predefined type:
233
	 * <pre>
234
	 *   GeometryType geomType = GeometryLocator.getGeometryManager().
235
	 *      registerBasicGeometryType(Point2D.class, "Point2D", Geometry.TYPES.POINT, Geometry.SYBTYPES.GEOM2D);
236
	 * </pre>
237
	 * </p>
238
	 * @param geomClass
239
	 *            Geometry subclass. It must not be null and must implement Geometry, otherwise an exception
240
	 *            is raised.
241
	 * @param name
242
	 * 			  Symbolic name for the geometry type, it can be null. If it is null then the symbolic name
243
	 * 		      will be the simple class name.
244
	 * @param type
245
	 * Type of geometry. Must be a value defined in {@link Geometry.TYPES}
246
	 * @param subType
247
	 * SubType of geometry. Must be a value defined in {@link Geometry.SUBTYPES}
248
	 * @return Instance of GeometryType associated to the Geometry implementation class
249
	 *         geomClass
250
	 * @throws IllegalArgumentException
251
	 *             If geomClass is null or does not implement Geometry
252
	 */
253
	public GeometryType registerGeometryType(Class geomClass, String name, int type, int subType);
247
    /**
248
     * <p>
249
     * Registers a GeometryOperation associated to all the geometries with a
250
     * concrete subtype. Returns an unique index that is used later to identify
251
     * and invoke the operation.<br>
252
     * </p>
253
     * <p>
254
     * By convention this index should be in a final and static variable in the
255
     * class that implements the operation. The value of this variable must be
256
     * set using the method
257
     * {@link GeometryManager#getGeometryOperationCode(String)}:<BR>
258
     * 
259
     * <pre>
260
     * 
261
     * public class MyOperation extends GeometryOperation {
262
     * 
263
     *     public static final int CODE = GeometryLocator.getGeometryManager()
264
     *         .getGeometryOperationCode(&quot;MyOperation&quot;);
265
     * }
266
     * </pre>
267
     * 
268
     * </p>
269
     * 
270
     * @param geomOpName
271
     *            Operation's unique name
272
     * @param geomOp
273
     *            Specific GeometryOperation's instance implementing this
274
     *            operation
275
     * @param subType
276
     *            SubType of geometry. Must be a value defined in
277
     *            {@link Geometry.SUBTYPES}
278
     * @return Index assigned to this operation. This index is used later to
279
     *         access the operation.
280
     */
281
    public int registerGeometryOperationBySubtype(String geomOpName,
282
        GeometryOperation geomOp, int subType);
254 283

  
255
	/**
256
	 * <p>
257
	 * Registers a Geometry implementation class with a predefined geometry type and returns the
258
	 * associated GeometryType instance. Available predefined types are defined in {@link Geometry.TYPES}
259
	 * and the subtypes are defined in {@link Geometry.SUBTYPES}.
260
	 * </p>
261
	 * <p>
262
	 * In this case the symbolic name will be the geometry's simple class name
263
	 * </p>
264
	 * How to register a new geometry type:
265
	 * <pre>
266
	 * GeometryType geomType = GeometryLocator.getGeometryManager().
267
	 *      registerBasicGeometryType(Point2D.class, Geometry.TYPES.POINT, Geometry.SYBTYPES.GEOM2D);
268
	 * </pre>
269
	 *
270
	 * @param geomClass Geometry implementation class. It must not be null and must implement Geometry,
271
	 * otherwise an exception is thrown.
272
	 * @param type
273
	 * Type of geometry. Must be a value defined in {@link Geometry.TYPES}
274
	 * @param subType
275
	 * SubType of geometry. Must be a value defined in {@link Geometry.SUBTYPES}
276
	 * @return Instance of GeometryType associated to the Geometry implementation class
277
	 * @throws IllegalArgumentException
278
	 *             If geomClass is null or does not implement Geometry
279
	 */
280
	public GeometryType registerGeometryType(Class geomClass, int type, int subType);
284
    /**
285
     * <p>
286
     * Registers a Geometry implementation class with a predefined geometry type
287
     * and returns the associated GeometryType instance. Available predefined
288
     * types are defined in {@link Geometry.TYPES} and the subtypes are defined
289
     * in {@link Geometry.SUBTYPES}.
290
     * </p>
291
     * <p>
292
     * How to register a geometry class with a predefined type:
293
     * 
294
     * <pre>
295
     * 
296
     * GeometryType geomType = GeometryLocator.getGeometryManager()
297
     *     .registerBasicGeometryType(Point2D.class, &quot;Point2D&quot;, Geometry.TYPES.POINT,
298
     *         Geometry.SYBTYPES.GEOM2D);
299
     * </pre>
300
     * 
301
     * </p>
302
     * 
303
     * @param geomClass
304
     *            Geometry subclass. It must not be null and must implement
305
     *            Geometry, otherwise an exception
306
     *            is raised.
307
     * @param name
308
     *            Symbolic name for the geometry type, it can be null. If it is
309
     *            null then the symbolic name
310
     *            will be the simple class name.
311
     * @param type
312
     *            Type of geometry. Must be a value defined in
313
     *            {@link Geometry.TYPES}
314
     * @param subType
315
     *            SubType of geometry. Must be a value defined in
316
     *            {@link Geometry.SUBTYPES}
317
     * @return Instance of GeometryType associated to the Geometry
318
     *         implementation class
319
     *         geomClass
320
     * @throws IllegalArgumentException
321
     *             If geomClass is null or does not implement Geometry
322
     */
323
    public GeometryType registerGeometryType(Class geomClass, String name,
324
        int type, int subType);
281 325

  
282
	/**
283
	 * <p>
284
	 * Returns an instance of GeometryType given the Geometry type
285
	 * and the subtype.
286
	 * </p>
287
	 * @param type
288
	 * Type of geometry. Must be a value defined in {@link Geometry.TYPES}
289
	 * @param subType
290
	 * SubType of geometry. Must be a value defined in {@link Geometry.SUBTYPES}
291
	 * @return Instance of GeometryType associated to the type and the subtype
292
	 * @throws GeometryTypeNotSupportedException
293
	 * Returns this exception if there is not a registered geometry with
294
	 * these type and subtype
295
	 * @throws GeometryTypeNotValidException
296
	 * Returns if the type and subtype are not valid
297
	 */
298
	public GeometryType getGeometryType(int type, int subType) throws GeometryTypeNotSupportedException, GeometryTypeNotValidException;
326
    /**
327
     * <p>
328
     * Registers a Geometry implementation class with a predefined geometry type
329
     * and returns the associated GeometryType instance. Available predefined
330
     * types are defined in {@link Geometry.TYPES} and the subtypes are defined
331
     * in {@link Geometry.SUBTYPES}.
332
     * </p>
333
     * <p>
334
     * In this case the symbolic name will be the geometry's simple class name
335
     * </p>
336
     * How to register a new geometry type:
337
     * 
338
     * <pre>
339
     * 
340
     * GeometryType geomType = GeometryLocator.getGeometryManager()
341
     *     .registerBasicGeometryType(Point2D.class, Geometry.TYPES.POINT,
342
     *         Geometry.SYBTYPES.GEOM2D);
343
     * </pre>
344
     * 
345
     * @param geomClass
346
     *            Geometry implementation class. It must not be null and must
347
     *            implement Geometry,
348
     *            otherwise an exception is thrown.
349
     * @param type
350
     *            Type of geometry. Must be a value defined in
351
     *            {@link Geometry.TYPES}
352
     * @param subType
353
     *            SubType of geometry. Must be a value defined in
354
     *            {@link Geometry.SUBTYPES}
355
     * @return Instance of GeometryType associated to the Geometry
356
     *         implementation class
357
     * @throws IllegalArgumentException
358
     *             If geomClass is null or does not implement Geometry
359
     */
360
    public GeometryType registerGeometryType(Class geomClass, int type,
361
        int subType);
299 362

  
300
	/**
301
	 * <p>
302
	 * This method creates a {@link Geometry} with the type specified
303
	 * by this GeometryType. The geometry is empty, and all the internal
304
	 * attributes must be assigned to a value when the geometry has
305
	 * been created.
306
	 * </p>
307
	 * <p>
308
	 * This example creates a point2D and sets the coordinates to 1,1:
309
	 *
310
	 * <pre>
311
	 * Point point = (Point)GeometryLocator
312
	 * 		.getGeometryManager().create(GEOMETRY.TYPES.POINT, GEOMETRY.SUBTYPES.GEOM2D);
313
	 * 	point.setX(1);
314
	 * 	point.setY(1);
315
	 * </pre>
316
	 * </p>
317
	 * @param geomType
318
	 * The geometry type
319
	 * @return
320
	 * A instance of a geometry.
321
	 * @throws CreateGeometryException
322
	 * This exception is thrown when the manager can not create
323
	 * the geometry.
324
	 */
325
	public Geometry create(GeometryType geomType) throws CreateGeometryException;
363
    /**
364
     * <p>
365
     * Returns an instance of GeometryType given the Geometry type and the
366
     * subtype.
367
     * </p>
368
     * 
369
     * @param type
370
     *            Type of geometry. Must be a value defined in
371
     *            {@link Geometry.TYPES}
372
     * @param subType
373
     *            SubType of geometry. Must be a value defined in
374
     *            {@link Geometry.SUBTYPES}
375
     * @return Instance of GeometryType associated to the type and the subtype
376
     * @throws GeometryTypeNotSupportedException
377
     *             Returns this exception if there is not a registered geometry
378
     *             with
379
     *             these type and subtype
380
     * @throws GeometryTypeNotValidException
381
     *             Returns if the type and subtype are not valid
382
     */
383
    public GeometryType getGeometryType(int type, int subType)
384
        throws GeometryTypeNotSupportedException, GeometryTypeNotValidException;
326 385

  
327
	/**
328
	 * <p>
329
	 * Creates a Envelope with a concrete subtype. The envelope is empty
330
	 * and it have to be filled with the corners once has been created.
331
	 * </p>
332
	 * @param subType
333
	 * SubType of envelope. Must be a value defined in {@link Geometry.SUBTYPES}
334
	 * @return
335
	 * A Envelope
336
	 * @throws CreateEnvelopeException
337
	 * If it is not possible to create the envelope.
338
	 */
339
	public Envelope createEnvelope(int subType) throws CreateEnvelopeException;
386
    /**
387
     * <p>
388
     * This method creates a {@link Geometry} with the type specified by this
389
     * GeometryType. The geometry is empty, and all the internal attributes must
390
     * be assigned to a value when the geometry has been created.
391
     * </p>
392
     * <p>
393
     * This example creates a point2D and sets the coordinates to 1,1:
394
     * 
395
     * <pre>
396
     * Point point =
397
     *     (Point) GeometryLocator.getGeometryManager().create(GEOMETRY.TYPES.POINT,
398
     *         GEOMETRY.SUBTYPES.GEOM2D);
399
     * point.setX(1);
400
     * point.setY(1);
401
     * </pre>
402
     * 
403
     * </p>
404
     * 
405
     * @param geomType
406
     *            The geometry type
407
     * @return
408
     *         A instance of a geometry.
409
     * @throws CreateGeometryException
410
     *             This exception is thrown when the manager can not create
411
     *             the geometry.
412
     */
413
    public Geometry create(GeometryType geomType)
414
        throws CreateGeometryException;
340 415

  
341
	/**
342
	 * <p>
343
	 * Creates a Envelope with a concrete subtype. It sets the values
344
	 * for the lower corner and the upper corner (in 2D) using the
345
	 * method parameters.
346
	 * </p>
347
	 * @param minX
348
	 * The minimum value for the X coordinate.
349
	 * @param minY
350
	 * The minimum value for the Y coordinate.
351
	 * @param maxX
352
	 * The maximum value for the X coordinate.
353
	 * @param maxY
354
	 * The maximum value for the Y coordinate.
355
	 * @param subType
356
	 * SubType of envelope. Must be a value defined in {@link Geometry.SUBTYPES}
357
	 * @return
358
	 * @throws CreateEnvelopeException
359
	 */
360
	public Envelope createEnvelope(double minX, double minY, double maxX, double maxY, int subType) throws CreateEnvelopeException;
416
    /**
417
     * <p>
418
     * Creates a Envelope with a concrete subtype. The envelope is empty and it
419
     * have to be filled with the corners once has been created.
420
     * </p>
421
     * 
422
     * @param subType
423
     *            SubType of envelope. Must be a value defined in
424
     *            {@link Geometry.SUBTYPES}
425
     * @return
426
     *         A Envelope
427
     * @throws CreateEnvelopeException
428
     *             If it is not possible to create the envelope.
429
     */
430
    public Envelope createEnvelope(int subType) throws CreateEnvelopeException;
361 431

  
362
	/**
363
	 * <p>
364
	 * This method creates a {@link Geometry} with the type specified
365
	 * by this name. If a geometry with this name doesn't exist, a
366
	 * {@link IllegalArgumentException} is thrown. The geometry is empty,
367
	 * and all the internal attributes must be assigned to a value when
368
	 * the geometry has  been created.
369
	 * </p>
370
	 * <p>
371
	 * This example creates a point2D and sets the coordinates to 1,1:
372
	 * It supposes that there is a Point2D class with name "Point2D".
373
	 * </p>
374
	 * <pre>
375
	 * Point point = (Point)GeometryLocator
376
	 * 		.getGeometryManager().create("Point2D");
377
	 * point.setX(1);
378
	 * point.setY(1);
379
	 * </pre>
380
	 *
381
	 * @param name
382
	 * The name of the geometry type
383
	 * @return
384
	 * A instance of a geometry.
385
	 * @throws CreateGeometryException
386
	 * This exception is thrown when the manager can not create
387
	 * the geometry.
388
	 */
389
	public Geometry create(String name) throws CreateGeometryException;
432
    /**
433
     * <p>
434
     * Creates a Envelope with a concrete subtype. It sets the values for the
435
     * lower corner and the upper corner (in 2D) using the method parameters.
436
     * </p>
437
     * 
438
     * @param minX
439
     *            The minimum value for the X coordinate.
440
     * @param minY
441
     *            The minimum value for the Y coordinate.
442
     * @param maxX
443
     *            The maximum value for the X coordinate.
444
     * @param maxY
445
     *            The maximum value for the Y coordinate.
446
     * @param subType
447
     *            SubType of envelope. Must be a value defined in
448
     *            {@link Geometry.SUBTYPES}
449
     * @return
450
     * @throws CreateEnvelopeException
451
     */
452
    public Envelope createEnvelope(double minX, double minY, double maxX,
453
        double maxY, int subType) throws CreateEnvelopeException;
390 454

  
391
	/**
392
	 * Create a geometry from a WKT definition.
393
	 * 
394
	 * This is a utility method to wrap the invocation to the operation
395
	 * {@link OPERATIONS#FROMWKT}.
396
	 * 
397
	 * @param wkt geometry in Well-known text format 
398
	 * 
399
	 * @return the geometry as a Geometry
400
	 * 
401
	 * @throws CreateGeometryException
402
	 * @throws GeometryException 
403
	 */
404
	public Geometry createFrom(String wkt, String srs) throws CreateGeometryException, GeometryException;
455
    /**
456
     * <p>
457
     * This method creates a {@link Geometry} with the type specified by this
458
     * name. If a geometry with this name doesn't exist, a
459
     * {@link IllegalArgumentException} is thrown. The geometry is empty, and
460
     * all the internal attributes must be assigned to a value when the geometry
461
     * has been created.
462
     * </p>
463
     * <p>
464
     * This example creates a point2D and sets the coordinates to 1,1: It
465
     * supposes that there is a Point2D class with name "Point2D".
466
     * </p>
467
     * 
468
     * <pre>
469
     * Point point = (Point) GeometryLocator.getGeometryManager().create(&quot;Point2D&quot;);
470
     * point.setX(1);
471
     * point.setY(1);
472
     * </pre>
473
     * 
474
     * @param name
475
     *            The name of the geometry type
476
     * @return
477
     *         A instance of a geometry.
478
     * @throws CreateGeometryException
479
     *             This exception is thrown when the manager can not create
480
     *             the geometry.
481
     */
482
    public Geometry create(String name) throws CreateGeometryException;
405 483

  
406
	public Geometry createFrom(String wkt) throws CreateGeometryException, GeometryException;
484
    /**
485
     * Create a geometry from a WKT definition.
486
     * 
487
     * This is a utility method to wrap the invocation to the operation
488
     * {@link OPERATIONS#FROMWKT}.
489
     * 
490
     * @param wkt
491
     *            geometry in Well-known text format
492
     * 
493
     * @return the geometry as a Geometry
494
     * 
495
     * @throws CreateGeometryException
496
     * @throws GeometryException
497
     */
498
    public Geometry createFrom(String wkt, String srs)
499
        throws CreateGeometryException, GeometryException;
407 500

  
408
	/**
409
	 * Create a geometry from a WKB definition.
410
	 * 
411
	 * This is a utility method to wrap the invocation to the operation
412
	 * {@link OPERATIONS#FROMWKB}.
413
	 * 
414
	 * @param wkb geometry in well-known binary format 
415
	 * 
416
	 * @return the geometry as a Geometry
417
	 * 
418
	 * @throws CreateGeometryException
419
	 * @throws GeometryException 
420
	 */
421
	public Geometry createFrom(byte[] wkb) throws CreateGeometryException, GeometryException;
422
	
423
	/**
424
	 * <p>
425
	 * This method creates a {@link Geometry} with a concrete type and subtype.
426
	 * The geometry is empty, and all the internal attributes must be assigned
427
	 * to a value when the geometry has  been created.
428
	 * </p>
429
	 * <p>
430
	 * This example creates a point2D and sets the coordinates to 1,1.
431
	 * It supposes that there is a Point2D class with the id 1.
432
	 * </p>
433
	 * <pre>
434
	 * Point point = (Point)GeometryLocator
435
	 * 		.getGeometryManager().create(Geometry.TYPES.POINT, Geometry.SYBTYPES.GEOM2D);
436
	 * 	point.setX(1);
437
	 * 	point.setY(1);
438
	 * </pre>
439
	 * @param type
440
	 * Type of geometry. Must be a value defined in {@link Geometry.TYPES}
441
	 * @param subType
442
	 * SubType of geometry. Must be a value defined in {@link Geometry.SUBTYPES}
443
	 * @return
444
	 * A instance of a geometry.
445
	 * @throws CreateGeometryException
446
	 * This exception is thrown when the manager can not create
447
	 * the geometry.
448
	 */
449
	public Geometry create(int type, int subType) throws CreateGeometryException;
501
    public Geometry createFrom(String wkt) throws CreateGeometryException,
502
        GeometryException;
450 503

  
451
	/**
452
	 * <p>
453
	 * It creates a null geometry with a concrete subtype.
454
	 * <p>
455
	 * @param subType
456
	 * SubType of geometry. Must be a value defined in {@link Geometry.SUBTYPES}
457
	 * @return
458
	 * A NullGeometry
459
	 * @throws CreateGeometryException
460
	 * This exception is thrown when the manager can not create
461
	 * the geometry.
462
	 */
463
	public NullGeometry createNullGeometry(int subType) throws CreateGeometryException;
504
    /**
505
     * Create a geometry from a WKB definition.
506
     * 
507
     * This is a utility method to wrap the invocation to the operation
508
     * {@link OPERATIONS#FROMWKB}.
509
     * 
510
     * @param wkb
511
     *            geometry in well-known binary format
512
     * 
513
     * @return the geometry as a Geometry
514
     * 
515
     * @throws CreateGeometryException
516
     * @throws GeometryException
517
     */
518
    public Geometry createFrom(byte[] wkb) throws CreateGeometryException,
519
        GeometryException;
464 520

  
465
	/**
466
	 * <p>
467
	 * Create a new point with a concrete type and sets the value
468
	 * for the X and the Y.
469
	 * </p>
470
	 * @param x
471
	 * The X coordinate
472
	 * @param y
473
	 * The y coordinate
474
	 * @param subType
475
	 * SubType of geometry. Must be a value defined in {@link Geometry.SUBTYPES}
476
	 * @throws CreateGeometryException
477
	 * This exception is thrown when the manager can not create
478
	 * the geometry.
479
	 * @return
480
	 * The Point
481
	 */
482
	public Point createPoint(double x, double y, int subType) throws CreateGeometryException;
521
    /**
522
     * <p>
523
     * This method creates a {@link Geometry} with a concrete type and subtype.
524
     * The geometry is empty, and all the internal attributes must be assigned
525
     * to a value when the geometry has been created.
526
     * </p>
527
     * <p>
528
     * This example creates a point2D and sets the coordinates to 1,1. It
529
     * supposes that there is a Point2D class with the id 1.
530
     * </p>
531
     * 
532
     * <pre>
533
     * Point point =
534
     *     (Point) GeometryLocator.getGeometryManager().create(Geometry.TYPES.POINT,
535
     *         Geometry.SYBTYPES.GEOM2D);
536
     * point.setX(1);
537
     * point.setY(1);
538
     * </pre>
539
     * 
540
     * @param type
541
     *            Type of geometry. Must be a value defined in
542
     *            {@link Geometry.TYPES}
543
     * @param subType
544
     *            SubType of geometry. Must be a value defined in
545
     *            {@link Geometry.SUBTYPES}
546
     * @return
547
     *         A instance of a geometry.
548
     * @throws CreateGeometryException
549
     *             This exception is thrown when the manager can not create
550
     *             the geometry.
551
     */
552
    public Geometry create(int type, int subType)
553
        throws CreateGeometryException;
483 554

  
484
	/**
485
	 * <p>
486
	 * Create a new curve with a concrete type and sets the value
487
	 * for the coordinates using a GeneralPathX.
488
	 * </p>
489
	 * @param generalPathX
490
	 * It is used to set the values for the X and Y coordinates.
491
	 * @param subType
492
	 * SubType of geometry. Must be a value defined in {@link Geometry.SUBTYPES}
493
	 * @return
494
	 * A curve
495
	 * @throws CreateGeometryException
496
	 * This exception is thrown when the manager can not create
497
	 * the geometry.
498
	 */
499
	public Curve createCurve(GeneralPathX generalPathX, int subType) throws CreateGeometryException;
555
    /**
556
     * <p>
557
     * It creates a null geometry with a concrete subtype.
558
     * <p>
559
     * 
560
     * @param subType
561
     *            SubType of geometry. Must be a value defined in
562
     *            {@link Geometry.SUBTYPES}
563
     * @return
564
     *         A NullGeometry
565
     * @throws CreateGeometryException
566
     *             This exception is thrown when the manager can not create
567
     *             the geometry.
568
     */
569
    public NullGeometry createNullGeometry(int subType)
570
        throws CreateGeometryException;
500 571

  
572
    /**
573
     * <p>
574
     * Create a new point with a concrete type and sets the value for the X and
575
     * the Y.
576
     * </p>
577
     * 
578
     * @param x
579
     *            The X coordinate
580
     * @param y
581
     *            The y coordinate
582
     * @param subType
583
     *            SubType of geometry. Must be a value defined in
584
     *            {@link Geometry.SUBTYPES}
585
     * @throws CreateGeometryException
586
     *             This exception is thrown when the manager can not create
587
     *             the geometry.
588
     * @return
589
     *         The Point
590
     */
591
    public Point createPoint(double x, double y, int subType)
592
        throws CreateGeometryException;
501 593

  
502
	/**
503
	 * <p>
504
	 * Create a new multicurve with a concrete type and sets the value for the
505
	 * coordinates using a GeneralPathX.
506
	 * </p>
507
	 *
508
	 * @param generalPathX
509
	 *            It is used to set the values for the X and Y coordinates.
510
	 * @param subType
511
	 *            SubType of geometry. Must be a value defined in
512
	 *            {@link Geometry.SUBTYPES}
513
	 * @return A multicurve
514
	 * @throws CreateGeometryException
515
	 *             This exception is thrown when the manager can not create the
516
	 *             geometry.
517
	 */
518
	public MultiCurve createMultiCurve(GeneralPathX generalPathX, int subType) throws CreateGeometryException;
594
    /**
595
     * <p>
596
     * Create a new curve with a concrete type and sets the value for the
597
     * coordinates using a GeneralPathX.
598
     * </p>
599
     * 
600
     * @param generalPathX
601
     *            It is used to set the values for the X and Y coordinates.
602
     * @param subType
603
     *            SubType of geometry. Must be a value defined in
604
     *            {@link Geometry.SUBTYPES}
605
     * @return
606
     *         A curve
607
     * @throws CreateGeometryException
608
     *             This exception is thrown when the manager can not create
609
     *             the geometry.
610
     */
611
    public Curve createCurve(GeneralPathX generalPathX, int subType)
612
        throws CreateGeometryException;
519 613

  
614
    /**
615
     * <p>
616
     * Create a new multicurve with a concrete type and sets the value for the
617
     * coordinates using a GeneralPathX.
618
     * </p>
619
     * 
620
     * @param generalPathX
621
     *            It is used to set the values for the X and Y coordinates.
622
     * @param subType
623
     *            SubType of geometry. Must be a value defined in
624
     *            {@link Geometry.SUBTYPES}
625
     * @return A multicurve
626
     * @throws CreateGeometryException
627
     *             This exception is thrown when the manager can not create the
628
     *             geometry.
629
     */
630
    public MultiCurve createMultiCurve(GeneralPathX generalPathX, int subType)
631
        throws CreateGeometryException;
520 632

  
521
	/**
522
	 * <p>
523
	 * Create a new surface with a concrete type and sets the value
524
	 * for the coordinates using a GeneralPathX.
525
	 * </p>
526
	 * @param generalPathX
527
	 * It is used to set the values for the X and Y coordinates.
528
	 * @param subType
529
	 * SubType of geometry. Must be a value defined in {@link Geometry.SUBTYPES}
530
	 * @return
531
	 * A surface
532
	 * @throws CreateGeometryException
533
	 * This exception is thrown when the manager can not create
534
	 * the geometry.
535
	 */
536
	public Surface createSurface(GeneralPathX generalPathX, int subType) throws CreateGeometryException;
633
    /**
634
     * <p>
635
     * Create a new surface with a concrete type and sets the value for the
636
     * coordinates using a GeneralPathX.
637
     * </p>
638
     * 
639
     * @param generalPathX
640
     *            It is used to set the values for the X and Y coordinates.
641
     * @param subType
642
     *            SubType of geometry. Must be a value defined in
643
     *            {@link Geometry.SUBTYPES}
644
     * @return
645
     *         A surface
646
     * @throws CreateGeometryException
647
     *             This exception is thrown when the manager can not create
648
     *             the geometry.
649
     */
650
    public Surface createSurface(GeneralPathX generalPathX, int subType)
651
        throws CreateGeometryException;
537 652

  
538
	/**
539
	 * <p>
540
	 * Create a new multisurface with a concrete type and sets the value for the
541
	 * coordinates using a GeneralPathX.
542
	 * </p>
543
	 * 
544
	 * @param generalPathX
545
	 *            It is used to set the values for the X and Y coordinates.
546
	 * @param subType
547
	 *            SubType of geometry. Must be a value defined in
548
	 *            {@link Geometry.SUBTYPES}
549
	 * @return A multisurface
550
	 * @throws CreateGeometryException
551
	 *             This exception is thrown when the manager can not create the
552
	 *             geometry.
553
	 */
554
	public MultiSurface createMultiSurface(GeneralPathX generalPathX, int subType) throws CreateGeometryException;
653
    /**
654
     * <p>
655
     * Create a new multisurface with a concrete type and sets the value for the
656
     * coordinates using a GeneralPathX.
657
     * </p>
658
     * 
659
     * @param generalPathX
660
     *            It is used to set the values for the X and Y coordinates.
661
     * @param subType
662
     *            SubType of geometry. Must be a value defined in
663
     *            {@link Geometry.SUBTYPES}
664
     * @return A multisurface
665
     * @throws CreateGeometryException
666
     *             This exception is thrown when the manager can not create the
667
     *             geometry.
668
     */
669
    public MultiSurface createMultiSurface(GeneralPathX generalPathX,
670
        int subType) throws CreateGeometryException;
555 671

  
556
	/**
557
	 * <p>
558
	 * Returns an operation given the Geometry type, the Geometry subtype and and the operation
559
	 * code. If opCode corresponds to a common operation (a common operation is an operation
560
	 * registered for all geometries), then this method returns the common operation.
561
	 * </p>
562
	 * <p>
563
	 * For better performance, if you need to call an operation multiple times,
564
	 * use this method only once and keep the returned object in a local variable
565
	 * over which you can iterate. For instance:
566
	 *
567
	 * <pre>
568
	 * // Get the operation you need
569
	 * GeometryManager gm = GeometryLocator.getGeometryManager()
570
	 * GeometryOperation geomOp = null;
571
	 * try {
572
	 *    geomOp = gm.getGeometryOperation(Draw2D.CODE);
573
	 * } catch (GeometryTypeNotSupportedException gtnse) {
574
	 *    // treat exception
575
	 * } catch (GeometryOperationNotSupportedException gonse) {
576
	 *    // treat exception
577
	 * }
578
	 *
579
	 *  // Fill the operation context with required params
580
	 * GeometryOperationContext ctx = new GeometryOperationContext();
581
	 *
582
	 *  // Here is the main loop where you call the operation
583
	 * for (int i=0; i<MyGeometries.length; i++) {
584
	 *    Object result = geomOp.invoke(myGeometries[i], ctx);
585
	 * }
586
	 * </pre>
587
	 * </p>
588
	 * @param opCode
589
	 * The operation code
590
	 * @param type
591
	 * Type of geometry. Must be a value defined in {@link Geometry.TYPES}
592
	 * @param subType
593
	 * SubType of geometry. Must be a value defined in {@link Geometry.SUBTYPES}
594
	 * @return Geometry operation
595
	 * @throws GeometryTypeNotSupportedException
596
	 * Returns this exception if there is not a registered geometry with
597
	 * these type and subtype
598
	 * @throws GeometryTypeNotValidException
599
	 * Returns this exception if the type and subtype are not valid
600
	 * @throws GeometryOperationNotSupportedException
601
	 * Returns this exception if there is not a registered operation with
602
	 * this operation code
603
	 */
604
	public GeometryOperation getGeometryOperation(int opCode, int type, int subType) throws GeometryTypeNotSupportedException, GeometryOperationNotSupportedException, GeometryTypeNotValidException;
672
    /**
673
     * <p>
674
     * Returns an operation given the Geometry type, the Geometry subtype and
675
     * and the operation code. If opCode corresponds to a common operation (a
676
     * common operation is an operation registered for all geometries), then
677
     * this method returns the common operation.
678
     * </p>
679
     * <p>
680
     * For better performance, if you need to call an operation multiple times,
681
     * use this method only once and keep the returned object in a local
682
     * variable over which you can iterate. For instance:
683
     * 
684
     * <pre>
685
     * // Get the operation you need
686
     * GeometryManager gm = GeometryLocator.getGeometryManager()
687
     * GeometryOperation geomOp = null;
688
     * try {
689
     *    geomOp = gm.getGeometryOperation(Draw2D.CODE);
690
     * } catch (GeometryTypeNotSupportedException gtnse) {
691
     *    // treat exception
692
     * } catch (GeometryOperationNotSupportedException gonse) {
693
     *    // treat exception
694
     * }
695
     * 
696
     *  // Fill the operation context with required params
697
     * GeometryOperationContext ctx = new GeometryOperationContext();
698
     * 
699
     *  // Here is the main loop where you call the operation
700
     * for (int i=0; i<MyGeometries.length; i++) {
701
     *    Object result = geomOp.invoke(myGeometries[i], ctx);
702
     * }
703
     * </pre>
704
     * 
705
     * </p>
706
     * 
707
     * @param opCode
708
     *            The operation code
709
     * @param type
710
     *            Type of geometry. Must be a value defined in
711
     *            {@link Geometry.TYPES}
712
     * @param subType
713
     *            SubType of geometry. Must be a value defined in
714
     *            {@link Geometry.SUBTYPES}
715
     * @return Geometry operation
716
     * @throws GeometryTypeNotSupportedException
717
     *             Returns this exception if there is not a registered geometry
718
     *             with
719
     *             these type and subtype
720
     * @throws GeometryTypeNotValidException
721
     *             Returns this exception if the type and subtype are not valid
722
     * @throws GeometryOperationNotSupportedException
723
     *             Returns this exception if there is not a registered operation
724
     *             with
725
     *             this operation code
726
     */
727
    public GeometryOperation getGeometryOperation(int opCode, int type,
728
        int subType) throws GeometryTypeNotSupportedException,
729
        GeometryOperationNotSupportedException, GeometryTypeNotValidException;
605 730

  
606
	/**
607
	 * <p>
608
	 * Invokes an operation given its code, the geometry and the operation context holding the
609
	 * parameters required for the operation.
610
	 * </p>
611
	 * @param opCode
612
	 * Operation code.
613
	 * @param geom
614
	 * Geometry to which apply the operation
615
	 * @param ctx
616
	 * Context holding the operation parameters
617
	 * @return
618
	 * The object returned by an operation, depends on each operation.
619
	 */
620
	public Object invokeOperation(int opCode, Geometry geom, GeometryOperationContext ctx) throws GeometryOperationNotSupportedException, GeometryOperationException;
731
    /**
732
     * <p>
733
     * Invokes an operation given its code, the geometry and the operation
734
     * context holding the parameters required for the operation.
735
     * </p>
736
     * 
737
     * @param opCode
738
     *            Operation code.
739
     * @param geom
740
     *            Geometry to which apply the operation
741
     * @param ctx
742
     *            Context holding the operation parameters
743
     * @return
744
     *         The object returned by an operation, depends on each operation.
745
     */
746
    public Object invokeOperation(int opCode, Geometry geom,
747
        GeometryOperationContext ctx)
748
        throws GeometryOperationNotSupportedException,
749
        GeometryOperationException;
621 750

  
622
	/**
623
	 * <p>
624
	 * Invokes an operation given its code, the geometry and the operation context holding the
625
	 * parameters required for the operation.
626
	 * </p>
627
	 * @param geomOpName
628
	 * Operation name.
629
	 * @param geom
630
	 * Geometry to which apply the operation
631
	 * @param ctx
632
	 * Context holding the operation parameters
633
	 * @return
634
	 * The object returned by an operation, depends on each operation.
635
	 */
636
	public Object invokeOperation(String geomOpName, Geometry geom, GeometryOperationContext ctx) throws GeometryOperationNotSupportedException, GeometryOperationException;
637
	
638
	/**
639
	 * <p>
640
	 * Invokes an operation given its code, the geometry and the operation context holding the
641
	 * parameters required for the operation.
642
	 * </p>
643
	 * @param geomOpName
644
	 * Operation name.
645
	 * @param ctx
646
	 * Context holding the operation parameters
647
	 * @return
648
	 * The object returned by an operation, depends on each operation.
649
	 */
650
	public Object invokeOperation(String geomOpName, GeometryOperationContext ctx) throws GeometryOperationNotSupportedException, GeometryOperationException;
651
	
652
	/**
653
	 * <p>
654
	 * Registers the unique name of one operation. If it already exists 
655
	 * then this method does nothing but returning the name's corresponding 
656
	 * index.
657
	 * </p>
658
	 * <p>
659
	 * By convention this method is used to set the value of the final and static 
660
	 * variable that is located in the classes that implements the operation:<BR>	
661
	 * <pre>
662
	 * public class MyOperation extends GeometryOperation {
663
	 *   public static final int CODE =
664
	 *     GeometryLocator.getGeometryManager()
665
	 *        .getGeometryOperationCode("MyOperation");
666
	 * }
667
	 * </pre>
668
	 * </p>
669
	 * @param geomOpName
670
	 * Name used to register the geometry operation
671
	 * @return
672
	 * Index assigned to the operation name passed as parameter
673
	 */
674
	public int getGeometryOperationCode(String geomOpName);
675
	
676
	/**
677
	 * Returns a list with the name of the operations that have been
678
	 * registered.
679
	 * @return
680
	 * A list of the registered operations.
681
	 */
682
	public List getGeometryOperationNames();
683
	
684
	/**
685
	 * Returns the flatness used to convert a curve is a set
686
	 * of points.
687
	 * @return
688
	 * The flatness.
689
	 */
690
	public double getFlatness();
691
	
692
	/**
693
	 * Sets the application flatness.
694
	 * @param flatness
695
	 * The flatness to set
696
	 */
697
	public void setFlatness(double flatness);	
751
    /**
752
     * <p>
753
     * Invokes an operation given its code, the geometry and the operation
754
     * context holding the parameters required for the operation.
755
     * </p>
756
     * 
757
     * @param geomOpName
758
     *            Operation name.
759
     * @param geom
760
     *            Geometry to which apply the operation
761
     * @param ctx
762
     *            Context holding the operation parameters
763
     * @return
764
     *         The object returned by an operation, depends on each operation.
765
     */
766
    public Object invokeOperation(String geomOpName, Geometry geom,
767
        GeometryOperationContext ctx)
768
        throws GeometryOperationNotSupportedException,
769
        GeometryOperationException;
770

  
771
    /**
772
     * <p>
773
     * Invokes an operation given its code, the geometry and the operation
774
     * context holding the parameters required for the operation.
775
     * </p>
776
     * 
777
     * @param geomOpName
778
     *            Operation name.
779
     * @param ctx
780
     *            Context holding the operation parameters
781
     * @return
782
     *         The object returned by an operation, depends on each operation.
783
     */
784
    public Object invokeOperation(String geomOpName,
785
        GeometryOperationContext ctx)
786
        throws GeometryOperationNotSupportedException,
787
        GeometryOperationException;
788

  
789
    /**
790
     * <p>
791
     * Registers the unique name of one operation. If it already exists then
792
     * this method does nothing but returning the name's corresponding index.
793
     * </p>
794
     * <p>
795
     * By convention this method is used to set the value of the final and
796
     * static variable that is located in the classes that implements the
797
     * operation:<BR>
798
     * 
799
     * <pre>
800
     * 
801
     * public class MyOperation extends GeometryOperation {
802
     * 
803
     *     public static final int CODE = GeometryLocator.getGeometryManager()
804
     *         .getGeometryOperationCode(&quot;MyOperation&quot;);
805
     * }
806
     * </pre>
807
     * 
808
     * </p>
809
     * 
810
     * @param geomOpName
811
     *            Name used to register the geometry operation
812
     * @return
813
     *         Index assigned to the operation name passed as parameter
814
     */
815
    public int getGeometryOperationCode(String geomOpName);
816

  
817
    /**
818
     * Returns a list with the name of the operations that have been
819
     * registered.
820
     * 
821
     * @return
822
     *         A list of the registered operations.
823
     */
824
    public List getGeometryOperationNames();
825

  
826
    /**
827
     * Returns the flatness used to convert a curve is a set
828
     * of points.
829
     * 
830
     * @return
831
     *         The flatness.
832
     */
833
    public double getFlatness();
834

  
835
    /**
836
     * Sets the application flatness.
837
     * 
838
     * @param flatness
839
     *            The flatness to set
840
     */
841
    public void setFlatness(double flatness);
698 842
}

Also available in: Unified diff