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 classSlippyMapController.MoveTaskMoves the map depending on which cursor keys are pressed (or not)private classSlippyMapController.MoveXActionprivate classSlippyMapController.MoveYActionprivate classSlippyMapController.ZoomInActionprivate classSlippyMapController.ZoomOutAction
-
Field Summary
Fields Modifier and Type Field Description private static doubleACCELERATIONThe speed increase per timer interval when a cursor button is clickedprivate java.awt.PointiEndSelectionPointprivate SlippyMapBBoxChooseriSlippyMapChooserprivate booleanisSelectingprivate java.awt.PointiStartSelectionPointprivate static int[]Kprivate static intMAC_MOUSE_BUTTON3_MASKprivate static doubleMAX_SPEEDThe maximum speed (pixels per timer interval)private SlippyMapController.MoveTaskmoveTaskDoes the movingprivate static java.lang.String[]Nprivate static java.util.TimerTIMERA Timer for smoothly moving the map areaprivate static longtimerIntervalHow 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 Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) static booleanisTyping()voidmouseDragged(java.awt.event.MouseEvent e)voidmouseMoved(java.awt.event.MouseEvent e)voidmousePressed(java.awt.event.MouseEvent e)Start drawing the selection rectangle if it was the 1st button (left button)voidmouseReleased(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:
mousePressedin interfacejava.awt.event.MouseListener- Overrides:
mousePressedin classjava.awt.event.MouseAdapter
-
mouseDragged
public void mouseDragged(java.awt.event.MouseEvent e)
- Specified by:
mouseDraggedin interfacejava.awt.event.MouseMotionListener- Overrides:
mouseDraggedin 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:
mouseReleasedin interfacejava.awt.event.MouseListener- Overrides:
mouseReleasedin classjava.awt.event.MouseAdapter
-
mouseMoved
public void mouseMoved(java.awt.event.MouseEvent e)
- Specified by:
mouseMovedin interfacejava.awt.event.MouseMotionListener- Overrides:
mouseMovedin classjava.awt.event.MouseAdapter
-
isTyping
static boolean isTyping()
-
-