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