Revision 20098 trunk/extensions/extCAD/src/com/iver/cit/gvsig/gui/graphictools/ToolSelectGraphic.java
ToolSelectGraphic.java | ||
---|---|---|
57 | 57 |
import com.iver.cit.gvsig.fmap.tools.Events.PointEvent; |
58 | 58 |
import com.iver.cit.gvsig.fmap.tools.Listeners.PointListener; |
59 | 59 |
|
60 |
/** |
|
61 |
* <p>Listener that selects the items of a {@link GraphicLayer GraphicLayer} that their area |
|
62 |
* intersects with the point selected on the associated <code>MapControl</code>.</p> |
|
63 |
* |
|
64 |
* <p>Listens a single click of any mouse's button.</p> |
|
65 |
*/ |
|
60 | 66 |
public class ToolSelectGraphic implements PointListener{ |
61 | 67 |
|
62 | 68 |
// private final Image img = new ImageIcon(MapControl.class.getResource( |
63 | 69 |
// "images/PointSelectCursor.gif")).getImage(); |
70 |
/** |
|
71 |
* The image to display when the cursor is active. |
|
72 |
*/ |
|
64 | 73 |
private final Image img = PluginServices.getIconTheme().get("rect-select-cursor").getImage(); |
65 |
private Cursor cur = Toolkit.getDefaultToolkit().createCustomCursor(img, |
|
66 |
new Point(16, 16), ""); |
|
67 |
protected MapControl mapCtrl; |
|
68 | 74 |
|
69 |
/** |
|
70 |
* Crea un nuevo AreaListenerImpl. |
|
71 |
* |
|
72 |
* @param mc MapControl. |
|
73 |
*/ |
|
74 |
public ToolSelectGraphic(MapControl mc) { |
|
75 |
this.mapCtrl = mc; |
|
76 |
} |
|
75 |
/** |
|
76 |
* The cursor used to work with this tool listener. |
|
77 |
* |
|
78 |
* @see #getCursor() |
|
79 |
*/ |
|
80 |
private Cursor cur = Toolkit.getDefaultToolkit().createCustomCursor(img, |
|
81 |
new Point(16, 16), ""); |
|
77 | 82 |
|
83 |
/** |
|
84 |
* Reference to the <code>MapControl</code> object that uses. |
|
85 |
*/ |
|
86 |
protected MapControl mapCtrl; |
|
78 | 87 |
|
88 |
/** |
|
89 |
* <p>Creates a new <code>ToolSelectGraphic</code> object.</p> |
|
90 |
* |
|
91 |
* @param mc the <code>MapControl</code> where will be applied the changes |
|
92 |
*/ |
|
93 |
public ToolSelectGraphic(MapControl mc) { |
|
94 |
this.mapCtrl = mc; |
|
95 |
} |
|
96 |
|
|
97 |
/* |
|
98 |
* (non-Javadoc) |
|
99 |
* @see com.iver.cit.gvsig.fmap.tools.Listeners.PointListener#point(com.iver.cit.gvsig.fmap.tools.Events.PointEvent) |
|
100 |
*/ |
|
79 | 101 |
public void point(PointEvent event) throws BehaviorException { |
80 | 102 |
Point2D p = event.getPoint(); |
81 | 103 |
Point2D mapPoint = mapCtrl.getViewPort().toMapPoint((int) p.getX(), (int) p.getY()); |
... | ... | |
96 | 118 |
mapCtrl.drawGraphics(); |
97 | 119 |
} |
98 | 120 |
|
121 |
/* |
|
122 |
* (non-Javadoc) |
|
123 |
* @see com.iver.cit.gvsig.fmap.tools.Listeners.PointListener#pointDoubleClick(com.iver.cit.gvsig.fmap.tools.Events.PointEvent) |
|
124 |
*/ |
|
99 | 125 |
public void pointDoubleClick(PointEvent event) throws BehaviorException { |
100 | 126 |
// TODO Auto-generated method stub |
101 | 127 |
|
102 | 128 |
} |
103 | 129 |
|
130 |
/* |
|
131 |
* (non-Javadoc) |
|
132 |
* @see com.iver.cit.gvsig.fmap.tools.Listeners.ToolListener#getCursor() |
|
133 |
*/ |
|
104 | 134 |
public Cursor getCursor() { |
105 | 135 |
return cur; |
106 | 136 |
} |
107 | 137 |
|
138 |
/* |
|
139 |
* (non-Javadoc) |
|
140 |
* @see com.iver.cit.gvsig.fmap.tools.Listeners.ToolListener#cancelDrawing() |
|
141 |
*/ |
|
108 | 142 |
public boolean cancelDrawing() { |
109 | 143 |
return false; |
110 | 144 |
} |
111 |
|
|
112 | 145 |
} |
113 | 146 |
|
114 | 147 |
|
Also available in: Unified diff