svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.fmap.dal / org.gvsig.fmap.dal.api / src / main / java / org / gvsig / fmap / dal / feature / FeatureSelection.java @ 47049
History | View | Annotate | Download (9.66 KB)
1 |
/**
|
---|---|
2 |
* gvSIG. Desktop Geographic Information System.
|
3 |
*
|
4 |
* Copyright (C) 2007-2013 gvSIG Association.
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU General Public License
|
8 |
* as published by the Free Software Foundation; either version 3
|
9 |
* of the License, or (at your option) any later version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
* GNU General Public License for more details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License
|
17 |
* along with this program; if not, write to the Free Software
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 |
* MA 02110-1301, USA.
|
20 |
*
|
21 |
* For any additional information, do not hesitate to contact us
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
23 |
*/
|
24 |
/*
|
25 |
* AUTHORS (In addition to CIT):
|
26 |
* 2008 {DiSiD Technologies} {Implement data selection}
|
27 |
*/
|
28 |
package org.gvsig.fmap.dal.feature; |
29 |
|
30 |
import java.util.Collections; |
31 |
import java.util.Iterator; |
32 |
import java.util.List; |
33 |
import javax.json.JsonArray; |
34 |
import javax.json.JsonArrayBuilder; |
35 |
import org.gvsig.expressionevaluator.Expression; |
36 |
import org.gvsig.fmap.dal.DataStore; |
37 |
import org.gvsig.fmap.dal.exception.DataException; |
38 |
import org.gvsig.tools.dispose.DisposableIterator; |
39 |
import org.gvsig.tools.dynobject.DynObjectSet; |
40 |
import org.gvsig.tools.exception.BaseException; |
41 |
import org.gvsig.tools.lang.Cloneable; |
42 |
import org.gvsig.tools.observer.Observable; |
43 |
import org.gvsig.tools.observer.Observer; |
44 |
import org.gvsig.tools.persistence.PersistentState; |
45 |
import org.gvsig.tools.persistence.exception.PersistenceException; |
46 |
import org.gvsig.tools.visitor.Visitor; |
47 |
|
48 |
/**
|
49 |
* Manages a selection of Features.
|
50 |
*
|
51 |
* @author <a href="mailto:cordin@disid.com">C?sar Ordi?ana</a>
|
52 |
*/
|
53 |
public interface FeatureSelection extends FeatureReferenceSelection, |
54 |
FeatureSet, Cloneable {
|
55 |
|
56 |
public static final FeatureSelection EMTPY_FEATURE_SELECTION = new FeatureSelection() { |
57 |
@Override
|
58 |
public boolean select(Feature feature) { |
59 |
return false; |
60 |
} |
61 |
|
62 |
@Override
|
63 |
public boolean deselect(Feature feature) { |
64 |
return false; |
65 |
} |
66 |
|
67 |
@Override
|
68 |
public boolean select(FeatureSet features) throws DataException { |
69 |
return false; |
70 |
} |
71 |
|
72 |
@Override
|
73 |
public boolean deselect(FeatureSet features) throws DataException { |
74 |
return false; |
75 |
} |
76 |
|
77 |
@Override
|
78 |
public boolean isSelected(Feature feature) { |
79 |
return false; |
80 |
} |
81 |
|
82 |
@Override
|
83 |
public boolean isAvailable() { |
84 |
return true; |
85 |
} |
86 |
|
87 |
@Override
|
88 |
public boolean select(FeatureReference reference) { |
89 |
return false; |
90 |
} |
91 |
|
92 |
@Override
|
93 |
public boolean deselect(FeatureReference reference) { |
94 |
return false; |
95 |
} |
96 |
|
97 |
@Override
|
98 |
public void selectAll() throws DataException { |
99 |
} |
100 |
|
101 |
@Override
|
102 |
public void deselectAll() throws DataException { |
103 |
} |
104 |
|
105 |
@Override
|
106 |
public boolean isSelected(FeatureReference reference) { |
107 |
return false; |
108 |
} |
109 |
|
110 |
@Override
|
111 |
public void reverse() { |
112 |
} |
113 |
|
114 |
@Override
|
115 |
public long getSelectedCount() { |
116 |
return 0; |
117 |
} |
118 |
|
119 |
@Override
|
120 |
public Iterator<FeatureReference> referenceIterator() { |
121 |
return Collections.EMPTY_LIST.iterator(); |
122 |
} |
123 |
|
124 |
@Override
|
125 |
public Iterable<FeatureReference> referenceIterable() { |
126 |
return Collections.EMPTY_LIST; |
127 |
} |
128 |
|
129 |
@Override
|
130 |
public boolean isFromStore(DataStore store) { |
131 |
return false; |
132 |
} |
133 |
|
134 |
@Override
|
135 |
public void accept(Visitor visitor) throws BaseException { |
136 |
} |
137 |
|
138 |
@Override
|
139 |
public void dispose() { |
140 |
} |
141 |
|
142 |
@Override
|
143 |
public void update(Observable observable, Object notification) { |
144 |
} |
145 |
|
146 |
@Override
|
147 |
public void addObserver(Observer o) { |
148 |
} |
149 |
|
150 |
@Override
|
151 |
public void deleteObserver(Observer o) { |
152 |
} |
153 |
|
154 |
@Override
|
155 |
public void deleteObservers() { |
156 |
} |
157 |
|
158 |
@Override
|
159 |
public void disableNotifications() { |
160 |
} |
161 |
|
162 |
@Override
|
163 |
public void enableNotifications() { |
164 |
} |
165 |
|
166 |
@Override
|
167 |
public void beginComplexNotification() { |
168 |
} |
169 |
|
170 |
@Override
|
171 |
public void endComplexNotification() { |
172 |
} |
173 |
|
174 |
@Override
|
175 |
public void saveToState(PersistentState state) throws PersistenceException { |
176 |
} |
177 |
|
178 |
@Override
|
179 |
public void loadFromState(PersistentState state) throws PersistenceException { |
180 |
} |
181 |
|
182 |
@Override
|
183 |
public FeatureType getDefaultFeatureType() {
|
184 |
return null; |
185 |
} |
186 |
|
187 |
@Override
|
188 |
public List getFeatureTypes() { |
189 |
return null; |
190 |
} |
191 |
|
192 |
@Override
|
193 |
public long getSize() throws DataException { |
194 |
return 0; |
195 |
} |
196 |
|
197 |
@Override
|
198 |
public DisposableIterator iterator(long index) throws DataException { |
199 |
return DisposableIterator.EMPTY_DISPOSABLE_ITERATOR;
|
200 |
} |
201 |
|
202 |
@Override
|
203 |
public DisposableIterator iterator(long index, long elements) throws DataException { |
204 |
return DisposableIterator.EMPTY_DISPOSABLE_ITERATOR;
|
205 |
} |
206 |
|
207 |
@Override
|
208 |
public DisposableFeatureSetIterable iterable() {
|
209 |
return DisposableFeatureSetIterable.EMPTY_DISPOSABLE_FEATURE_SET_ITERABLE;
|
210 |
} |
211 |
|
212 |
@Override
|
213 |
public DisposableFeatureSetIterable iterable(boolean disposeFeatureSet) { |
214 |
return DisposableFeatureSetIterable.EMPTY_DISPOSABLE_FEATURE_SET_ITERABLE;
|
215 |
} |
216 |
|
217 |
@Override
|
218 |
public DisposableIterator fastIterator() throws DataException { |
219 |
return DisposableIterator.EMPTY_DISPOSABLE_ITERATOR;
|
220 |
} |
221 |
|
222 |
@Override
|
223 |
public DisposableIterator fastIterator(long index) throws DataException { |
224 |
return DisposableIterator.EMPTY_DISPOSABLE_ITERATOR;
|
225 |
} |
226 |
|
227 |
@Override
|
228 |
public DisposableIterator fastIterator(long index, long elemets) throws DataException { |
229 |
return DisposableIterator.EMPTY_DISPOSABLE_ITERATOR;
|
230 |
} |
231 |
|
232 |
@Override
|
233 |
public Feature first() {
|
234 |
return null; |
235 |
} |
236 |
|
237 |
@Override
|
238 |
public void update(EditableFeature feature) throws DataException { |
239 |
} |
240 |
|
241 |
@Override
|
242 |
public void commitChanges() throws DataException { |
243 |
} |
244 |
|
245 |
@Override
|
246 |
public void delete(Feature feature) throws DataException { |
247 |
} |
248 |
|
249 |
@Override
|
250 |
public void insert(EditableFeature feature) throws DataException { |
251 |
} |
252 |
|
253 |
@Override
|
254 |
public DynObjectSet getDynObjectSet() {
|
255 |
return null; |
256 |
} |
257 |
|
258 |
@Override
|
259 |
public DynObjectSet getDynObjectSet(boolean fast) { |
260 |
return null; |
261 |
} |
262 |
|
263 |
@Override
|
264 |
public void accept(Visitor visitor, long firstValueIndex) throws BaseException { |
265 |
} |
266 |
|
267 |
@Override
|
268 |
public void accept(Visitor visitor, long firstValueIndex, long elements) throws BaseException { |
269 |
} |
270 |
|
271 |
@Override
|
272 |
public FeatureStore getFeatureStore() {
|
273 |
return null; |
274 |
} |
275 |
|
276 |
@Override
|
277 |
public JsonArray toJSON() {
|
278 |
return null; |
279 |
} |
280 |
|
281 |
@Override
|
282 |
public JsonArray toJson() {
|
283 |
return null; |
284 |
} |
285 |
|
286 |
@Override
|
287 |
public JsonArrayBuilder toJsonBuilder() {
|
288 |
return null; |
289 |
} |
290 |
|
291 |
@Override
|
292 |
public long size64() { |
293 |
return 0; |
294 |
} |
295 |
|
296 |
@Override
|
297 |
public int size() { |
298 |
return 0; |
299 |
} |
300 |
|
301 |
@Override
|
302 |
public boolean isEmpty() { |
303 |
return false; |
304 |
} |
305 |
|
306 |
@Override
|
307 |
public DisposableIterator<Feature> iterator() {
|
308 |
return DisposableIterator.EMPTY_DISPOSABLE_ITERATOR;
|
309 |
} |
310 |
|
311 |
@Override
|
312 |
public Object clone() throws CloneNotSupportedException { |
313 |
return this; |
314 |
} |
315 |
|
316 |
@Override
|
317 |
public Expression makeFilter(int maxfeatures) { |
318 |
return null; |
319 |
} |
320 |
|
321 |
|
322 |
}; |
323 |
|
324 |
/**
|
325 |
* Adds a feature to the selection.
|
326 |
*
|
327 |
* @param feature
|
328 |
* the selected feature
|
329 |
* @return true if the feature was not selected before selecting it
|
330 |
*/
|
331 |
boolean select(Feature feature);
|
332 |
|
333 |
/**
|
334 |
* Removes a feature from the selection.
|
335 |
*
|
336 |
* @param feature
|
337 |
* the deselected feature
|
338 |
* @return true if the feature was selected before deselecting it
|
339 |
*/
|
340 |
boolean deselect(Feature feature);
|
341 |
|
342 |
/**
|
343 |
* Adds a DataSet of features to the selection.
|
344 |
*
|
345 |
* @param features
|
346 |
* the selected features
|
347 |
* @return true if any of the feature was not selected before selecting it
|
348 |
* @throws DataException
|
349 |
* if there is an error reading the FeatureSet values
|
350 |
*/
|
351 |
boolean select(FeatureSet features) throws DataException; |
352 |
|
353 |
/**
|
354 |
* Removes a DataSet of features from the selection.
|
355 |
*
|
356 |
* @param features
|
357 |
* the deselected features
|
358 |
* @return true if any of the features was selected before deselecting it
|
359 |
* @throws DataException
|
360 |
* if there is an error reading the FeatureSet values
|
361 |
*/
|
362 |
boolean deselect(FeatureSet features) throws DataException; |
363 |
|
364 |
/**
|
365 |
* Returns if a feature is selected.
|
366 |
*
|
367 |
* @param feature
|
368 |
* to check
|
369 |
* @return if it is selected
|
370 |
*/
|
371 |
boolean isSelected(Feature feature);
|
372 |
|
373 |
@Override
|
374 |
boolean isAvailable();
|
375 |
} |