Revision 21156 branches/v2_0_0_prep/libraries/libFMap/src/org/gvsig/fmap/mapcontrol/tools/RectangleSelectionListener.java
RectangleSelectionListener.java | ||
---|---|---|
48 | 48 |
|
49 | 49 |
import javax.swing.ImageIcon; |
50 | 50 |
|
51 |
import org.gvsig.fmap.drivers.exceptions.VisitorException;
|
|
52 |
import org.gvsig.fmap.mapcontext.layers.FBitSet;
|
|
51 |
import org.gvsig.data.ReadException;
|
|
52 |
import org.gvsig.data.vectorial.FeatureCollection;
|
|
53 | 53 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
54 | 54 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
55 | 55 |
import org.gvsig.fmap.mapcontrol.MapControl; |
56 | 56 |
import org.gvsig.fmap.mapcontrol.tools.Events.RectangleEvent; |
57 | 57 |
import org.gvsig.fmap.mapcontrol.tools.Listeners.RectangleListener; |
58 | 58 |
|
59 |
import com.hardcode.gdbms.driver.exceptions.ReadDriverException; |
|
60 |
|
|
61 |
|
|
62 | 59 |
/** |
63 | 60 |
* <p>Listener that selects all features of the active and vector layers which intersect with the defined |
64 | 61 |
* rectangle area in the associated {@link MapControl MapControl} object.</p> |
... | ... | |
74 | 71 |
|
75 | 72 |
/** |
76 | 73 |
* The cursor used to work with this tool listener. |
77 |
*
|
|
74 |
* |
|
78 | 75 |
* @see #getCursor() |
79 | 76 |
*/ |
80 | 77 |
private Cursor cur = Toolkit.getDefaultToolkit().createCustomCursor(img, |
... | ... | |
108 | 105 |
{ |
109 | 106 |
if (actives[i] instanceof FLyrVect) { |
110 | 107 |
FLyrVect lyrVect = (FLyrVect) actives[i]; |
111 |
FBitSet oldBitSet = lyrVect.getSource().getRecordset().getSelection(); |
|
112 |
FBitSet newBitSet = lyrVect.queryByRect(rect); |
|
113 |
if (event.getEvent().isControlDown()) |
|
114 |
newBitSet.xor(oldBitSet); |
|
115 |
lyrVect.getRecordset().setSelection(newBitSet); |
|
108 |
FeatureCollection oldSelection = (FeatureCollection) lyrVect.getFeatureStore().getSelection(); |
|
109 |
FeatureCollection newSelection = (FeatureCollection) lyrVect.queryByRect(rect); |
|
110 |
if (event.getEvent().isControlDown()){ |
|
111 |
//TODO |
|
112 |
// newBitSet.xor(oldBitSet); |
|
113 |
} |
|
114 |
lyrVect.getFeatureStore().setSelection(newSelection); |
|
116 | 115 |
} |
117 | 116 |
} |
118 | 117 |
|
119 |
} catch (ReadDriverException e) {
|
|
118 |
} catch (ReadException e) { |
|
120 | 119 |
throw new BehaviorException("No se pudo hacer la selecci?n"); |
121 |
} catch (VisitorException e) { |
|
122 |
throw new BehaviorException("No se pudo hacer la selecci?n"); |
|
123 | 120 |
} |
124 | 121 |
} |
125 | 122 |
|
Also available in: Unified diff