[Schmitzm-commits] r649 - in branches/2.0-RC2/src: schmitzm/swing/event skrueger/geotools

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Jan 28 18:24:20 CET 2010


Author: alfonx
Date: 2010-01-28 18:24:15 +0100 (Thu, 28 Jan 2010)
New Revision: 649

Modified:
   branches/2.0-RC2/src/schmitzm/swing/event/SelectiveMouseAdapter.java
   branches/2.0-RC2/src/skrueger/geotools/XMapPane.java
   branches/2.0-RC2/src/skrueger/geotools/XMapPaneAction_Zoom.java
   branches/2.0-RC2/src/skrueger/geotools/XMapPaneMouseListener.java
   branches/2.0-RC2/src/skrueger/geotools/ZoomXMapPaneMouseListener.java
Log:


Modified: branches/2.0-RC2/src/schmitzm/swing/event/SelectiveMouseAdapter.java
===================================================================
--- branches/2.0-RC2/src/schmitzm/swing/event/SelectiveMouseAdapter.java	2010-01-28 16:51:55 UTC (rev 648)
+++ branches/2.0-RC2/src/schmitzm/swing/event/SelectiveMouseAdapter.java	2010-01-28 17:24:15 UTC (rev 649)
@@ -283,11 +283,11 @@
    * Checks whether dragging is enabled for a mouse event.
    */
   private boolean isMouseDragEnabled(MouseEvent e) {
-    switch ( e.getButton() ) {
+    switch ( dragButton ) {
       case MouseEvent.BUTTON1: return isEnabled(MouseInputType.LDrag);
       case MouseEvent.BUTTON3: return isEnabled(MouseInputType.RDrag);
     }
-    return e.getButton() != MouseEvent.NOBUTTON;
+    return dragButton != MouseEvent.NOBUTTON;
   }
 
   

Modified: branches/2.0-RC2/src/skrueger/geotools/XMapPane.java
===================================================================
--- branches/2.0-RC2/src/skrueger/geotools/XMapPane.java	2010-01-28 16:51:55 UTC (rev 648)
+++ branches/2.0-RC2/src/skrueger/geotools/XMapPane.java	2010-01-28 17:24:15 UTC (rev 649)
@@ -108,7 +108,10 @@
 
 	private final static Logger LOGGER = Logger.getLogger(XMapPane.class);
 
-	/** A flag indicating whether the {@link XMapPane} is accepting repaints from the EDT. @see {@link XMapPane#setPainting(boolean)) **/
+	/**
+	 * A flag indicating whether the {@link XMapPane} is accepting repaints from
+	 * the EDT. @see {@link XMapPane#setPainting(boolean))
+	 **/
 	private boolean acceptsRepaintCalls = true;
 
 	/**
@@ -574,17 +577,18 @@
 
 	private AffineTransform worldToScreen;
 
-//	/**
-//	 * This {@link MouseListener} is managing all zoom related tasks
-//	 */
-//	private final ZoomXMapPaneMouseListener zoomMapPaneMouseListener = new ZoomXMapPaneMouseListener(
-//			this);
-	
+	// /**
+	// * This {@link MouseListener} is managing all zoom related tasks
+	// */
+	// private final ZoomXMapPaneMouseListener zoomMapPaneMouseListener = new
+	// ZoomXMapPaneMouseListener(
+	// this);
+
 	/**
 	 * This {@link MouseListener} is managing all zoom related tasks
 	 */
-	private final XMapPaneMouseListener xMapPaneMouseListener = new XMapPaneMouseListener(this);
-	
+	private final XMapPaneMouseListener xMapPaneMouseListener = new XMapPaneMouseListener(
+			this);
 
 	/** Is set if a renderer has an error **/
 	protected ArrayList<Exception> renderingErrors = new ArrayList<Exception>();
@@ -628,13 +632,19 @@
 		this.addMouseListener(xMapPaneMouseListener);
 		this.addMouseMotionListener(xMapPaneMouseListener);
 		this.addMouseWheelListener(xMapPaneMouseListener);
-		xMapPaneMouseListener.actions.put(MouseInputType.RClick, XMapPaneAction.ZOOM_IN);
-		xMapPaneMouseListener.actions.put(MouseInputType.RDrag, XMapPaneAction.ZOOM_IN);
-		
-		xMapPaneMouseListener.actions.put(MouseInputType.LClick, XMapPaneAction.ZOOM_OUT);
-		xMapPaneMouseListener.actions.put(MouseInputType.LDrag, XMapPaneAction.ZOOM_OUT);
-		
+		xMapPaneMouseListener.actions.put(MouseInputType.LClick,
+				XMapPaneAction.ZOOM_IN);
+		xMapPaneMouseListener.actions.put(MouseInputType.LDrag,
+				XMapPaneAction.ZOOM_IN);
+		xMapPaneMouseListener.actions.put(MouseInputType.Wheel,
+				XMapPaneAction.ZOOM_IN);
 
+		xMapPaneMouseListener.actions.put(MouseInputType.RClick,
+				XMapPaneAction.ZOOM_OUT);
+
+		xMapPaneMouseListener.actions.put(MouseInputType.RDrag,
+				XMapPaneAction.ZOOM_OUT);
+
 		/*
 		 * We use a Timer object to avoid rendering delays and flickering when
 		 * the user is drag-resizing the parent container of this map pane.
@@ -998,7 +1008,7 @@
 
 		removeAll();
 	}
-	
+
 	/**
 	 * Draws a rectangle in XOR mode from the origin at {@link #startPos} to the
 	 * given point. All in screen coordinates.
@@ -1692,7 +1702,7 @@
 
 		if (mapArea == null)
 			return;
-		
+
 		final ReferencedEnvelope refMapEnv = new ReferencedEnvelope(mapArea,
 				getMapContext().getCoordinateReferenceSystem());
 
@@ -1988,18 +1998,18 @@
 	@Deprecated
 	public void setState(final int state) {
 		this.state = state;
-		
-//		throw new RuntimeException("Old concept.. migrate to new concept!");
 
-//		xMapPaneMouseListener.setEnabled((state == ZOOM_IN
-//				|| state == ZOOM_OUT || state == PAN));
+		// throw new RuntimeException("Old concept.. migrate to new concept!");
 
+		// xMapPaneMouseListener.setEnabled((state == ZOOM_IN
+		// || state == ZOOM_OUT || state == PAN));
+
 		// Je nach Aktion den Cursor umsetzen
 		updateCursor();
 	}
-	
-	public void configureMouse(MouseInputType type, XMapPaneAction action){
-		
+
+	public void configureMouse(MouseInputType type, XMapPaneAction action) {
+		xMapPaneMouseListener.actions.put(type, action);
 	}
 
 	/**

Modified: branches/2.0-RC2/src/skrueger/geotools/XMapPaneAction_Zoom.java
===================================================================
--- branches/2.0-RC2/src/skrueger/geotools/XMapPaneAction_Zoom.java	2010-01-28 16:51:55 UTC (rev 648)
+++ branches/2.0-RC2/src/skrueger/geotools/XMapPaneAction_Zoom.java	2010-01-28 17:24:15 UTC (rev 649)
@@ -12,6 +12,19 @@
 
 public abstract class XMapPaneAction_Zoom implements XMapPaneAction {
 
+	@Override
+	public void performDragging(XMapPane mapPane, MouseEvent ev,
+			Point dragStartPos, Point dragLastPos,
+			DirectPosition startCoord, DirectPosition endCoord) {
+
+		if (dragLastPos != null)
+			mapPane.drawRectangle(mapPane.getGraphics(), dragStartPos,
+					dragLastPos);
+
+		mapPane.drawRectangle(mapPane.getGraphics(), dragStartPos, ev
+				.getPoint());
+	}
+
 	public static class In extends XMapPaneAction_Zoom {
 
 		@Override
@@ -33,19 +46,6 @@
 		}
 
 		@Override
-		public void performDragging(XMapPane mapPane, MouseEvent ev,
-				Point dragStartPos, Point dragLastPos,
-				DirectPosition startCoord, DirectPosition endCoord) {
-
-			if (dragLastPos != null)
-				mapPane.drawRectangle(mapPane.getGraphics(), dragStartPos,
-						dragLastPos);
-
-			mapPane.drawRectangle(mapPane.getGraphics(), dragStartPos, ev
-					.getPoint());
-		}
-
-		@Override
 		public void performDragged(XMapPane mapPane, MouseEvent ev,
 				Point dragStartPos, Point dragLastPos,
 				DirectPosition startCoord, DirectPosition endCoord) {
@@ -111,19 +111,7 @@
 				mapPane.zoomTo(wheelEvt.getPoint(), 2. / -units);
 		}
 
-		@Override
-		public void performDragging(XMapPane mapPane, MouseEvent ev,
-				Point dragStartPos, Point dragLastPos,
-				DirectPosition startCoord, DirectPosition endCoord) {
 
-			if (dragLastPos != null)
-				mapPane.drawRectangle(mapPane.getGraphics(), dragStartPos,
-						dragLastPos);
-
-			mapPane.drawRectangle(mapPane.getGraphics(), dragStartPos, ev
-					.getPoint());
-		}
-
 		@Override
 		public void performDragged(XMapPane mapPane, MouseEvent ev,
 				Point dragStartPos, Point dragLastPos,

Modified: branches/2.0-RC2/src/skrueger/geotools/XMapPaneMouseListener.java
===================================================================
--- branches/2.0-RC2/src/skrueger/geotools/XMapPaneMouseListener.java	2010-01-28 16:51:55 UTC (rev 648)
+++ branches/2.0-RC2/src/skrueger/geotools/XMapPaneMouseListener.java	2010-01-28 17:24:15 UTC (rev 649)
@@ -67,7 +67,7 @@
 
 		MouseInputType key = null;
 
-		switch (mEv.getButton()) {
+		switch (dragButton) {
 		case MouseEvent.BUTTON1:
 			key = MouseInputType.LDrag;
 			break;

Modified: branches/2.0-RC2/src/skrueger/geotools/ZoomXMapPaneMouseListener.java
===================================================================
--- branches/2.0-RC2/src/skrueger/geotools/ZoomXMapPaneMouseListener.java	2010-01-28 16:51:55 UTC (rev 648)
+++ branches/2.0-RC2/src/skrueger/geotools/ZoomXMapPaneMouseListener.java	2010-01-28 17:24:15 UTC (rev 649)
@@ -1,223 +1,223 @@
-package skrueger.geotools;
-
-import java.awt.Color;
-import java.awt.Graphics;
-import java.awt.Point;
-import java.awt.Rectangle;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseWheelEvent;
-
-import org.apache.log4j.Logger;
-
-import schmitzm.swing.SwingUtil;
-
-import com.vividsolutions.jts.geom.Coordinate;
-import com.vividsolutions.jts.geom.Envelope;
-
-public class ZoomXMapPaneMouseListener extends MouseAdapter {
-
-	private static Logger LOGGER = Logger
-			.getLogger(ZoomXMapPaneMouseListener.class);
-
-	protected final XMapPane xMapPane;
-
-	protected boolean enabled = true;
-
-	public ZoomXMapPaneMouseListener(XMapPane xMapPane) {
-		if (xMapPane == null)
-			throw new IllegalArgumentException("xMapPane may not be null");
-		this.xMapPane = xMapPane;
-	}
-
-	/**
-	 * 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;
-
-	/**
-	 * Draws a rectangle in XOR mode from the origin at {@link #startPos} to the
-	 * given point. All in screen coordinates.
-	 */
-	protected void drawRectangle(final Graphics graphics, Point e) {
-		// undraw last box/draw new box
-		final int left = Math.min(startPos.x, e.x);
-		final int right = Math.max(startPos.x, e.x);
-		final int top = Math.max(startPos.y, e.y);
-		final int bottom = Math.min(startPos.y, e.y);
-		final int width = right - left;
-		final int height = top - bottom;
-
-		if (width == 0 && height == 0)
-			return;
-
-		graphics.setXORMode(Color.WHITE);
-		graphics.drawRect(left, bottom, width, height);
-	}
-
-	public void mousePressed(final MouseEvent e) {
-		if (!isEnabled())
-			return;
-		startPos = new Point(e.getPoint());
-		lastPos = new Point(e.getPoint());
-	}
-
-	public void mouseReleased(final MouseEvent e) {
-		if (!isEnabled())
-			return;
-
-		// If this is a click, let mouseClicked handle it!
-		if ((Math.abs(startPos.x - e.getPoint().x) * Math.abs(e.getPoint().y
-				- startPos.y)) < 160) {
-			// xMapPane.zoomTo(e.getPoint(), .5);
-			return;
-		}
-
-		
-		// Not the best check.. but works
-		if (xMapPane.getCursor() == SwingUtil.PANNING_CURSOR)
-		{
-			xMapPane.performPan();
-			return;
-		}
-
-		final Rectangle bounds = xMapPane.getBounds();
-
-		Envelope mapArea = xMapPane.getMapArea();
-
-		// Replace with transform and translate
-		final double mapWidth = mapArea.getWidth();
-		final double mapHeight = mapArea.getHeight();
-
-		final double startX = ((startPos.x * mapWidth) / (double) bounds.width)
-				+ mapArea.getMinX();
-		final double startY = (((bounds.getHeight() - startPos.y) * mapHeight) / (double) bounds.height)
-				+ mapArea.getMinY();
-		final double endX = ((e.getPoint().x * mapWidth) / (double) bounds.width)
-				+ mapArea.getMinX();
-		final double endY = (((bounds.getHeight() - e.getPoint().y) * mapHeight) / (double) bounds.height)
-				+ mapArea.getMinY();
-
-		if (xMapPane.getState() == XMapPane.ZOOM_IN) {
-
-			drawRectangle(xMapPane.getGraphics(), e.getPoint());
-
-			final double left = Math.min(startX, endX);
-			final double right = Math.max(startX, endX);
-			final double bottom = Math.min(startY, endY);
-			final double top = Math.max(startY, endY);
-			final Coordinate ll = new Coordinate(left, bottom);
-			final Coordinate ur = new Coordinate(right, top);
-
-			xMapPane.setMapArea(new Envelope(ll, ur));
-
-		} else if (xMapPane.getState() == XMapPane.ZOOM_OUT) {
-
-			// Remove the rectangle
-			drawRectangle(xMapPane.getGraphics(), e.getPoint());
-			//
-			// // Don't zoom too small areas
-			// if ((Math.abs(startPos.x - e.getPoint().x) * Math
-			// .abs(e.getPoint().y - startPos.y)) < 100) {
-			// xMapPane.zoomTo(e.getPoint(), 2.);
-			// return;
-			// }
-
-			// make the dragged rectangle in screen coords the new map size?
-			final double left = Math.min(startX, endX);
-			final double right = Math.max(startX, endX);
-			final double bottom = Math.min(startY, endY);
-			final double top = Math.max(startY, endY);
-			final double nWidth = (mapWidth * mapWidth) / (right - left);
-			final double nHeight = (mapHeight * mapHeight) / (top - bottom);
-			final double deltaX1 = left - mapArea.getMinX();
-			final double nDeltaX1 = (deltaX1 * nWidth) / mapWidth;
-			final double deltaY1 = bottom - mapArea.getMinY();
-			final double nDeltaY1 = (deltaY1 * nHeight) / mapHeight;
-			final Coordinate ll = new Coordinate(mapArea.getMinX() - nDeltaX1,
-					mapArea.getMinY() - nDeltaY1);
-			final double deltaX2 = mapArea.getMaxX() - right;
-			final double nDeltaX2 = (deltaX2 * nWidth) / mapWidth;
-			final double deltaY2 = mapArea.getMaxY() - top;
-			final double nDeltaY2 = (deltaY2 * nHeight) / mapHeight;
-			final Coordinate ur = new Coordinate(mapArea.getMaxX() + nDeltaX2,
-					mapArea.getMaxY() + nDeltaY2);
-
-			xMapPane.setMapArea(new Envelope(ll, ur));
-		}
-
-	}
-
-	public void setEnabled(boolean enabled) {
-		this.enabled = enabled;
-	}
-
-	/**
-	 * Returns <code>true</code> if the xMapPane is well defined and the
-	 * listener is enabled.
-	 */
-	public boolean isEnabled() {
-		return enabled && xMapPane.isWellDefined();
-	}
-
-	/**
-	 * Verarbeitet die Mausrad-Aktion, indem gezoomed wird.
-	 * 
-	 * @param wheelEvt
-	 *            Mausrad-Event
-	 */
-	public void mouseWheelMoved(MouseWheelEvent wheelEvt) {
-		if (!isEnabled())
-			return;
-		
-		//DONE
-
-		final int units = wheelEvt.getUnitsToScroll();
-		if (units > 0)
-			xMapPane.zoomTo(wheelEvt.getPoint(), 1. + .11 * units);
-		else
-			xMapPane.zoomTo(wheelEvt.getPoint(), 2. / -units);
-	}
-
-	@Override
-	public void mouseClicked(final MouseEvent e) {
-
-		// DONE
-		
-		if (!isEnabled())
-			return;
-
-		int state = xMapPane.getState();
-
-		// Nothing to do for panning
-		if (state == XMapPane.PAN)
-			return;
-
-		if (state == XMapPane.ZOOM_IN && e.getButton() == MouseEvent.BUTTON1) {
-			xMapPane.zoomTo(e.getPoint(), 1 / 2.);
-		} else if (state == XMapPane.ZOOM_IN
-				&& e.getButton() == MouseEvent.BUTTON3
-				|| state == XMapPane.ZOOM_OUT) {
-			xMapPane.zoomTo(e.getPoint(), 2.);
-		}
-
-	}
-
-	/**
-	 * Constantly fired while the mouse is dragging
-	 */
-	public void mouseDragged(final MouseEvent event) {
-		if (!isEnabled())
-			return;
-
-		xMapPane.mouseDragged(startPos, lastPos, event);
-
-		lastPos = event.getPoint();
-	}
-
-}
+//package skrueger.geotools;
+//
+//import java.awt.Color;
+//import java.awt.Graphics;
+//import java.awt.Point;
+//import java.awt.Rectangle;
+//import java.awt.event.MouseAdapter;
+//import java.awt.event.MouseEvent;
+//import java.awt.event.MouseWheelEvent;
+//
+//import org.apache.log4j.Logger;
+//
+//import schmitzm.swing.SwingUtil;
+//
+//import com.vividsolutions.jts.geom.Coordinate;
+//import com.vividsolutions.jts.geom.Envelope;
+//
+//public class ZoomXMapPaneMouseListener extends MouseAdapter {
+//
+//	private static Logger LOGGER = Logger
+//			.getLogger(ZoomXMapPaneMouseListener.class);
+//
+//	protected final XMapPane xMapPane;
+//
+//	protected boolean enabled = true;
+//
+//	public ZoomXMapPaneMouseListener(XMapPane xMapPane) {
+//		if (xMapPane == null)
+//			throw new IllegalArgumentException("xMapPane may not be null");
+//		this.xMapPane = xMapPane;
+//	}
+//
+//	/**
+//	 * 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;
+//
+//	/**
+//	 * Draws a rectangle in XOR mode from the origin at {@link #startPos} to the
+//	 * given point. All in screen coordinates.
+//	 */
+//	protected void drawRectangle(final Graphics graphics, Point e) {
+//		// undraw last box/draw new box
+//		final int left = Math.min(startPos.x, e.x);
+//		final int right = Math.max(startPos.x, e.x);
+//		final int top = Math.max(startPos.y, e.y);
+//		final int bottom = Math.min(startPos.y, e.y);
+//		final int width = right - left;
+//		final int height = top - bottom;
+//
+//		if (width == 0 && height == 0)
+//			return;
+//
+//		graphics.setXORMode(Color.WHITE);
+//		graphics.drawRect(left, bottom, width, height);
+//	}
+//
+//	public void mousePressed(final MouseEvent e) {
+//		if (!isEnabled())
+//			return;
+//		startPos = new Point(e.getPoint());
+//		lastPos = new Point(e.getPoint());
+//	}
+//
+//	public void mouseReleased(final MouseEvent e) {
+//		if (!isEnabled())
+//			return;
+//
+//		// If this is a click, let mouseClicked handle it!
+//		if ((Math.abs(startPos.x - e.getPoint().x) * Math.abs(e.getPoint().y
+//				- startPos.y)) < 160) {
+//			// xMapPane.zoomTo(e.getPoint(), .5);
+//			return;
+//		}
+//
+//		
+//		// Not the best check.. but works
+//		if (xMapPane.getCursor() == SwingUtil.PANNING_CURSOR)
+//		{
+//			xMapPane.performPan();
+//			return;
+//		}
+//
+//		final Rectangle bounds = xMapPane.getBounds();
+//
+//		Envelope mapArea = xMapPane.getMapArea();
+//
+//		// Replace with transform and translate
+//		final double mapWidth = mapArea.getWidth();
+//		final double mapHeight = mapArea.getHeight();
+//
+//		final double startX = ((startPos.x * mapWidth) / (double) bounds.width)
+//				+ mapArea.getMinX();
+//		final double startY = (((bounds.getHeight() - startPos.y) * mapHeight) / (double) bounds.height)
+//				+ mapArea.getMinY();
+//		final double endX = ((e.getPoint().x * mapWidth) / (double) bounds.width)
+//				+ mapArea.getMinX();
+//		final double endY = (((bounds.getHeight() - e.getPoint().y) * mapHeight) / (double) bounds.height)
+//				+ mapArea.getMinY();
+//
+//		if (xMapPane.getState() == XMapPane.ZOOM_IN) {
+//
+//			drawRectangle(xMapPane.getGraphics(), e.getPoint());
+//
+//			final double left = Math.min(startX, endX);
+//			final double right = Math.max(startX, endX);
+//			final double bottom = Math.min(startY, endY);
+//			final double top = Math.max(startY, endY);
+//			final Coordinate ll = new Coordinate(left, bottom);
+//			final Coordinate ur = new Coordinate(right, top);
+//
+//			xMapPane.setMapArea(new Envelope(ll, ur));
+//
+//		} else if (xMapPane.getState() == XMapPane.ZOOM_OUT) {
+//
+//			// Remove the rectangle
+//			drawRectangle(xMapPane.getGraphics(), e.getPoint());
+//			//
+//			// // Don't zoom too small areas
+//			// if ((Math.abs(startPos.x - e.getPoint().x) * Math
+//			// .abs(e.getPoint().y - startPos.y)) < 100) {
+//			// xMapPane.zoomTo(e.getPoint(), 2.);
+//			// return;
+//			// }
+//
+//			// make the dragged rectangle in screen coords the new map size?
+//			final double left = Math.min(startX, endX);
+//			final double right = Math.max(startX, endX);
+//			final double bottom = Math.min(startY, endY);
+//			final double top = Math.max(startY, endY);
+//			final double nWidth = (mapWidth * mapWidth) / (right - left);
+//			final double nHeight = (mapHeight * mapHeight) / (top - bottom);
+//			final double deltaX1 = left - mapArea.getMinX();
+//			final double nDeltaX1 = (deltaX1 * nWidth) / mapWidth;
+//			final double deltaY1 = bottom - mapArea.getMinY();
+//			final double nDeltaY1 = (deltaY1 * nHeight) / mapHeight;
+//			final Coordinate ll = new Coordinate(mapArea.getMinX() - nDeltaX1,
+//					mapArea.getMinY() - nDeltaY1);
+//			final double deltaX2 = mapArea.getMaxX() - right;
+//			final double nDeltaX2 = (deltaX2 * nWidth) / mapWidth;
+//			final double deltaY2 = mapArea.getMaxY() - top;
+//			final double nDeltaY2 = (deltaY2 * nHeight) / mapHeight;
+//			final Coordinate ur = new Coordinate(mapArea.getMaxX() + nDeltaX2,
+//					mapArea.getMaxY() + nDeltaY2);
+//
+//			xMapPane.setMapArea(new Envelope(ll, ur));
+//		}
+//
+//	}
+//
+//	public void setEnabled(boolean enabled) {
+//		this.enabled = enabled;
+//	}
+//
+//	/**
+//	 * Returns <code>true</code> if the xMapPane is well defined and the
+//	 * listener is enabled.
+//	 */
+//	public boolean isEnabled() {
+//		return enabled && xMapPane.isWellDefined();
+//	}
+//
+//	/**
+//	 * Verarbeitet die Mausrad-Aktion, indem gezoomed wird.
+//	 * 
+//	 * @param wheelEvt
+//	 *            Mausrad-Event
+//	 */
+//	public void mouseWheelMoved(MouseWheelEvent wheelEvt) {
+//		if (!isEnabled())
+//			return;
+//		
+//		//DONE
+//
+//		final int units = wheelEvt.getUnitsToScroll();
+//		if (units > 0)
+//			xMapPane.zoomTo(wheelEvt.getPoint(), 1. + .11 * units);
+//		else
+//			xMapPane.zoomTo(wheelEvt.getPoint(), 2. / -units);
+//	}
+//
+//	@Override
+//	public void mouseClicked(final MouseEvent e) {
+//
+//		// DONE
+//		
+//		if (!isEnabled())
+//			return;
+//
+//		int state = xMapPane.getState();
+//
+//		// Nothing to do for panning
+//		if (state == XMapPane.PAN)
+//			return;
+//
+//		if (state == XMapPane.ZOOM_IN && e.getButton() == MouseEvent.BUTTON1) {
+//			xMapPane.zoomTo(e.getPoint(), 1 / 2.);
+//		} else if (state == XMapPane.ZOOM_IN
+//				&& e.getButton() == MouseEvent.BUTTON3
+//				|| state == XMapPane.ZOOM_OUT) {
+//			xMapPane.zoomTo(e.getPoint(), 2.);
+//		}
+//
+//	}
+//
+//	/**
+//	 * Constantly fired while the mouse is dragging
+//	 */
+//	public void mouseDragged(final MouseEvent event) {
+//		if (!isEnabled())
+//			return;
+//
+//		xMapPane.mouseDragged(startPos, lastPos, event);
+//
+//		lastPos = event.getPoint();
+//	}
+//
+//}



More information about the Schmitzm-commits mailing list