Revision 456 trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/layers/FLyrVect.java
FLyrVect.java | ||
---|---|---|
6 | 6 |
import java.awt.geom.Point2D; |
7 | 7 |
import java.awt.geom.Rectangle2D; |
8 | 8 |
import java.awt.image.BufferedImage; |
9 |
import java.util.ArrayList; |
|
9 | 10 |
import java.util.BitSet; |
11 |
import java.util.Iterator; |
|
10 | 12 |
|
11 | 13 |
import com.hardcode.driverManager.DriverLoadException; |
12 | 14 |
import com.hardcode.gdbms.engine.data.DataSource; |
... | ... | |
25 | 27 |
import com.iver.utiles.XMLEntity; |
26 | 28 |
|
27 | 29 |
public class FLyrVect extends FLyrDefault implements LayerOperations, VectorialOperations, CommonOperations { |
28 |
/** |
|
29 |
* Colecci?n de leyendas de la capa vectorial. Contendr? tantos elementos como tipos de |
|
30 |
* features pueda tener la capa vectorial |
|
31 |
*/ |
|
30 |
/** Leyenda de la capa vectorial */ |
|
32 | 31 |
private VectorialLegend legend; |
33 | 32 |
|
34 | 33 |
public void addLayerListener(LayerListener listener) { |
34 |
listeners.add(listener); |
|
35 | 35 |
} |
36 | 36 |
|
37 | 37 |
public void removeLayerListener(LayerListener listener) { |
38 |
listeners.remove(listener); |
|
38 | 39 |
} |
39 | 40 |
|
40 | 41 |
/** |
41 | 42 |
* Cuando ocurre un evento de cambio en la selecci?n, ?ste puede ser uno de una gran cantidad de eventos. Con el fin de no propagar todos estos eventos, se realiza la propagaci?n de manera manual al final de la "r?faga" de eventos |
42 | 43 |
*/ |
43 | 44 |
public void fireSelectionEvents() { |
45 |
LayerEvent e = new LayerEvent(); |
|
46 |
e.setLayer(this); |
|
47 |
for (Iterator iter = listeners.iterator(); iter.hasNext();) { |
|
48 |
LayerListener listener = (LayerListener) iter.next(); |
|
49 |
|
|
50 |
listener.selectionChanged(e); |
|
51 |
} |
|
44 | 52 |
} |
45 | 53 |
|
46 | 54 |
public VectorialAdapter getSource() { |
... | ... | |
51 | 59 |
source = va; |
52 | 60 |
} |
53 | 61 |
|
54 |
private BitSet selected ; |
|
62 |
private BitSet selected = new BitSet();
|
|
55 | 63 |
|
56 | 64 |
/** |
57 | 65 |
* @supplierCardinality 0..* |
58 | 66 |
*/ |
59 |
private LayerListener[] listeners;
|
|
67 |
private ArrayList listeners = new ArrayList();
|
|
60 | 68 |
|
61 | 69 |
/** |
62 | 70 |
* @clientCardinality 0..* |
... | ... | |
112 | 120 |
* @see com.iver.cit.gvsig.fmap.layers.CommonOperations#setSelection(com.iver.cit.gvsig.fmap.operations.selection.VectorialSubSet) |
113 | 121 |
*/ |
114 | 122 |
public void setSelection(BitSet selection) { |
123 |
selected = selection; |
|
115 | 124 |
} |
116 | 125 |
|
117 | 126 |
/** |
118 | 127 |
* @see com.iver.cit.gvsig.fmap.layers.CommonOperations#isSelected(int) |
119 | 128 |
*/ |
120 | 129 |
public boolean isSelected(int index) { |
121 |
return false;
|
|
130 |
return selected.get(index);
|
|
122 | 131 |
} |
123 | 132 |
|
124 | 133 |
/** |
134 |
* @see com.iver.cit.gvsig.fmap.layers.CommonOperations#getSelection() |
|
135 |
*/ |
|
136 |
public BitSet getSelection() { |
|
137 |
return selected; |
|
138 |
} |
|
139 |
|
|
140 |
/** |
|
125 | 141 |
* @see com.iver.cit.gvsig.fmap.layers.CommonOperations#clearSelection() |
126 | 142 |
*/ |
127 | 143 |
public void clearSelection() { |
144 |
selected.clear(); |
|
128 | 145 |
} |
129 | 146 |
|
130 | 147 |
/** |
... | ... | |
149 | 166 |
} |
150 | 167 |
|
151 | 168 |
/** |
169 |
* @throws DriverIOException |
|
152 | 170 |
* @see com.iver.cit.gvsig.fmap.layers.CommonOperations#selectByPoint(com.iver.cit.gvsig.fmap.operations.QueriedPoint, double) |
153 | 171 |
*/ |
154 |
public void selectByPoint(QueriedPoint p, double tolerance) { |
|
172 |
public void selectByPoint(QueriedPoint p, double tolerance) throws DriverIOException { |
|
173 |
Strategy s = StrategyManager.getStrategy(this); |
|
174 |
this.setSelection(s.queryByPoint(p, tolerance)); |
|
175 |
fireSelectionEvents(); |
|
155 | 176 |
} |
156 | 177 |
|
157 | 178 |
/** |
179 |
* @throws DriverIOException |
|
158 | 180 |
* @see com.iver.cit.gvsig.fmap.layers.CommonOperations#selectByRect(java.awt.geom.Rectangle2D) |
159 | 181 |
*/ |
160 |
public void selectByRect(Rectangle2D rect) { |
|
182 |
public void selectByRect(Rectangle2D rect) throws DriverIOException { |
|
183 |
Strategy s = StrategyManager.getStrategy(this); |
|
184 |
this.setSelection(s.queryByRect(rect)); |
|
185 |
fireSelectionEvents(); |
|
161 | 186 |
} |
162 | 187 |
|
163 | 188 |
/** |
164 | 189 |
* @see com.iver.cit.gvsig.fmap.layers.CommonOperations#selectByShape(com.iver.cit.gvsig.fmap.core.IGeometry, int) |
165 | 190 |
*/ |
166 | 191 |
public void selectByShape(IGeometry g, int relationship) { |
192 |
fireSelectionEvents(); |
|
167 | 193 |
} |
168 | 194 |
|
169 | 195 |
/** |
Also available in: Unified diff