org.openstreetmap.josm.gui.bbox
Class SlippyMapControler

java.lang.Object
  extended by java.awt.event.MouseAdapter
      extended by org.openstreetmap.josm.gui.bbox.SlippyMapControler
All Implemented Interfaces:
java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.event.MouseWheelListener, java.util.EventListener

public class SlippyMapControler
extends java.awt.event.MouseAdapter
implements java.awt.event.MouseMotionListener, java.awt.event.MouseListener

This class controls the user input by listening to mouse and key events. Currently implemented is: - zooming in and out with scrollwheel - zooming in and centering by double clicking - selecting an area by clicking and dragging the mouse


Nested Class Summary
private  class SlippyMapControler.MoveTask
          Moves the map depending on which cursor keys are pressed (or not)
private  class SlippyMapControler.MoveXAction
           
private  class SlippyMapControler.MoveYAction
           
private  class SlippyMapControler.ZoomInAction
           
private  class SlippyMapControler.ZoomOutAction
           
 
Field Summary
private static double ACCELERATION
          The speed increase per timer interval when a cursor button is clicked
private  java.awt.Point iEndSelectionPoint
           
private  SizeButton iSizeButton
           
private  SlippyMapBBoxChooser iSlippyMapChooser
           
private  SourceButton iSourceButton
           
private  boolean isSelecting
           
private  java.awt.Point iStartSelectionPoint
           
private static double MAX_SPEED
          The maximum speed (pixels per timer interval)
private  SlippyMapControler.MoveTask moveTask
          Does the moving
private static java.util.Timer timer
          A Timer for smoothly moving the map area
private static long timerInterval
          How often to do the moving (milliseconds)
 
Constructor Summary
SlippyMapControler(SlippyMapBBoxChooser navComp, javax.swing.JPanel contentPane, SizeButton sizeButton, SourceButton sourceButton)
          Create a new OsmMapControl
 
Method Summary
 void mouseDragged(java.awt.event.MouseEvent e)
           
 void mouseMoved(java.awt.event.MouseEvent e)
           
 void mousePressed(java.awt.event.MouseEvent e)
          Start drawing the selection rectangle if it was the 1st button (left button)
 void mouseReleased(java.awt.event.MouseEvent e)
          When dragging the map change the cursor back to it's pre-move cursor.
 
Methods inherited from class java.awt.event.MouseAdapter
mouseClicked, mouseEntered, mouseExited, mouseWheelMoved
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.awt.event.MouseListener
mouseClicked, mouseEntered, mouseExited
 

Field Detail

timer

private static final java.util.Timer timer
A Timer for smoothly moving the map area


moveTask

private SlippyMapControler.MoveTask moveTask
Does the moving


timerInterval

private static long timerInterval
How often to do the moving (milliseconds)


MAX_SPEED

private static final double MAX_SPEED
The maximum speed (pixels per timer interval)

See Also:
Constant Field Values

ACCELERATION

private static final double ACCELERATION
The speed increase per timer interval when a cursor button is clicked

See Also:
Constant Field Values

iStartSelectionPoint

private java.awt.Point iStartSelectionPoint

iEndSelectionPoint

private java.awt.Point iEndSelectionPoint

iSlippyMapChooser

private final SlippyMapBBoxChooser iSlippyMapChooser

iSizeButton

private SizeButton iSizeButton

iSourceButton

private SourceButton iSourceButton

isSelecting

private boolean isSelecting
Constructor Detail

SlippyMapControler

public SlippyMapControler(SlippyMapBBoxChooser navComp,
                          javax.swing.JPanel contentPane,
                          SizeButton sizeButton,
                          SourceButton sourceButton)
Create a new OsmMapControl

Method Detail

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Start drawing the selection rectangle if it was the 1st button (left button)

Specified by:
mousePressed in interface java.awt.event.MouseListener
Overrides:
mousePressed in class java.awt.event.MouseAdapter

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent e)
Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener
Overrides:
mouseDragged in class java.awt.event.MouseAdapter

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
When dragging the map change the cursor back to it's pre-move cursor. If a double-click occurs center and zoom the map on the clicked location.

Specified by:
mouseReleased in interface java.awt.event.MouseListener
Overrides:
mouseReleased in class java.awt.event.MouseAdapter

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent e)
Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener
Overrides:
mouseMoved in class java.awt.event.MouseAdapter


JOSM