[Schmitzm-commits] r657 - in branches/2.0-RC2/src: schmitzm/geotools/gui skrueger/geotools

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Feb 3 14:44:03 CET 2010


Author: mojays
Date: 2010-02-03 14:44:00 +0100 (Wed, 03 Feb 2010)
New Revision: 657

Added:
   branches/2.0-RC2/src/skrueger/geotools/XMapPaneActionAdapter.java
Modified:
   branches/2.0-RC2/src/schmitzm/geotools/gui/JMapEditorPane.java
   branches/2.0-RC2/src/schmitzm/geotools/gui/LayeredEditorFrame.java
   branches/2.0-RC2/src/schmitzm/geotools/gui/LayeredMapFrame.java
   branches/2.0-RC2/src/schmitzm/geotools/gui/LayeredMapPane.java
   branches/2.0-RC2/src/schmitzm/geotools/gui/MapActionControlPane.java
   branches/2.0-RC2/src/skrueger/geotools/XMapPaneTool.java
Log:
new XMapPaneActionAdapter


Modified: branches/2.0-RC2/src/schmitzm/geotools/gui/JMapEditorPane.java
===================================================================
--- branches/2.0-RC2/src/schmitzm/geotools/gui/JMapEditorPane.java	2010-02-03 12:18:35 UTC (rev 656)
+++ branches/2.0-RC2/src/schmitzm/geotools/gui/JMapEditorPane.java	2010-02-03 13:44:00 UTC (rev 657)
@@ -53,6 +53,7 @@
 import org.opengis.feature.simple.SimpleFeature;
 import org.opengis.feature.simple.SimpleFeatureType;
 import org.opengis.feature.type.AttributeDescriptor;
+import org.opengis.geometry.DirectPosition;
 
 import schmitzm.geotools.GTUtil;
 import schmitzm.geotools.feature.FeatureUtil;
@@ -64,6 +65,12 @@
 import schmitzm.geotools.map.event.MapContextSynchronizer;
 import schmitzm.swing.InputOption;
 import schmitzm.swing.MultipleOptionPane;
+import schmitzm.swing.event.MouseInputType;
+import skrueger.geotools.XMapPane;
+import skrueger.geotools.XMapPaneAction;
+import skrueger.geotools.XMapPaneActionAdapter;
+import skrueger.geotools.XMapPaneAction_Zoom;
+import skrueger.geotools.XMapPaneTool;
 
 import com.vividsolutions.jts.geom.Coordinate;
 import com.vividsolutions.jts.geom.Geometry;
@@ -175,6 +182,47 @@
   protected Stack<SimpleFeature> globalRedoFeatures = new Stack<SimpleFeature>();
 
   /**
+   * Defines a map action which reacts on mouse clicks with the
+   * editing functionality.
+   */
+  private final XMapPaneAction EDITING_ACTION = new XMapPaneActionAdapter() {
+    @Override
+    public void performClick(XMapPane mapPane, MouseEvent ev, DirectPosition coord) {
+//      Point2D geoCoord = getScreenToWorld().transform(ev.getPoint(), null);
+      
+      // Zunaechst Modus auf NULL pruefen, da ansonsten
+      // NullPointerException in switch-Statement
+      if ( editorMode == null )
+        return;
+      switch( editorMode ) {
+        case New_Point:
+        case New_Line:
+        case New_Polygon: addSegment( new Coordinate(coord.getOrdinate(0), coord.getOrdinate(1)) );
+                          break;
+      }
+    }
+  };
+  
+  protected XMapPaneTool EDITING_TOOL = new XMapPaneTool() {
+    @Override
+    public void initTool() {
+      super.initTool();
+      // links Klick -> Editieren
+      setMouseAction( MouseInputType.LClick, EDITING_ACTION );
+      // rechts Klick -> Nichts
+      setMouseAction( MouseInputType.RClick, null);
+      // links Drag -> Zoom In
+      setMouseAction( MouseInputType.LDrag, XMapPaneAction.ZOOM_IN);
+      // rechts Drag -> Nichts
+      setMouseAction( MouseInputType.RDrag, XMapPaneAction.PAN);
+      // Mausrad -> Zoom In
+      setMouseAction( MouseInputType.Wheel, XMapPaneAction.ZOOM_IN);
+    }
+  };
+  
+  
+  
+  /**
    * Creates a new {@code JMapEditorPane}.
    */
   public JMapEditorPane() {
@@ -196,8 +244,8 @@
       this.setEditorStyle(geomForm, null);
 
     // no standard action on left mouse button, instead: adding points
-    setState( NONE );
-    setState( ZOOM_IN );
+    setTool( EDITING_TOOL );
+
     // special map context for the editor layers, so the
     // editor layers are not shown in "normal" layer list
     this.editorMapContext = new DefaultMapContext( mapContext.getCoordinateReferenceSystem() );
@@ -223,27 +271,27 @@
     editorRenderer.paint((Graphics2D) g, dr, mapArea);
   }
 
-  /**
-   * Ignores the actions of the super class for left-clicks.
-   * Instead this method reacts according to the current
-   * editor mode.
-   */
+//  /**
+//   * Ignores the actions of the super class for left-clicks.
+//   * Instead this method reacts according to the current
+//   * editor mode.
+//   */
 //  @Override
-  public void mouseClicked(MouseEvent e) {
-    Point2D geoCoord = getScreenToWorld().transform(e.getPoint(), null);
-    // Zunaechst Modus auf NULL pruefen, da ansonsten
-    // NullPointerException in switch-Statement
-    if ( editorMode == null )
-      return;
+//  public void mouseClicked(MouseEvent e) {
+//    Point2D geoCoord = getScreenToWorld().transform(e.getPoint(), null);
+//    // Zunaechst Modus auf NULL pruefen, da ansonsten
+//    // NullPointerException in switch-Statement
+//    if ( editorMode == null )
+//      return;
+//
+//    switch( editorMode ) {
+//      case New_Point:
+//      case New_Line:
+//      case New_Polygon: addSegment( new Coordinate(geoCoord.getX(), geoCoord.getY()) );
+//                        break;
+//    }
+//  }
 
-    switch( editorMode ) {
-      case New_Point:
-      case New_Line:
-      case New_Polygon: addSegment( new Coordinate(geoCoord.getX(), geoCoord.getY()) );
-                        break;
-    }
-  }
-
   //**********************************************************************
   //***** General public methods
   //**********************************************************************

Modified: branches/2.0-RC2/src/schmitzm/geotools/gui/LayeredEditorFrame.java
===================================================================
--- branches/2.0-RC2/src/schmitzm/geotools/gui/LayeredEditorFrame.java	2010-02-03 12:18:35 UTC (rev 656)
+++ branches/2.0-RC2/src/schmitzm/geotools/gui/LayeredEditorFrame.java	2010-02-03 13:44:00 UTC (rev 657)
@@ -85,6 +85,9 @@
       throw new IllegalArgumentException("LayeredMapPane must contain a JEditorPane to use in LayeredEditorFrame.");
     this.toolBar  = new JMapEditorToolBar( (JMapEditorPane)layeredMapPane.geoMapPane.mapPane );
     this.styleBar = new StyleToolBar();
