org.geotools.swt.tool
Class PanTool

Object
  extended by MapMouseAdapter
      extended by CursorTool
          extended by PanTool
All Implemented Interfaces:
MapMouseListener

public class PanTool
extends CursorTool

A map panning tool for SwtMapPane.

Allows the user to drag the map with the mouse.

Since:
2.6
Author:
Michael Bedward

Field Summary
static String TOOL_NAME
          Tool name
static String TOOL_TIP
          Tool tip text
 
Fields inherited from class CursorTool
ANY_BUTTON
 
Constructor Summary
PanTool()
          Constructs a new pan tool which is triggered by any mouse button.
PanTool(int triggerButtonMask)
          Constructs a new pan tool.
 
Method Summary
 boolean canDraw()
          Checks if the tool can draw when dragging.
 boolean canMove()
          Checks if the tool can move the map when dragging.
 Cursor getCursor()
          Get the mouse cursor for this tool
 void onMouseDragged(MapMouseEvent ev)
          Respond to a mouse dragged event.
 void onMousePressed(MapMouseEvent ev)
          Respond to a mouse button press event from the map mapPane.
 void onMouseReleased(MapMouseEvent ev)
          If this button release is the end of a mouse dragged event, requests the map mapPane to repaint the display
 
Methods inherited from class CursorTool
getMapPane, isDrawing, isTriggerMouseButton, setMapPane
 
Methods inherited from class MapMouseAdapter
onMouseClicked, onMouseEntered, onMouseExited, onMouseMoved, onMouseWheelMoved
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TOOL_NAME

public static final String TOOL_NAME
Tool name


TOOL_TIP

public static final String TOOL_TIP
Tool tip text

Constructor Detail

PanTool

public PanTool(int triggerButtonMask)
Constructs a new pan tool. To activate the tool only on certain mouse events provide a single mask, e.g. SWT.BUTTON1, or a combination of multiple SWT-masks.

Parameters:
triggerButtonMask - Mouse button which triggers the tool's activation or if the tool is to be triggered by any button

PanTool

public PanTool()
Constructs a new pan tool which is triggered by any mouse button.

Method Detail

onMousePressed

public void onMousePressed(MapMouseEvent ev)
Respond to a mouse button press event from the map mapPane. This may signal the start of a mouse drag. Records the event's window position.

Specified by:
onMousePressed in interface MapMouseListener
Overrides:
onMousePressed in class MapMouseAdapter
Parameters:
ev - the mouse event

onMouseDragged

public void onMouseDragged(MapMouseEvent ev)
Respond to a mouse dragged event. Calls org.geotools.swing.JMapPane#moveImage()

Specified by:
onMouseDragged in interface MapMouseListener
Overrides:
onMouseDragged in class MapMouseAdapter
Parameters:
ev - the mouse event

onMouseReleased

public void onMouseReleased(MapMouseEvent ev)
If this button release is the end of a mouse dragged event, requests the map mapPane to repaint the display

Specified by:
onMouseReleased in interface MapMouseListener
Overrides:
onMouseReleased in class MapMouseAdapter
Parameters:
ev - the mouse event

getCursor

public Cursor getCursor()
Get the mouse cursor for this tool

Overrides:
getCursor in class CursorTool
Returns:
the default cursor

canDraw

public boolean canDraw()
Description copied from class: CursorTool
Checks if the tool can draw when dragging.

Specified by:
canDraw in class CursorTool
Returns:
true if the tool can draw.

canMove

public boolean canMove()
Description copied from class: CursorTool
Checks if the tool can move the map when dragging.

Specified by:
canMove in class CursorTool
Returns:
true if the tool can move the map while dragging.


Copyright © 1996-2014 Geotools. All Rights Reserved.