Package org.openstreetmap.josm.gui.bbox
Class SlippyMapController
- java.lang.Object
-
- java.awt.event.MouseAdapter
-
- org.openstreetmap.josm.gui.bbox.SlippyMapController
-
- All Implemented Interfaces:
java.awt.event.MouseListener
,java.awt.event.MouseMotionListener
,java.awt.event.MouseWheelListener
,java.util.EventListener
public class SlippyMapController extends java.awt.event.MouseAdapter
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
Nested Classes Modifier and Type Class Description private class
SlippyMapController.MoveTask
Moves the map depending on which cursor keys are pressed (or not)private class
SlippyMapController.MoveXAction
private class
SlippyMapController.MoveYAction
private class
SlippyMapController.ZoomInAction
private class
SlippyMapController.ZoomOutAction
-
Field Summary
Fields Modifier and Type Field Description private static double
ACCELERATION
The speed increase per timer interval when a cursor button is clickedprivate java.awt.Point
iEndSelectionPoint
private SlippyMapBBoxChooser
iSlippyMapChooser
private boolean
isSelecting
private java.awt.Point
iStartSelectionPoint
private static int[]
K
private static int
MAC_MOUSE_BUTTON3_MASK
private static double
MAX_SPEED
The maximum speed (pixels per timer interval)private SlippyMapController.MoveTask
moveTask
Does the movingprivate static java.lang.String[]
N
private static java.util.Timer
TIMER
A Timer for smoothly moving the map areaprivate static long
timerInterval
How often to do the moving (milliseconds)
-
Constructor Summary
Constructors Constructor Description SlippyMapController(SlippyMapBBoxChooser navComp, javax.swing.JPanel contentPane)
Constructs a newSlippyMapController
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.
-
-
-
Field Detail
-
TIMER
private static final java.util.Timer TIMER
A Timer for smoothly moving the map area
-
moveTask
private SlippyMapController.MoveTask moveTask
Does the moving
-
timerInterval
private static final long timerInterval
How often to do the moving (milliseconds)- See Also:
- Constant Field Values
-
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
-
MAC_MOUSE_BUTTON3_MASK
private static final int MAC_MOUSE_BUTTON3_MASK
- See Also:
- Constant Field Values
-
N
private static final java.lang.String[] N
-
K
private static final int[] K
-
iStartSelectionPoint
private java.awt.Point iStartSelectionPoint
-
iEndSelectionPoint
private java.awt.Point iEndSelectionPoint
-
iSlippyMapChooser
private final SlippyMapBBoxChooser iSlippyMapChooser
-
isSelecting
private boolean isSelecting
-
-
Constructor Detail
-
SlippyMapController
public SlippyMapController(SlippyMapBBoxChooser navComp, javax.swing.JPanel contentPane)
Constructs a newSlippyMapController
.- Parameters:
navComp
- navigable componentcontentPane
- content pane
-
-
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 interfacejava.awt.event.MouseListener
- Overrides:
mousePressed
in classjava.awt.event.MouseAdapter
-
mouseDragged
public void mouseDragged(java.awt.event.MouseEvent e)
- Specified by:
mouseDragged
in interfacejava.awt.event.MouseMotionListener
- Overrides:
mouseDragged
in classjava.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 interfacejava.awt.event.MouseListener
- Overrides:
mouseReleased
in classjava.awt.event.MouseAdapter
-
mouseMoved
public void mouseMoved(java.awt.event.MouseEvent e)
- Specified by:
mouseMoved
in interfacejava.awt.event.MouseMotionListener
- Overrides:
mouseMoved
in classjava.awt.event.MouseAdapter
-
-