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 @ 41610
History | View | Annotate | Download (47.6 KB)
1 |
/**
|
---|---|
2 |
* gvSIG. Desktop Geographic Information System.
|
3 |
*
|
4 |
* Copyright (C) 2007-2013 gvSIG Association.
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU General Public License
|
8 |
* as published by the Free Software Foundation; either version 3
|
9 |
* of the License, or (at your option) any later version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
* GNU General Public License for more details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License
|
17 |
* along with this program; if not, write to the Free Software
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 |
* MA 02110-1301, USA.
|
20 |
*
|
21 |
* For any additional information, do not hesitate to contact us
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
23 |
*/
|
24 |
package org.gvsig.fmap.geom; |
25 |
|
26 |
import java.awt.geom.PathIterator; |
27 |
import java.util.List; |
28 |
|
29 |
import org.gvsig.fmap.geom.aggregate.MultiCurve; |
30 |
import org.gvsig.fmap.geom.aggregate.MultiLine; |
31 |
import org.gvsig.fmap.geom.aggregate.MultiPoint; |
32 |
import org.gvsig.fmap.geom.aggregate.MultiPolygon; |
33 |
import org.gvsig.fmap.geom.aggregate.MultiPrimitive; |
34 |
import org.gvsig.fmap.geom.aggregate.MultiSurface; |
35 |
import org.gvsig.fmap.geom.exception.CreateEnvelopeException; |
36 |
import org.gvsig.fmap.geom.exception.CreateGeometryException; |
37 |
import org.gvsig.fmap.geom.operation.GeometryOperation; |
38 |
import org.gvsig.fmap.geom.operation.GeometryOperationContext; |
39 |
import org.gvsig.fmap.geom.operation.GeometryOperationException; |
40 |
import org.gvsig.fmap.geom.operation.GeometryOperationNotSupportedException; |
41 |
import org.gvsig.fmap.geom.primitive.Curve; |
42 |
import org.gvsig.fmap.geom.primitive.Envelope; |
43 |
import org.gvsig.fmap.geom.primitive.GeneralPathX; |
44 |
import org.gvsig.fmap.geom.primitive.IGeneralPathX; |
45 |
import org.gvsig.fmap.geom.primitive.Line; |
46 |
import org.gvsig.fmap.geom.primitive.NullGeometry; |
47 |
import org.gvsig.fmap.geom.primitive.OrientablePrimitive; |
48 |
import org.gvsig.fmap.geom.primitive.Point; |
49 |
import org.gvsig.fmap.geom.primitive.Polygon; |
50 |
import org.gvsig.fmap.geom.primitive.Surface; |
51 |
import org.gvsig.fmap.geom.type.GeometryType; |
52 |
import org.gvsig.fmap.geom.type.GeometryTypeNotSupportedException; |
53 |
import org.gvsig.fmap.geom.type.GeometryTypeNotValidException; |
54 |
import org.gvsig.tools.dynobject.DynObject; |
55 |
import org.gvsig.tools.service.Manager; |
56 |
import org.gvsig.tools.service.ServiceException; |
57 |
import org.gvsig.tools.service.spi.ServiceManager; |
58 |
|
59 |
/**
|
60 |
* This singleton provides a centralized access to gvSIG's Geometry Model.
|
61 |
* Its responsibilities are:<br>
|
62 |
*
|
63 |
* <ul>
|
64 |
* <li>Offering a set of convenient methods for registering and retrieving
|
65 |
* geometry types.
|
66 |
* <li>Offering a set of convenient methods for registering and retrieving
|
67 |
* geometry operations associated to one or more geometry types.
|
68 |
* <li>Offering a set of convenient methods for registering and retrieving new
|
69 |
* geometries.
|
70 |
* </ul>
|
71 |
*
|
72 |
* @author jiyarza
|
73 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
|
74 |
*/
|
75 |
public interface GeometryManager extends Manager, ServiceManager { |
76 |
|
77 |
public interface OPERATIONS { |
78 |
|
79 |
public final static String FROMWKT = "FromWKT"; |
80 |
public final static String FROMWKB = "FromWKB"; |
81 |
} |
82 |
|
83 |
/**
|
84 |
* <p>
|
85 |
* Registers a GeometryOperation associated to a GeometryType. Returns an
|
86 |
* 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
|
91 |
* set using the method
|
92 |
* {@link GeometryManager#getGeometryOperationCode(String)}:<BR>
|
93 |
*
|
94 |
* <pre>
|
95 |
*
|
96 |
* public class MyOperation extends GeometryOperation {
|
97 |
*
|
98 |
* public static final int CODE = GeometryLocator.getGeometryManager()
|
99 |
* .getGeometryOperationCode("MyOperation");
|
100 |
* }
|
101 |
* </pre>
|
102 |
*
|
103 |
* </p>
|
104 |
*
|
105 |
* @param geomOpName
|
106 |
* Operation's unique name
|
107 |
* @param geomOp
|
108 |
* Specific GeometryOperation's instance implementing this
|
109 |
* operation
|
110 |
* @param geomType
|
111 |
* GeometryType instance to which this operation should be
|
112 |
* associated
|
113 |
* @return Index assigned to this operation. This index is used later to
|
114 |
* access the operation.
|
115 |
*
|
116 |
*/
|
117 |
public int registerGeometryOperation(String geomOpName, |
118 |
GeometryOperation geomOp, GeometryType geomType); |
119 |
|
120 |
/**
|
121 |
* <p>
|
122 |
* Registers a GeometryOperation that is common for all GeometryType
|
123 |
* (registered yet or not). Returns an unique index that is used later to
|
124 |
* identify and invoke the operation.
|
125 |
* </p>
|
126 |
* <p>
|
127 |
* By convention this index should be in a final and static variable in the
|
128 |
* class that implements the operation. The value of this variable must be
|
129 |
* set using the method
|
130 |
* {@link GeometryManager#getGeometryOperationCode(String)}:<BR>
|
131 |
*
|
132 |
* <pre>
|
133 |
*
|
134 |
* public class MyOperation extends GeometryOperation {
|
135 |
*
|
136 |
* public static final int CODE = GeometryLocator.getGeometryManager()
|
137 |
* .getGeometryOperationCode("MyOperation");
|
138 |
* }
|
139 |
* </pre>
|
140 |
*
|
141 |
* </p>
|
142 |
*
|
143 |
* @param geomOpName
|
144 |
* Operation's unique name
|
145 |
* @param geomOp
|
146 |
* Specific GeometryOperation's instance implementing this
|
147 |
* operation
|
148 |
* @return Index assigned to this operation. This index is used later to
|
149 |
* access the operation.
|
150 |
*/
|
151 |
public int registerGeometryOperation(String geomOpName, |
152 |
GeometryOperation geomOp); |
153 |
|
154 |
/**
|
155 |
* <p>
|
156 |
* Registers a GeometryOperation associated to a GeometryType, that has been
|
157 |
* specified using the type code and the subtype code. Returns an unique
|
158 |
* index that is used later to identify and invoke the operation.
|
159 |
* </p>
|
160 |
* <p>
|
161 |
* By convention this index should be in a final and static variable in the
|
162 |
* class that implements the operation. The value of this variable must be
|
163 |
* set using the method
|
164 |
* {@link GeometryManager#getGeometryOperationCode(String)}:<BR>
|
165 |
*
|
166 |
* <pre>
|
167 |
*
|
168 |
* public class MyOperation extends GeometryOperation {
|
169 |
*
|
170 |
* public static final int CODE = GeometryLocator.getGeometryManager()
|
171 |
* .getGeometryOperationCode("MyOperation");
|
172 |
* }
|
173 |
* </pre>
|
174 |
*
|
175 |
* </p>
|
176 |
* <p>
|
177 |
* This method is only used if you have not a reference to the GeometryType
|
178 |
* associated to the geometry class. If you have such reference then it is
|
179 |
* slightly faster to use the method that receives the GeometryType.<br>
|
180 |
* </p>
|
181 |
*
|
182 |
* @param geomOpName
|
183 |
* Operation's unique name
|
184 |
* @param geomOp
|
185 |
* Specific GeometryOperation's instance implementing this
|
186 |
* operation
|
187 |
* @param type
|
188 |
* Type of geometry. Must be a value defined in
|
189 |
* {@link Geometry.TYPES}
|
190 |
* @param subType
|
191 |
* SubType of geometry. Must be a value defined in
|
192 |
* {@link Geometry.SUBTYPES}
|
193 |
* @return Index assigned to this operation. This index is used later to
|
194 |
* access the operation.
|
195 |
* @throws GeometryTypeNotSupportedException
|
196 |
* Returns this exception if there is not a registered geometry
|
197 |
* with
|
198 |
* these type and subtype
|
199 |
* @throws GeometryTypeNotValidException
|
200 |
* Returns if the type and subtype are not valid
|
201 |
*/
|
202 |
public int registerGeometryOperation(String geomOpName, |
203 |
GeometryOperation geomOp, int type, int subType) |
204 |
throws GeometryTypeNotSupportedException, GeometryTypeNotValidException;
|
205 |
|
206 |
/**
|
207 |
* <p>
|
208 |
* Registers a GeometryOperation associated to all the geometries with a
|
209 |
* concrete type. Returns an unique index that is used later to identify and
|
210 |
* invoke the operation.<br>
|
211 |
* </p>
|
212 |
* <p>
|
213 |
* By convention this index should be in a final and static variable in the
|
214 |
* class that implements the operation. The value of this variable must be
|
215 |
* set using the method
|
216 |
* {@link GeometryManager#getGeometryOperationCode(String)}:<BR>
|
217 |
*
|
218 |
* <pre>
|
219 |
*
|
220 |
* public class MyOperation extends GeometryOperation {
|
221 |
*
|
222 |
* public static final int CODE = GeometryLocator.getGeometryManager()
|
223 |
* .getGeometryOperationCode("MyOperation");
|
224 |
* }
|
225 |
* </pre>
|
226 |
*
|
227 |
* </p>
|
228 |
*
|
229 |
* @param geomOpName
|
230 |
* Operation's unique name
|
231 |
* @param geomOp
|
232 |
* Specific GeometryOperation's instance implementing this
|
233 |
* operation
|
234 |
* @param type
|
235 |
* Type of geometry. Must be a value defined in
|
236 |
* {@link Geometry.TYPES}
|
237 |
* @return Index assigned to this operation. This index is used later to
|
238 |
* access the operation.
|
239 |
*/
|
240 |
public int registerGeometryOperation(String geomOpName, |
241 |
GeometryOperation geomOp, int type);
|
242 |
|
243 |
/**
|
244 |
* <p>
|
245 |
* Registers a GeometryOperation associated to all the geometries which
|
246 |
* super type matches with a concrete type. Returns an unique index that
|
247 |
* is used later to identify and invoke the operation.<br>
|
248 |
* </p>
|
249 |
* <p>
|
250 |
* By convention this index should be in a final and static variable in the
|
251 |
* class that implements the operation. The value of this variable must be
|
252 |
* set using the method
|
253 |
* {@link GeometryManager#getGeometryOperationCode(String)}:<BR>
|
254 |
*
|
255 |
* <pre>
|
256 |
*
|
257 |
* public class MyOperation extends GeometryOperation {
|
258 |
*
|
259 |
* public static final int CODE = GeometryLocator.getGeometryManager()
|
260 |
* .getGeometryOperationCode("MyOperation");
|
261 |
* }
|
262 |
* </pre>
|
263 |
*
|
264 |
* </p>
|
265 |
*
|
266 |
* @param geomOpName
|
267 |
* Operation's unique name
|
268 |
* @param geomOp
|
269 |
* Specific GeometryOperation's instance implementing this
|
270 |
* operation
|
271 |
* @param superType
|
272 |
* super type of geometries that is used to register
|
273 |
* the operation. Must be a value defined in
|
274 |
* {@link Geometry.TYPES}
|
275 |
* @return Index assigned to this operation. This index is used later to
|
276 |
* access the operation.
|
277 |
*/
|
278 |
public int registerGeometryOperationBySuperType(String geomOpName, |
279 |
GeometryOperation geomOp, int superType);
|
280 |
|
281 |
/**
|
282 |
* <p>
|
283 |
* Registers a GeometryOperation associated to all the geometries which
|
284 |
* super subType matches with a concrete subType. Returns an unique index that
|
285 |
* is used later to identify and invoke the operation.<br>
|
286 |
* </p>
|
287 |
* <p>
|
288 |
* By convention this index should be in a final and static variable in the
|
289 |
* class that implements the operation. The value of this variable must be
|
290 |
* set using the method
|
291 |
* {@link GeometryManager#getGeometryOperationCode(String)}:<BR>
|
292 |
*
|
293 |
* <pre>
|
294 |
*
|
295 |
* public class MyOperation extends GeometryOperation {
|
296 |
*
|
297 |
* public static final int CODE = GeometryLocator.getGeometryManager()
|
298 |
* .getGeometryOperationCode("MyOperation");
|
299 |
* }
|
300 |
* </pre>
|
301 |
*
|
302 |
* </p>
|
303 |
*
|
304 |
* @param geomOpName
|
305 |
* Operation's unique name
|
306 |
* @param geomOp
|
307 |
* Specific GeometryOperation's instance implementing this
|
308 |
* operation
|
309 |
* @param superSubType
|
310 |
* super subType of geometries that is used to register
|
311 |
* the operation. Must be a value defined in
|
312 |
* {@link Geometry.SUBTYPES}
|
313 |
* @return Index assigned to this operation. This index is used later to
|
314 |
* access the operation.
|
315 |
*/
|
316 |
public int registerGeometryOperationBySuperSubType(String geomOpName, |
317 |
GeometryOperation geomOp, int superSubType);
|
318 |
|
319 |
/**
|
320 |
* <p>
|
321 |
* Registers a GeometryOperation associated to all the geometries with a
|
322 |
* concrete subtype. Returns an unique index that is used later to identify
|
323 |
* and invoke the operation.<br>
|
324 |
* </p>
|
325 |
* <p>
|
326 |
* By convention this index should be in a final and static variable in the
|
327 |
* class that implements the operation. The value of this variable must be
|
328 |
* set using the method
|
329 |
* {@link GeometryManager#getGeometryOperationCode(String)}:<BR>
|
330 |
*
|
331 |
* <pre>
|
332 |
*
|
333 |
* public class MyOperation extends GeometryOperation {
|
334 |
*
|
335 |
* public static final int CODE = GeometryLocator.getGeometryManager()
|
336 |
* .getGeometryOperationCode("MyOperation");
|
337 |
* }
|
338 |
* </pre>
|
339 |
*
|
340 |
* </p>
|
341 |
*
|
342 |
* @param geomOpName
|
343 |
* Operation's unique name
|
344 |
* @param geomOp
|
345 |
* Specific GeometryOperation's instance implementing this
|
346 |
* operation
|
347 |
* @param subType
|
348 |
* SubType of geometry. Must be a value defined in
|
349 |
* {@link Geometry.SUBTYPES}
|
350 |
* @return Index assigned to this operation. This index is used later to
|
351 |
* access the operation.
|
352 |
*/
|
353 |
public int registerGeometryOperationBySubtype(String geomOpName, |
354 |
GeometryOperation geomOp, int subType);
|
355 |
|
356 |
/**
|
357 |
* <p>
|
358 |
* Registers a GeometryType instance.
|
359 |
* </p>
|
360 |
*
|
361 |
* @param geometryType
|
362 |
* A {@link GeometryType} instance to create {@link Geometry} objects
|
363 |
*/
|
364 |
public void registerGeometryType(GeometryType geometryType); |
365 |
|
366 |
/**
|
367 |
* <p>
|
368 |
* Registers a Geometry implementation class with a predefined geometry type
|
369 |
* and returns the associated GeometryType instance. Available predefined
|
370 |
* types are defined in {@link Geometry.TYPES} and the subtypes are defined
|
371 |
* in {@link Geometry.SUBTYPES}.
|
372 |
* </p>
|
373 |
* <p>
|
374 |
* How to register a geometry class with a predefined type:
|
375 |
*
|
376 |
* <pre>
|
377 |
*
|
378 |
* GeometryType geomType = GeometryLocator.getGeometryManager()
|
379 |
* .registerBasicGeometryType(Point2D.class, "Point2D", Geometry.TYPES.POINT,
|
380 |
* Geometry.SYBTYPES.GEOM2D);
|
381 |
* </pre>
|
382 |
*
|
383 |
* </p>
|
384 |
*
|
385 |
* @param geomClass
|
386 |
* Geometry subclass. It must not be null and must implement
|
387 |
* Geometry, otherwise an exception
|
388 |
* is raised.
|
389 |
* @param name
|
390 |
* Symbolic name for the geometry type, it can be null. If it is
|
391 |
* null then the symbolic name
|
392 |
* will be the simple class name.
|
393 |
* @param type
|
394 |
* Type of geometry. Must be a value defined in
|
395 |
* {@link Geometry.TYPES}
|
396 |
* @param subType
|
397 |
* SubType of geometry. Must be a value defined in
|
398 |
* {@link Geometry.SUBTYPES}
|
399 |
* @return Instance of GeometryType associated to the Geometry
|
400 |
* implementation class
|
401 |
* geomClass
|
402 |
* @throws IllegalArgumentException
|
403 |
* If geomClass is null or does not implement Geometry
|
404 |
*/
|
405 |
public GeometryType registerGeometryType(Class geomClass, String name, |
406 |
int type, int subType); |
407 |
|
408 |
/**
|
409 |
* <p>
|
410 |
* Registers a Geometry implementation class with a predefined geometry type
|
411 |
* and returns the associated GeometryType instance. Available predefined
|
412 |
* types are defined in {@link Geometry.TYPES} and the subtypes are defined
|
413 |
* in {@link Geometry.SUBTYPES}.
|
414 |
* </p>
|
415 |
* <p>
|
416 |
* It adds also the super type and the super subType of the geometry, that
|
417 |
* can be used to check if the type (or the subtype) inherits of other
|
418 |
* type (or subType)
|
419 |
* </p>
|
420 |
* <p>
|
421 |
* How to register a geometry class with a predefined type:
|
422 |
*
|
423 |
* <pre>
|
424 |
*
|
425 |
* GeometryType geomType = GeometryLocator.getGeometryManager()
|
426 |
* .registerBasicGeometryType(Arc3D.class, "Arc3D", Geometry.TYPES.ARC,
|
427 |
* Geometry.SYBTYPES.GEOM3D, Geometry.TYPES.CURVE, Geometry.SYBTYPES.GEOM2D);
|
428 |
* </pre>
|
429 |
*
|
430 |
* </p>
|
431 |
*
|
432 |
* @param geomClass
|
433 |
* Geometry subclass. It must not be null and must implement
|
434 |
* Geometry, otherwise an exception
|
435 |
* is raised.
|
436 |
* @param name
|
437 |
* Symbolic name for the geometry type, it can be null. If it is
|
438 |
* null then the symbolic name
|
439 |
* will be the simple class name.
|
440 |
* @param type
|
441 |
* Type of geometry. Must be a value defined in
|
442 |
* {@link Geometry.TYPES}
|
443 |
* @param subType
|
444 |
* SubType of geometry. Must be a value defined in
|
445 |
* {@link Geometry.SUBTYPES}
|
446 |
* @param superType
|
447 |
* Super type of a geometry. Must be a value defined in
|
448 |
* {@link Geometry.TYPES}
|
449 |
* @param superSubType
|
450 |
* Super subType of a geometry. Must be a value defined in
|
451 |
* {@link Geometry.SUBTYPES}
|
452 |
* @return Instance of GeometryType associated to the Geometry
|
453 |
* implementation class
|
454 |
* geomClass
|
455 |
* @throws IllegalArgumentException
|
456 |
* If geomClass is null or does not implement Geometry
|
457 |
*/
|
458 |
public GeometryType registerGeometryType(Class geomClass, String name, |
459 |
int type, int subType, int superType, int superSubType); |
460 |
|
461 |
/**
|
462 |
* <p>
|
463 |
* Registers a Geometry implementation class with a predefined geometry type
|
464 |
* and returns the associated GeometryType instance. Available predefined
|
465 |
* types are defined in {@link Geometry.TYPES} and the subtypes are defined
|
466 |
* in {@link Geometry.SUBTYPES}.
|
467 |
* </p>
|
468 |
* <p>
|
469 |
* It adds also the super type of the geometry, that can be used to
|
470 |
* check if the type inherits of other type.
|
471 |
* </p>
|
472 |
* <p>
|
473 |
* How to register a geometry class with a predefined type:
|
474 |
*
|
475 |
* <pre>
|
476 |
*
|
477 |
* GeometryType geomType = GeometryLocator.getGeometryManager()
|
478 |
* .registerBasicGeometryType(Arc3D.class, "Arc3D", Geometry.TYPES.ARC,
|
479 |
* Geometry.SYBTYPES.GEOM3D, Geometry.TYPES.CURVE);
|
480 |
* </pre>
|
481 |
*
|
482 |
* </p>
|
483 |
*
|
484 |
* @param geomClass
|
485 |
* Geometry subclass. It must not be null and must implement
|
486 |
* Geometry, otherwise an exception
|
487 |
* is raised.
|
488 |
* @param name
|
489 |
* Symbolic name for the geometry type, it can be null. If it is
|
490 |
* null then the symbolic name
|
491 |
* will be the simple class name.
|
492 |
* @param type
|
493 |
* Type of geometry. Must be a value defined in
|
494 |
* {@link Geometry.TYPES}
|
495 |
* @param subType
|
496 |
* SubType of geometry. Must be a value defined in
|
497 |
* {@link Geometry.SUBTYPES}
|
498 |
* @param superType
|
499 |
* Super type of a geometry. Must be a value defined in
|
500 |
* {@link Geometry.TYPES}
|
501 |
* @return Instance of GeometryType associated to the Geometry
|
502 |
* implementation class
|
503 |
* geomClass
|
504 |
* @throws IllegalArgumentException
|
505 |
* If geomClass is null or does not implement Geometry
|
506 |
*/
|
507 |
public GeometryType registerGeometryType(Class geomClass, String name, |
508 |
int type, int subType, int superType); |
509 |
|
510 |
/**
|
511 |
* <p>
|
512 |
* Registers a Geometry implementation class with a predefined geometry type
|
513 |
* and returns the associated GeometryType instance. Available predefined
|
514 |
* types are defined in {@link Geometry.TYPES} and the subtypes are defined
|
515 |
* in {@link Geometry.SUBTYPES}.
|
516 |
* </p>
|
517 |
* <p>
|
518 |
* It adds also the super types and the super subTypes of the geometry, that
|
519 |
* can be used to check if the type (or the subtype) inherits of other
|
520 |
* types (or subTypes)
|
521 |
* </p>
|
522 |
* <p>
|
523 |
* How to register a geometry class with a predefined type:
|
524 |
*
|
525 |
* <pre>
|
526 |
*
|
527 |
* GeometryType geomType = GeometryLocator.getGeometryManager()
|
528 |
* .registerBasicGeometryType(Circle3DM.class, "Circle3DM", Geometry.TYPES.CIRCLE,
|
529 |
* Geometry.SYBTYPES.GEOM3DM,
|
530 |
* new int[]{Geometry.TYPES.CURVE, Geometry.TYPES.GEOMETRY},
|
531 |
* new int[]{Geometry.SYBTYPES.GEOM2D, Geometry.SYBTYPES.GEOM3D});
|
532 |
* </pre>
|
533 |
*
|
534 |
* </p>
|
535 |
*
|
536 |
* @param geomClass
|
537 |
* Geometry subclass. It must not be null and must implement
|
538 |
* Geometry, otherwise an exception
|
539 |
* is raised.
|
540 |
* @param name
|
541 |
* Symbolic name for the geometry type, it can be null. If it is
|
542 |
* null then the symbolic name
|
543 |
* will be the simple class name.
|
544 |
* @param type
|
545 |
* Type of geometry. Must be a value defined in
|
546 |
* {@link Geometry.TYPES}
|
547 |
* @param subType
|
548 |
* SubType of geometry. Must be a value defined in
|
549 |
* {@link Geometry.SUBTYPES}
|
550 |
* @param superTypes
|
551 |
* List of the super types of a geometry. Must be a value defined in
|
552 |
* {@link Geometry.TYPES}
|
553 |
* @param superSubTypes
|
554 |
* List of the super subType of a geometry. Must be a value defined in
|
555 |
* {@link Geometry.SUBTYPES}
|
556 |
* @return Instance of GeometryType associated to the Geometry
|
557 |
* implementation class
|
558 |
* geomClass
|
559 |
* @throws IllegalArgumentException
|
560 |
* If geomClass is null or does not implement Geometry
|
561 |
*/
|
562 |
public GeometryType registerGeometryType(Class geomClass, String name, |
563 |
int type, int subType, int[] superTypes, int superSubTypes[]); |
564 |
|
565 |
/**
|
566 |
* <p>
|
567 |
* Registers a Geometry implementation class with a predefined geometry type
|
568 |
* and returns the associated GeometryType instance. Available predefined
|
569 |
* types are defined in {@link Geometry.TYPES} and the subtypes are defined
|
570 |
* in {@link Geometry.SUBTYPES}.
|
571 |
* </p>
|
572 |
* <p>
|
573 |
* It adds also the super types and the super subTypes of the geometry, that
|
574 |
* can be used to check if the type inherits of other types.
|
575 |
* </p>
|
576 |
* <p>
|
577 |
* How to register a geometry class with a predefined type:
|
578 |
*
|
579 |
* <pre>
|
580 |
*
|
581 |
* GeometryType geomType = GeometryLocator.getGeometryManager()
|
582 |
* .registerBasicGeometryType(Circle2D.class, "Circle2DM", Geometry.TYPES.CIRCLE,
|
583 |
* Geometry.SYBTYPES.GEOM2D,
|
584 |
* new int[]{Geometry.TYPES.CURVE, Geometry.TYPES.SURFACE});
|
585 |
* </pre>
|
586 |
*
|
587 |
* </p>
|
588 |
*
|
589 |
* @param geomClass
|
590 |
* Geometry subclass. It must not be null and must implement
|
591 |
* Geometry, otherwise an exception
|
592 |
* is raised.
|
593 |
* @param name
|
594 |
* Symbolic name for the geometry type, it can be null. If it is
|
595 |
* null then the symbolic name
|
596 |
* will be the simple class name.
|
597 |
* @param type
|
598 |
* Type of geometry. Must be a value defined in
|
599 |
* {@link Geometry.TYPES}
|
600 |
* @param subType
|
601 |
* SubType of geometry. Must be a value defined in
|
602 |
* {@link Geometry.SUBTYPES}
|
603 |
* @param superTypes
|
604 |
* List of the super types of a geometry. Must be a value defined in
|
605 |
* {@link Geometry.TYPES}
|
606 |
* @return Instance of GeometryType associated to the Geometry
|
607 |
* implementation class
|
608 |
* geomClass
|
609 |
* @throws IllegalArgumentException
|
610 |
* If geomClass is null or does not implement Geometry
|
611 |
*/
|
612 |
public GeometryType registerGeometryType(Class geomClass, String name, |
613 |
int type, int subType, int[] superTypes); |
614 |
|
615 |
/**
|
616 |
* <p>
|
617 |
* Registers a Geometry implementation class with a predefined geometry type
|
618 |
* and returns the associated GeometryType instance. Available predefined
|
619 |
* types are defined in {@link Geometry.TYPES} and the subtypes are defined
|
620 |
* in {@link Geometry.SUBTYPES}.
|
621 |
* </p>
|
622 |
* <p>
|
623 |
* In this case the symbolic name will be the geometry's simple class name
|
624 |
* </p>
|
625 |
* How to register a new geometry type:
|
626 |
*
|
627 |
* <pre>
|
628 |
*
|
629 |
* GeometryType geomType = GeometryLocator.getGeometryManager()
|
630 |
* .registerBasicGeometryType(Point2D.class, Geometry.TYPES.POINT,
|
631 |
* Geometry.SYBTYPES.GEOM2D);
|
632 |
* </pre>
|
633 |
*
|
634 |
* @param geomClass
|
635 |
* Geometry implementation class. It must not be null and must
|
636 |
* implement Geometry,
|
637 |
* otherwise an exception is thrown.
|
638 |
* @param type
|
639 |
* Type of geometry. Must be a value defined in
|
640 |
* {@link Geometry.TYPES}
|
641 |
* @param subType
|
642 |
* SubType of geometry. Must be a value defined in
|
643 |
* {@link Geometry.SUBTYPES}
|
644 |
* @return Instance of GeometryType associated to the Geometry
|
645 |
* implementation class
|
646 |
* @throws IllegalArgumentException
|
647 |
* If geomClass is null or does not implement Geometry
|
648 |
*/
|
649 |
public GeometryType registerGeometryType(Class geomClass, int type, |
650 |
int subType);
|
651 |
|
652 |
/**
|
653 |
* <p>
|
654 |
* Returns an instance of GeometryType given the Geometry type and the
|
655 |
* subtype.
|
656 |
* </p>
|
657 |
*
|
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 type and the subtype
|
665 |
* @throws GeometryTypeNotSupportedException
|
666 |
* Returns this exception if there is not a registered geometry
|
667 |
* with
|
668 |
* these type and subtype
|
669 |
* @throws GeometryTypeNotValidException
|
670 |
* Returns if the type and subtype are not valid
|
671 |
*/
|
672 |
public GeometryType getGeometryType(int type, int subType) |
673 |
throws GeometryTypeNotSupportedException, GeometryTypeNotValidException;
|
674 |
|
675 |
/**
|
676 |
* <p>
|
677 |
* This method creates a {@link Geometry} with the type specified by this
|
678 |
* GeometryType. The geometry is empty, and all the internal attributes must
|
679 |
* be assigned to a value when the geometry has been created.
|
680 |
* </p>
|
681 |
* <p>
|
682 |
* This example creates a point2D and sets the coordinates to 1,1:
|
683 |
*
|
684 |
* <pre>
|
685 |
* Point point =
|
686 |
* (Point) GeometryLocator.getGeometryManager().create(GEOMETRY.TYPES.POINT,
|
687 |
* GEOMETRY.SUBTYPES.GEOM2D);
|
688 |
* point.setX(1);
|
689 |
* point.setY(1);
|
690 |
* </pre>
|
691 |
*
|
692 |
* </p>
|
693 |
*
|
694 |
* @param geomType
|
695 |
* The geometry type
|
696 |
* @return
|
697 |
* A instance of a geometry.
|
698 |
* @throws CreateGeometryException
|
699 |
* This exception is thrown when the manager can not create
|
700 |
* the geometry.
|
701 |
*/
|
702 |
public Geometry create(GeometryType geomType)
|
703 |
throws CreateGeometryException;
|
704 |
|
705 |
/**
|
706 |
* <p>
|
707 |
* Creates a Envelope with a concrete subtype. The envelope is empty and it
|
708 |
* have to be filled with the corners once has been created.
|
709 |
* </p>
|
710 |
*
|
711 |
* @param subType
|
712 |
* SubType of envelope. Must be a value defined in
|
713 |
* {@link Geometry.SUBTYPES}
|
714 |
* @return
|
715 |
* A Envelope
|
716 |
* @throws CreateEnvelopeException
|
717 |
* If it is not possible to create the envelope.
|
718 |
*/
|
719 |
public Envelope createEnvelope(int subType) throws CreateEnvelopeException; |
720 |
|
721 |
/**
|
722 |
* <p>
|
723 |
* Creates a Envelope with a concrete subtype. It sets the values for the
|
724 |
* lower corner and the upper corner (in 2D) using the method parameters.
|
725 |
* </p>
|
726 |
*
|
727 |
* @param minX
|
728 |
* The minimum value for the X coordinate.
|
729 |
* @param minY
|
730 |
* The minimum value for the Y coordinate.
|
731 |
* @param maxX
|
732 |
* The maximum value for the X coordinate.
|
733 |
* @param maxY
|
734 |
* The maximum value for the Y coordinate.
|
735 |
* @param subType
|
736 |
* SubType of envelope. Must be a value defined in
|
737 |
* {@link Geometry.SUBTYPES}
|
738 |
* @return
|
739 |
* @throws CreateEnvelopeException
|
740 |
*/
|
741 |
public Envelope createEnvelope(double minX, double minY, double maxX, |
742 |
double maxY, int subType) throws CreateEnvelopeException; |
743 |
|
744 |
/**
|
745 |
* <p>
|
746 |
* This method creates a {@link Geometry} with the type specified by this
|
747 |
* name. If a geometry with this name doesn't exist, a
|
748 |
* {@link IllegalArgumentException} is thrown. The geometry is empty, and
|
749 |
* all the internal attributes must be assigned to a value when the geometry
|
750 |
* has been created.
|
751 |
* </p>
|
752 |
* <p>
|
753 |
* This example creates a point2D and sets the coordinates to 1,1: It
|
754 |
* supposes that there is a Point2D class with name "Point2D".
|
755 |
* </p>
|
756 |
*
|
757 |
* <pre>
|
758 |
* Point point = (Point) GeometryLocator.getGeometryManager().create("Point2D");
|
759 |
* point.setX(1);
|
760 |
* point.setY(1);
|
761 |
* </pre>
|
762 |
*
|
763 |
* @param name
|
764 |
* The name of the geometry type
|
765 |
* @return
|
766 |
* A instance of a geometry.
|
767 |
* @throws CreateGeometryException
|
768 |
* This exception is thrown when the manager can not create
|
769 |
* the geometry.
|
770 |
*/
|
771 |
public Geometry create(String name) throws CreateGeometryException; |
772 |
|
773 |
/**
|
774 |
* Create a geometry from a WKT definition.
|
775 |
*
|
776 |
* This is a utility method to wrap the invocation to the operation
|
777 |
* {@link OPERATIONS#FROMWKT}.
|
778 |
*
|
779 |
* @param wkt
|
780 |
* geometry in Well-known text format
|
781 |
*
|
782 |
* @return the geometry as a Geometry
|
783 |
*
|
784 |
* @throws CreateGeometryException
|
785 |
* @throws GeometryException
|
786 |
*/
|
787 |
public Geometry createFrom(String wkt, String srs) |
788 |
throws CreateGeometryException, GeometryException;
|
789 |
|
790 |
public Geometry createFrom(String wkt) throws CreateGeometryException, |
791 |
GeometryException; |
792 |
|
793 |
/**
|
794 |
* Create a geometry from a WKB definition.
|
795 |
*
|
796 |
* This is a utility method to wrap the invocation to the operation
|
797 |
* {@link OPERATIONS#FROMWKB}.
|
798 |
*
|
799 |
* @param wkb
|
800 |
* geometry in well-known binary format
|
801 |
*
|
802 |
* @return the geometry as a Geometry
|
803 |
*
|
804 |
* @throws CreateGeometryException
|
805 |
* @throws GeometryException
|
806 |
*/
|
807 |
public Geometry createFrom(byte[] wkb) throws CreateGeometryException, |
808 |
GeometryException; |
809 |
|
810 |
/**
|
811 |
* <p>
|
812 |
* This method creates a {@link Geometry} with a concrete type and subtype.
|
813 |
* The geometry is empty, and all the internal attributes must be assigned
|
814 |
* to a value when the geometry has been created.
|
815 |
* </p>
|
816 |
* <p>
|
817 |
* This example creates a point2D and sets the coordinates to 1,1. It
|
818 |
* supposes that there is a Point2D class with the id 1.
|
819 |
* </p>
|
820 |
*
|
821 |
* <pre>
|
822 |
* Point point =
|
823 |
* (Point) GeometryLocator.getGeometryManager().create(Geometry.TYPES.POINT,
|
824 |
* Geometry.SYBTYPES.GEOM2D);
|
825 |
* point.setX(1);
|
826 |
* point.setY(1);
|
827 |
* </pre>
|
828 |
*
|
829 |
* @param type
|
830 |
* Type of geometry. Must be a value defined in
|
831 |
* {@link Geometry.TYPES}
|
832 |
* @param subType
|
833 |
* SubType of geometry. Must be a value defined in
|
834 |
* {@link Geometry.SUBTYPES}
|
835 |
* @return
|
836 |
* A instance of a geometry.
|
837 |
* @throws CreateGeometryException
|
838 |
* This exception is thrown when the manager can not create
|
839 |
* the geometry.
|
840 |
*/
|
841 |
public Geometry create(int type, int subType) |
842 |
throws CreateGeometryException;
|
843 |
|
844 |
/**
|
845 |
* <p>
|
846 |
* It creates a null geometry with a concrete subtype.
|
847 |
* <p>
|
848 |
*
|
849 |
* @param subType
|
850 |
* SubType of geometry. Must be a value defined in
|
851 |
* {@link Geometry.SUBTYPES}
|
852 |
* @return
|
853 |
* A NullGeometry
|
854 |
* @throws CreateGeometryException
|
855 |
* This exception is thrown when the manager can not create
|
856 |
* the geometry.
|
857 |
* @deprecated use null instead. This method can be removed in next revisions
|
858 |
*/
|
859 |
public NullGeometry createNullGeometry(int subType) |
860 |
throws CreateGeometryException;
|
861 |
|
862 |
/**
|
863 |
* <p>
|
864 |
* Create a new point with a concrete type and sets the value for the X and
|
865 |
* the Y.
|
866 |
* </p>
|
867 |
*
|
868 |
* @param x
|
869 |
* The X coordinate
|
870 |
* @param y
|
871 |
* The y coordinate
|
872 |
* @param subType
|
873 |
* SubType of geometry. Must be a value defined in
|
874 |
* {@link Geometry.SUBTYPES}
|
875 |
* @throws CreateGeometryException
|
876 |
* This exception is thrown when the manager can not create
|
877 |
* the geometry.
|
878 |
* @return
|
879 |
* The Point
|
880 |
*/
|
881 |
public Point createPoint(double x, double y, int subType) |
882 |
throws CreateGeometryException;
|
883 |
|
884 |
/**
|
885 |
* Create a new line with a concrete type. Use later addVertex to add
|
886 |
* vertex to te line.
|
887 |
*
|
888 |
* @param subType SubType of geometry. Must be a value defined in {@link Geometry.SUBTYPES}
|
889 |
* @return a line
|
890 |
* @throws CreateGeometryException
|
891 |
* This exception is thrown when the manager can not create
|
892 |
* the geometry.
|
893 |
*/
|
894 |
public Line createLine(int subType) throws CreateGeometryException; |
895 |
|
896 |
/**
|
897 |
* @deprecated use createLine
|
898 |
*/
|
899 |
public Curve createCurve(int subType) throws CreateGeometryException; |
900 |
|
901 |
/**
|
902 |
* Create a new polygon with a concrete type.
|
903 |
* Use later addVertex to add vertex to te polygon.
|
904 |
*
|
905 |
* @param subType
|
906 |
* SubType of geometry. Must be a value defined in
|
907 |
* {@link Geometry.SUBTYPES}
|
908 |
* @return
|
909 |
* A polygon
|
910 |
* @throws CreateGeometryException
|
911 |
* This exception is thrown when the manager can not create
|
912 |
* the geometry.
|
913 |
*/
|
914 |
public Polygon createPolygon(int subType) |
915 |
throws CreateGeometryException;
|
916 |
|
917 |
/**
|
918 |
* @deprecated use createPolygon
|
919 |
*/
|
920 |
public Surface createSurface(int subType) |
921 |
throws CreateGeometryException;
|
922 |
|
923 |
/**
|
924 |
* Create a new multipoint with a concrete subtype.
|
925 |
* Use addPrimitive to populate the multipoint.
|
926 |
*
|
927 |
* @param subType
|
928 |
* SubType of geometry. Must be a value defined in
|
929 |
* {@link Geometry.SUBTYPES}
|
930 |
* @return A multipoint
|
931 |
* @throws CreateGeometryException
|
932 |
* This exception is thrown when the manager can not create the
|
933 |
* geometry.
|
934 |
*/
|
935 |
public MultiPoint createMultiPoint(int subType) |
936 |
throws CreateGeometryException;
|
937 |
|
938 |
/**
|
939 |
* Create a new multicurve with a concrete subtype.
|
940 |
* Use addPrimitive to populate the multicurve.
|
941 |
*
|
942 |
* @param subType
|
943 |
* SubType of geometry. Must be a value defined in
|
944 |
* {@link Geometry.SUBTYPES}
|
945 |
* @return A multicurve
|
946 |
* @throws CreateGeometryException
|
947 |
* This exception is thrown when the manager can not create the
|
948 |
* geometry.
|
949 |
*/
|
950 |
public MultiCurve createMultiCurve(int subType) throws CreateGeometryException; |
951 |
|
952 |
public MultiLine createMultiLine(int subType) throws CreateGeometryException; |
953 |
|
954 |
/**
|
955 |
* Create a new multisurface with a concrete subtype.
|
956 |
* Use later addPrimitive to populate.
|
957 |
*
|
958 |
* @param subType
|
959 |
* SubType of geometry. Must be a value defined in
|
960 |
* {@link Geometry.SUBTYPES}
|
961 |
* @return A multisurface
|
962 |
* @throws CreateGeometryException
|
963 |
* This exception is thrown when the manager can not create the
|
964 |
* geometry.
|
965 |
*/
|
966 |
public MultiSurface createMultiSurface(int subType) throws CreateGeometryException; |
967 |
|
968 |
public MultiPolygon createMultiPolygon(int subType) throws CreateGeometryException; |
969 |
|
970 |
/**
|
971 |
* <p>
|
972 |
* Returns an operation given the Geometry type, the Geometry subtype and
|
973 |
* and the operation code. If opCode corresponds to a common operation (a
|
974 |
* common operation is an operation registered for all geometries), then
|
975 |
* this method returns the common operation.
|
976 |
* </p>
|
977 |
* <p>
|
978 |
* For better performance, if you need to call an operation multiple times,
|
979 |
* use this method only once and keep the returned object in a local
|
980 |
* variable over which you can iterate. For instance:
|
981 |
*
|
982 |
* <pre>
|
983 |
* // Get the operation you need
|
984 |
* GeometryManager gm = GeometryLocator.getGeometryManager()
|
985 |
* GeometryOperation geomOp = null;
|
986 |
* try {
|
987 |
* geomOp = gm.getGeometryOperation(Draw2D.CODE, Geometry.TYPES.POINT,
|
988 |
* Geometry.SUBTYPES.GEOM2D);
|
989 |
* } catch (GeometryTypeNotSupportedException gtnse) {
|
990 |
* // treat exception
|
991 |
* } catch (GeometryOperationNotSupportedException gonse) {
|
992 |
* // treat exception
|
993 |
* }
|
994 |
*
|
995 |
* // Fill the operation context with required params
|
996 |
* GeometryOperationContext ctx = new GeometryOperationContext();
|
997 |
*
|
998 |
* // Here is the main loop where you call the operation
|
999 |
* for (int i=0; i<myGeometries.length; i++) {
|
1000 |
* Object result = geomOp.invoke(myGeometries[i], ctx);
|
1001 |
* }
|
1002 |
* </pre>
|
1003 |
*
|
1004 |
* </p>
|
1005 |
*
|
1006 |
* @param opCode
|
1007 |
* The operation code
|
1008 |
* @param type
|
1009 |
* Type of geometry. Must be a value defined in
|
1010 |
* {@link Geometry.TYPES}
|
1011 |
* @param subType
|
1012 |
* SubType of geometry. Must be a value defined in
|
1013 |
* {@link Geometry.SUBTYPES}
|
1014 |
* @return Geometry operation
|
1015 |
* @throws GeometryTypeNotSupportedException
|
1016 |
* Returns this exception if there is not a registered geometry
|
1017 |
* with
|
1018 |
* these type and subtype
|
1019 |
* @throws GeometryTypeNotValidException
|
1020 |
* Returns this exception if the type and subtype are not valid
|
1021 |
* @throws GeometryOperationNotSupportedException
|
1022 |
* Returns this exception if there is not a registered operation
|
1023 |
* with
|
1024 |
* this operation code
|
1025 |
*/
|
1026 |
public GeometryOperation getGeometryOperation(int opCode, int type, |
1027 |
int subType) throws GeometryTypeNotSupportedException, |
1028 |
GeometryOperationNotSupportedException, GeometryTypeNotValidException; |
1029 |
|
1030 |
/**
|
1031 |
* <p>
|
1032 |
* Returns an common operation with given operation code. A common operation
|
1033 |
* is an operation registered for all geometries.
|
1034 |
* </p>
|
1035 |
* <p>
|
1036 |
* For better performance, if you need to call an operation multiple times,
|
1037 |
* use this method only once and keep the returned object in a local
|
1038 |
* variable over which you can iterate. For instance:
|
1039 |
*
|
1040 |
* <pre>
|
1041 |
* // Get the operation you need
|
1042 |
* GeometryManager gm = GeometryLocator.getGeometryManager()
|
1043 |
* GeometryOperation geomOp = null;
|
1044 |
* try {
|
1045 |
* geomOp = gm.getGeometryOperation(FromWKB.CODE);
|
1046 |
* } catch (GeometryOperationNotSupportedException gonse) {
|
1047 |
* // treat exception
|
1048 |
* }
|
1049 |
*
|
1050 |
* // Fill the operation context with required params
|
1051 |
* FromWKBGeometryOperationContext ctx = new FromWKBGeometryOperationContext();
|
1052 |
*
|
1053 |
* // Here is the main loop where you call the operation
|
1054 |
* for (int i=0; i<myGeometriesWKB.length; i++) {
|
1055 |
* ctx.setData(myGeometriesWKB[i]);
|
1056 |
* Object result = geomOp.invoke(null, ctx);
|
1057 |
* }
|
1058 |
* </pre>
|
1059 |
*
|
1060 |
* </p>
|
1061 |
*
|
1062 |
* @param opCode
|
1063 |
* The operation code
|
1064 |
* @return Geometry operation
|
1065 |
* @throws GeometryOperationNotSupportedException
|
1066 |
* Returns this exception if there is not a registered operation
|
1067 |
* with
|
1068 |
* this operation code
|
1069 |
*/
|
1070 |
public GeometryOperation getGeometryOperation(int opCode) |
1071 |
throws GeometryOperationNotSupportedException;
|
1072 |
|
1073 |
/**
|
1074 |
* <p>
|
1075 |
* Invokes an operation given its code, the geometry and the operation
|
1076 |
* context holding the parameters required for the operation.
|
1077 |
* </p>
|
1078 |
*
|
1079 |
* @param opCode
|
1080 |
* Operation code.
|
1081 |
* @param geom
|
1082 |
* Geometry to which apply the operation
|
1083 |
* @param ctx
|
1084 |
* Context holding the operation parameters
|
1085 |
* @return
|
1086 |
* The object returned by an operation, depends on each operation.
|
1087 |
*/
|
1088 |
public Object invokeOperation(int opCode, Geometry geom, |
1089 |
GeometryOperationContext ctx) |
1090 |
throws GeometryOperationNotSupportedException,
|
1091 |
GeometryOperationException; |
1092 |
|
1093 |
/**
|
1094 |
* <p>
|
1095 |
* Invokes an operation given its code, the geometry and the operation
|
1096 |
* context holding the parameters required for the operation.
|
1097 |
* </p>
|
1098 |
*
|
1099 |
* @param geomOpName
|
1100 |
* Operation name.
|
1101 |
* @param geom
|
1102 |
* Geometry to which apply the operation
|
1103 |
* @param ctx
|
1104 |
* Context holding the operation parameters
|
1105 |
* @return
|
1106 |
* The object returned by an operation, depends on each operation.
|
1107 |
*/
|
1108 |
public Object invokeOperation(String geomOpName, Geometry geom, |
1109 |
GeometryOperationContext ctx) |
1110 |
throws GeometryOperationNotSupportedException,
|
1111 |
GeometryOperationException; |
1112 |
|
1113 |
/**
|
1114 |
* <p>
|
1115 |
* Invokes an operation given its code, and the operation context holding
|
1116 |
* the parameters required for the operation.
|
1117 |
* </p>
|
1118 |
*
|
1119 |
* @param geomOpName
|
1120 |
* Operation name.
|
1121 |
* @param ctx
|
1122 |
* Context holding the operation parameters
|
1123 |
* @return
|
1124 |
* The object returned by an operation, depends on each operation.
|
1125 |
*/
|
1126 |
public Object invokeOperation(String geomOpName, |
1127 |
GeometryOperationContext ctx) |
1128 |
throws GeometryOperationNotSupportedException,
|
1129 |
GeometryOperationException; |
1130 |
|
1131 |
/**
|
1132 |
* <p>
|
1133 |
* Registers the unique name of one operation. If it already exists then
|
1134 |
* this method does nothing but returning the name's corresponding index.
|
1135 |
* </p>
|
1136 |
* <p>
|
1137 |
* By convention this method is used to set the value of the final and
|
1138 |
* static variable that is located in the classes that implements the
|
1139 |
* operation:<BR>
|
1140 |
*
|
1141 |
* <pre>
|
1142 |
*
|
1143 |
* public class MyOperation extends GeometryOperation {
|
1144 |
*
|
1145 |
* public static final int CODE = GeometryLocator.getGeometryManager()
|
1146 |
* .getGeometryOperationCode("MyOperation");
|
1147 |
* }
|
1148 |
* </pre>
|
1149 |
*
|
1150 |
* </p>
|
1151 |
*
|
1152 |
* @param geomOpName
|
1153 |
* Name used to register the geometry operation
|
1154 |
* @return
|
1155 |
* Index assigned to the operation name passed as parameter
|
1156 |
*/
|
1157 |
public int getGeometryOperationCode(String geomOpName); |
1158 |
|
1159 |
/**
|
1160 |
* Returns a list with the name of the operations that have been
|
1161 |
* registered.
|
1162 |
*
|
1163 |
* @return
|
1164 |
* A list of the registered operations.
|
1165 |
*/
|
1166 |
public List getGeometryOperationNames(); |
1167 |
|
1168 |
/**
|
1169 |
* Returns the flatness used to convert a curve is a set
|
1170 |
* of points.
|
1171 |
*
|
1172 |
* @return
|
1173 |
* The flatness.
|
1174 |
*/
|
1175 |
public double getFlatness(); |
1176 |
|
1177 |
/**
|
1178 |
* Sets the application flatness.
|
1179 |
*
|
1180 |
* @param flatness
|
1181 |
* The flatness to set
|
1182 |
*/
|
1183 |
public void setFlatness(double flatness); |
1184 |
|
1185 |
/**
|
1186 |
* Create a memory spatial index with the default implementation.
|
1187 |
*
|
1188 |
* @return a new SpatialIndex
|
1189 |
*/
|
1190 |
public SpatialIndex createDefaultMemorySpatialIndex() throws ServiceException; |
1191 |
|
1192 |
|
1193 |
/**
|
1194 |
* Create a spatial index with the implementation specified as name.
|
1195 |
* If the creation of index don't requery parameters can be passed a null.
|
1196 |
*
|
1197 |
* @param name of the type of spatial index to create
|
1198 |
* @param parameters used to create the index or null.
|
1199 |
* @return the new SpatialIndex or null if not exists the type of index.
|
1200 |
* @throws GeometryException
|
1201 |
*/
|
1202 |
public SpatialIndex createSpatialIndex(String name, DynObject parameters) throws ServiceException; |
1203 |
|
1204 |
/**
|
1205 |
* Return the name of the factory of the spatial index required.
|
1206 |
*
|
1207 |
* @param name of the spatial index factory
|
1208 |
* @return the SpatialIndexFactory required or null if not exists
|
1209 |
*/
|
1210 |
public SpatialIndexFactory getSpatialIndexFactory(String name); |
1211 |
|
1212 |
/**
|
1213 |
* Create a GeneralPathX to populate a geometry.
|
1214 |
* This method is deprecated, instead use OrientablePrimitive#addVertex(Point) to add vertex to
|
1215 |
* primitive geometries or {@link MultiPrimitive#addPrimitive(org.gvsig.fmap.geom.primitive.Primitive)} to add geometries to an aggregate.
|
1216 |
*
|
1217 |
* @param rule
|
1218 |
* @param initialCapacity
|
1219 |
* @param pathIterator , can be null
|
1220 |
* @return a GeneralPathX
|
1221 |
* @deprecated use method of Geometry to handle this
|
1222 |
* @see OrientablePrimitive#addVertex(Point) or {@link MultiPrimitive#addPrimitive(org.gvsig.fmap.geom.primitive.Primitive)}
|
1223 |
*
|
1224 |
*/
|
1225 |
public IGeneralPathX createGeneralPath(int rule, PathIterator pathIterator); |
1226 |
|
1227 |
/**
|
1228 |
* <p>
|
1229 |
* Create a new curve with a concrete type and sets the value for the
|
1230 |
* coordinates using a GeneralPathX.
|
1231 |
* </p>
|
1232 |
*
|
1233 |
* @param generalPathX
|
1234 |
* It is used to set the values for the X and Y coordinates.
|
1235 |
* @param subType
|
1236 |
* SubType of geometry. Must be a value defined in
|
1237 |
* {@link Geometry.SUBTYPES}
|
1238 |
* @return
|
1239 |
* A curve
|
1240 |
* @throws CreateGeometryException
|
1241 |
* This exception is thrown when the manager can not create
|
1242 |
* the geometry.
|
1243 |
* @deprecated use {@link #createCurve(int)} and OrientablePrimitive#addVertex(Point)
|
1244 |
*/
|
1245 |
public Curve createCurve(GeneralPathX generalPathX, int subType) |
1246 |
throws CreateGeometryException;
|
1247 |
|
1248 |
/**
|
1249 |
* <p>
|
1250 |
* Create a new multicurve with a concrete type and sets the value for the
|
1251 |
* coordinates using a GeneralPathX.
|
1252 |
* </p>
|
1253 |
*
|
1254 |
* @param generalPathX
|
1255 |
* It is used to set the values for the X and Y coordinates.
|
1256 |
* @param subType
|
1257 |
* SubType of geometry. Must be a value defined in
|
1258 |
* {@link Geometry.SUBTYPES}
|
1259 |
* @return A multicurve
|
1260 |
* @throws CreateGeometryException
|
1261 |
* This exception is thrown when the manager can not create the
|
1262 |
* geometry.
|
1263 |
* @deprecated use {@link #createMultiCurve(int)} and {@link MultiPrimitive#addPrimitive(org.gvsig.fmap.geom.primitive.Primitive)}
|
1264 |
*/
|
1265 |
public MultiCurve createMultiCurve(GeneralPathX generalPathX, int subType) |
1266 |
throws CreateGeometryException;
|
1267 |
|
1268 |
/**
|
1269 |
* <p>
|
1270 |
* Create a new surface with a concrete type and sets the value for the
|
1271 |
* coordinates using a GeneralPathX.
|
1272 |
* </p>
|
1273 |
*
|
1274 |
* @param generalPathX
|
1275 |
* It is used to set the values for the X and Y coordinates.
|
1276 |
* @param subType
|
1277 |
* SubType of geometry. Must be a value defined in
|
1278 |
* {@link Geometry.SUBTYPES}
|
1279 |
* @return
|
1280 |
* A surface
|
1281 |
* @throws CreateGeometryException
|
1282 |
* This exception is thrown when the manager can not create
|
1283 |
* the geometry.
|
1284 |
* @deprecated use {@link #createSurface(int)} and OrientablePrimitive#addVertex(Point)
|
1285 |
*/
|
1286 |
public Surface createSurface(GeneralPathX generalPathX, int subType) |
1287 |
throws CreateGeometryException;
|
1288 |
|
1289 |
/**
|
1290 |
* <p>
|
1291 |
* Create a new multisurface with a concrete type and sets the value for the
|
1292 |
* coordinates using a GeneralPathX.
|
1293 |
* </p>
|
1294 |
*
|
1295 |
* @param generalPathX
|
1296 |
* It is used to set the values for the X and Y coordinates.
|
1297 |
* @param subType
|
1298 |
* SubType of geometry. Must be a value defined in
|
1299 |
* {@link Geometry.SUBTYPES}
|
1300 |
* @return A multisurface
|
1301 |
* @throws CreateGeometryException
|
1302 |
* This exception is thrown when the manager can not create the
|
1303 |
* geometry.
|
1304 |
* @deprecated use {@link #createMultiSurface(int)} and {@link MultiPrimitive#addPrimitive(org.gvsig.fmap.geom.primitive.Primitive)}
|
1305 |
*/
|
1306 |
public MultiSurface createMultiSurface(GeneralPathX generalPathX,
|
1307 |
int subType) throws CreateGeometryException; |
1308 |
|
1309 |
} |