public abstract class DefaultMouseHandler
extends java.lang.Object
implements org.eclipse.swt.events.MouseListener, org.eclipse.swt.events.MouseWheelListener, org.eclipse.swt.events.MouseMoveListener, org.eclipse.swt.events.MouseTrackListener, org.eclipse.swt.events.PaintListener
Constructor and Description |
---|
DefaultMouseHandler(GeoMapPositioned geoMap) |
Modifier and Type | Method and Description |
---|---|
protected void |
center(org.eclipse.swt.events.MouseEvent e)
Center at cursor position
|
protected boolean |
checkButtons(org.eclipse.swt.events.MouseEvent e,
int buttons)
Checks that the MouseEvent corresponds to the provided buttons bit mask.
|
protected GeoMapPositioned |
getGeoMap() |
abstract org.eclipse.swt.graphics.Point |
getMapSize()
Gets the size of the map viewport/pane.
|
int |
getPanButtons() |
int |
getPanCenterButtons() |
int |
getPanClickCount() |
int |
getPanScrollButtons() |
int |
getPanScrollSpeed() |
int |
getZoomClickCount() |
int |
getZoomInClickButtons() |
int |
getZoomOutClickButtons() |
int |
getZoomRectangleButtons() |
int |
getZoomScrollButtons() |
protected boolean |
handleDown(org.eclipse.swt.events.MouseEvent e)
Checks if a down event is (the start of) a pan or zoom and initiates it.
|
protected boolean |
handlePanDrag(org.eclipse.swt.events.MouseEvent e)
Handles one pan step, according to the distance from the click to the
current position
|
protected boolean |
handlePanUp(org.eclipse.swt.events.MouseEvent e)
Handles end of pan.
|
protected boolean |
handleZoomClick(org.eclipse.swt.events.MouseEvent e)
Checks if a click event is a zoom and performs it.
|
protected boolean |
handleZoomDrag(org.eclipse.swt.events.MouseEvent e)
Handles one zoom step, extending the zoom rectangle.
|
protected boolean |
handleZoomUp(org.eclipse.swt.events.MouseEvent e)
Handles zooming to rectangle.
|
protected boolean |
isPanning() |
protected boolean |
isPanStart(org.eclipse.swt.events.MouseEvent e) |
protected boolean |
isZooming() |
protected boolean |
isZoomStart(org.eclipse.swt.events.MouseEvent e) |
void |
mouseDoubleClick(org.eclipse.swt.events.MouseEvent e) |
void |
mouseDown(org.eclipse.swt.events.MouseEvent e) |
void |
mouseEnter(org.eclipse.swt.events.MouseEvent e) |
void |
mouseExit(org.eclipse.swt.events.MouseEvent e) |
void |
mouseHover(org.eclipse.swt.events.MouseEvent e) |
void |
mouseMove(org.eclipse.swt.events.MouseEvent e) |
void |
mouseScrolled(org.eclipse.swt.events.MouseEvent e) |
void |
mouseUp(org.eclipse.swt.events.MouseEvent e) |
void |
paintControl(org.eclipse.swt.events.PaintEvent e) |
protected void |
pan(int x,
int y,
boolean relative)
Sets the map position
|
protected boolean |
panStart(org.eclipse.swt.events.MouseEvent e)
Initiates a pan.
|
void |
setPanButtons(int panButtons)
Sets the button(s) that triggers a pan.
|
void |
setPanCenterButtons(int panCenterButtons) |
void |
setPanClickCount(int panClickCount)
Sets the number of clicks that triggers a pan.
|
void |
setPanScrollButtons(int panScrollButtons)
Sets the button(s) that triggers a pan, when using the scroll wheel.
|
void |
setPanScrollSpeed(int panScrollSpeed)
Sets the panning speed, when using the scroll wheel.
|
void |
setZoomClickCount(int zoomClickCount)
Sets the number of clicks that triggers a zoom.
|
void |
setZoomInClickButtons(int zoomInClickButtons)
Sets the button(s) that triggers a zoom in.
|
void |
setZoomOutClickButtons(int zoomOutClickButtons)
Sets the button(s) that triggers a zoom out.
|
void |
setZoomRectangleButtons(int zoomRectangleButtons)
Sets the button(s) that triggers a zoom (rectangle).
|
void |
setZoomScrollButtons(int zoomScrollButtons)
Sets the button(s) that triggers a zoom, when using the scroll wheel.
|
protected void |
zoomIn(org.eclipse.swt.events.MouseEvent e)
Zoom in at cursor position
|
protected void |
zoomOut(org.eclipse.swt.events.MouseEvent e)
Zoom out at cursor position
|
protected boolean |
zoomStart(org.eclipse.swt.events.MouseEvent e)
Initiates a zoom (rectangle).
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public DefaultMouseHandler(GeoMapPositioned geoMap)
geoMap
- control
- protected GeoMapPositioned getGeoMap()
protected void zoomIn(org.eclipse.swt.events.MouseEvent e)
e
- the MouseEventprotected void zoomOut(org.eclipse.swt.events.MouseEvent e)
e
- the MouseEventprotected void pan(int x, int y, boolean relative)
x
- the x or x offsety
- the y or y offsetrelative
- tells whether x and y are offsetspublic abstract org.eclipse.swt.graphics.Point getMapSize()
protected void center(org.eclipse.swt.events.MouseEvent e)
e
- the MouseEventpublic int getZoomClickCount()
public void setZoomClickCount(int zoomClickCount)
zoomClickCount
- The zoomClickCount to set.public int getPanCenterButtons()
public void setPanCenterButtons(int panCenterButtons)
panCenterButtons
- The panCenterButtons to set.public int getZoomInClickButtons()
public void setZoomInClickButtons(int zoomInClickButtons)
zoomInClickButtons
- The zoomInClickButtons to set.public int getZoomOutClickButtons()
public void setZoomOutClickButtons(int zoomOutClickButtons)
zoomOutClickButtons
- The zoomOutClickButtons to set.public int getPanClickCount()
public void setPanClickCount(int panClickCount)
panClickCount
- The panClickCount to set.public int getPanButtons()
public void setPanButtons(int panButtons)
panButtons
- The panButtons to set.public int getPanScrollButtons()
public void setPanScrollButtons(int panScrollButtons)
panScrollButtons
- The panScrollButtons to set.public int getPanScrollSpeed()
public void setPanScrollSpeed(int panScrollSpeed)
panScrollSpeed
- The panScrollSpeed to set.public int getZoomScrollButtons()
public void setZoomScrollButtons(int zoomScrollButtons)
zoomScrollButtons
- The zoomScrollButtons to set.public int getZoomRectangleButtons()
public void setZoomRectangleButtons(int zoomRectangleButtons)
zoomRectangleButtons
- The zoomRectangleButtons to set.public void mouseEnter(org.eclipse.swt.events.MouseEvent e)
mouseEnter
in interface org.eclipse.swt.events.MouseTrackListener
public void mouseExit(org.eclipse.swt.events.MouseEvent e)
mouseExit
in interface org.eclipse.swt.events.MouseTrackListener
public void mouseHover(org.eclipse.swt.events.MouseEvent e)
mouseHover
in interface org.eclipse.swt.events.MouseTrackListener
protected boolean checkButtons(org.eclipse.swt.events.MouseEvent e, int buttons)
e
- the MouseEventbuttons
- Or'ed button bits for modifiers keys and mouse buttons.public void mouseDown(org.eclipse.swt.events.MouseEvent e)
mouseDown
in interface org.eclipse.swt.events.MouseListener
public void mouseMove(org.eclipse.swt.events.MouseEvent e)
mouseMove
in interface org.eclipse.swt.events.MouseMoveListener
public void mouseDoubleClick(org.eclipse.swt.events.MouseEvent e)
mouseDoubleClick
in interface org.eclipse.swt.events.MouseListener
protected boolean handleZoomClick(org.eclipse.swt.events.MouseEvent e)
e
- the MouseEventprotected boolean handleDown(org.eclipse.swt.events.MouseEvent e)
e
- the MouseEventprotected boolean isPanStart(org.eclipse.swt.events.MouseEvent e)
e
- the MouseEventprotected boolean isZoomStart(org.eclipse.swt.events.MouseEvent e)
e
- the MouseEventprotected boolean panStart(org.eclipse.swt.events.MouseEvent e)
e
- the MouseEventprotected boolean isPanning()
protected boolean zoomStart(org.eclipse.swt.events.MouseEvent e)
e
- the MouseEventprotected boolean isZooming()
public void mouseUp(org.eclipse.swt.events.MouseEvent e)
mouseUp
in interface org.eclipse.swt.events.MouseListener
public void mouseScrolled(org.eclipse.swt.events.MouseEvent e)
mouseScrolled
in interface org.eclipse.swt.events.MouseWheelListener
protected boolean handlePanDrag(org.eclipse.swt.events.MouseEvent e)
e
- the MouseEventprotected boolean handleZoomDrag(org.eclipse.swt.events.MouseEvent e)
e
- the MouseEventprotected boolean handlePanUp(org.eclipse.swt.events.MouseEvent e)
e
- the MouseEventprotected boolean handleZoomUp(org.eclipse.swt.events.MouseEvent e)
e
- the MouseEventpublic void paintControl(org.eclipse.swt.events.PaintEvent e)
paintControl
in interface org.eclipse.swt.events.PaintListener