gvsig-vectorediting / org.gvsig.vectorediting / trunk / org.gvsig.vectorediting / org.gvsig.vectorediting.lib / org.gvsig.vectorediting.lib.api / src / main / java / org / gvsig / vectorediting / lib / api / EditingService.java @ 2444
History | View | Annotate | Download (6.38 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.api; |
26 |
|
27 |
import java.util.List; |
28 |
|
29 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
30 |
import org.gvsig.fmap.geom.Geometry; |
31 |
import org.gvsig.fmap.geom.primitive.Point; |
32 |
import org.gvsig.tools.service.Service; |
33 |
import org.gvsig.vectorediting.lib.api.exceptions.DrawServiceException; |
34 |
import org.gvsig.vectorediting.lib.api.exceptions.FinishServiceException; |
35 |
import org.gvsig.vectorediting.lib.api.exceptions.InvalidEntryException; |
36 |
import org.gvsig.vectorediting.lib.api.exceptions.StartServiceException; |
37 |
import org.gvsig.vectorediting.lib.api.exceptions.StopServiceException; |
38 |
|
39 |
/**
|
40 |
* <p>
|
41 |
* This service is used to interact with Editing providers. Each instance of
|
42 |
* this has linked an Editing provider. At this moment services delegate all
|
43 |
* functionality to providers. To get an instance of this use
|
44 |
* {@link EditingManager#getEditingService(String, org.gvsig.fmap.dal.feature.FeatureStore)}
|
45 |
* </p>
|
46 |
*
|
47 |
* @author gvSIG team.
|
48 |
* @version $Id$
|
49 |
*/
|
50 |
public interface EditingService extends Service { |
51 |
|
52 |
/**
|
53 |
* Gets state of drawing. If this service has sufficient values with mouse
|
54 |
* position to create geometries returns a {@link DrawingStatus}. List of
|
55 |
* geometries of drawing status object can be different from final
|
56 |
* geometries. Use this method to get a draft status information while user
|
57 |
* is drawing.
|
58 |
*
|
59 |
* @param mousePosition
|
60 |
* Mouse position to draw geometries.
|
61 |
* @return A {@link DrawingStatus} object with a list of geometries and
|
62 |
* information.
|
63 |
* @throws DrawServiceException
|
64 |
* if there are some error creating geometries.
|
65 |
*/
|
66 |
public DrawingStatus getDrawingStatus(Point mousePosition) |
67 |
throws DrawServiceException;
|
68 |
|
69 |
/**
|
70 |
* Gets a <code>List</code> with all parameters of service. Each parameter
|
71 |
* has name, description and types. See {@link EditingServiceParameter}.
|
72 |
*
|
73 |
* @return A list of {@link EditingServiceParameter} objects.
|
74 |
*/
|
75 |
public List<EditingServiceParameter> getParameters(); |
76 |
|
77 |
/**
|
78 |
* Gets next parameter needed by service. The parameter has information
|
79 |
* about its name, description and types. Returns <code>null</code> if all
|
80 |
* parameters have values.
|
81 |
*
|
82 |
* @return An {@link EditingServiceParameter} object that represents the
|
83 |
* next parameter.
|
84 |
*/
|
85 |
public EditingServiceParameter next();
|
86 |
|
87 |
/**
|
88 |
* Sets value to service. The value will be put in the next parameter need
|
89 |
* by this service.
|
90 |
*
|
91 |
* @param value
|
92 |
* Object to be set to next {@link EditingServiceParameter}
|
93 |
* @throws InvalidEntryException
|
94 |
* If the next parameter needed does not accept this value.
|
95 |
*/
|
96 |
public void setValue(Object value) throws InvalidEntryException; |
97 |
|
98 |
/**
|
99 |
* Sets value into a paremeter of the service.The value will be put in the parameter of this service.
|
100 |
*
|
101 |
* @param parameter {@link EditingServiceParameter}
|
102 |
* @param value
|
103 |
* Object to be set to {@link EditingServiceParameter}
|
104 |
* @throws InvalidEntryException
|
105 |
* If the next parameter needed does not accept this value.
|
106 |
*/
|
107 |
public void setValue(EditingServiceParameter parameter, Object value) throws InvalidEntryException; |
108 |
|
109 |
/**
|
110 |
* Return true if the parameter is enabled
|
111 |
*
|
112 |
* @param parameter
|
113 |
* @return
|
114 |
*/
|
115 |
public boolean isEnabled(EditingServiceParameter parameter); |
116 |
|
117 |
/**
|
118 |
* Stops service. Use this method to stop and clean values of service.
|
119 |
*
|
120 |
* @throws StopServiceException
|
121 |
* Stops service initializing necessary parameters of service.
|
122 |
* This method is called when user cancels service.
|
123 |
*/
|
124 |
public void stop() throws StopServiceException; |
125 |
|
126 |
/**
|
127 |
* Finalizes service. Use this method to get the result of service without
|
128 |
* store it to {@link FeatureStore}. Make sure that service has all required
|
129 |
* values.
|
130 |
*
|
131 |
* @return Geometry created or modified from added values.
|
132 |
* @throws FinishServiceException
|
133 |
* if there are some error getting values,
|
134 |
* creating geometries.
|
135 |
*/
|
136 |
public Geometry finish() throws FinishServiceException; |
137 |
|
138 |
/**
|
139 |
* Finalizes service and stores the result to {@link FeatureStore} of this
|
140 |
* service. Use this method to store the result of this service. Make sure
|
141 |
* that service has all required values.
|
142 |
*
|
143 |
* @throws FinishServiceException
|
144 |
* if there are some error getting values,
|
145 |
* creating geometries or inserting/updating/removing geometries
|
146 |
* from feature store.
|
147 |
*/
|
148 |
public void finishAndStore() throws FinishServiceException; |
149 |
|
150 |
/**
|
151 |
* Starts service. Use this method before add values.
|
152 |
*
|
153 |
* @throws StartServiceException
|
154 |
* if there are some error starting service.
|
155 |
* @throws InvalidEntryException
|
156 |
* if the entry of provider is not valid
|
157 |
*/
|
158 |
public void start() throws StartServiceException, InvalidEntryException; |
159 |
|
160 |
/**
|
161 |
* Gets service name. The name of service is the same name of linked
|
162 |
* provider.
|
163 |
*
|
164 |
* @return Name of service.
|
165 |
*/
|
166 |
public String getName(); |
167 |
|
168 |
/**
|
169 |
* Activate service
|
170 |
*/
|
171 |
public void activate(); |
172 |
|
173 |
/**
|
174 |
* Return the parameter's value
|
175 |
*
|
176 |
* @param parameter
|
177 |
* @return
|
178 |
*/
|
179 |
public Object getValue(EditingServiceParameter parameter); |
180 |
|
181 |
} |