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