/[schmitzm]/trunk/src/skrueger/geotools/XMapPaneTool.java
ViewVC logotype

Diff of /trunk/src/skrueger/geotools/XMapPaneTool.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 654 by alfonx, Mon Feb 1 18:13:14 2010 UTC revision 655 by alfonx, Wed Feb 3 11:47:44 2010 UTC
# Line 22  import schmitzm.swing.event.MouseInputTy Line 22  import schmitzm.swing.event.MouseInputTy
22   */   */
23  public class XMapPaneTool {  public class XMapPaneTool {
24    
25            public Cursor getCursor() {
26                    return cursor;
27            }
28    
29            public void setCursor(Cursor cursor) {
30                    this.cursor = cursor;
31            }
32    
33            public String getToolTip() {
34                    return toolTip;
35            }
36    
37            public void setToolTip(String toolTip) {
38                    this.toolTip = toolTip;
39            }
40    
41            public Icon getIcon() {
42                    return icon;
43            }
44    
45            public void setIcon(Icon icon) {
46                    this.icon = icon;
47            }
48    
49            public XMapPaneAction getMouseAction(MouseInputType type) {
50                    return mouseActions.get(type);
51            }
52    
53            public void setMouseAction(MouseInputType type, XMapPaneAction mouseAction) {
54                    this.mouseActions.put(type, mouseAction);;
55            }
56    
57            public XMapPaneAction getKeyAction(KeyStroke keyStroke) {
58                    return keyAction.get(keyStroke);
59            }
60    
61            public void setKeyAction(KeyStroke keyStroke, XMapPaneAction keyAction) {
62                    this.keyAction.put(keyStroke,keyAction);
63            }
64    
65            public Object getKeyActionParam(KeyStroke keyStroke) {
66                    return keyActionParams.get(keyStroke);
67            }
68    
69            public void setKeyActionParam(KeyStroke keyStroke, Object param) {
70                    this.keyActionParams.put(keyStroke, param);
71            }
72    
73          public XMapPaneTool() {          public XMapPaneTool() {
74                  addDefaultKeyboardAssignments(this);                  addDefaultKeyboardAssignments(this);
75          }          }
# Line 61  public class XMapPaneTool { Line 109  public class XMapPaneTool {
109           * {@link KeyStroke} is triggered           * {@link KeyStroke} is triggered
110           **/           **/
111          Map<KeyStroke, Object> keyActionParams = new HashMap<KeyStroke, Object>();          Map<KeyStroke, Object> keyActionParams = new HashMap<KeyStroke, Object>();
112            
113            /** This {@link XMapPaneTool} does nothing **/
114            public static XMapPaneTool NO_ACTION = new XMapPaneTool() ;
115            static {
116                    // Remove the keyboard mapping that are defined by the default constructor
117                    NO_ACTION.keyAction.clear();
118                    NO_ACTION.keyActionParams.clear();
119            }
120            
121          /** The configuration of the default ZOOM IN {@link XMapPaneTool} **/          /** The configuration of the default ZOOM IN {@link XMapPaneTool} **/
122          public static XMapPaneTool ZOOM_IN = new XMapPaneTool();          public static XMapPaneTool ZOOM_IN = new XMapPaneTool();
123          static {          static {
# Line 134  public class XMapPaneTool { Line 190  public class XMapPaneTool {
190                  PAN.mouseActions.put(MouseInputType.Wheel, XMapPaneAction_Zoom.ZOOM_IN);                  PAN.mouseActions.put(MouseInputType.Wheel, XMapPaneAction_Zoom.ZOOM_IN);
191    
192          }          }
193            
194            
195    
196            /** A tool that will do a select_top action on the left mouse button **/
197            public static final XMapPaneTool SELECTION_TOP_LAYER = new XMapPaneTool();
198            static {
199    //              SELECTION_TOP_LAYER.icon = new ImageIcon(MapView.class
200    //                              .getResource("resource/icons/selection_add.png"));
201    //              SELECTION_TOP_LAYER.toolTip = R("MapPaneButtons.Selection.AddSelection.TT"); // TODO
202                    // move
203                    // to
204                    // schmitzm
205    
206                    SELECTION_TOP_LAYER.cursor = SwingUtil.SELECTION_SET_CURSOR;
207    
208                    // Left mouse click & drag zoom in
209                    SELECTION_TOP_LAYER.mouseActions.put(MouseInputType.LClick,
210                                    XMapPaneAction.SELECT_TOP);
211                    SELECTION_TOP_LAYER.mouseActions.put(MouseInputType.LDrag,
212                                    XMapPaneAction.SELECT_TOP);
213    
214                    SELECTION_TOP_LAYER.mouseActions
215                                    .put(MouseInputType.RDrag, XMapPaneAction.PAN);
216    
217                    // Mousewheel can zoom
218                    SELECTION_TOP_LAYER.mouseActions.put(MouseInputType.Wheel,
219                                    XMapPaneAction_Zoom.ZOOM_IN);
220    
221                    // TODO Strg-A shoud select all
222            }
223            
224    
225            /** A tool that will do a select_top action on the left mouse button **/
226            public static final XMapPaneTool SELECTION_ONE_FROM_TOP_LAYER = new XMapPaneTool();
227            static {
228    //              SELECTION_ONE_FROM_TOP.icon = new ImageIcon(MapView.class
229    //                              .getResource("resource/icons/selection_add.png"));
230    //              SELECTION_ONE_FROM_TOP.toolTip = R("MapPaneButtons.Selection.AddSelection.TT"); // TODO
231                    // move
232                    // to
233                    // schmitzm
234    
235                    SELECTION_ONE_FROM_TOP_LAYER.cursor = SwingUtil.SELECTION_SET_CURSOR;
236    
237                    // Left mouse click & drag zoom in
238                    SELECTION_ONE_FROM_TOP_LAYER.mouseActions.put(MouseInputType.LClick,
239                                    XMapPaneAction.SELECT_ONE_FROM_TOP);
240                    SELECTION_ONE_FROM_TOP_LAYER.mouseActions.put(MouseInputType.LDrag,
241                                    XMapPaneAction.SELECT_ONE_FROM_TOP);
242    
243                    SELECTION_ONE_FROM_TOP_LAYER.mouseActions
244                                    .put(MouseInputType.RDrag, XMapPaneAction.PAN);
245    
246                    // Mousewheel can zoom
247                    SELECTION_ONE_FROM_TOP_LAYER.mouseActions.put(MouseInputType.Wheel,
248                                    XMapPaneAction_Zoom.ZOOM_IN);
249    
250                    // TODO Strg-A shoud select all
251            }
252    
253            
254    
255            /** A tool that will do a select_top action on the left mouse button **/
256            public static final XMapPaneTool SELECTION_ALL_LAYERS = new XMapPaneTool();
257            static {
258    //              SELECTION_ALL_LAYERS.icon = new ImageIcon(MapView.class
259    //                              .getResource("resource/icons/selection_add.png"));
260    //              SELECTION_ALL_LAYERS.toolTip = R("MapPaneButtons.Selection.AddSelection.TT"); // TODO
261                    // move
262                    // to
263                    // schmitzm
264    
265                    SELECTION_ALL_LAYERS.cursor = SwingUtil.SELECTION_SET_CURSOR;
266    
267                    // Left mouse click & drag zoom in
268                    SELECTION_ALL_LAYERS.mouseActions.put(MouseInputType.LClick,
269                                    XMapPaneAction.SELECT_ALL);
270                    SELECTION_ALL_LAYERS.mouseActions.put(MouseInputType.LDrag,
271                                    XMapPaneAction.SELECT_ALL);
272    
273                    SELECTION_ALL_LAYERS.mouseActions
274                                    .put(MouseInputType.RDrag, XMapPaneAction.PAN);
275    
276                    // Mousewheel can zoom
277                    SELECTION_ALL_LAYERS.mouseActions.put(MouseInputType.Wheel,
278                                    XMapPaneAction_Zoom.ZOOM_IN);
279    
280                    // TODO Strg-A shoud select all
281            }
282    
283    
284          /** The configuration of the INFO {@link XMapPaneTool} **/          /** The configuration of the INFO {@link XMapPaneTool} **/
285          public static final XMapPaneTool INFO = new XMapPaneTool();          public static final XMapPaneTool INFO = new XMapPaneTool();

Legend:
Removed from v.654  
changed lines
  Added in v.655

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26