root / trunk / libraries / libFMap / src / com / iver / cit / gvsig / fmap / tools / RectangleSelectionListener.java @ 770
History | View | Annotate | Download (1.6 KB)
1 |
package com.iver.cit.gvsig.fmap.tools; |
---|---|
2 |
|
3 |
import java.awt.Cursor; |
4 |
import java.awt.Image; |
5 |
import java.awt.Point; |
6 |
import java.awt.Toolkit; |
7 |
|
8 |
import javax.swing.ImageIcon; |
9 |
|
10 |
import com.iver.cit.gvsig.fmap.DriverException; |
11 |
import com.iver.cit.gvsig.fmap.NewMapControl; |
12 |
import com.iver.cit.gvsig.fmap.drivers.DriverIOException; |
13 |
import com.iver.cit.gvsig.fmap.tools.Events.RectangleEvent; |
14 |
import com.iver.cit.gvsig.fmap.tools.Listeners.RectangleListener; |
15 |
|
16 |
|
17 |
public class RectangleSelectionListener implements RectangleListener{ |
18 |
private final Image img = new ImageIcon(NewMapControl.class.getResource( |
19 |
"images/RectSelectCursor.gif")).getImage();
|
20 |
private Cursor cur = Toolkit.getDefaultToolkit().createCustomCursor(img, |
21 |
new Point(16, 16), ""); |
22 |
private NewMapControl mapCtrl;
|
23 |
|
24 |
/**
|
25 |
* Crea un nuevo AreaListenerImpl.
|
26 |
*
|
27 |
* @param vp DOCUMENT ME!
|
28 |
*/
|
29 |
public RectangleSelectionListener(NewMapControl mc) {
|
30 |
this.mapCtrl = mc;
|
31 |
} |
32 |
|
33 |
/**
|
34 |
* @throws DriverIOException
|
35 |
* @see com.iver.cit.gvsig.fmap.tools.Listeners.RectangleListener#rectangle(com.iver.cit.gvsig.fmap.tools.Events.RectangleEvent)
|
36 |
*/
|
37 |
public void rectangle(RectangleEvent event) throws BehaviorException{ |
38 |
try {
|
39 |
mapCtrl.getMapContext().selectByRect(event.getRect()); |
40 |
} catch (DriverException e) {
|
41 |
throw new BehaviorException("No se pudo hacer la selecci?n"); |
42 |
} |
43 |
} |
44 |
|
45 |
/**
|
46 |
* @see com.iver.cit.gvsig.fmap.tools.Listeners.ToolListener#getCursor()
|
47 |
*/
|
48 |
public Cursor getCursor() { |
49 |
return cur;
|
50 |
} |
51 |
|
52 |
/**
|
53 |
* @see com.iver.cit.gvsig.fmap.tools.Listeners.ToolListener#cancelDrawing()
|
54 |
*/
|
55 |
public boolean cancelDrawing() { |
56 |
return false; |
57 |
} |
58 |
|
59 |
} |