gvsig-vectorediting / org.gvsig.vectorediting / trunk / org.gvsig.vectorediting / org.gvsig.vectorediting.lib / org.gvsig.vectorediting.lib.spi / src / main / java / org / gvsig / vectorediting / lib / spi / EditingProviderServices.java @ 2109
History | View | Annotate | Download (18.2 KB)
1 |
/**
|
---|---|
2 |
* gvSIG. Desktop Geographic Information System.
|
3 |
*
|
4 |
* Copyright ? 2007-2014 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 2
|
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 |
|
25 |
package org.gvsig.vectorediting.lib.spi; |
26 |
|
27 |
import java.util.List; |
28 |
import java.util.Map; |
29 |
import org.gvsig.euclidean.EuclideanLine2D; |
30 |
|
31 |
import org.gvsig.fmap.dal.exception.DataException; |
32 |
import org.gvsig.fmap.dal.feature.EditableFeature; |
33 |
import org.gvsig.fmap.dal.feature.Feature; |
34 |
import org.gvsig.fmap.dal.feature.FeatureSet; |
35 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
36 |
import org.gvsig.fmap.geom.Geometry; |
37 |
import org.gvsig.fmap.geom.Geometry.SUBTYPES; |
38 |
import org.gvsig.fmap.geom.exception.CreateGeometryException; |
39 |
import org.gvsig.fmap.geom.operation.GeometryOperationException; |
40 |
import org.gvsig.fmap.geom.operation.GeometryOperationNotSupportedException; |
41 |
import org.gvsig.fmap.geom.primitive.Arc; |
42 |
import org.gvsig.fmap.geom.primitive.Circle; |
43 |
import org.gvsig.fmap.geom.primitive.Ellipse; |
44 |
import org.gvsig.fmap.geom.primitive.Line; |
45 |
import org.gvsig.fmap.geom.primitive.Point; |
46 |
import org.gvsig.fmap.geom.primitive.Spline; |
47 |
import org.gvsig.fmap.geom.type.GeometryType; |
48 |
import org.gvsig.fmap.mapcontext.MapContext; |
49 |
import org.gvsig.tools.exception.BaseException; |
50 |
import org.gvsig.tools.service.spi.ProviderServices; |
51 |
|
52 |
/**
|
53 |
* EditingProviderServices provides services to provides.
|
54 |
*
|
55 |
* @author gvSIG team.
|
56 |
* @version $Id$
|
57 |
*/
|
58 |
public interface EditingProviderServices extends ProviderServices { |
59 |
|
60 |
/**
|
61 |
* Makes a console message. Parameters must be i18n keys. If you don't want
|
62 |
* any text before options use null. The format of console message returned
|
63 |
* is:
|
64 |
* "preText". ["keyOption1"]valueOption1 ["keyOption2"]valueOption2...
|
65 |
*
|
66 |
* @param preText
|
67 |
* i18n key of first part of message.
|
68 |
* @param options
|
69 |
* Map with accepted options. Keys of map should be first letter
|
70 |
* of option and value of map should be an i18n key. For example,
|
71 |
* a valid map could be <"A","arc_mode">, <"C","close_polyline">
|
72 |
* @return console message created
|
73 |
*/
|
74 |
public String makeConsoleMessage(String preText, Map<String, String> options); |
75 |
|
76 |
/**
|
77 |
* Inserts the feature into feature store.
|
78 |
*
|
79 |
* @param feature
|
80 |
* to be insert
|
81 |
* @param featureStore
|
82 |
* where feature will be insert
|
83 |
*/
|
84 |
public void insertFeatureIntoFeatureStore(Feature feature, |
85 |
FeatureStore featureStore); |
86 |
|
87 |
/**
|
88 |
* Inserts the geometry into feature store.
|
89 |
*
|
90 |
* @param geometry
|
91 |
* to be insert
|
92 |
* @param featureStore
|
93 |
* where geometry will be insert
|
94 |
*/
|
95 |
public void insertGeometryIntoFeatureStore(Geometry geometry, |
96 |
FeatureStore featureStore); |
97 |
|
98 |
/**
|
99 |
* Deletes the feature from feature store.
|
100 |
*
|
101 |
* @param feature
|
102 |
* @param featureStore
|
103 |
*/
|
104 |
public void deleteFeatureFromFeatureStore(Feature feature, |
105 |
FeatureStore featureStore); |
106 |
|
107 |
/**
|
108 |
* Deletes the feature from feature set.
|
109 |
*
|
110 |
* @param feature
|
111 |
* @param featureStore
|
112 |
* @param featureSet
|
113 |
*/
|
114 |
public void deleteFeatureFromFeatureSet(Feature feature, |
115 |
FeatureStore featureStore, FeatureSet featureSet); |
116 |
|
117 |
/**
|
118 |
* Updates the feature received as parameter in feature store.
|
119 |
*
|
120 |
* @param feature
|
121 |
* to be updated
|
122 |
* @param featureStore
|
123 |
* where feature will be updated
|
124 |
*/
|
125 |
public void updateFeatureInFeatureStore(Feature feature, |
126 |
FeatureStore featureStore); |
127 |
|
128 |
/**
|
129 |
* Creates a circle as of center and radius.
|
130 |
* @deprecated
|
131 |
* Use same method in GeometryUtils
|
132 |
*
|
133 |
* @param center
|
134 |
* of new circle
|
135 |
* @param radius
|
136 |
* of new circle
|
137 |
* @param subtype
|
138 |
* subtype of circle. See {@link Geometry.SUBTYPES}
|
139 |
* @return The circle created with center and radius
|
140 |
* @throws org.gvsig.fmap.geom.exception.CreateGeometryException
|
141 |
*/
|
142 |
@Deprecated
|
143 |
public Circle createCircle(Point center, double radius, int subtype) |
144 |
throws CreateGeometryException;
|
145 |
|
146 |
/**
|
147 |
* Creates a circle from three points.
|
148 |
* @deprecated
|
149 |
* Use same method in GeometryUtils
|
150 |
*
|
151 |
* @param firstPoint
|
152 |
* of circle
|
153 |
* @param secondPoint
|
154 |
* of circle
|
155 |
* @param thirdPoint
|
156 |
* of circle
|
157 |
* @param subtype
|
158 |
* subtype of circle. See {@link Geometry.SUBTYPES}
|
159 |
* @return The circle created from three points received as parameters.
|
160 |
* @throws org.gvsig.fmap.geom.exception.CreateGeometryException
|
161 |
*/
|
162 |
@Deprecated
|
163 |
public Circle createCircle(Point firstPoint, Point secondPoint, |
164 |
Point thirdPoint, int subtype) throws CreateGeometryException; |
165 |
|
166 |
/**
|
167 |
* Creates a circle from five points.The first two points are two points on a tangent to the circle.The next two are two points on another tangent to the circle.The last one is a point near the center of the circle.
|
168 |
* @deprecated
|
169 |
* Use same method in GeometryUtils
|
170 |
*
|
171 |
* @param firstPoint
|
172 |
* @param secondPoint
|
173 |
* @param thirdPoint
|
174 |
* @param fourthPoint
|
175 |
* @param fifthPoint
|
176 |
* @param subtype
|
177 |
* subtype of circle. See {@link Geometry.SUBTYPES}
|
178 |
* @return The circle created from three points received as parameters.
|
179 |
* @throws org.gvsig.fmap.geom.exception.CreateGeometryException
|
180 |
*/
|
181 |
@Deprecated
|
182 |
public Circle createCircle(Point firstPoint, Point secondPoint, |
183 |
Point thirdPoint, Point fourthPoint, Point fifthPoint, int subtype) throws CreateGeometryException; |
184 |
|
185 |
/**
|
186 |
* Creates a circle from two tangents and one point.
|
187 |
* @deprecated
|
188 |
* Use same method in GeometryUtils
|
189 |
*
|
190 |
* @param line1
|
191 |
* A tangent line
|
192 |
* @param line2
|
193 |
* Another tangent line
|
194 |
* @param point
|
195 |
* A point near the center of the circle.
|
196 |
* @param subtype
|
197 |
* subtype of circle. See {@link Geometry.SUBTYPES}
|
198 |
* @return The circle created from two tangents and one point received as parameters.
|
199 |
* @throws org.gvsig.fmap.geom.exception.CreateGeometryException
|
200 |
*/
|
201 |
@Deprecated
|
202 |
public Circle createCircle(EuclideanLine2D line1, EuclideanLine2D line2,
|
203 |
Point point, int subtype) throws CreateGeometryException; |
204 |
|
205 |
/**
|
206 |
* Creates a circle from two tangent geometries and the radius.
|
207 |
* @deprecated
|
208 |
* Use same method in GeometryUtils
|
209 |
*
|
210 |
* @param geometry1
|
211 |
* A tangent geometry
|
212 |
* @param geometry2
|
213 |
* Another tangent geometry
|
214 |
* @param radius
|
215 |
* the radius of the cicle.
|
216 |
* @param firstPoint
|
217 |
* a point near tangent point of geometry1
|
218 |
* @param secondPoint
|
219 |
* a point near tangent point of geometry2
|
220 |
* @param subtype
|
221 |
* subtype of circle. See {@link Geometry.SUBTYPES}
|
222 |
* @return The circle created from two tangent geometries and the radius received as parameters.
|
223 |
* @throws org.gvsig.fmap.geom.exception.CreateGeometryException
|
224 |
*/
|
225 |
@Deprecated
|
226 |
public Circle createCircle(Geometry geometry1, Geometry geometry2,
|
227 |
double radius, Point firstPoint, Point secondPoint, int subtype) throws CreateGeometryException; |
228 |
|
229 |
/**
|
230 |
* Creates an arc as of center, radius, start angle and extension angle.
|
231 |
* @deprecated
|
232 |
* Use same method in GeometryUtils
|
233 |
*
|
234 |
* @param center
|
235 |
* center of arc.
|
236 |
* @param radius
|
237 |
* of arc.
|
238 |
* @param startAngle
|
239 |
* of arc in radians
|
240 |
* @param angleExt
|
241 |
* of arc in radians
|
242 |
* @param subtype
|
243 |
* subtype of arc. See {@link Geometry.SUBTYPES}
|
244 |
* @return The arc created with center, radius, start angle and extension
|
245 |
* angle.
|
246 |
* @throws org.gvsig.fmap.geom.exception.CreateGeometryException
|
247 |
*/
|
248 |
@Deprecated
|
249 |
public Arc createArc(Point center, double radius, double startAngle, |
250 |
double angleExt, int subtype) throws CreateGeometryException; |
251 |
|
252 |
/**
|
253 |
* Creates an arc as of three points.
|
254 |
* @deprecated
|
255 |
* Use same method in GeometryUtils
|
256 |
*
|
257 |
* @param start
|
258 |
* point of arc
|
259 |
* @param middle
|
260 |
* point of arc. It can be any point of arc.
|
261 |
* @param end
|
262 |
* point of arc
|
263 |
* @param subtype
|
264 |
* of arc. See {@link Geometry.SUBTYPES}
|
265 |
* @return The arc created that it start at start point, cross middle
|
266 |
* point and end at end point.
|
267 |
* @throws org.gvsig.tools.exception.BaseException
|
268 |
*/
|
269 |
@Deprecated
|
270 |
public Arc createArc(Point start, Point middle, Point end, int subtype) |
271 |
throws BaseException;
|
272 |
|
273 |
/**
|
274 |
* Creates an ellipse from start and end point of A axis and half length
|
275 |
* of B axis.
|
276 |
* @deprecated
|
277 |
* Use same method in GeometryUtils
|
278 |
*
|
279 |
* @param firstPointAxisA
|
280 |
* first point of A axis
|
281 |
* @param secondPointAxisA
|
282 |
* second point of B axis
|
283 |
* @param halfLengthAxisB
|
284 |
* half length of B axis
|
285 |
* @param subtype
|
286 |
* of ellipse See {@link Geometry.SUBTYPES}
|
287 |
* @return The ellipse created
|
288 |
* @throws org.gvsig.fmap.geom.exception.CreateGeometryException
|
289 |
*/
|
290 |
@Deprecated
|
291 |
public Arc createEllipse(Point firstPointAxisA, |
292 |
Point secondPointAxisA, double halfLengthAxisB, int subtype) |
293 |
throws CreateGeometryException;
|
294 |
|
295 |
/**
|
296 |
* Creates a filled ellipse from start and end point of A axis and half length
|
297 |
* of B axis.
|
298 |
* @deprecated
|
299 |
* Use same method in GeometryUtils
|
300 |
*
|
301 |
* @param firstPointAxisA
|
302 |
* first point of A axis
|
303 |
* @param secondPointAxisA
|
304 |
* second point of B axis
|
305 |
* @param halfLengthAxisB
|
306 |
* half length of B axis
|
307 |
* @param subtype
|
308 |
* of ellipse See {@link Geometry.SUBTYPES}
|
309 |
* @return The ellipse created
|
310 |
* @throws org.gvsig.fmap.geom.exception.CreateGeometryException
|
311 |
*/
|
312 |
@Deprecated
|
313 |
public Ellipse createFilledEllipse(Point firstPointAxisA, |
314 |
Point secondPointAxisA, double halfLengthAxisB, int subtype) |
315 |
throws CreateGeometryException;
|
316 |
|
317 |
|
318 |
/**
|
319 |
* Creates point with x and y values.
|
320 |
* @deprecated
|
321 |
* Use createPoint from GeometryManager
|
322 |
*
|
323 |
* @param x
|
324 |
* The X coordinate
|
325 |
* @param y
|
326 |
* The y coordinate
|
327 |
* @param subtype
|
328 |
* of point. See {@link Geometry.SUBTYPES}
|
329 |
* @return The Point created.
|
330 |
* @throws org.gvsig.fmap.geom.exception.CreateGeometryException
|
331 |
*/
|
332 |
@Deprecated
|
333 |
public Point createPoint(double x, double y, int subtype) |
334 |
throws CreateGeometryException;
|
335 |
|
336 |
/**
|
337 |
* Creates line as of two point coordinates.
|
338 |
* @deprecated
|
339 |
* Use same method in GeometryUtils
|
340 |
*
|
341 |
* @param x1
|
342 |
* The X1 coordinate
|
343 |
* @param y1
|
344 |
* The y1 coordinate
|
345 |
* @param x2
|
346 |
* The X2 coordinate
|
347 |
* @param y2
|
348 |
* The y2 coordinate
|
349 |
* @param subtype
|
350 |
* of line. See {@link Geometry.SUBTYPES}
|
351 |
* @return The Line created.
|
352 |
* @throws org.gvsig.fmap.geom.exception.CreateGeometryException
|
353 |
*/
|
354 |
@Deprecated
|
355 |
public Line createLine(double x1, double y1, double x2, double y2, |
356 |
int subtype) throws CreateGeometryException; |
357 |
|
358 |
/**
|
359 |
* Creates line as of two point objects.
|
360 |
* @deprecated
|
361 |
* Use same method in GeometryUtils
|
362 |
*
|
363 |
* @param p1
|
364 |
* First point
|
365 |
* @param p2
|
366 |
* Second point
|
367 |
* @param subtype
|
368 |
* of line. See {@link Geometry.SUBTYPES}
|
369 |
* @return The Line created.
|
370 |
* @throws org.gvsig.fmap.geom.exception.CreateGeometryException
|
371 |
*/
|
372 |
@Deprecated
|
373 |
public Line createLine(Point p1, Point p2, int subtype) |
374 |
throws CreateGeometryException;
|
375 |
|
376 |
/**
|
377 |
* Create Spline from point list
|
378 |
* @deprecated
|
379 |
* Use same method in GeometryUtils
|
380 |
*
|
381 |
* @param points
|
382 |
* @param subtype
|
383 |
* @return
|
384 |
* @throws org.gvsig.fmap.geom.exception.CreateGeometryException
|
385 |
*/
|
386 |
@Deprecated
|
387 |
public Spline createSpline(List<Point> points, int subtype) |
388 |
throws CreateGeometryException;
|
389 |
|
390 |
/**
|
391 |
* Gets {@link SUBTYPES} of the feature store received as parameter.
|
392 |
*
|
393 |
* @param featureStore
|
394 |
* @return the subtype of the default geometry.
|
395 |
* @throws DataException
|
396 |
* if there some problem getting subtype.
|
397 |
*/
|
398 |
public int getSubType(FeatureStore featureStore) throws DataException; |
399 |
|
400 |
/**
|
401 |
* Gets {@link GeometryType} of the feature store received as parameter.
|
402 |
*
|
403 |
* @param featureStore
|
404 |
* @return the GeometryType of the default geometry.
|
405 |
* @throws DataException
|
406 |
* if there some problem getting subtype.
|
407 |
*/
|
408 |
public GeometryType getGeomType(FeatureStore featureStore)
|
409 |
throws DataException;
|
410 |
|
411 |
/**
|
412 |
* Returns a copy of a feature without primary keys data
|
413 |
*
|
414 |
* @param featureStore
|
415 |
* @param feature
|
416 |
* @return the copy of a feature without primary keys data
|
417 |
* @throws DataException
|
418 |
* if there some problem getting subtype.
|
419 |
*/
|
420 |
public EditableFeature getFeatureCopyWithoutPK(FeatureStore featureStore,
|
421 |
Feature feature) throws DataException;
|
422 |
|
423 |
/**
|
424 |
* Gets center point of three points.
|
425 |
* @deprecated
|
426 |
* Use same method in GeometryUtils
|
427 |
*
|
428 |
* @param a
|
429 |
* Point one
|
430 |
* @param b
|
431 |
* Point two
|
432 |
* @param c
|
433 |
* Point three
|
434 |
* @param subtype
|
435 |
* of point created. See {@link Geometry.SUBTYPES}
|
436 |
* @return Point center.
|
437 |
* @throws org.gvsig.fmap.geom.exception.CreateGeometryException
|
438 |
*/
|
439 |
@Deprecated
|
440 |
public Point getCenter(Point a, Point b, Point c, int subtype) |
441 |
throws CreateGeometryException;
|
442 |
|
443 |
/**
|
444 |
* Gets midpoint of two points
|
445 |
* @deprecated
|
446 |
* Use same method in GeometryUtils
|
447 |
*
|
448 |
* @param a
|
449 |
* Point one
|
450 |
* @param b
|
451 |
* Point two
|
452 |
* @param subtype
|
453 |
* of point created. See {@link Geometry.SUBTYPES}
|
454 |
* @return Mid point of points.
|
455 |
* @throws org.gvsig.fmap.geom.exception.CreateGeometryException
|
456 |
*/
|
457 |
@Deprecated
|
458 |
public Point getMidPoint(Point a, Point b, int subtype) |
459 |
throws CreateGeometryException;
|
460 |
|
461 |
/**
|
462 |
* Gets the slope of the line created by points received.
|
463 |
* @deprecated
|
464 |
* Use EuclideanLine2D
|
465 |
*
|
466 |
* @param point
|
467 |
* of line
|
468 |
* @param nextPoint
|
469 |
* of line
|
470 |
* @return An array with two valors. First is slope of line and second is
|
471 |
* y-intercept
|
472 |
*/
|
473 |
@Deprecated
|
474 |
public Double[] getLineParams(Point point, Point nextPoint); |
475 |
|
476 |
/**
|
477 |
* Gets perpendicular of line formed by slope and y-intercept received as
|
478 |
* parameters.The perpendicular cross the point received as parameter.
|
479 |
* @deprecated
|
480 |
* Use getPerpendicular method from EuclideanLine2D package
|
481 |
*
|
482 |
* @param m
|
483 |
* slope of line
|
484 |
* @param b
|
485 |
* y-intercep of line
|
486 |
* @param point
|
487 |
* Point crossed by perpendicular
|
488 |
* @param subtype
|
489 |
* of perpendicular points. See {@link Geometry.SUBTYPES}
|
490 |
* @return Line perpendicular to line received as parameter. The
|
491 |
* perpendicular cross point received as parameter.
|
492 |
* @throws org.gvsig.fmap.geom.exception.CreateGeometryException
|
493 |
*/
|
494 |
@Deprecated
|
495 |
public Point[] getPerpendicular(Double m, Double b, Point point, int subtype) |
496 |
throws CreateGeometryException;
|
497 |
|
498 |
/**
|
499 |
* Gets intersection point of two lines.If lines are parallels return null.
|
500 |
* @deprecated
|
501 |
* Use getIntersection method from EuclideanLine2D package
|
502 |
*
|
503 |
* @param lineA
|
504 |
* @param lineB
|
505 |
* @param subtype
|
506 |
* of intersection point. See {@link Geometry.SUBTYPES}
|
507 |
* @return Point of intersection. If lines are parallels return null.
|
508 |
* @throws org.gvsig.fmap.geom.exception.CreateGeometryException
|
509 |
*/
|
510 |
@Deprecated
|
511 |
public Point getIntersection(Point[] lineA, Point[] lineB, int subtype) |
512 |
throws CreateGeometryException;
|
513 |
|
514 |
/**
|
515 |
* Gets angle between two points.
|
516 |
*
|
517 |
* @param start
|
518 |
* @param end
|
519 |
* @return Angle between two points.
|
520 |
* @throws org.gvsig.fmap.geom.operation.GeometryOperationNotSupportedException
|
521 |
* @throws org.gvsig.fmap.geom.operation.GeometryOperationException
|
522 |
*/
|
523 |
public double getAngle(Point start, Point end) |
524 |
throws GeometryOperationNotSupportedException,
|
525 |
GeometryOperationException; |
526 |
|
527 |
/**
|
528 |
* Gets distance between two angles.
|
529 |
*
|
530 |
* @param angle1
|
531 |
* @param angle2
|
532 |
* @return Distance of angles
|
533 |
*/
|
534 |
public double angleDistance(double angle1, double angle2); |
535 |
|
536 |
/**
|
537 |
* Return a geometry from store that intersects with the point.
|
538 |
*
|
539 |
* @param point
|
540 |
* @param store
|
541 |
* @param mapContext
|
542 |
* @return
|
543 |
*/
|
544 |
public Geometry getGeometry(Point point, FeatureStore store, MapContext mapContext); |
545 |
|
546 |
/**
|
547 |
* Return a geometry that intersects with the point from the visible layers
|
548 |
* if it can't be found in the feature store.
|
549 |
*
|
550 |
* @param point
|
551 |
* @param store
|
552 |
* @param mapContext
|
553 |
* @return
|
554 |
*/
|
555 |
public Geometry getGeometryOfVisibleLayers(Point point, FeatureStore store, MapContext mapContext); |
556 |
|
557 |
} |