Revision 21156 branches/v2_0_0_prep/libraries/libFMap/src/org/gvsig/fmap/mapcontrol/tools/PointSelectionListener.java
PointSelectionListener.java | ||
---|---|---|
48 | 48 |
|
49 | 49 |
import javax.swing.ImageIcon; |
50 | 50 |
|
51 |
import org.gvsig.fmap.drivers.exceptions.VisitorException; |
|
51 |
import org.gvsig.data.ReadException; |
|
52 |
import org.gvsig.data.vectorial.FeatureCollection; |
|
52 | 53 |
import org.gvsig.fmap.mapcontext.layers.FBitSet; |
53 | 54 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
54 | 55 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
... | ... | |
56 | 57 |
import org.gvsig.fmap.mapcontrol.tools.Events.PointEvent; |
57 | 58 |
import org.gvsig.fmap.mapcontrol.tools.Listeners.PointListener; |
58 | 59 |
|
59 |
import com.hardcode.gdbms.driver.exceptions.ReadDriverException; |
|
60 |
|
|
61 |
|
|
62 | 60 |
/** |
63 | 61 |
* <p>Listener that selects all features of the active, and vector layers of the associated <code>MapControl</code> |
64 | 62 |
* that their area intersects with the point selected by a single click of any button of the mouse.</p> |
... | ... | |
74 | 72 |
|
75 | 73 |
/** |
76 | 74 |
* The cursor used to work with this tool listener. |
77 |
*
|
|
75 |
* |
|
78 | 76 |
* @see #getCursor() |
79 | 77 |
*/ |
80 | 78 |
private Cursor cur = Toolkit.getDefaultToolkit().createCustomCursor(img, |
... | ... | |
87 | 85 |
|
88 | 86 |
/** |
89 | 87 |
* <p>Creates a new <code>PointSelectionListener</code> object.</p> |
90 |
*
|
|
88 |
* |
|
91 | 89 |
* @param mc the <code>MapControl</code> where will be applied the changes |
92 | 90 |
*/ |
93 | 91 |
public PointSelectionListener(MapControl mc) { |
... | ... | |
112 | 110 |
{ |
113 | 111 |
if (actives[i] instanceof FLyrVect) { |
114 | 112 |
FLyrVect lyrVect = (FLyrVect) actives[i]; |
115 |
FBitSet oldBitSet = lyrVect.getSource().getRecordset().getSelection(); |
|
116 |
FBitSet newBitSet = lyrVect.queryByPoint(mapPoint, tol); |
|
117 |
if (event.getEvent().isControlDown()) |
|
118 |
newBitSet.xor(oldBitSet); |
|
119 |
lyrVect.getRecordset().setSelection(newBitSet); |
|
113 |
FeatureCollection oldSelection = (FeatureCollection)lyrVect.getFeatureStore().getSelection(); |
|
114 |
FeatureCollection newSelection = (FeatureCollection)lyrVect.queryByPoint(mapPoint, tol); |
|
115 |
if (event.getEvent().isControlDown()){ |
|
116 |
//TODO |
|
117 |
// newSelection.xor(oldSelection); |
|
118 |
} |
|
119 |
|
|
120 |
lyrVect.getFeatureStore().setSelection(newSelection); |
|
120 | 121 |
} |
121 | 122 |
} |
122 | 123 |
|
123 |
} catch (ReadDriverException e) {
|
|
124 |
} catch (ReadException e) { |
|
124 | 125 |
throw new BehaviorException("No se pudo hacer la selecci?n"); |
125 |
} catch (VisitorException e) { |
|
126 |
throw new BehaviorException("No se pudo hacer la selecci?n"); |
|
127 | 126 |
} |
128 | 127 |
} |
129 | 128 |
|
Also available in: Unified diff