01: package net.refractions.udig.project.geoselection;
02:
03: import java.util.ArrayList;
04: import java.util.Iterator;
05:
06: import net.refractions.udig.project.ILayer;
07:
08: import org.geotools.feature.Feature;
09:
10: /**
11: * Example what is a real IGeoSelection.
12: *
13: * @author Vitalus
14: */
15: public class ExampleFeatureGeoSelection extends AbstractGeoSelection {
16:
17: final private Feature feature;
18:
19: final private ILayer layer;
20:
21: private ArrayList list;
22:
23: public ExampleFeatureGeoSelection(Feature feature, ILayer layer) {
24: super ();
25: this .feature = feature;
26: this .layer = layer;
27:
28: }
29:
30: public Iterator iterator() {
31: if (list == null) {
32: list = new ArrayList(2);
33: list.add(feature);
34: list.add(layer);
35: }
36: return list.iterator();
37: }
38:
39: public Object getAdapter(Class adapter) {
40: if (Feature.class.isAssignableFrom(adapter))
41: return feature;
42: if (ILayer.class.isAssignableFrom(adapter))
43: return layer;
44:
45: return null;
46: }
47:
48: }
|