[Schmitzm-commits] r651 - in branches/2.0-RC2/src: schmitzm/geotools/gui skrueger/geotools
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Fri Jan 29 09:37:39 CET 2010
Author: alfonx
Date: 2010-01-29 09:37:34 +0100 (Fri, 29 Jan 2010)
New Revision: 651
Added:
branches/2.0-RC2/src/skrueger/geotools/XMapPaneAction_Pan.java
Modified:
branches/2.0-RC2/src/schmitzm/geotools/gui/SelectableXMapPane.java
branches/2.0-RC2/src/skrueger/geotools/SelectXMapPaneMouseListener.java
branches/2.0-RC2/src/skrueger/geotools/XMapPane.java
branches/2.0-RC2/src/skrueger/geotools/XMapPaneAction.java
Log:
Created XMapPaneAction_Pan
Modified: branches/2.0-RC2/src/schmitzm/geotools/gui/SelectableXMapPane.java
===================================================================
--- branches/2.0-RC2/src/schmitzm/geotools/gui/SelectableXMapPane.java 2010-01-28 17:43:54 UTC (rev 650)
+++ branches/2.0-RC2/src/schmitzm/geotools/gui/SelectableXMapPane.java 2010-01-29 08:37:34 UTC (rev 651)
@@ -1028,11 +1028,6 @@
return result;
}
- @Override
- public void mouseDragged(Point startPos, Point lastPos, MouseEvent event) {
- super.mouseDragged(startPos, lastPos, event);
- }
-
/**
* Testet (anhand der Bounding-Box), ob das Objekt eines Layers eine andere
* Bounding-Box schneidet. Die Bounding-Box des Layer-Objekts wird zunaechst
Modified: branches/2.0-RC2/src/skrueger/geotools/SelectXMapPaneMouseListener.java
===================================================================
--- branches/2.0-RC2/src/skrueger/geotools/SelectXMapPaneMouseListener.java 2010-01-28 17:43:54 UTC (rev 650)
+++ branches/2.0-RC2/src/skrueger/geotools/SelectXMapPaneMouseListener.java 2010-01-29 08:37:34 UTC (rev 651)
@@ -183,35 +183,37 @@
else
xMapPane.zoomTo(wheelEvt.getPoint(), 2. / -units);
}
+//
+// @Override
+// public void mouseDragged(final MouseEvent event) {
+// if (!isEnabled())
+// return;
+//
+// xMapPane.mouseDragged(startPos, lastPos, event);
+//
+// lastPos = event.getPoint();
+// }
- @Override
- public void mouseDragged(final MouseEvent event) {
- if (!isEnabled())
- return;
-
- xMapPane.mouseDragged(startPos, lastPos, event);
-
- lastPos = event.getPoint();
- }
-
/**
* Stores beginning of a drag event in window coordinates
*/
protected Point startPos;
+//
+// /**
+// * Stores last position of a drag event in window coordinates
+// */
+// protected Point lastPos;
- /**
- * Stores last position of a drag event in window coordinates
- */
- protected Point lastPos;
-
public void mouseReleased(final MouseEvent event) {
if (!isEnabled())
return;
- if (xMapPane.getState() == XMapPane.PAN
- || event.getButton() == MouseEvent.BUTTON3) {
- xMapPane.performPan();
- } else if (xMapPane.getState() == XMapPane.SELECT_ALL
+// if (xMapPane.getState() == XMapPane.PAN
+// || event.getButton() == MouseEvent.BUTTON3) {
+// xMapPane.performPan();
+// } else
+//
+ if (xMapPane.getState() == XMapPane.SELECT_ALL
|| xMapPane.getState() == XMapPane.SELECT_TOP
) {
@@ -228,14 +230,14 @@
}
}
+//
+// public void mousePressed(final MouseEvent e) {
+// if (!isEnabled())
+// return;
+// startPos = new Point(e.getPoint());
+// lastPos = new Point(e.getPoint());
+// }
- public void mousePressed(final MouseEvent e) {
- if (!isEnabled())
- return;
- startPos = new Point(e.getPoint());
- lastPos = new Point(e.getPoint());
- }
-
public SelectXMapPaneMouseListener(SelectableXMapPane xMapPane) {
this.xMapPane = xMapPane;
}
Modified: branches/2.0-RC2/src/skrueger/geotools/XMapPane.java
===================================================================
--- branches/2.0-RC2/src/skrueger/geotools/XMapPane.java 2010-01-28 17:43:54 UTC (rev 650)
+++ branches/2.0-RC2/src/skrueger/geotools/XMapPane.java 2010-01-29 08:37:34 UTC (rev 651)
@@ -395,7 +395,7 @@
* While dragging, the {@link #updateFinalImage()} method is translating the
* cached images while setting it together.
**/
- Point imageOrigin = new Point(0, 0);
+ private final Point imageOrigin = new Point(0, 0);
/**
* For every rendering thread started,
* {@link GTUtil#createGTRenderer(MapContext)} is called to create a new
@@ -643,7 +643,7 @@
XMapPaneAction.ZOOM_OUT);
xMapPaneMouseListener.actions.put(MouseInputType.RDrag,
- XMapPaneAction.ZOOM_OUT);
+ XMapPaneAction.PAN);
/*
* We use a Timer object to avoid rendering delays and flickering when
@@ -1378,86 +1378,82 @@
}
/**
- * Called from the listeners while the mouse is dragging, this method either
- * paints a translated (moved/panned) version of the image, or a rectangle.
+ * Usually called from {@link XMapPaneAction_Pan} to pan the image.
*
* @param startPos
* in screen coordinates
* @param lastPos
* in screen coordinates
- * @param event
- * the {@link MouseEvent} to read the mouse buttons from
*/
- public void mouseDragged(final Point startPos, final Point lastPos,
- final MouseEvent event) {
+ public void pan(final int dX, final int dY) {
- if ((getState() == XMapPane.PAN)
- || ((event.getModifiersEx() & InputEvent.BUTTON3_DOWN_MASK) != 0)) {
+ // if ((getState() == XMapPane.PAN)
+ // || ((event.getModifiersEx() & InputEvent.BUTTON3_DOWN_MASK) != 0)) {
- // Panning needs a panning coursor
- if (getCursor() != SwingUtil.PANNING_CURSOR) {
- setCursor(SwingUtil.PANNING_CURSOR);
+ // Panning needs a panning coursor
+ if (getCursor() != SwingUtil.PANNING_CURSOR) {
+ setCursor(SwingUtil.PANNING_CURSOR);
- // While panning, we deactivate the rendering. So the tasks are
- // ready to start when the panning is finished.
- if (bgExecuter != null && bgExecuter.isRunning())
- bgExecuter.cancelTask();
- if (localExecuter.isRunning())
- localExecuter.cancelTask();
- }
+ // While panning, we deactivate the rendering. So the tasks are
+ // ready to start when the panning is finished.
+ if (bgExecuter != null && bgExecuter.isRunning())
+ bgExecuter.cancelTask();
+ if (localExecuter.isRunning())
+ localExecuter.cancelTask();
+ }
+ //
+ // if (lastPos.x > 0 && lastPos.y > 0) {
+ // final int dx = event.getX() - lastPos.x;
+ // final int dy = event.getY() - lastPos.y;
- if (lastPos.x > 0 && lastPos.y > 0) {
- final int dx = event.getX() - lastPos.x;
- final int dy = event.getY() - lastPos.y;
+ // TODO Stop dragging when the drag would not be valid...
+ // boolean dragValid = true;
+ // // check if this panning results in a valid mapArea
+ // {
+ // Rectangle winBounds = xMapPane.getBounds();
+ // winBounds.translate(xMapPane.imageOrigin.x,
+ // -xMapPane.imageOrigin.y);
+ // Envelope newMapAreaBefore = xMapPane.tranformWindowToGeo(
+ // winBounds.x, winBounds.y, winBounds.x
+ // + winBounds.width, winBounds.y
+ // + winBounds.height);
+ //
+ //
+ // winBounds = xMapPane.getBounds();
+ // Point testIng = new Point(xMapPane.imageOrigin);
+ // testIng.translate(dx, dy);
+ // winBounds.translate(testIng.x, -testIng.y);
+ // Envelope newMapAreaAfter = xMapPane.tranformWindowToGeo(
+ // winBounds.x, winBounds.y, winBounds.x
+ // + winBounds.width, winBounds.y
+ // + winBounds.height);
+ //
+ // // If the last drag doesn't change the MapArea anymore cancel
+ // it.
+ // if (xMapPane.bestAllowedMapArea(newMapAreaAfter).equals(
+ // xMapPane.bestAllowedMapArea(newMapAreaBefore))){
+ // dragValid = false;
+ // return;
+ // }
+ // }
- // TODO Stop dragging when the drag would not be valid...
- // boolean dragValid = true;
- // // check if this panning results in a valid mapArea
- // {
- // Rectangle winBounds = xMapPane.getBounds();
- // winBounds.translate(xMapPane.imageOrigin.x,
- // -xMapPane.imageOrigin.y);
- // Envelope newMapAreaBefore = xMapPane.tranformWindowToGeo(
- // winBounds.x, winBounds.y, winBounds.x
- // + winBounds.width, winBounds.y
- // + winBounds.height);
- //
- //
- // winBounds = xMapPane.getBounds();
- // Point testIng = new Point(xMapPane.imageOrigin);
- // testIng.translate(dx, dy);
- // winBounds.translate(testIng.x, -testIng.y);
- // Envelope newMapAreaAfter = xMapPane.tranformWindowToGeo(
- // winBounds.x, winBounds.y, winBounds.x
- // + winBounds.width, winBounds.y
- // + winBounds.height);
- //
- // // If the last drag doesn't change the MapArea anymore cancel
- // it.
- // if (xMapPane.bestAllowedMapArea(newMapAreaAfter).equals(
- // xMapPane.bestAllowedMapArea(newMapAreaBefore))){
- // dragValid = false;
- // return;
- // }
- // }
+ getImageOrigin().translate(dX, dY);
+ updateFinalImage();
+ repaint();
+ // }
- imageOrigin.translate(dx, dy);
- updateFinalImage();
- repaint();
- }
-
- } else if ((getState() == XMapPane.ZOOM_IN)
- || (getState() == XMapPane.ZOOM_OUT)
- || (getState() == XMapPane.SELECT_ALL)
- || (getState() == XMapPane.SELECT_TOP)) {
-
- // Draws a rectangle
- final Graphics2D graphics = (Graphics2D) getGraphics();
- drawRectangle(graphics, startPos, event.getPoint());
- if ((lastPos.x > 0) && (lastPos.y > 0))
- drawRectangle(graphics, startPos, lastPos);
- graphics.dispose();
- }
+ // } else if ((getState() == XMapPane.ZOOM_IN)
+ // || (getState() == XMapPane.ZOOM_OUT)
+ // || (getState() == XMapPane.SELECT_ALL)
+ // || (getState() == XMapPane.SELECT_TOP)) {
+ //
+ // // Draws a rectangle
+ // final Graphics2D graphics = (Graphics2D) getGraphics();
+ // drawRectangle(graphics, startPos, event.getPoint());
+ // if ((lastPos.x > 0) && (lastPos.y > 0))
+ // drawRectangle(graphics, startPos, lastPos);
+ // graphics.dispose();
+ // }
}
/**
@@ -1619,39 +1615,39 @@
}
}
+//
+// /**
+// * Performs a {@value #PAN} action. During panning, the displacement is
+// * stored in {@link #imageOrigin} object. Calling {@link #performPan()} will
+// * reset the offset and call {@link #setMapArea(Envelope)}.
+// */
+// public void performPan() {
+//
+// final Rectangle winBounds = getVisibleRect();
+//
+// winBounds.translate(-imageOrigin.x, -imageOrigin.y);
+// final Envelope newMapArea = tranformWindowToGeo(winBounds.x,
+// winBounds.y, winBounds.x + winBounds.width, winBounds.y
+// + winBounds.height);
+//
+// imageOrigin.x = 0;
+// imageOrigin.y = 0;
+//
+// if (!setMapArea(newMapArea)) {
+// /**
+// * If setMapArea returns true, the finalImage is updated anyways.
+// * This if-case exists to ensure that we repaint a correct image
+// * even if the new panning area has been denied.
+// */
+// updateFinalImage();
+// repaint();
+// }
+//
+// if (getCursor() == SwingUtil.PANNING_CURSOR)
+// setCursor(SwingUtil.PAN_CURSOR);
+// }
/**
- * Performs a {@value #PAN} action. During panning, the displacement is
- * stored in {@link #imageOrigin} object. Calling {@link #performPan()} will
- * reset the offset and call {@link #setMapArea(Envelope)}.
- */
- public void performPan() {
-
- final Rectangle winBounds = getVisibleRect();
-
- winBounds.translate(-imageOrigin.x, -imageOrigin.y);
- final Envelope newMapArea = tranformWindowToGeo(winBounds.x,
- winBounds.y, winBounds.x + winBounds.width, winBounds.y
- + winBounds.height);
-
- imageOrigin.x = 0;
- imageOrigin.y = 0;
-
- if (!setMapArea(newMapArea)) {
- /**
- * If setMapArea returns true, the finalImage is updated anyways.
- * This if-case exists to ensure that we repaint a correct image
- * even if the new panning area has been denied.
- */
- updateFinalImage();
- repaint();
- }
-
- if (getCursor() == SwingUtil.PANNING_CURSOR)
- setCursor(SwingUtil.PAN_CURSOR);
- }
-
- /**
* Entfernt einen Listener von der Map.
*
* @param l
@@ -2229,17 +2225,17 @@
final Graphics2D finalG = getFinalImage().createGraphics();
finalG.setBackground(getMapBackgroundColor());
- finalG.drawImage(getPreFinalImage(), imageOrigin.x, imageOrigin.y,
+ finalG.drawImage(getPreFinalImage(), getImageOrigin().x, getImageOrigin().y,
getMapBackgroundColor(), null);
// When panning, we have to clear the area around the image
- final Rectangle painedArea = new Rectangle(imageOrigin.x,
- imageOrigin.y, getFinalImage().getWidth(), getFinalImage()
+ final Rectangle painedArea = new Rectangle(getImageOrigin().x,
+ getImageOrigin().y, getFinalImage().getWidth(), getFinalImage()
.getHeight());
SwingUtil.clearAround(finalG, painedArea, getVisibleRect(),
getMapBackgroundColor());
- addGadgets(finalG, false);
+// addGadgets(finalG, false);
finalG.dispose();
@@ -2632,4 +2628,8 @@
}
+ public Point getImageOrigin() {
+ return imageOrigin;
+ }
+
}
Modified: branches/2.0-RC2/src/skrueger/geotools/XMapPaneAction.java
===================================================================
--- branches/2.0-RC2/src/skrueger/geotools/XMapPaneAction.java 2010-01-28 17:43:54 UTC (rev 650)
+++ branches/2.0-RC2/src/skrueger/geotools/XMapPaneAction.java 2010-01-29 08:37:34 UTC (rev 651)
@@ -29,6 +29,7 @@
******************************************************************************/
package skrueger.geotools;
+import java.awt.Cursor;
import java.awt.Point;
import java.awt.event.MouseEvent;
import java.awt.event.MouseWheelEvent;
@@ -38,56 +39,99 @@
import schmitzm.swing.event.MouseInputType;
/**
- * Defines an action (e.g. Zoom in, zoom out, drag) when a click, drag or
- * window selection is performed on a {@link XMapPane}.
- * @author <a href="mailto:martin.schmitz at koeln.de">Martin Schmitz</a> (University of Bonn/Germany)
+ * Defines an action (e.g. Zoom in, zoom out, drag) when a click, drag or window
+ * selection is performed on a {@link XMapPane}.
+ *
+ * @author <a href="mailto:martin.schmitz at koeln.de">Martin Schmitz</a>
+ * (University of Bonn/Germany)
*/
public interface XMapPaneAction {
-
- /**
- * Defines the action in case of a single click on the map. Called by
- * ### XMapPaneMouseAdapter ### on {@link MouseInputType#LClick} and
- * {@link MouseInputType#RClick}.
- * @param mapPane map pane the action should be performed on
- * @param ev mouse event of the action
- * @param coord geo coordinate the click is performed on
- */
- public void performClick(XMapPane mapPane, MouseEvent ev, DirectPosition coord);
-
- /**
- * Defines the action in case of a mouse drag on the map. This method
- * is called on every mouse motion.
- * @param mapPane map pane the action should be performed on
- * @param ev mouse event of the action
- * @param dragStartPos window position the drag was started (the current
- * position can be determined from the mouse event)
- * @param startCoord geo coordinate the drag was started
- * @param endCoord geo coordinate the drag is currently moved over
- */
- public void performDragging(XMapPane mapPane, MouseEvent ev, Point dragStartPos, Point dragLastPos, DirectPosition startCoord, DirectPosition endCoord);
- /**
- * Defines the action in case of a window selection on the map (the moment
- * a drag ends).
- * @param mapPane map pane the action should be performed on
- * @param ev mouse event of the action
- * @param dragStartPos window position the window starts (the end
- * position can be determined from the mouse event)
- * @param startCoord geo coordinate the window starts
- * @param endCoord geo coordinate the window ends
- */
- public void performDragged(XMapPane mapPane, MouseEvent ev, Point dragStartPos, Point dragLastPos, DirectPosition startCoord, DirectPosition endCoord);
+ /**
+ * This action can be assigned to any {@link MouseInputType} to perform
+ * zoom-in
+ **/
+ public static XMapPaneAction_Zoom ZOOM_IN = new XMapPaneAction_Zoom.In();
- /**
- * Defines the action in case of a mouse wheel action on the map (the moment
- * a drag ends).
- * @param mapPane map pane the action should be performed on
- * @param ev mouse event of the action
- * @param coord geo coordinate the wheel is turned on
- */
- public void performWheel(XMapPane mapPane, MouseWheelEvent ev, DirectPosition coord);
-
- public static XMapPaneAction_Zoom ZOOM_IN = new XMapPaneAction_Zoom.In();
- public static XMapPaneAction_Zoom ZOOM_OUT = new XMapPaneAction_Zoom.Out();
+ /**
+ * This action can be assigned to any {@link MouseInputType} to perform
+ * zoom-out
+ **/
+ public static XMapPaneAction_Zoom ZOOM_OUT = new XMapPaneAction_Zoom.Out();
+
+ /**
+ * This action can be assigned to any {@link MouseInputType} to perform
+ * panning on a Map
+ **/
+ public static XMapPaneAction_Pan PAN = new XMapPaneAction_Pan();
+ /**
+ * Defines the action in case of a single click on the map. Called by ###
+ * XMapPaneMouseAdapter ### on {@link MouseInputType#LClick} and
+ * {@link MouseInputType#RClick}.
+ *
+ * @param mapPane
+ * map pane the action should be performed on
+ * @param ev
+ * mouse event of the action
+ * @param coord
+ * geo coordinate the click is performed on
+ */
+ public void performClick(XMapPane mapPane, MouseEvent ev,
+ DirectPosition coord);
+
+ /**
+ * Defines the action in case of a mouse drag on the map. This method is
+ * called on every mouse motion.
+ *
+ * @param mapPane
+ * map pane the action should be performed on
+ * @param ev
+ * mouse event of the action
+ * @param dragStartPos
+ * window position the drag was started (the current position can
+ * be determined from the mouse event)
+ * @param startCoord
+ * geo coordinate the drag was started
+ * @param endCoord
+ * geo coordinate the drag is currently moved over
+ */
+ public void performDragging(XMapPane mapPane, MouseEvent ev,
+ Point dragStartPos, Point dragLastPos, DirectPosition startCoord,
+ DirectPosition endCoord);
+
+ /**
+ * Defines the action in case of a window selection on the map (the moment a
+ * drag ends).
+ *
+ * @param mapPane
+ * map pane the action should be performed on
+ * @param ev
+ * mouse event of the action
+ * @param dragStartPos
+ * window position the window starts (the end position can be
+ * determined from the mouse event)
+ * @param startCoord
+ * geo coordinate the window starts
+ * @param endCoord
+ * geo coordinate the window ends
+ */
+ public void performDragged(XMapPane mapPane, MouseEvent ev,
+ Point dragStartPos, Point dragLastPos, DirectPosition startCoord,
+ DirectPosition endCoord);
+
+ /**
+ * Defines the action in case of a mouse wheel action on the map (the moment
+ * a drag ends).
+ *
+ * @param mapPane
+ * map pane the action should be performed on
+ * @param ev
+ * mouse event of the action
+ * @param coord
+ * geo coordinate the wheel is turned on
+ */
+ public void performWheel(XMapPane mapPane, MouseWheelEvent ev,
+ DirectPosition coord);
+
}
Added: branches/2.0-RC2/src/skrueger/geotools/XMapPaneAction_Pan.java
===================================================================
--- branches/2.0-RC2/src/skrueger/geotools/XMapPaneAction_Pan.java 2010-01-28 17:43:54 UTC (rev 650)
+++ branches/2.0-RC2/src/skrueger/geotools/XMapPaneAction_Pan.java 2010-01-29 08:37:34 UTC (rev 651)
@@ -0,0 +1,129 @@
+/*******************************************************************************
+ * 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.Cursor;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseWheelEvent;
+
+import org.opengis.geometry.DirectPosition;
+
+import schmitzm.swing.SwingUtil;
+
+import com.vividsolutions.jts.geom.Envelope;
+
+public class XMapPaneAction_Pan implements XMapPaneAction {
+
+ /**
+ * This variable can be used to backup the active cursor of the mapPane, if
+ * the actions changes the cursor during dragging
+ */
+ public Cursor backupCursor = null;
+
+ /**
+ * Performs a pan action. During panning, the displacement is
+ * stored in {@link #imageOrigin} object. Calling {@link #performPan()} will
+ * reset the offset and call {@link #setMapArea(Envelope)}.
+ */
+ @Override
+ public void performDragged(XMapPane mapPane, MouseEvent ev,
+ Point dragStartPos, Point dragLastPos, DirectPosition startCoord,
+ DirectPosition endCoord) {
+
+ final Rectangle winBounds = mapPane.getVisibleRect();
+
+ Point imageOrigin = mapPane.getImageOrigin();
+
+ winBounds.translate(-imageOrigin.x, -imageOrigin.y);
+ final Envelope newMapArea = mapPane.tranformWindowToGeo(winBounds.x,
+ winBounds.y, winBounds.x + winBounds.width, winBounds.y
+ + winBounds.height);
+
+ imageOrigin.x = 0;
+ imageOrigin.y = 0;
+
+ if (!mapPane.setMapArea(newMapArea)) {
+ /**
+ * If setMapArea returns true, the finalImage is updated anyways.
+ * This if-case exists to ensure that we repaint a correct image
+ * even if the new panning area has been denied.
+ */
+ mapPane.updateFinalImage();
+ mapPane.repaint();
+ }
+
+ if (mapPane.getCursor() == SwingUtil.PANNING_CURSOR) {
+ mapPane.setCursor(backupCursor);
+ }
+ }
+
+ /**
+ * TODO: Stop dragging if the expected map area would not be valid.
+ */
+ @Override
+ public void performDragging(XMapPane mapPane, MouseEvent ev,
+ Point dragStartPos, Point dragLastPos, DirectPosition startCoord,
+ DirectPosition endCoord) {
+
+ if (mapPane.getCursor() != SwingUtil.PANNING_CURSOR) {
+ backupCursor = mapPane.getCursor();
+ mapPane.setCursor(SwingUtil.PANNING_CURSOR);
+ }
+
+ int dX;
+ int dY;
+
+ if (dragLastPos == null) {
+ dX = ev.getPoint().x - dragStartPos.x;
+ dY = ev.getPoint().y - dragStartPos.y;
+ } else {
+ dX = ev.getPoint().x - dragLastPos.x;
+ dY = ev.getPoint().y - dragLastPos.y;
+ }
+
+ if (dX != 0 && dY != 0)
+ mapPane.pan(dX, dY);
+
+ }
+
+ @Override
+ public void performWheel(XMapPane mapPane, MouseWheelEvent ev,
+ DirectPosition coord) {
+ }
+
+ @Override
+ public void performClick(XMapPane mapPane, MouseEvent ev,
+ DirectPosition coord) {
+ }
+
+
+}
Property changes on: branches/2.0-RC2/src/skrueger/geotools/XMapPaneAction_Pan.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Id URL
Name: svn:eol-style
+ native
More information about the Schmitzm-commits
mailing list