[Schmitzm-commits] r640 - 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 17:12:05 CET 2010


Author: alfonx
Date: 2010-01-28 17:12:04 +0100 (Thu, 28 Jan 2010)
New Revision: 640

Modified:
   branches/2.0-RC2/src/schmitzm/swing/event/MouseInputType.java
   branches/2.0-RC2/src/schmitzm/swing/event/SelectiveMouseAdapter.java
   branches/2.0-RC2/src/skrueger/geotools/XMapPaneAction.java
   branches/2.0-RC2/src/skrueger/geotools/XMapPaneAction_ZoomIn.java
Log:


Modified: branches/2.0-RC2/src/schmitzm/swing/event/MouseInputType.java
===================================================================
--- branches/2.0-RC2/src/schmitzm/swing/event/MouseInputType.java	2010-01-28 16:07:22 UTC (rev 639)
+++ branches/2.0-RC2/src/schmitzm/swing/event/MouseInputType.java	2010-01-28 16:12:04 UTC (rev 640)
@@ -45,28 +45,26 @@
 
 	/**
 	 * A rectangle is being spanned via dragging with the left mouse button.
-	 * Button has not been released.
 	 */
 	LDrag,
 
 	/**
 	 * A rectangle is being spanned via dragging with the right mouse button.
-	 * Button has not been released.
 	 */
 	RDrag,
+//
+//	/**
+//	 * A rectangle has been spanned via dragging with the left mouse button.
+//	 * Button has been released.
+//	 */
+//	LWin,
+//
+//	/**
+//	 * A rectangle has been spanned via dragging with the right mouse button.
+//	 * Button has been released.
+//	 */
+//	RWin,
 
-	/**
-	 * A rectangle has been spanned via dragging with the left mouse button.
-	 * Button has been released.
-	 */
-	LWin,
-
-	/**
-	 * A rectangle has been spanned via dragging with the right mouse button.
-	 * Button has been released.
-	 */
-	RWin,
-
 	/** The mouse wheel has been used (in any direction) **/
 	Wheel
 

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:07:22 UTC (rev 639)
+++ branches/2.0-RC2/src/schmitzm/swing/event/SelectiveMouseAdapter.java	2010-01-28 16:12:04 UTC (rev 640)
@@ -30,10 +30,10 @@
 
 package schmitzm.swing.event;
 
+import java.awt.Point;
 import java.awt.event.MouseAdapter;
 import java.awt.event.MouseEvent;
 import java.awt.event.MouseWheelEvent;
-import java.awt.geom.Point2D;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -45,7 +45,7 @@
   /** Holds the activation of the several {@link MouseInputType MouseInputTypes}. */
   protected Map<MouseInputType, Boolean> activationMap = new HashMap<MouseInputType, Boolean>();
   /** Holds the window position a drag is started on. */
-  protected Point2D dragStartPos = null;
+  protected Point dragStartPos = null;
   
   /**
    * Creates a new mouse adapter. All actions are activated initially.
@@ -78,7 +78,7 @@
   /**
    * Returns the start point of a drag or window selection.
    */
-  public Point2D getDragStartPoint() {
+  public Point getDragStartPoint() {
     return dragStartPos;
   }
   
@@ -164,7 +164,7 @@
    */
   @Override
   public final void mouseReleased(MouseEvent e) {
-    Point2D dragEndPos = e.getPoint();
+    Point dragEndPos = e.getPoint();
     
     if (  dragEndPos.equals(dragStartPos) ) {
       // Startposition = Endposition
@@ -173,8 +173,8 @@
         performMouseReleased(e);
     } else {
       // Startposition <> Endposition
-      // --> nur wenn Drag oder Fenster aktiviert
-      if ( isMouseDragEnabled(e) || isMouseWindowEnabled(e) )
+      // --> nur wenn Drag aktiviert
+      if ( isMouseDragEnabled(e)  )
         performMouseReleased(e);
     }
   
@@ -261,16 +261,7 @@
     return e.getButton() != MouseEvent.NOBUTTON;
   }
 
-  /**
-   * Checks whether window selection is enabled for a mouse event.
-   */
-  private boolean isMouseWindowEnabled(MouseEvent e) {
-    switch ( e.getButton() ) {
-      case MouseEvent.BUTTON1: return isEnabled(MouseInputType.LWin);
-      case MouseEvent.BUTTON3: return isEnabled(MouseInputType.RWin);
-    }
-    return e.getButton() != MouseEvent.NOBUTTON;
-  }
+  
 }
 
 

Modified: branches/2.0-RC2/src/skrueger/geotools/XMapPaneAction.java
===================================================================
--- branches/2.0-RC2/src/skrueger/geotools/XMapPaneAction.java	2010-01-28 16:07:22 UTC (rev 639)
+++ branches/2.0-RC2/src/skrueger/geotools/XMapPaneAction.java	2010-01-28 16:12:04 UTC (rev 640)
@@ -64,7 +64,7 @@
    * @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, DirectPosition startCoord, DirectPosition endCoord);
+  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
@@ -76,7 +76,7 @@
    * @param startCoord   geo coordinate the window starts
    * @param endCoord     geo coordinate the window ends
    */
-  public void performDragged(XMapPane mapPane, MouseEvent ev, Point dragStartPos, DirectPosition startCoord, DirectPosition endCoord);
+  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

Modified: branches/2.0-RC2/src/skrueger/geotools/XMapPaneAction_ZoomIn.java
===================================================================
--- branches/2.0-RC2/src/skrueger/geotools/XMapPaneAction_ZoomIn.java	2010-01-28 16:07:22 UTC (rev 639)
+++ branches/2.0-RC2/src/skrueger/geotools/XMapPaneAction_ZoomIn.java	2010-01-28 16:12:04 UTC (rev 640)
@@ -1,21 +1,13 @@
 package skrueger.geotools;
 
-import java.awt.Color;
-import java.awt.Graphics;
 import java.awt.Point;
 import java.awt.event.MouseEvent;
 import java.awt.event.MouseWheelEvent;
-import java.awt.geom.Point2D;
 
 import org.opengis.geometry.DirectPosition;
 
 public class XMapPaneAction_ZoomIn implements XMapPaneAction {
 	
-	/**
-	 * Stores last position of a drag event in window coordinates
-	 */
-	protected Point lastPos;
-	
 	@Override
 	public void performClick(XMapPane mapPane, MouseEvent ev,
 			DirectPosition coord) {
@@ -25,9 +17,12 @@
 
 	@Override
 	public void performDragging(XMapPane mapPane, MouseEvent ev,
-			Point dragStartPos, DirectPosition startCoord,
+			Point dragStartPos, Point dragLastPos, DirectPosition startCoord,
 			DirectPosition endCoord) {
 		
+		if (dragLastPos != null)
+			mapPane.drawRectangle(mapPane.getGraphics(), dragLastPos, ev.getPoint());
+		
 		mapPane.drawRectangle(mapPane.getGraphics(), dragStartPos, ev.getPoint());
 	}
 
@@ -44,7 +39,7 @@
 
 	@Override
 	public void performDragged(XMapPane mapPane, MouseEvent ev,
-			Point dragStartPos, DirectPosition startCoord,
+			Point dragStartPos, Point dragLastPos, DirectPosition startCoord,
 			DirectPosition endCoord) {
 		// TODO Auto-generated method stub
 



More information about the Schmitzm-commits mailing list