Package org.openstreetmap.josm.gui.bbox
Class SlippyMapController
- java.lang.Object
-
- java.awt.event.MouseAdapter
-
- org.openstreetmap.josm.gui.bbox.SlippyMapController
-
- All Implemented Interfaces:
MouseListener
,MouseMotionListener
,MouseWheelListener
,EventListener
public class SlippyMapController extends 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 Point
iEndSelectionPoint
private SlippyMapBBoxChooser
iSlippyMapChooser
private boolean
isSelecting
private 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 String[]
N
private static 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, JPanel contentPane)
Constructs a newSlippyMapController
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
mouseDragged(MouseEvent e)
void
mouseMoved(MouseEvent e)
void
mousePressed(MouseEvent e)
Start drawing the selection rectangle if it was the 1st button (left button)void
mouseReleased(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
-
-
-
-
Field Detail
-
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
-
K
private static final int[] K
-
iStartSelectionPoint
private Point iStartSelectionPoint
-
iEndSelectionPoint
private Point iEndSelectionPoint
-
iSlippyMapChooser
private final SlippyMapBBoxChooser iSlippyMapChooser
-
isSelecting
private boolean isSelecting
-
-
Constructor Detail
-
SlippyMapController
public SlippyMapController(SlippyMapBBoxChooser navComp, JPanel contentPane)
Constructs a newSlippyMapController
.- Parameters:
navComp
- navigable componentcontentPane
- content pane
-
-
Method Detail
-
mousePressed
public void mousePressed(MouseEvent e)
Start drawing the selection rectangle if it was the 1st button (left button)- Specified by:
mousePressed
in interfaceMouseListener
- Overrides:
mousePressed
in classMouseAdapter
-
mouseDragged
public void mouseDragged(MouseEvent e)
- Specified by:
mouseDragged
in interfaceMouseMotionListener
- Overrides:
mouseDragged
in classMouseAdapter
-
mouseReleased
public void mouseReleased(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 interfaceMouseListener
- Overrides:
mouseReleased
in classMouseAdapter
-
mouseMoved
public void mouseMoved(MouseEvent e)
- Specified by:
mouseMoved
in interfaceMouseMotionListener
- Overrides:
mouseMoved
in classMouseAdapter
-
-