+    // hide the tool bar for the map action, so only the
+    // editing actions are available
+    this.mapControl.setVisible(false);
     // Add a listener to the style bar, to apply every style
     // change to the map
     this.styleBar.addPropertyChangeListener( new PropertyChangeListener() {

Modified: branches/2.0-RC2/src/schmitzm/geotools/gui/LayeredMapFrame.java
===================================================================
--- branches/2.0-RC2/src/schmitzm/geotools/gui/LayeredMapFrame.java	2010-02-03 12:18:35 UTC (rev 656)
+++ branches/2.0-RC2/src/schmitzm/geotools/gui/LayeredMapFrame.java	2010-02-03 13:44:00 UTC (rev 657)
@@ -54,61 +54,71 @@
 import schmitzm.swing.SwingUtil;
 
 /**
- * Diese Klasse stellt ein Fenster dar, in dem layer-basiert Objekte
- * grafisch dargestellt werden koennen. Hinzugefuegt werden die Objekte
- * direkt in das {@link LayeredMapPane#addLayer(Object,String)}<br>
+ * Diese Klasse stellt ein Fenster dar, in dem layer-basiert Objekte grafisch
+ * dargestellt werden koennen. Hinzugefuegt werden die Objekte direkt in das
+ * {@link LayeredMapPane#addLayer(Object,String)}<br>
  * Welche Objekte dargestellt werden koennen, ist der Beschreibung der
  * {@link LayeredMapPane#isVisualisable(Object)}-Methode zu entnehmen.<br>
  * Das Fenster besteht aus 3 Komponenten:
  * <ol>
- * <li>Eine Map ({@link SelectableXMapPane}) zu grafischen Darstellung der Layer</li>
+ * <li>Eine Map ({@link SelectableXMapPane}) zu grafischen Darstellung der Layer
+ * </li>
  * <li>Eine Liste mit Steuerungskomponenten, ueber die die einzelnen Layer
- *     angesprochen werden koennen (ein/ausblenden, zoomen, ...).</li>
+ * angesprochen werden koennen (ein/ausblenden, zoomen, ...).</li>
  * <li>Eine Status-Zeile, in der die Koordinaten der aktuellen Mausposition
- *     angezeigt werden, sowie der Raster-Wert des obersten Rasters unterhalb
- *     des Mauszeigers.</li>
+ * angezeigt werden, sowie der Raster-Wert des obersten Rasters unterhalb des
+ * Mauszeigers.</li>
  * </ol>
- * Die grafischen Layer (in der Map) koennen wahlweise (de)aktiviert werden. Dies
- * geschieht durch setzen/entfernen eines Haekchens in der entsprechenden
+ * Die grafischen Layer (in der Map) koennen wahlweise (de)aktiviert werden.
+ * Dies geschieht durch setzen/entfernen eines Haekchens in der entsprechenden
  * Steuerungskomponente. Diese enthaelt zudem ein Kontextmenue, ueber welches
  * <ul>
  * <li>das jeweilige Layer aus der Map entfernt werden kann</li>
- * <li>das jeweilige Layer in der Map eine Ebene nach oben/unten verschoben werden kann</li>
- * <li>die Map sogezoomt werden kann, dass das jeweilige Layer komplett angezeigt wird</li>
+ * <li>das jeweilige Layer in der Map eine Ebene nach oben/unten verschoben
+ * werden kann</li>
+ * <li>die Map sogezoomt werden kann, dass das jeweilige Layer komplett
+ * angezeigt wird</li>
  * </ul>
  * Um Layer einzufuegen koennen die {@code addLayer(.)}-Methoden des
- * {@link #getLayeredMapPane() LayeredMapPane} (dabei wird ein Default-Style verwendet)
- * oder die entsprechenden Methoden des {@link MapContext} ({@code getLayeredMapPane().getMapPane().getContext()}).
- * @author <a href="mailto:martin.schmitz at koeln.de">Martin Schmitz</a> (University of Bonn/Germany)
+ * {@link #getLayeredMapPane() LayeredMapPane} (dabei wird ein Default-Style
+ * verwendet) oder die entsprechenden Methoden des {@link MapContext} ({@code
+ * getLayeredMapPane().getMapPane().getContext()}).
+ * @author <a href="mailto:martin.schmitz at koeln.de">Martin Schmitz</a>
+ *         (University of Bonn/Germany)
  * @version 1.0
  */
 public class LayeredMapFrame extends JFrame {
-  private   JPanel                     contentPane      = null;
+  private JPanel contentPane = null;
   /** Karten- und Layer-Kontroll-Bereich. */
-  protected LayeredMapPane             layeredMapPane   = null;
-  private   SelectableXMapPane         mapPane          = null;
-  private   MapContext                 mapContext       = null;
+  protected LayeredMapPane layeredMapPane = null;
+  private SelectableXMapPane mapPane = null;
+  private MapContext mapContext = null;
+  /** Toolbar zur Kontroller der Karten-Aktionen (z.B. Zoom oder Select). */
+  protected MapActionControlPane mapControl = null;
   /** Status-Balken. */
-  protected MapPaneStatusBar           statusBar        = null;
+  protected MapPaneStatusBar statusBar = null;
   /** Fenster fuer SimpleFeature-Details */
-  protected FeatureCollectionFrame     featuresFrame    = null;
-  /** Auswahlfeld fuer das Raster, fuer welches die Koordinaten angezeigt werden. */
-  protected SelectionInputOption<MapLayer> rasterComboBox   = null;
+  protected FeatureCollectionFrame featuresFrame = null;
+  /**
+   * Auswahlfeld fuer das Raster, fuer welches die Koordinaten angezeigt werden.
+   */
+  protected SelectionInputOption<MapLayer> rasterComboBox = null;
 
   /**
    * Erzeugt ein neues (leeres) Map-Fenster.
    */
   public LayeredMapFrame() {
-    this(null,"");
+    this(null, "");
   }
 
   /**
    * Erzeugt ein neues (leeres) Map-Fenster.
-   * @param lmp {@link LayeredMapPane} welches zur Anzeige der Karten verwendet wird (wenn
-   *            {@code null} wird eine neue {@link LayeredMapPane}-Instanz erzeugt)
+   * @param lmp {@link LayeredMapPane} welches zur Anzeige der Karten verwendet
+   *          wird (wenn {@code null} wird eine neue {@link LayeredMapPane}
+   *          -Instanz erzeugt)
    */
   public LayeredMapFrame(LayeredMapPane lmp) {
-    this(lmp,"");
+    this(lmp, "");
   }
 
   /**
@@ -116,14 +126,15 @@
    * @param title Titel des Fensters
    */
   public LayeredMapFrame(String title) {
-    this(null,title);
+    this(null, title);
   }
 
   /**
    * Erzeugt ein neues (leeres) Map-Fenster.
    * @param title Titel des Fensters
-   * @param lmp {@link LayeredMapPane} welches zur Anzeige der Karten verwendet wird (wenn
-   *            {@code null} wird eine neue {@link LayeredMapPane}-Instanz erzeugt)
+   * @param lmp {@link LayeredMapPane} welches zur Anzeige der Karten verwendet
+   *          wird (wenn {@code null} wird eine neue {@link LayeredMapPane}
+   *          -Instanz erzeugt)
    */
   public LayeredMapFrame(LayeredMapPane lmp, String title) {
     super();
@@ -134,29 +145,32 @@
 
     // Karte und Layer-Kontrolle
     layeredMapPane = lmp != null ? lmp : new LayeredMapPane();
-    mapPane        = layeredMapPane.getMapPane();
-    mapContext     = mapPane.getMapContext();
-    MapActionControlPane mapControl = new MapActionControlPane(mapPane,MapActionControlPane.VERTICAL);
+    mapPane = layeredMapPane.getMapPane();
+    mapContext = mapPane.getMapContext();
+    mapControl = new MapActionControlPane(mapPane, MapActionControlPane.VERTICAL);
     mapControl.setFloatable(false);
 
     // unter Layer-Liste eine ComboBox mit Raster-Auswahl einfuegen
-    this.rasterComboBox   = new SelectionInputOption.Combo<MapLayer>("",false);
-    this.mapContext.addMapLayerListListener( new MapLayerListListener() {
+    this.rasterComboBox = new SelectionInputOption.Combo<MapLayer>("", false);
+    this.mapContext.addMapLayerListListener(new MapLayerListListener() {
       public void layerChanged(MapLayerListEvent e) {
         updateRasterComboBox();
       }
-      public void layerMoved(MapLayerListEvent e) { }
+
+      public void layerMoved(MapLayerListEvent e) {
+      }
+
       public void layerAdded(MapLayerListEvent e) {
         updateRasterComboBox();
       }
+
       public void layerRemoved(MapLayerListEvent e) {
         updateRasterComboBox();
       }
-    } );
-    this.layeredMapPane.horSplitPane.getContainer(0).add(
-        rasterComboBox, BorderLayout.SOUTH);
+    });
+    this.layeredMapPane.horSplitPane.getContainer(0).add(rasterComboBox,
+                                                         BorderLayout.SOUTH);
 
-
     // Spezielles RasterPositionLabel in dem die Koordinaten des in der
     // ComboBox ausgewaehlten Rasters angezeigt werden
     RasterPositionLabel rpLabel = new RasterPositionLabel(1) {
@@ -167,76 +181,79 @@
 
     // Status-Zeile mit Raster-Auswahlfeld
     statusBar = new MapPaneStatusBar(mapPane, rpLabel, null);
-    statusBar.setBorder( BorderFactory.createCompoundBorder(
-      BorderFactory.createLoweredBevelBorder(),
-      BorderFactory.createEmptyBorder(2,5,2,5)
-    ) );
+    statusBar.setBorder(BorderFactory.createCompoundBorder(
+                                                           BorderFactory.createLoweredBevelBorder(),
+                                                           BorderFactory.createEmptyBorder(
+                                                                                           2,
+                                                                                           5,
+                                                                                           2,
+                                                                                           5)));
 
     // Status-Zeile mit Raster-Auswahlfeld kombinieren
     JPanel statusBarContainer = new JPanel();
-    statusBarContainer.setLayout( new BorderLayout() );
+    statusBarContainer.setLayout(new BorderLayout());
     statusBarContainer.add(rasterComboBox, BorderLayout.WEST);
     statusBarContainer.add(statusBar, BorderLayout.CENTER);
 
     // Root-SplitPane in Fenster einfuegen
-    contentPane.add(layeredMapPane, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0
-        ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
-    contentPane.add(mapControl, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0
-        ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(2, 0, 0, 0), 0, 0));
-    contentPane.add(statusBarContainer, new GridBagConstraints(0, 1, 2, 1, 1.0, 0.0
-        ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(2, 0, 0, 0), 0, 0));
+    contentPane.add(layeredMapPane, new GridBagConstraints(0, 0, 1, 1, 1.0,
+        1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0,
+            0, 0, 0), 0, 0));
+    contentPane.add(mapControl, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0,
+        GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(2, 0, 0,
+            0), 0, 0));
+    contentPane.add(statusBarContainer, new GridBagConstraints(0, 1, 2, 1, 1.0,
+        0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(2,
+            0, 0, 0), 0, 0));
 
     // Fenster fuer SimpleFeature-Details
-    featuresFrame = new FeatureCollectionFrame(null,true);
-    featuresFrame.setSize( new Dimension(400,200) );
+    featuresFrame = new FeatureCollectionFrame(null, true);
+    featuresFrame.setSize(new Dimension(400, 200));
     // Ausgewaehlte Features werden im Detail-Frame angezeigt
-    mapPane.addMapPaneListener( new JMapPaneListener() {
+    mapPane.addMapPaneListener(new JMapPaneListener() {
       public void performMapPaneEvent(MapPaneEvent e) {
         // Wenn Features ueber die Maus aus der Karte ausgewaehlt werden,
         // oeffnet sich ein Detail-Fenster
-        if ( e instanceof FeatureSelectedEvent && e.getSourceObject() == mapPane ) {
-          FeatureSelectedEvent fse = (FeatureSelectedEvent)e;
-          FeatureCollection    fc  = fse.getSelectionResult();
+        if (e instanceof FeatureSelectedEvent && e.getSourceObject() == mapPane) {
+          FeatureSelectedEvent fse = (FeatureSelectedEvent) e;
+          FeatureCollection fc = fse.getSelectionResult();
           featuresFrame.setFeatureCollection(fc);
-          featuresFrame.setTitle( fse.getSourceLayer().getTitle()+" ["+fse.getSelectionRange()+"]" );
-          if ( !featuresFrame.isVisible() ) {
-              SwingUtil.setRelativeFramePosition(featuresFrame,1,0);
+          featuresFrame.setTitle(fse.getSourceLayer().getTitle() + " [" +
+                                 fse.getSelectionRange() + "]");
+          if (!featuresFrame.isVisible()) {
+            SwingUtil.setRelativeFramePosition(featuresFrame, 1, 0);
           }
           featuresFrame.setVisible(true);
         }
 
-        if ( e instanceof GridCoverageSelectedEvent ) {
+        if (e instanceof GridCoverageSelectedEvent) {
           // ...
         }
       }
     });
   }
 
-
   protected void updateRasterComboBox() {
     // Letzte Auswahl merken
-    MapLayer         lastSelection   = (MapLayer)rasterComboBox.getValue();
+    MapLayer lastSelection = (MapLayer) rasterComboBox.getValue();
     // Alle Raster-Layer und Titel ermitteln
-    Vector<MapLayer> rasterLayer     = new Vector<MapLayer>();
-    Vector<String>   rasterLayerDesc = new Vector<String>();
+    Vector<MapLayer> rasterLayer = new Vector<MapLayer>();
+    Vector<String> rasterLayerDesc = new Vector<String>();
     for (MapLayer layer : mapPane.getMapContext().getLayers())
-      if ( mapPane.isGridCoverageLayer(layer) ) {
+      if (mapPane.isGridCoverageLayer(layer)) {
         rasterLayer.add(layer);
-        rasterLayerDesc.add( layer.getTitle() );
+        rasterLayerDesc.add(layer.getTitle());
       }
     // Auswahl neu setzen
-    rasterComboBox.setSelectionObjects(
-      rasterLayer.toArray( new MapLayer[0] ),
-      rasterLayerDesc.toArray()
-    );
+    rasterComboBox.setSelectionObjects(rasterLayer.toArray(new MapLayer[0]),
+                                       rasterLayerDesc.toArray());
     // Wenn nur ein Raster zur Verfuegung steht, dieses autom. auswaehlen
-    if ( rasterLayer.size() == 1 )
+    if (rasterLayer.size() == 1)
       lastSelection = rasterLayer.firstElement();
     // Letzte Auswahl setzen
     rasterComboBox.setSelectedItem(lastSelection);
   }
 
-
   /**
    * Liefert den Karten- und Kontroll-Bereich des Fensters.
    */
@@ -251,4 +268,10 @@
     return this.statusBar;
   }
 
+//  /**
+//   * Liefert den Toolbar fuer die Karten-Aktionen.
+//   */
+//  public MapActionControlPane getToolBar() {
+//    return this.mapControl;
+//  }
 }

Modified: branches/2.0-RC2/src/schmitzm/geotools/gui/LayeredMapPane.java
===================================================================
--- branches/2.0-RC2/src/schmitzm/geotools/gui/LayeredMapPane.java	2010-02-03 12:18:35 UTC (rev 656)
+++ branches/2.0-RC2/src/schmitzm/geotools/gui/LayeredMapPane.java	2010-02-03 13:44:00 UTC (rev 657)
@@ -124,11 +124,12 @@
     this.setLayout(new BorderLayout());
 
     // Kartenbereich ueber Border "versenken"
-    geoMapPane.getMapPanePanel().setBorder(BorderFactory.createLoweredBevelBorder());
+    geoMapPane.getMapPanePanel()
+              .setBorder(BorderFactory.createLoweredBevelBorder());
     // Aufgrund der Border werden die Koordinaten-Leisten
     // nicht mehr benoetigt
     geoMapPane.setGridBarVisible(false);
-   
+
     // rechter Bereich: Map, Grids und Scale
     this.geoMapPane = geoMapPane;
     this.mapPane = geoMapPane.getMapPane();

Modified: branches/2.0-RC2/src/schmitzm/geotools/gui/MapActionControlPane.java
===================================================================
--- branches/2.0-RC2/src/schmitzm/geotools/gui/MapActionControlPane.java	2010-02-03 12:18:35 UTC (rev 656)
+++ branches/2.0-RC2/src/schmitzm/geotools/gui/MapActionControlPane.java	2010-02-03 13:44:00 UTC (rev 657)
@@ -43,6 +43,8 @@
 import schmitzm.geotools.map.event.FeatureSelectedEvent;
 import schmitzm.swing.CaptionsChangeable;
 import schmitzm.swing.SwingUtil;
+import schmitzm.swing.event.MouseInputType;
+import skrueger.geotools.XMapPaneAction;
 import skrueger.geotools.XMapPaneTool;
 
 /**
@@ -199,7 +201,6 @@
 		}
 
 		// Buttons entsprechend dem MapPane-Status einstellen
-		infoState.doClick();
 		if (mapPane != null) {
 			if (mapPane.getTool() == XMapPaneTool.ZOOM_IN
 					|| mapPane.getTool() == XMapPaneTool.ZOOM_OUT) {
@@ -308,6 +309,7 @@
    * @version 1.0
    */
   protected class Action_ZoomState extends AbstractAction {
+
     /**
      * Erzeugt einen neue Zoom-Aktion
      */
@@ -331,7 +333,7 @@
      * @param e das ActionEvent
      */
     public void actionPerformed(ActionEvent e) {
-      getMapPane().setTool( XMapPaneTool.ZOOM_IN);
+      getMapPane().setTool( XMapPaneTool.ZOOM_IN );
     }
   }
 

Added: branches/2.0-RC2/src/skrueger/geotools/XMapPaneActionAdapter.java
===================================================================
--- branches/2.0-RC2/src/skrueger/geotools/XMapPaneActionAdapter.java	2010-02-03 12:18:35 UTC (rev 656)
+++ branches/2.0-RC2/src/skrueger/geotools/XMapPaneActionAdapter.java	2010-02-03 13:44:00 UTC (rev 657)
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Martin O. J. Schmitz.
+ * 
+ * This file is part of the SCHMITZM library - a collection of utility 
+ * classes based on Java 1.6, focusing (not only) on Java Swing 
+ * and the Geotools library.
+ * 
+ * The SCHMITZM project is hosted at:
+ * http://wald.intevation.org/projects/schmitzm/
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public License (license.txt)
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ * or try this link: http://www.gnu.org/licenses/lgpl.html
+ * 
+ * Contributors:
+ *     Martin O. J. Schmitz - initial API and implementation
+ *     Stefan A. Krüger - additional utility classes
+ ******************************************************************************/
+
+package skrueger.geotools;
+
+import java.awt.Point;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseWheelEvent;
+
+import org.opengis.geometry.DirectPosition;
+
+/**
+ * Empty implementation of {@link XMapPaneAction}. No method of this class
+ * does anything.
+ * @author <a href="mailto:martin.schmitz at koeln.de">Martin Schmitz</a> (University of Bonn/Germany)
+ */
+public class XMapPaneActionAdapter implements XMapPaneAction {
+
+  /**
+   * Implements the action on a mouse click event. Does nothing.
+   */
+  @Override
+  public void performClick(XMapPane mapPane, MouseEvent ev, DirectPosition coord) {
+  }
+
+  /**
+   * Implements the action AFTER a mouse drag has ended. Does nothing.
+   */
+  @Override
+  public void performDragged(XMapPane mapPane, MouseEvent ev,
+      Point dragStartPos, Point dragLastPos, DirectPosition startCoord,
+      DirectPosition endCoord) {
+  }
+
+  /**
+   * Implements the action DURING a mouse drag. Does nothing.
+   */
+  @Override
+  public void performDragging(XMapPane mapPane, MouseEvent ev,
+      Point dragStartPos, Point dragLastPos, DirectPosition startCoord,
+      DirectPosition endCoord) {
+  }
+
+  /**
+   * Implements the action on a keyboard stroke. Does nothing.
+   */
+  @Override
+  public void performKeyboard(XMapPane mapPane, Object param) {
+  }
+
+  /**
+   * Implements the action on mouse wheel event. Does nothing.
+   */
+  @Override
+  public void performWheel(XMapPane mapPane, MouseWheelEvent ev,
+      DirectPosition coord) {
+  }
+
+}

Modified: branches/2.0-RC2/src/skrueger/geotools/XMapPaneTool.java
===================================================================
--- branches/2.0-RC2/src/skrueger/geotools/XMapPaneTool.java	2010-02-03 12:18:35 UTC (rev 656)
+++ branches/2.0-RC2/src/skrueger/geotools/XMapPaneTool.java	2010-02-03 13:44:00 UTC (rev 657)
@@ -11,6 +11,8 @@
 import javax.swing.ImageIcon;
 import javax.swing.KeyStroke;
 
+import com.sun.corba.se.spi.copyobject.CopierManager;
+
 import schmitzm.lang.LangUtil;
 import schmitzm.lang.ResourceProvider;
 import schmitzm.swing.SwingUtil;
@@ -20,427 +22,445 @@
  * This class combines the mapping of mouse-inputs and keyboard inputs to
  * {@link XMapPaneAction}s and provides a tool icon and a default mouse cursor.
  */
-public class XMapPaneTool {
+public class XMapPaneTool implements Copyable<XMapPaneTool> {
+  public static ResourceProvider RESOURCE = new ResourceProvider(
+      LangUtil.extendPackagePath(MapPaneToolBar.class,
+      "resource.locales.mapPaneToolbar"),
+      Locale.ENGLISH);
+  public static String R(String key, Object... values) {
+    return RESOURCE.getString(key, values);
+  }
 
-	/** The cursor of the mouse if the tool is active **/
-	private Cursor cursor = null;
+  /** The cursor of the mouse if the tool is active **/
+  private Cursor cursor = null;
 
-	/** A tool-tip for the tool , optional **/
-	private String toolTip = null;
+  /** A tool-tip for the tool , optional **/
+  private String toolTip = null;
 
-	/** The icon for the button **/
-	private Icon icon = null;
+  /** The icon for the button **/
+  private Icon icon = null;
 
-	/**
-	 * Defines which {@link XMapPaneAction} should be should be called when a
-	 * {@link MouseInputType} is triggered
-	 **/
-	Map<MouseInputType, XMapPaneAction> mouseActions = new HashMap<MouseInputType, XMapPaneAction>();
+  /**
+   * Defines which {@link XMapPaneAction} should be should be called when a
+   * {@link MouseInputType} is triggered
+   **/
+  Map<MouseInputType, XMapPaneAction> mouseActions = new HashMap<MouseInputType, XMapPaneAction>();
 
-	/**
-	 * Defines which {@link XMapPaneAction#performKeyboard(XMapPane, Object)}
-	 * should be called when a {@link KeyStroke} is triggered
-	 **/
-	Map<KeyStroke, XMapPaneAction> keyAction = new HashMap<KeyStroke, XMapPaneAction>();
+  /**
+   * Defines which {@link XMapPaneAction#performKeyboard(XMapPane, Object)}
+   * should be called when a {@link KeyStroke} is triggered
+   **/
+  Map<KeyStroke, XMapPaneAction> keyAction = new HashMap<KeyStroke, XMapPaneAction>();
 
-	/**
-	 * Defines which optional parameter should be passed to
-	 * {@link XMapPaneAction#performKeyboard(XMapPane, Object)} if a
-	 * {@link KeyStroke} is triggered
-	 **/
-	Map<KeyStroke, Object> keyActionParams = new HashMap<KeyStroke, Object>();
+  /**
+   * Defines which optional parameter should be passed to
+   * {@link XMapPaneAction#performKeyboard(XMapPane, Object)} if a
+   * {@link KeyStroke} is triggered
+   **/
+  Map<KeyStroke, Object> keyActionParams = new HashMap<KeyStroke, Object>();
 
-	/**
-	 * @return the {@link Cursor} that shall be set as the default mouse cursor
-	 *         (when no button is clicked)
-	 */
-	public Cursor getCursor() {
-		return cursor;
-	}
+  /**
+   * The default constructor sets some default keyboard settings
+   */
+  public XMapPaneTool() {
+    initTool();
+  }
 
-	/**
-	 * @return the {@link Cursor} that shall be set as the default mouse cursor
-	 *         (when no button is clicked)
-	 */
-	public void setCursor(Cursor cursor) {
-		this.cursor = cursor;
-	}
+  /**
+   * Called by the constructor. Initializes the tool actions by defining default
+   * keyboard actions.
+   */
+  protected void initTool() {
+    // + and - keys zoom
+    keyAction.put(KeyStroke.getKeyStroke(KeyEvent.VK_PLUS, 0),
+                  XMapPaneAction.ZOOM_IN);
+    keyAction.put(KeyStroke.getKeyStroke(KeyEvent.VK_MINUS, 0),
+                  XMapPaneAction.ZOOM_OUT);
 
-	public String getToolTip() {
-		return toolTip;
-	}
+    KeyStroke keyStroke;
+    for (int modifier : new int[] { InputEvent.ALT_DOWN_MASK,
+                                   InputEvent.ALT_GRAPH_DOWN_MASK,
+                                   InputEvent.CTRL_DOWN_MASK,
+                                   InputEvent.SHIFT_DOWN_MASK,
+                                   InputEvent.META_DOWN_MASK }) {
+      // RIGHT button pan
+      keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, modifier);
+      keyAction.put(keyStroke, XMapPaneAction.PAN);
+      keyActionParams.put(keyStroke, XMapPaneAction_Pan.Direction.RIGHT);
 
-	public void setToolTip(String toolTip) {
-		this.toolTip = toolTip;
-	}
+      // LEFT button pan
+      keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, modifier);
+      keyAction.put(keyStroke, XMapPaneAction.PAN);
+      keyActionParams.put(keyStroke, XMapPaneAction_Pan.Direction.LEFT);
 
-	/**
-	 * An icon to use if the tool is associated with a button. May be
-	 * <code>null</code>.
-	 */
-	public Icon getIcon() {
-		return icon;
-	}
+      // UP button pan
+      keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, modifier);
+      keyAction.put(keyStroke, XMapPaneAction.PAN);
+      keyActionParams.put(keyStroke, XMapPaneAction_Pan.Direction.UP);
 
-	/**
-	 * An icon to use if the tool is associated with a button. May be
-	 * <code>null</code>.
-	 */
-	public void setIcon(Icon icon) {
-		this.icon = icon;
-	}
+      // DOWN button pan
+      keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_UP, modifier);
+      keyAction.put(keyStroke, XMapPaneAction.PAN);
+      keyActionParams.put(keyStroke, XMapPaneAction_Pan.Direction.DOWN);
+    }
+  }
+  
+  /**
+   * Returns a copy of the tool to derive other tools.
+   */
+  public XMapPaneTool copy() {
+    return copyTo(null);
+  }
 
-	/**
-	 * @return The {@link XMapPaneAction} associated with a given
-	 *         {@link MouseInputType}
-	 */
-	public XMapPaneAction getMouseAction(MouseInputType type) {
-		return mouseActions.get(type);
-	}
+  /**
+   * Copies all actions of this tool to another.
+   * @param tool tool to copy the actions to (if {@code null} a new
+   *             tool is created)
+   * @return the modified or created tool
+   */
+  public XMapPaneTool copyTo(XMapPaneTool tool) {
+    if ( tool == null )
+      tool = new XMapPaneTool();
+    
+    tool.setCursor( getCursor() );
+    tool.setIcon( getIcon() );
+    tool.setToolTip( getToolTip() );
+    for ( MouseInputType type : mouseActions.keySet() )
+      tool.setMouseAction(type, getMouseAction(type));
+    for ( KeyStroke stroke : keyAction.keySet() )
+      tool.setKeyAction(stroke, getKeyAction(stroke));
+    for ( KeyStroke stroke : keyActionParams.keySet() )
+      tool.setKeyActionParam(stroke, getKeyActionParam(stroke));
+    
+    return tool;
+  }
 
-	/**
-	 * Sets the {@link XMapPaneAction} for a given {@link MouseInputType}
-	 */
-	public void setMouseAction(MouseInputType type, XMapPaneAction mouseAction) {
-		this.mouseActions.put(type, mouseAction);
-	}
+  /**
+   * @return the {@link Cursor} that shall be set as the default mouse cursor
+   *         (when no button is clicked)
+   */
+  public Cursor getCursor() {
+    return cursor;
+  }
 
-	/**
-	 * @return The {@link XMapPaneAction} associated with a {@link KeyStroke}
-	 */
-	public XMapPaneAction getKeyAction(KeyStroke keyStroke) {
-		return keyAction.get(keyStroke);
-	}
+  /**
+   * @return the {@link Cursor} that shall be set as the default mouse cursor
+   *         (when no button is clicked)
+   */
+  public void setCursor(Cursor cursor) {
+    this.cursor = cursor;
+  }
 
-	/**
-	 * Set the {@link XMapPaneAction} for a {@link KeyStroke}
-	 */
-	public void setKeyAction(KeyStroke keyStroke, XMapPaneAction keyAction) {
-		this.keyAction.put(keyStroke, keyAction);
-	}
+  public String getToolTip() {
+    return toolTip;
+  }
 
-	/**
-	 * Get the optional parameter for a{@link XMapPaneAction} when triggered by
-	 * {@link KeyStroke}
-	 */
-	public Object getKeyActionParam(KeyStroke keyStroke) {
-		return keyActionParams.get(keyStroke);
-	}
+  public void setToolTip(String toolTip) {
+    this.toolTip = toolTip;
+  }
 
-	/**
-	 * Set the optional parameter for a{@link XMapPaneAction} when triggered by
-	 * {@link KeyStroke}
-	 */
-	public void setKeyActionParam(KeyStroke keyStroke, Object param) {
-		this.keyActionParams.put(keyStroke, param);
-	}
+  /**
+   * An icon to use if the tool is associated with a button. May be
+   * <code>null</code>.
+   */
+  public Icon getIcon() {
+    return icon;
+  }
 
-	/**
-	 * The default constructor sets some default keyboard settings
-	 */
-	public XMapPaneTool() {
-		addDefaultKeyboardAssignments(this);
-	}
+  /**
+   * An icon to use if the tool is associated with a button. May be
+   * <code>null</code>.
+   */
+  public void setIcon(Icon icon) {
+    this.icon = icon;
+  }
 
-	public static ResourceProvider RESOURCE = new ResourceProvider(LangUtil
-			.extendPackagePath(MapPaneToolBar.class,
-					"resource.locales.mapPaneToolbar"), Locale.ENGLISH);
+  /**
+   * @return The {@link XMapPaneAction} associated with a given
+   *         {@link MouseInputType}
+   */
+  public XMapPaneAction getMouseAction(MouseInputType type) {
+    return mouseActions.get(type);
+  }
 
-	public static String R(String key, Object... values) {
-		return RESOURCE.getString(key, values);
-	}
+  /**
+   * Sets the {@link XMapPaneAction} for a given {@link MouseInputType}
+   */
+  public void setMouseAction(MouseInputType type, XMapPaneAction mouseAction) {
+    this.mouseActions.put(type, mouseAction);
+  }
 
-	/** This {@link XMapPaneTool} does nothing **/
-	public static XMapPaneTool NO_ACTION = new XMapPaneTool();
-	static {
-		// Remove the keyboard mapping that are defined by the default
-		// constructor
-		NO_ACTION.keyAction.clear();
-		NO_ACTION.keyActionParams.clear();
-	}
+  /**
+   * @return The {@link XMapPaneAction} associated with a {@link KeyStroke}
+   */
+  public XMapPaneAction getKeyAction(KeyStroke keyStroke) {
+    return keyAction.get(keyStroke);
+  }
 
-	/** The configuration of the default ZOOM IN {@link XMapPaneTool} **/
-	public static XMapPaneTool ZOOM_IN = new XMapPaneTool();
-	static {
-		ZOOM_IN.icon = new ImageIcon(MapView.class
-				.getResource("resource/icons/zoom_in.png"));
-		ZOOM_IN.toolTip = R("MapPaneButtons.ZoomIn.TT");
-		ZOOM_IN.cursor = SwingUtil.ZOOMIN_CURSOR;
+  /**
+   * Set the {@link XMapPaneAction} for a {@link KeyStroke}
+   */
+  public void setKeyAction(KeyStroke keyStroke, XMapPaneAction keyAction) {
+    this.keyAction.put(keyStroke, keyAction);
+  }
 
-		// Left mouse click & drag zoom in
-		ZOOM_IN.mouseActions.put(MouseInputType.LClick, XMapPaneAction.ZOOM_IN);
-		ZOOM_IN.mouseActions.put(MouseInputType.LDrag, XMapPaneAction.ZOOM_IN);
+  /**
+   * Get the optional parameter for a{@link XMapPaneAction} when triggered by
+   * {@link KeyStroke}
+   */
+  public Object getKeyActionParam(KeyStroke keyStroke) {
+    return keyActionParams.get(keyStroke);
+  }
 
-		// Right mouse click & drag zoom out
-		ZOOM_IN.mouseActions
-				.put(MouseInputType.RClick, XMapPaneAction.ZOOM_OUT);
-		ZOOM_IN.mouseActions.put(MouseInputType.RDrag, XMapPaneAction.ZOOM_OUT);
+  /**
+   * Set the optional parameter for a{@link XMapPaneAction} when triggered by
+   * {@link KeyStroke}
+   */
+  public void setKeyActionParam(KeyStroke keyStroke, Object param) {
+    this.keyActionParams.put(keyStroke, param);
+  }
 
-		// Mousewheel can zoom too
-		ZOOM_IN.mouseActions.put(MouseInputType.Wheel, XMapPaneAction.ZOOM_IN);
-	}
+  /** This {@link XMapPaneTool} does nothing **/
+  public static XMapPaneTool NO_ACTION = new XMapPaneTool();
+  static {
+    // Remove the keyboard mapping that are defined by the default
+    // constructor
+    NO_ACTION.keyAction.clear();
+    NO_ACTION.keyActionParams.clear();
+  }
 
-	/** The configuration of the default ZOOM IN {@link XMapPaneTool} **/
-	public static XMapPaneTool ZOOM_OUT = new XMapPaneTool();
-	static {
-		ZOOM_OUT.icon = new ImageIcon(MapView.class
-				.getResource("resource/icons/zoom_out.png"));
-		ZOOM_OUT.toolTip = R("MapPaneButtons.ZoomOut.TT");
-		ZOOM_OUT.cursor = SwingUtil.ZOOMOUT_CURSOR;
+  /** The configuration of the default ZOOM IN {@link XMapPaneTool} **/
+  public static XMapPaneTool ZOOM_IN = new XMapPaneTool();
+  static {
+    ZOOM_IN.icon = new ImageIcon(
+        MapView.class.getResource("resource/icons/zoom_in.png"));
+    ZOOM_IN.toolTip = R("MapPaneButtons.ZoomIn.TT");
+    ZOOM_IN.cursor = SwingUtil.ZOOMIN_CURSOR;
 
-		// Left mouse click & drag zoom in
-		ZOOM_OUT.mouseActions.put(MouseInputType.LClick,
-				XMapPaneAction.ZOOM_OUT);
-		ZOOM_OUT.mouseActions
-				.put(MouseInputType.LDrag, XMapPaneAction.ZOOM_OUT);
+    // Left mouse click & drag zoom in
+    ZOOM_IN.mouseActions.put(MouseInputType.LClick, XMapPaneAction.ZOOM_IN);
+    ZOOM_IN.mouseActions.put(MouseInputType.LDrag, XMapPaneAction.ZOOM_IN);
 
-		// Right mouse click & drag zoom out
-		ZOOM_OUT.mouseActions
-				.put(MouseInputType.RClick, XMapPaneAction.ZOOM_IN);
-		ZOOM_OUT.mouseActions.put(MouseInputType.RDrag, XMapPaneAction.ZOOM_IN);
+    // Right mouse click & drag zoom out
+    ZOOM_IN.mouseActions.put(MouseInputType.RClick, XMapPaneAction.ZOOM_OUT);
+    ZOOM_IN.mouseActions.put(MouseInputType.RDrag, XMapPaneAction.PAN);
 
-		// Mousewheel can zoom
-		ZOOM_OUT.mouseActions.put(MouseInputType.Wheel, XMapPaneAction.ZOOM_IN);
+    // Mousewheel can zoom too
+    ZOOM_IN.mouseActions.put(MouseInputType.Wheel, XMapPaneAction.ZOOM_IN);
+  }
 
-	}
+  /** The configuration of the default ZOOM IN {@link XMapPaneTool} **/
+  public static XMapPaneTool ZOOM_OUT = new XMapPaneTool();
+  static {
+    ZOOM_OUT.icon = new ImageIcon(
+        MapView.class.getResource("resource/icons/zoom_out.png"));
+    ZOOM_OUT.toolTip = R("MapPaneButtons.ZoomOut.TT");
+    ZOOM_OUT.cursor = SwingUtil.ZOOMOUT_CURSOR;
 
-	/** The configuration of the PAN {@link XMapPaneTool} **/
-	public static final XMapPaneTool PAN = new XMapPaneTool();
-	static {
-		PAN.icon = new ImageIcon(MapView.class
-				.getResource("resource/icons/pan.png"));
-		PAN.toolTip = R("MapPaneButtons.Pan.TT");
-		PAN.cursor = SwingUtil.PAN_CURSOR;
+    // Left mouse click & drag zoom in
+    ZOOM_OUT.mouseActions.put(MouseInputType.LClick, XMapPaneAction.ZOOM_OUT);
+    ZOOM_OUT.mouseActions.put(MouseInputType.LDrag, XMapPaneAction.ZOOM_OUT);
 
-		// Left mouse click & drag zoom in
-		PAN.mouseActions.put(MouseInputType.LClick, XMapPaneAction.PAN);
-		PAN.mouseActions.put(MouseInputType.LDrag, XMapPaneAction.PAN);
+    // Right mouse click & drag zoom out
+    ZOOM_OUT.mouseActions.put(MouseInputType.RClick, XMapPaneAction.ZOOM_IN);
+    ZOOM_OUT.mouseActions.put(MouseInputType.RDrag, XMapPaneAction.PAN);
 
-		// Right mouse click & drag zoom out
-		PAN.mouseActions.put(MouseInputType.RClick, XMapPaneAction.PAN);
-		PAN.mouseActions.put(MouseInputType.RDrag, XMapPaneAction.PAN);
+    // Mousewheel can zoom
+    ZOOM_OUT.mouseActions.put(MouseInputType.Wheel, XMapPaneAction.ZOOM_IN);
 
-		// Mousewheel can zoom
-		PAN.mouseActions.put(MouseInputType.Wheel, XMapPaneAction.ZOOM_IN);
+  }
 
-	}
+  /** The configuration of the PAN {@link XMapPaneTool} **/
+  public static final XMapPaneTool PAN = new XMapPaneTool();
+  static {
+    PAN.icon = new ImageIcon(
+        MapView.class.getResource("resource/icons/pan.png"));
+    PAN.toolTip = R("MapPaneButtons.Pan.TT");
+    PAN.cursor = SwingUtil.PAN_CURSOR;
 
-	/** A tool that will do a select_top action on the left mouse button **/
-	public static final XMapPaneTool SELECTION_TOP_LAYER = new XMapPaneTool();
-	static {
-		SELECTION_TOP_LAYER.icon = new ImageIcon(MapView.class
-				.getResource("resource/icons/selection_set.png"));
+    // Left mouse click & drag zoom in
+    PAN.mouseActions.put(MouseInputType.LClick, XMapPaneAction.PAN);
+    PAN.mouseActions.put(MouseInputType.LDrag, XMapPaneAction.PAN);
 
-		SELECTION_TOP_LAYER.cursor = SwingUtil.SELECTION_SET_CURSOR;
+    // Right mouse click & drag zoom out
+    PAN.mouseActions.put(MouseInputType.RClick, XMapPaneAction.PAN);
+    PAN.mouseActions.put(MouseInputType.RDrag, XMapPaneAction.PAN);
 
-		// Left mouse click & drag zoom in
-		SELECTION_TOP_LAYER.mouseActions.put(MouseInputType.LClick,
-				XMapPaneAction.SELECT_TOP);
-		SELECTION_TOP_LAYER.mouseActions.put(MouseInputType.LDrag,
-				XMapPaneAction.SELECT_TOP);
+    // Mousewheel can zoom
+    PAN.mouseActions.put(MouseInputType.Wheel, XMapPaneAction.ZOOM_IN);
 
-		SELECTION_TOP_LAYER.mouseActions.put(MouseInputType.RDrag,
-				XMapPaneAction.PAN);
+  }
 
-		// Mousewheel can zoom
-		SELECTION_TOP_LAYER.mouseActions.put(MouseInputType.Wheel,
-				XMapPaneAction.ZOOM_IN);
+  /** A tool that will do a select_top action on the left mouse button **/
+  public static final XMapPaneTool SELECTION_TOP_LAYER = new XMapPaneTool();
+  static {
+    SELECTION_TOP_LAYER.icon = new ImageIcon(
+        MapView.class.getResource("resource/icons/selection_set.png"));
 
-		// TODO Strg-A shoud select all
-	}
+    SELECTION_TOP_LAYER.cursor = SwingUtil.SELECTION_SET_CURSOR;
 
-	/** A tool that will do a select_top action on the left mouse button **/
-	public static final XMapPaneTool SELECTION_ONE_FROM_TOP_LAYER = new XMapPaneTool();
-	static {
-		SELECTION_ONE_FROM_TOP_LAYER.icon = new ImageIcon(MapView.class
-				.getResource("resource/icons/selection_set.png"));
+    // Left mouse click & drag zoom in
+    SELECTION_TOP_LAYER.mouseActions.put(MouseInputType.LClick,
+                                         XMapPaneAction.SELECT_TOP);
+    SELECTION_TOP_LAYER.mouseActions.put(MouseInputType.LDrag,
+                                         XMapPaneAction.SELECT_TOP);
 
-		SELECTION_ONE_FROM_TOP_LAYER.cursor = SwingUtil.SELECTION_SET_CURSOR;
+    SELECTION_TOP_LAYER.mouseActions.put(MouseInputType.RDrag,
+                                         XMapPaneAction.PAN);
 
-		// Left mouse click & drag zoom in
-		SELECTION_ONE_FROM_TOP_LAYER.mouseActions.put(MouseInputType.LClick,
-				XMapPaneAction.SELECT_ONE_FROM_TOP);
-		SELECTION_ONE_FROM_TOP_LAYER.mouseActions.put(MouseInputType.LDrag,
-				XMapPaneAction.SELECT_ONE_FROM_TOP);
+    // Mousewheel can zoom
+    SELECTION_TOP_LAYER.mouseActions.put(MouseInputType.Wheel,
+                                         XMapPaneAction.ZOOM_IN);
 
-		SELECTION_ONE_FROM_TOP_LAYER.mouseActions.put(MouseInputType.RDrag,
-				XMapPaneAction.PAN);
+    // TODO Strg-A shoud select all
+  }
 
-		// Mousewheel can zoom
-		SELECTION_ONE_FROM_TOP_LAYER.mouseActions.put(MouseInputType.Wheel,
-				XMapPaneAction.ZOOM_IN);
+  /** A tool that will do a select_top action on the left mouse button **/
+  public static final XMapPaneTool SELECTION_ONE_FROM_TOP_LAYER = new XMapPaneTool();
+  static {
+    SELECTION_ONE_FROM_TOP_LAYER.icon = new ImageIcon(
+        MapView.class.getResource("resource/icons/selection_set.png"));
 
-		// TODO Strg-A shoud select all
-	}
+    SELECTION_ONE_FROM_TOP_LAYER.cursor = SwingUtil.SELECTION_SET_CURSOR;
 
-	/** A tool that will do a select_top action on the left mouse button **/
-	public static final XMapPaneTool SELECTION_ALL_LAYERS = new XMapPaneTool();
-	static {
-		SELECTION_ALL_LAYERS.icon = new ImageIcon(MapView.class
-				.getResource("resource/icons/selection_set.png"));
+    // Left mouse click & drag zoom in
+    SELECTION_ONE_FROM_TOP_LAYER.mouseActions.put(
+                                                  MouseInputType.LClick,
+                                                  XMapPaneAction.SELECT_ONE_FROM_TOP);
+    SELECTION_ONE_FROM_TOP_LAYER.mouseActions.put(
+                                                  MouseInputType.LDrag,
+                                                  XMapPaneAction.SELECT_ONE_FROM_TOP);
 
-		SELECTION_ALL_LAYERS.cursor = SwingUtil.SELECTION_SET_CURSOR;
+    SELECTION_ONE_FROM_TOP_LAYER.mouseActions.put(MouseInputType.RDrag,
+                                                  XMapPaneAction.PAN);
 
-		// Left mouse click & drag zoom in
-		SELECTION_ALL_LAYERS.mouseActions.put(MouseInputType.LClick,
-				XMapPaneAction.SELECT_ALL);
-		SELECTION_ALL_LAYERS.mouseActions.put(MouseInputType.LDrag,
-				XMapPaneAction.SELECT_ALL);
+    // Mousewheel can zoom
+    SELECTION_ONE_FROM_TOP_LAYER.mouseActions.put(MouseInputType.Wheel,
+                                                  XMapPaneAction.ZOOM_IN);
 
-		SELECTION_ALL_LAYERS.mouseActions.put(MouseInputType.RDrag,
-				XMapPaneAction.PAN);
+    // TODO Strg-A shoud select all
+  }
 
-		// Mousewheel can zoom
-		SELECTION_ALL_LAYERS.mouseActions.put(MouseInputType.Wheel,
-				XMapPaneAction.ZOOM_IN);
+  /** A tool that will do a select_top action on the left mouse button **/
+  public static final XMapPaneTool SELECTION_ALL_LAYERS = new XMapPaneTool();
+  static {
+    SELECTION_ALL_LAYERS.icon = new ImageIcon(
+        MapView.class.getResource("resource/icons/selection_set.png"));
 
-		// TODO Strg-A shoud select all
-	}
+    SELECTION_ALL_LAYERS.cursor = SwingUtil.SELECTION_SET_CURSOR;
 
-	/** The configuration of the INFO {@link XMapPaneTool} **/
-	public static final XMapPaneTool INFO = new XMapPaneTool();
+    // Left mouse click & drag zoom in
+    SELECTION_ALL_LAYERS.mouseActions.put(MouseInputType.LClick,
+                                          XMapPaneAction.SELECT_ALL);
+    SELECTION_ALL_LAYERS.mouseActions.put(MouseInputType.LDrag,
+                                          XMapPaneAction.SELECT_ALL);
 
-	static {
-		INFO.icon = new ImageIcon(MapView.class
-				.getResource("resource/icons/info.png"));
-		INFO.toolTip = R("MapPaneButtons.Info.TT");
-		INFO.cursor = SwingUtil.INFO_CURSOR;
+    SELECTION_ALL_LAYERS.mouseActions.put(MouseInputType.RDrag,
+                                          XMapPaneAction.PAN);
 
-		// Left mouse click & drag zoom in
-		INFO.mouseActions.put(MouseInputType.LClick,
-				XMapPaneAction.SELECT_ONE_FROM_TOP);
-		// INFO.mouseActions.put(MouseInputType.LDrag,
-		// XMapPaneAction.SELECT_ONE_FROM_TOP);
+    // Mousewheel can zoom
+    SELECTION_ALL_LAYERS.mouseActions.put(MouseInputType.Wheel,
+                                          XMapPaneAction.ZOOM_IN);
 
-		INFO.mouseActions.put(MouseInputType.RDrag, XMapPaneAction.PAN);
+    // TODO Strg-A shoud select all
+  }
 
-		// Mousewheel can zoom
-		INFO.mouseActions.put(MouseInputType.Wheel, XMapPaneAction.ZOOM_IN);
+  /** The configuration of the INFO {@link XMapPaneTool} **/
+  public static final XMapPaneTool INFO = new XMapPaneTool();
 
-	}
+  static {
+    INFO.icon = new ImageIcon(
+        MapView.class.getResource("resource/icons/info.png"));
+    INFO.toolTip = R("MapPaneButtons.Info.TT");
+    INFO.cursor = SwingUtil.INFO_CURSOR;
 
-	public static final XMapPaneTool SELECTION_ADD = new XMapPaneTool();
-	static {
-		SELECTION_ADD.icon = new ImageIcon(MapView.class
-				.getResource("resource/icons/selection_add.png"));
-		SELECTION_ADD.toolTip = R("MapPaneButtons.Selection.AddSelection.TT"); // TODO
-		// move
-		// to
-		// schmitzm
+    // Left mouse click & drag zoom in
+    INFO.mouseActions.put(MouseInputType.LClick,
+                          XMapPaneAction.SELECT_ONE_FROM_TOP);
+    // INFO.mouseActions.put(MouseInputType.LDrag,
+    // XMapPaneAction.SELECT_ONE_FROM_TOP);
 
-		SELECTION_ADD.cursor = SwingUtil.SELECTION_ADD_CURSOR;
+    INFO.mouseActions.put(MouseInputType.RDrag, XMapPaneAction.PAN);
 
-		// Left mouse click & drag zoom in
-		SELECTION_ADD.mouseActions.put(MouseInputType.LClick,
-				XMapPaneAction.SELECT_ALL);
-		SELECTION_ADD.mouseActions.put(MouseInputType.LDrag,
-				XMapPaneAction.SELECT_ALL);
+    // Mousewheel can zoom
+    INFO.mouseActions.put(MouseInputType.Wheel, XMapPaneAction.ZOOM_IN);
 
-		SELECTION_ADD.mouseActions
-				.put(MouseInputType.RDrag, XMapPaneAction.PAN);
+  }
 
-		// Mousewheel can zoom
-		SELECTION_ADD.mouseActions.put(MouseInputType.Wheel,
-				XMapPaneAction.ZOOM_IN);
+  public static final XMapPaneTool SELECTION_ADD = new XMapPaneTool();
+  static {
+    SELECTION_ADD.icon = new ImageIcon(
+        MapView.class.getResource("resource/icons/selection_add.png"));
+    SELECTION_ADD.toolTip = R("MapPaneButtons.Selection.AddSelection.TT"); // TODO
+    // move
+    // to
+    // schmitzm
 
-		// TODO Strg-A shoud select all
-	}
+    SELECTION_ADD.cursor = SwingUtil.SELECTION_ADD_CURSOR;
 
-	public static final XMapPaneTool SELECTION_REMOVE = new XMapPaneTool();
-	static {
-		SELECTION_REMOVE.icon = new ImageIcon(MapView.class
-				.getResource("resource/icons/selection_remove.png"));
-		SELECTION_REMOVE.toolTip = R("MapPaneButtons.Selection.RemoveSelection.TT"); // TODO
-		// move
-		// to
-		// schmitzm
+    // Left mouse click & drag zoom in
+    SELECTION_ADD.mouseActions.put(MouseInputType.LClick,
+                                   XMapPaneAction.SELECT_ALL);
+    SELECTION_ADD.mouseActions.put(MouseInputType.LDrag,
+                                   XMapPaneAction.SELECT_ALL);
 
-		SELECTION_REMOVE.cursor = SwingUtil.SELECTION_REMOVE_CURSOR;
+    SELECTION_ADD.mouseActions.put(MouseInputType.RDrag, XMapPaneAction.PAN);
 
-		// Left mouse click & drag zoom in
-		SELECTION_REMOVE.mouseActions.put(MouseInputType.LClick,
-				XMapPaneAction.SELECT_ALL);
-		SELECTION_REMOVE.mouseActions.put(MouseInputType.LDrag,
-				XMapPaneAction.SELECT_ALL);
+    // Mousewheel can zoom
+    SELECTION_ADD.mouseActions.put(MouseInputType.Wheel, XMapPaneAction.ZOOM_IN);
 
-		SELECTION_REMOVE.mouseActions.put(MouseInputType.RDrag,
-				XMapPaneAction.PAN);
+    // TODO Strg-A shoud select all
+  }
 
-		// Mousewheel can zoom
-		SELECTION_REMOVE.mouseActions.put(MouseInputType.Wheel,
-				XMapPaneAction.ZOOM_IN);
+  public static final XMapPaneTool SELECTION_REMOVE = new XMapPaneTool();
+  static {
+    SELECTION_REMOVE.icon = new ImageIcon(
+        MapView.class.getResource("resource/icons/selection_remove.png"));
+    SELECTION_REMOVE.toolTip = R("MapPaneButtons.Selection.RemoveSelection.TT"); // TODO
+    // move
+    // to
+    // schmitzm
 
-		// TODO Strg-A shoud select all
-	}
+    SELECTION_REMOVE.cursor = SwingUtil.SELECTION_REMOVE_CURSOR;
 
-	public static final XMapPaneTool SELECTION_SET = new XMapPaneTool();
-	static {
-		SELECTION_SET.icon = new ImageIcon(MapView.class
-				.getResource("resource/icons/selection_set.png"));
-		SELECTION_SET.toolTip = R("MapPaneButtons.Selection.SetSelection.TT"); // TODO
-		// move
-		// to
-		// schmitzm
+    // Left mouse click & drag zoom in
+    SELECTION_REMOVE.mouseActions.put(MouseInputType.LClick,
+                                      XMapPaneAction.SELECT_ALL);
+    SELECTION_REMOVE.mouseActions.put(MouseInputType.LDrag,
+                                      XMapPaneAction.SELECT_ALL);
 
-		SELECTION_SET.cursor = SwingUtil.SELECTION_SET_CURSOR;
+    SELECTION_REMOVE.mouseActions.put(MouseInputType.RDrag, XMapPaneAction.PAN);
 
-		// Left mouse click & drag zoom in
-		SELECTION_SET.mouseActions.put(MouseInputType.LClick,
-				XMapPaneAction.SELECT_ALL);
-		SELECTION_SET.mouseActions.put(MouseInputType.LDrag,
-				XMapPaneAction.SELECT_ALL);
+    // Mousewheel can zoom
+    SELECTION_REMOVE.mouseActions.put(MouseInputType.Wheel,
+                                      XMapPaneAction.ZOOM_IN);
 
-		SELECTION_SET.mouseActions
-				.put(MouseInputType.RDrag, XMapPaneAction.PAN);
+    // TODO Strg-A shoud select all
+  }
 
-		// Mousewheel can zoom
-		SELECTION_SET.mouseActions.put(MouseInputType.Wheel,
-				XMapPaneAction.ZOOM_IN);
+  public static final XMapPaneTool SELECTION_SET = new XMapPaneTool();
+  static {
+    SELECTION_SET.icon = new ImageIcon(
+        MapView.class.getResource("resource/icons/selection_set.png"));
+    SELECTION_SET.toolTip = R("MapPaneButtons.Selection.SetSelection.TT"); // TODO
+    // move
+    // to
+    // schmitzm
 
-		// TODO Strg-A shoud select all
-	}
+    SELECTION_SET.cursor = SwingUtil.SELECTION_SET_CURSOR;
 
-	/**
-	 * Adds default Keyboard actions to a given {@link XMapPaneTool}
-	 */
-	public static void addDefaultKeyboardAssignments(XMapPaneTool tool) {
+    // Left mouse click & drag zoom in
+    SELECTION_SET.mouseActions.put(MouseInputType.LClick,
+                                   XMapPaneAction.SELECT_ALL);
+    SELECTION_SET.mouseActions.put(MouseInputType.LDrag,
+                                   XMapPaneAction.SELECT_ALL);
 
-		// + and - keys zoom
-		tool.keyAction.put(KeyStroke.getKeyStroke(KeyEvent.VK_PLUS, 0),
-				XMapPaneAction.ZOOM_IN);
-		tool.keyAction.put(KeyStroke.getKeyStroke(KeyEvent.VK_MINUS, 0),
-				XMapPaneAction.ZOOM_OUT);
+    SELECTION_SET.mouseActions.put(MouseInputType.RDrag, XMapPaneAction.PAN);
 
-		KeyStroke keyStroke;
+    // Mousewheel can zoom
+    SELECTION_SET.mouseActions.put(MouseInputType.Wheel, XMapPaneAction.ZOOM_IN);
 
-		for (int modifier : new int[] { InputEvent.ALT_DOWN_MASK,
-				InputEvent.ALT_GRAPH_DOWN_MASK, InputEvent.CTRL_DOWN_MASK,
-				InputEvent.SHIFT_DOWN_MASK, InputEvent.META_DOWN_MASK }) {
+    // TODO Strg-A shoud select all
+  }
 
-			// RIGHT button pan
-			keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, modifier);
-			tool.keyAction.put(keyStroke, XMapPaneAction.PAN);
-			tool.keyActionParams.put(keyStroke,
-					XMapPaneAction_Pan.Direction.RIGHT);
-
-			// LEFT button pan
-			keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, modifier);
-			tool.keyAction.put(keyStroke, XMapPaneAction.PAN);
-			tool.keyActionParams.put(keyStroke,
-					XMapPaneAction_Pan.Direction.LEFT);
-
-			// UP button pan
-			keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, modifier);
-			tool.keyAction.put(keyStroke, XMapPaneAction.PAN);
-			tool.keyActionParams
-					.put(keyStroke, XMapPaneAction_Pan.Direction.UP);
-
-			// DOWN button pan
-			keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_UP, modifier);
-			tool.keyAction.put(keyStroke, XMapPaneAction.PAN);
-			tool.keyActionParams.put(keyStroke,
-					XMapPaneAction_Pan.Direction.DOWN);
-		}
-
-	}
 }



More information about the Schmitzm-commits mailing list