1 |
alfonx |
653 |
package skrueger.geotools; |
2 |
|
|
|
3 |
|
|
import java.awt.Cursor; |
4 |
alfonx |
654 |
import java.awt.event.InputEvent; |
5 |
alfonx |
653 |
import java.awt.event.KeyEvent; |
6 |
|
|
import java.util.HashMap; |
7 |
|
|
import java.util.Locale; |
8 |
|
|
import java.util.Map; |
9 |
|
|
|
10 |
|
|
import javax.swing.Icon; |
11 |
|
|
import javax.swing.ImageIcon; |
12 |
|
|
import javax.swing.KeyStroke; |
13 |
|
|
|
14 |
|
|
import schmitzm.lang.LangUtil; |
15 |
|
|
import schmitzm.lang.ResourceProvider; |
16 |
|
|
import schmitzm.swing.SwingUtil; |
17 |
|
|
import schmitzm.swing.event.MouseInputType; |
18 |
|
|
|
19 |
|
|
/** |
20 |
|
|
* This class combines the mapping of mouse-inputs and keyboard inputs to |
21 |
|
|
* {@link XMapPaneAction}s and provides a tool icon and a default mouse cursor. |
22 |
|
|
*/ |
23 |
mojays |
657 |
public class XMapPaneTool implements Copyable<XMapPaneTool> { |
24 |
|
|
public static ResourceProvider RESOURCE = new ResourceProvider( |
25 |
|
|
LangUtil.extendPackagePath(MapPaneToolBar.class, |
26 |
|
|
"resource.locales.mapPaneToolbar"), |
27 |
|
|
Locale.ENGLISH); |
28 |
|
|
public static String R(String key, Object... values) { |
29 |
|
|
return RESOURCE.getString(key, values); |
30 |
|
|
} |
31 |
alfonx |
653 |
|
32 |
mojays |
657 |
/** The cursor of the mouse if the tool is active **/ |
33 |
|
|
private Cursor cursor = null; |
34 |
alfonx |
656 |
|
35 |
mojays |
657 |
/** A tool-tip for the tool , optional **/ |
36 |
|
|
private String toolTip = null; |
37 |
alfonx |
656 |
|
38 |
mojays |
657 |
/** The icon for the button **/ |
39 |
|
|
private Icon icon = null; |
40 |
alfonx |
656 |
|
41 |
mojays |
657 |
/** |
42 |
|
|
* Defines which {@link XMapPaneAction} should be should be called when a |
43 |
|
|
* {@link MouseInputType} is triggered |
44 |
|
|
**/ |
45 |
|
|
Map<MouseInputType, XMapPaneAction> mouseActions = new HashMap<MouseInputType, XMapPaneAction>(); |
46 |
alfonx |
656 |
|
47 |
mojays |
657 |
/** |
48 |
|
|
* Defines which {@link XMapPaneAction#performKeyboard(XMapPane, Object)} |
49 |
|
|
* should be called when a {@link KeyStroke} is triggered |
50 |
|
|
**/ |
51 |
|
|
Map<KeyStroke, XMapPaneAction> keyAction = new HashMap<KeyStroke, XMapPaneAction>(); |
52 |
alfonx |
656 |
|
53 |
mojays |
657 |
/** |
54 |
|
|
* Defines which optional parameter should be passed to |
55 |
|
|
* {@link XMapPaneAction#performKeyboard(XMapPane, Object)} if a |
56 |
|
|
* {@link KeyStroke} is triggered |
57 |
|
|
**/ |
58 |
|
|
Map<KeyStroke, Object> keyActionParams = new HashMap<KeyStroke, Object>(); |
59 |
alfonx |
656 |
|
60 |
mojays |
657 |
/** |
61 |
|
|
* The default constructor sets some default keyboard settings |
62 |
|
|
*/ |
63 |
|
|
public XMapPaneTool() { |
64 |
|
|
initTool(); |
65 |
|
|
} |
66 |
alfonx |
655 |
|
67 |
mojays |
657 |
/** |
68 |
|
|
* Called by the constructor. Initializes the tool actions by defining default |
69 |
|
|
* keyboard actions. |
70 |
|
|
*/ |
71 |
|
|
protected void initTool() { |
72 |
|
|
// + and - keys zoom |
73 |
|
|
keyAction.put(KeyStroke.getKeyStroke(KeyEvent.VK_PLUS, 0), |
74 |
|
|
XMapPaneAction.ZOOM_IN); |
75 |
|
|
keyAction.put(KeyStroke.getKeyStroke(KeyEvent.VK_MINUS, 0), |
76 |
|
|
XMapPaneAction.ZOOM_OUT); |
77 |
alfonx |
655 |
|
78 |
mojays |
657 |
KeyStroke keyStroke; |
79 |
|
|
for (int modifier : new int[] { InputEvent.ALT_DOWN_MASK, |
80 |
|
|
InputEvent.ALT_GRAPH_DOWN_MASK, |
81 |
|
|
InputEvent.CTRL_DOWN_MASK, |
82 |
|
|
InputEvent.SHIFT_DOWN_MASK, |
83 |
|
|
InputEvent.META_DOWN_MASK }) { |
84 |
|
|
// RIGHT button pan |
85 |
|
|
keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, modifier); |
86 |
|
|
keyAction.put(keyStroke, XMapPaneAction.PAN); |
87 |
|
|
keyActionParams.put(keyStroke, XMapPaneAction_Pan.Direction.RIGHT); |
88 |
alfonx |
655 |
|
89 |
mojays |
657 |
// LEFT button pan |
90 |
|
|
keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, modifier); |
91 |
|
|
keyAction.put(keyStroke, XMapPaneAction.PAN); |
92 |
|
|
keyActionParams.put(keyStroke, XMapPaneAction_Pan.Direction.LEFT); |
93 |
alfonx |
655 |
|
94 |
mojays |
657 |
// UP button pan |
95 |
|
|
keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, modifier); |
96 |
|
|
keyAction.put(keyStroke, XMapPaneAction.PAN); |
97 |
|
|
keyActionParams.put(keyStroke, XMapPaneAction_Pan.Direction.UP); |
98 |
alfonx |
655 |
|
99 |
mojays |
657 |
// DOWN button pan |
100 |
|
|
keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_UP, modifier); |
101 |
|
|
keyAction.put(keyStroke, XMapPaneAction.PAN); |
102 |
|
|
keyActionParams.put(keyStroke, XMapPaneAction_Pan.Direction.DOWN); |
103 |
|
|
} |
104 |
|
|
} |
105 |
|
|
|
106 |
|
|
/** |
107 |
|
|
* Returns a copy of the tool to derive other tools. |
108 |
|
|
*/ |
109 |
|
|
public XMapPaneTool copy() { |
110 |
|
|
return copyTo(null); |
111 |
|
|
} |
112 |
alfonx |
655 |
|
113 |
mojays |
657 |
/** |
114 |
|
|
* Copies all actions of this tool to another. |
115 |
|
|
* @param tool tool to copy the actions to (if {@code null} a new |
116 |
|
|
* tool is created) |
117 |
|
|
* @return the modified or created tool |
118 |
|
|
*/ |
119 |
|
|
public XMapPaneTool copyTo(XMapPaneTool tool) { |
120 |
|
|
if ( tool == null ) |
121 |
|
|
tool = new XMapPaneTool(); |
122 |
|
|
|
123 |
|
|
tool.setCursor( getCursor() ); |
124 |
|
|
tool.setIcon( getIcon() ); |
125 |
|
|
tool.setToolTip( getToolTip() ); |
126 |
|
|
for ( MouseInputType type : mouseActions.keySet() ) |
127 |
|
|
tool.setMouseAction(type, getMouseAction(type)); |
128 |
|
|
for ( KeyStroke stroke : keyAction.keySet() ) |
129 |
|
|
tool.setKeyAction(stroke, getKeyAction(stroke)); |
130 |
|
|
for ( KeyStroke stroke : keyActionParams.keySet() ) |
131 |
|
|
tool.setKeyActionParam(stroke, getKeyActionParam(stroke)); |
132 |
|
|
|
133 |
|
|
return tool; |
134 |
|
|
} |
135 |
alfonx |
655 |
|
136 |
mojays |
657 |
/** |
137 |
|
|
* @return the {@link Cursor} that shall be set as the default mouse cursor |
138 |
|
|
* (when no button is clicked) |
139 |
|
|
*/ |
140 |
|
|
public Cursor getCursor() { |
141 |
|
|
return cursor; |
142 |
|
|
} |
143 |
alfonx |
655 |
|
144 |
mojays |
657 |
/** |
145 |
|
|
* @return the {@link Cursor} that shall be set as the default mouse cursor |
146 |
|
|
* (when no button is clicked) |
147 |
|
|
*/ |
148 |
|
|
public void setCursor(Cursor cursor) { |
149 |
|
|
this.cursor = cursor; |
150 |
|
|
} |
151 |
alfonx |
655 |
|
152 |
mojays |
657 |
public String getToolTip() { |
153 |
|
|
return toolTip; |
154 |
|
|
} |
155 |
alfonx |
655 |
|
156 |
mojays |
657 |
public void setToolTip(String toolTip) { |
157 |
|
|
this.toolTip = toolTip; |
158 |
|
|
} |
159 |
alfonx |
655 |
|
160 |
mojays |
657 |
/** |
161 |
|
|
* An icon to use if the tool is associated with a button. May be |
162 |
|
|
* <code>null</code>. |
163 |
|
|
*/ |
164 |
|
|
public Icon getIcon() { |
165 |
|
|
return icon; |
166 |
|
|
} |
167 |
alfonx |
655 |
|
168 |
mojays |
657 |
/** |
169 |
|
|
* An icon to use if the tool is associated with a button. May be |
170 |
|
|
* <code>null</code>. |
171 |
|
|
*/ |
172 |
|
|
public void setIcon(Icon icon) { |
173 |
|
|
this.icon = icon; |
174 |
|
|
} |
175 |
alfonx |
653 |
|
176 |
mojays |
657 |
/** |
177 |
|
|
* @return The {@link XMapPaneAction} associated with a given |
178 |
|
|
* {@link MouseInputType} |
179 |
|
|
*/ |
180 |
|
|
public XMapPaneAction getMouseAction(MouseInputType type) { |
181 |
|
|
return mouseActions.get(type); |
182 |
|
|
} |
183 |
alfonx |
653 |
|
184 |
mojays |
657 |
/** |
185 |
|
|
* Sets the {@link XMapPaneAction} for a given {@link MouseInputType} |
186 |
|
|
*/ |
187 |
|
|
public void setMouseAction(MouseInputType type, XMapPaneAction mouseAction) { |
188 |
|
|
this.mouseActions.put(type, mouseAction); |
189 |
|
|
} |
190 |
alfonx |
653 |
|
191 |
mojays |
657 |
/** |
192 |
|
|
* @return The {@link XMapPaneAction} associated with a {@link KeyStroke} |
193 |
|
|
*/ |
194 |
|
|
public XMapPaneAction getKeyAction(KeyStroke keyStroke) { |
195 |
|
|
return keyAction.get(keyStroke); |
196 |
|
|
} |
197 |
alfonx |
656 |
|
198 |
mojays |
657 |
/** |
199 |
|
|
* Set the {@link XMapPaneAction} for a {@link KeyStroke} |
200 |
|
|
*/ |
201 |
|
|
public void setKeyAction(KeyStroke keyStroke, XMapPaneAction keyAction) { |
202 |
|
|
this.keyAction.put(keyStroke, keyAction); |
203 |
|
|
} |
204 |
alfonx |
653 |
|
205 |
mojays |
657 |
/** |
206 |
|
|
* Get the optional parameter for a{@link XMapPaneAction} when triggered by |
207 |
|
|
* {@link KeyStroke} |
208 |
|
|
*/ |
209 |
|
|
public Object getKeyActionParam(KeyStroke keyStroke) { |
210 |
|
|
return keyActionParams.get(keyStroke); |
211 |
|
|
} |
212 |
alfonx |
653 |
|
213 |
mojays |
657 |
/** |
214 |
|
|
* Set the optional parameter for a{@link XMapPaneAction} when triggered by |
215 |
|
|
* {@link KeyStroke} |
216 |
|
|
*/ |
217 |
|
|
public void setKeyActionParam(KeyStroke keyStroke, Object param) { |
218 |
|
|
this.keyActionParams.put(keyStroke, param); |
219 |
|
|
} |
220 |
alfonx |
653 |
|
221 |
mojays |
657 |
/** This {@link XMapPaneTool} does nothing **/ |
222 |
|
|
public static XMapPaneTool NO_ACTION = new XMapPaneTool(); |
223 |
|
|
static { |
224 |
|
|
// Remove the keyboard mapping that are defined by the default |
225 |
|
|
// constructor |
226 |
|
|
NO_ACTION.keyAction.clear(); |
227 |
|
|
NO_ACTION.keyActionParams.clear(); |
228 |
|
|
} |
229 |
alfonx |
653 |
|
230 |
mojays |
657 |
/** The configuration of the default ZOOM IN {@link XMapPaneTool} **/ |
231 |
|
|
public static XMapPaneTool ZOOM_IN = new XMapPaneTool(); |
232 |
|
|
static { |
233 |
|
|
ZOOM_IN.icon = new ImageIcon( |
234 |
|
|
MapView.class.getResource("resource/icons/zoom_in.png")); |
235 |
|
|
ZOOM_IN.toolTip = R("MapPaneButtons.ZoomIn.TT"); |
236 |
|
|
ZOOM_IN.cursor = SwingUtil.ZOOMIN_CURSOR; |
237 |
alfonx |
653 |
|
238 |
mojays |
657 |
// Left mouse click & drag zoom in |
239 |
|
|
ZOOM_IN.mouseActions.put(MouseInputType.LClick, XMapPaneAction.ZOOM_IN); |
240 |
|
|
ZOOM_IN.mouseActions.put(MouseInputType.LDrag, XMapPaneAction.ZOOM_IN); |
241 |
alfonx |
653 |
|
242 |
mojays |
657 |
// Right mouse click & drag zoom out |
243 |
|
|
ZOOM_IN.mouseActions.put(MouseInputType.RClick, XMapPaneAction.ZOOM_OUT); |
244 |
|
|
ZOOM_IN.mouseActions.put(MouseInputType.RDrag, XMapPaneAction.PAN); |
245 |
alfonx |
653 |
|
246 |
mojays |
657 |
// Mousewheel can zoom too |
247 |
|
|
ZOOM_IN.mouseActions.put(MouseInputType.Wheel, XMapPaneAction.ZOOM_IN); |
248 |
|
|
} |
249 |
alfonx |
653 |
|
250 |
mojays |
657 |
/** The configuration of the default ZOOM IN {@link XMapPaneTool} **/ |
251 |
|
|
public static XMapPaneTool ZOOM_OUT = new XMapPaneTool(); |
252 |
|
|
static { |
253 |
|
|
ZOOM_OUT.icon = new ImageIcon( |
254 |
|
|
MapView.class.getResource("resource/icons/zoom_out.png")); |
255 |
|
|
ZOOM_OUT.toolTip = R("MapPaneButtons.ZoomOut.TT"); |
256 |
|
|
ZOOM_OUT.cursor = SwingUtil.ZOOMOUT_CURSOR; |
257 |
alfonx |
654 |
|
258 |
mojays |
657 |
// Left mouse click & drag zoom in |
259 |
|
|
ZOOM_OUT.mouseActions.put(MouseInputType.LClick, XMapPaneAction.ZOOM_OUT); |
260 |
|
|
ZOOM_OUT.mouseActions.put(MouseInputType.LDrag, XMapPaneAction.ZOOM_OUT); |
261 |
alfonx |
653 |
|
262 |
mojays |
657 |
// Right mouse click & drag zoom out |
263 |
|
|
ZOOM_OUT.mouseActions.put(MouseInputType.RClick, XMapPaneAction.ZOOM_IN); |
264 |
|
|
ZOOM_OUT.mouseActions.put(MouseInputType.RDrag, XMapPaneAction.PAN); |
265 |
alfonx |
653 |
|
266 |
mojays |
657 |
// Mousewheel can zoom |
267 |
|
|
ZOOM_OUT.mouseActions.put(MouseInputType.Wheel, XMapPaneAction.ZOOM_IN); |
268 |
alfonx |
653 |
|
269 |
mojays |
657 |
} |
270 |
alfonx |
653 |
|
271 |
mojays |
657 |
/** The configuration of the PAN {@link XMapPaneTool} **/ |
272 |
|
|
public static final XMapPaneTool PAN = new XMapPaneTool(); |
273 |
|
|
static { |
274 |
|
|
PAN.icon = new ImageIcon( |
275 |
|
|
MapView.class.getResource("resource/icons/pan.png")); |
276 |
|
|
PAN.toolTip = R("MapPaneButtons.Pan.TT"); |
277 |
|
|
PAN.cursor = SwingUtil.PAN_CURSOR; |
278 |
alfonx |
653 |
|
279 |
mojays |
657 |
// Left mouse click & drag zoom in |
280 |
|
|
PAN.mouseActions.put(MouseInputType.LClick, XMapPaneAction.PAN); |
281 |
|
|
PAN.mouseActions.put(MouseInputType.LDrag, XMapPaneAction.PAN); |
282 |
alfonx |
655 |
|
283 |
mojays |
657 |
// Right mouse click & drag zoom out |
284 |
|
|
PAN.mouseActions.put(MouseInputType.RClick, XMapPaneAction.PAN); |
285 |
|
|
PAN.mouseActions.put(MouseInputType.RDrag, XMapPaneAction.PAN); |
286 |
alfonx |
655 |
|
287 |
mojays |
657 |
// Mousewheel can zoom |
288 |
|
|
PAN.mouseActions.put(MouseInputType.Wheel, XMapPaneAction.ZOOM_IN); |
289 |
alfonx |
655 |
|
290 |
mojays |
657 |
} |
291 |
alfonx |
655 |
|
292 |
mojays |
657 |
/** A tool that will do a select_top action on the left mouse button **/ |
293 |
|
|
public static final XMapPaneTool SELECTION_TOP_LAYER = new XMapPaneTool(); |
294 |
|
|
static { |
295 |
|
|
SELECTION_TOP_LAYER.icon = new ImageIcon( |
296 |
|
|
MapView.class.getResource("resource/icons/selection_set.png")); |
297 |
alfonx |
655 |
|
298 |
mojays |
657 |
SELECTION_TOP_LAYER.cursor = SwingUtil.SELECTION_SET_CURSOR; |
299 |
alfonx |
655 |
|
300 |
mojays |
657 |
// Left mouse click & drag zoom in |
301 |
|
|
SELECTION_TOP_LAYER.mouseActions.put(MouseInputType.LClick, |
302 |
|
|
XMapPaneAction.SELECT_TOP); |
303 |
|
|
SELECTION_TOP_LAYER.mouseActions.put(MouseInputType.LDrag, |
304 |
|
|
XMapPaneAction.SELECT_TOP); |
305 |
alfonx |
655 |
|
306 |
mojays |
657 |
SELECTION_TOP_LAYER.mouseActions.put(MouseInputType.RDrag, |
307 |
|
|
XMapPaneAction.PAN); |
308 |
alfonx |
655 |
|
309 |
mojays |
657 |
// Mousewheel can zoom |
310 |
|
|
SELECTION_TOP_LAYER.mouseActions.put(MouseInputType.Wheel, |
311 |
|
|
XMapPaneAction.ZOOM_IN); |
312 |
alfonx |
655 |
|
313 |
mojays |
657 |
// TODO Strg-A shoud select all |
314 |
|
|
} |
315 |
alfonx |
655 |
|
316 |
mojays |
657 |
/** A tool that will do a select_top action on the left mouse button **/ |
317 |
|
|
public static final XMapPaneTool SELECTION_ONE_FROM_TOP_LAYER = new XMapPaneTool(); |
318 |
|
|
static { |
319 |
|
|
SELECTION_ONE_FROM_TOP_LAYER.icon = new ImageIcon( |
320 |
|
|
MapView.class.getResource("resource/icons/selection_set.png")); |
321 |
alfonx |
655 |
|
322 |
mojays |
657 |
SELECTION_ONE_FROM_TOP_LAYER.cursor = SwingUtil.SELECTION_SET_CURSOR; |
323 |
alfonx |
655 |
|
324 |
mojays |
657 |
// Left mouse click & drag zoom in |
325 |
|
|
SELECTION_ONE_FROM_TOP_LAYER.mouseActions.put( |
326 |
|
|
MouseInputType.LClick, |
327 |
|
|
XMapPaneAction.SELECT_ONE_FROM_TOP); |
328 |
|
|
SELECTION_ONE_FROM_TOP_LAYER.mouseActions.put( |
329 |
|
|
MouseInputType.LDrag, |
330 |
|
|
XMapPaneAction.SELECT_ONE_FROM_TOP); |
331 |
alfonx |
655 |
|
332 |
mojays |
657 |
SELECTION_ONE_FROM_TOP_LAYER.mouseActions.put(MouseInputType.RDrag, |
333 |
|
|
XMapPaneAction.PAN); |
334 |
alfonx |
655 |
|
335 |
mojays |
657 |
// Mousewheel can zoom |
336 |
|
|
SELECTION_ONE_FROM_TOP_LAYER.mouseActions.put(MouseInputType.Wheel, |
337 |
|
|
XMapPaneAction.ZOOM_IN); |
338 |
alfonx |
655 |
|
339 |
mojays |
657 |
// TODO Strg-A shoud select all |
340 |
|
|
} |
341 |
alfonx |
655 |
|
342 |
mojays |
657 |
/** A tool that will do a select_top action on the left mouse button **/ |
343 |
|
|
public static final XMapPaneTool SELECTION_ALL_LAYERS = new XMapPaneTool(); |
344 |
|
|
static { |
345 |
|
|
SELECTION_ALL_LAYERS.icon = new ImageIcon( |
346 |
|
|
MapView.class.getResource("resource/icons/selection_set.png")); |
347 |
alfonx |
655 |
|
348 |
mojays |
657 |
SELECTION_ALL_LAYERS.cursor = SwingUtil.SELECTION_SET_CURSOR; |
349 |
alfonx |
655 |
|
350 |
mojays |
657 |
// Left mouse click & drag zoom in |
351 |
|
|
SELECTION_ALL_LAYERS.mouseActions.put(MouseInputType.LClick, |
352 |
|
|
XMapPaneAction.SELECT_ALL); |
353 |
|
|
SELECTION_ALL_LAYERS.mouseActions.put(MouseInputType.LDrag, |
354 |
|
|
XMapPaneAction.SELECT_ALL); |
355 |
alfonx |
654 |
|
356 |
mojays |
657 |
SELECTION_ALL_LAYERS.mouseActions.put(MouseInputType.RDrag, |
357 |
|
|
XMapPaneAction.PAN); |
358 |
alfonx |
653 |
|
359 |
mojays |
657 |
// Mousewheel can zoom |
360 |
|
|
SELECTION_ALL_LAYERS.mouseActions.put(MouseInputType.Wheel, |
361 |
|
|
XMapPaneAction.ZOOM_IN); |
362 |
alfonx |
653 |
|
363 |
mojays |
657 |
// TODO Strg-A shoud select all |
364 |
|
|
} |
365 |
alfonx |
654 |
|
366 |
mojays |
657 |
/** The configuration of the INFO {@link XMapPaneTool} **/ |
367 |
|
|
public static final XMapPaneTool INFO = new XMapPaneTool(); |
368 |
alfonx |
654 |
|
369 |
mojays |
657 |
static { |
370 |
|
|
INFO.icon = new ImageIcon( |
371 |
|
|
MapView.class.getResource("resource/icons/info.png")); |
372 |
|
|
INFO.toolTip = R("MapPaneButtons.Info.TT"); |
373 |
|
|
INFO.cursor = SwingUtil.INFO_CURSOR; |
374 |
alfonx |
654 |
|
375 |
mojays |
657 |
// Left mouse click & drag zoom in |
376 |
|
|
INFO.mouseActions.put(MouseInputType.LClick, |
377 |
|
|
XMapPaneAction.SELECT_ONE_FROM_TOP); |
378 |
|
|
// INFO.mouseActions.put(MouseInputType.LDrag, |
379 |
|
|
// XMapPaneAction.SELECT_ONE_FROM_TOP); |
380 |
alfonx |
654 |
|
381 |
mojays |
657 |
INFO.mouseActions.put(MouseInputType.RDrag, XMapPaneAction.PAN); |
382 |
alfonx |
654 |
|
383 |
mojays |
657 |
// Mousewheel can zoom |
384 |
|
|
INFO.mouseActions.put(MouseInputType.Wheel, XMapPaneAction.ZOOM_IN); |
385 |
alfonx |
654 |
|
386 |
mojays |
657 |
} |
387 |
alfonx |
654 |
|
388 |
mojays |
657 |
public static final XMapPaneTool SELECTION_ADD = new XMapPaneTool(); |
389 |
|
|
static { |
390 |
|
|
SELECTION_ADD.icon = new ImageIcon( |
391 |
|
|
MapView.class.getResource("resource/icons/selection_add.png")); |
392 |
|
|
SELECTION_ADD.toolTip = R("MapPaneButtons.Selection.AddSelection.TT"); // TODO |
393 |
|
|
// move |
394 |
|
|
// to |
395 |
|
|
// schmitzm |
396 |
alfonx |
654 |
|
397 |
mojays |
657 |
SELECTION_ADD.cursor = SwingUtil.SELECTION_ADD_CURSOR; |
398 |
alfonx |
654 |
|
399 |
mojays |
657 |
// Left mouse click & drag zoom in |
400 |
|
|
SELECTION_ADD.mouseActions.put(MouseInputType.LClick, |
401 |
|
|
XMapPaneAction.SELECT_ALL); |
402 |
|
|
SELECTION_ADD.mouseActions.put(MouseInputType.LDrag, |
403 |
|
|
XMapPaneAction.SELECT_ALL); |
404 |
alfonx |
654 |
|
405 |
mojays |
657 |
SELECTION_ADD.mouseActions.put(MouseInputType.RDrag, XMapPaneAction.PAN); |
406 |
alfonx |
654 |
|
407 |
mojays |
657 |
// Mousewheel can zoom |
408 |
|
|
SELECTION_ADD.mouseActions.put(MouseInputType.Wheel, XMapPaneAction.ZOOM_IN); |
409 |
alfonx |
654 |
|
410 |
mojays |
657 |
// TODO Strg-A shoud select all |
411 |
|
|
} |
412 |
alfonx |
653 |
|
413 |
mojays |
657 |
public static final XMapPaneTool SELECTION_REMOVE = new XMapPaneTool(); |
414 |
|
|
static { |
415 |
|
|
SELECTION_REMOVE.icon = new ImageIcon( |
416 |
|
|
MapView.class.getResource("resource/icons/selection_remove.png")); |
417 |
|
|
SELECTION_REMOVE.toolTip = R("MapPaneButtons.Selection.RemoveSelection.TT"); // TODO |
418 |
|
|
// move |
419 |
|
|
// to |
420 |
|
|
// schmitzm |
421 |
alfonx |
653 |
|
422 |
mojays |
657 |
SELECTION_REMOVE.cursor = SwingUtil.SELECTION_REMOVE_CURSOR; |
423 |
alfonx |
654 |
|
424 |
mojays |
657 |
// Left mouse click & drag zoom in |
425 |
|
|
SELECTION_REMOVE.mouseActions.put(MouseInputType.LClick, |
426 |
|
|
XMapPaneAction.SELECT_ALL); |
427 |
|
|
SELECTION_REMOVE.mouseActions.put(MouseInputType.LDrag, |
428 |
|
|
XMapPaneAction.SELECT_ALL); |
429 |
alfonx |
654 |
|
430 |
mojays |
657 |
SELECTION_REMOVE.mouseActions.put(MouseInputType.RDrag, XMapPaneAction.PAN); |
431 |
alfonx |
654 |
|
432 |
mojays |
657 |
// Mousewheel can zoom |
433 |
|
|
SELECTION_REMOVE.mouseActions.put(MouseInputType.Wheel, |
434 |
|
|
XMapPaneAction.ZOOM_IN); |
435 |
alfonx |
654 |
|
436 |
mojays |
657 |
// TODO Strg-A shoud select all |
437 |
|
|
} |
438 |
alfonx |
654 |
|
439 |
mojays |
657 |
public static final XMapPaneTool SELECTION_SET = new XMapPaneTool(); |
440 |
|
|
static { |
441 |
|
|
SELECTION_SET.icon = new ImageIcon( |
442 |
|
|
MapView.class.getResource("resource/icons/selection_set.png")); |
443 |
|
|
SELECTION_SET.toolTip = R("MapPaneButtons.Selection.SetSelection.TT"); // TODO |
444 |
|
|
// move |
445 |
|
|
// to |
446 |
|
|
// schmitzm |
447 |
alfonx |
654 |
|
448 |
mojays |
657 |
SELECTION_SET.cursor = SwingUtil.SELECTION_SET_CURSOR; |
449 |
alfonx |
654 |
|
450 |
mojays |
657 |
// Left mouse click & drag zoom in |
451 |
|
|
SELECTION_SET.mouseActions.put(MouseInputType.LClick, |
452 |
|
|
XMapPaneAction.SELECT_ALL); |
453 |
|
|
SELECTION_SET.mouseActions.put(MouseInputType.LDrag, |
454 |
|
|
XMapPaneAction.SELECT_ALL); |
455 |
alfonx |
654 |
|
456 |
mojays |
657 |
SELECTION_SET.mouseActions.put(MouseInputType.RDrag, XMapPaneAction.PAN); |
457 |
alfonx |
654 |
|
458 |
mojays |
657 |
// Mousewheel can zoom |
459 |
|
|
SELECTION_SET.mouseActions.put(MouseInputType.Wheel, XMapPaneAction.ZOOM_IN); |
460 |
alfonx |
654 |
|
461 |
mojays |
657 |
// TODO Strg-A shoud select all |
462 |
|
|
} |
463 |
alfonx |
654 |
|
464 |
alfonx |
653 |
} |