org.geotools.swt.tool
Class CursorTool

Object
  extended by MapMouseAdapter
      extended by CursorTool
All Implemented Interfaces:
MapMouseListener
Direct Known Subclasses:
AbstractZoomTool, InfoTool, PanTool

public abstract class CursorTool
extends MapMouseAdapter

The base class for map pane cursor tools. Simply adds a getCursor method to the MapToolAdapter

Author:
Michael Bedward, Andrea Antonello (www.hydrologis.com)

Field Summary
static int ANY_BUTTON
          Flag indicating that the tool should be triggered whenever any mouse button is used.
 
Constructor Summary
CursorTool()
          Constructs a new cursor tool which is triggered by any mouse button.
CursorTool(int triggerButtonMask)
          Constructs a new cursor tool.
 
Method Summary
abstract  boolean canDraw()
          Checks if the tool can draw when dragging.
abstract  boolean canMove()
          Checks if the tool can move the map when dragging.
 Cursor getCursor()
          Get the cursor for this tool.
 SwtMapPane getMapPane()
          Get the map pane that this tool is servicing
 boolean isDrawing()
          Returns true for any tool which is drawing while dragging.
protected  boolean isTriggerMouseButton(MapMouseEvent event)
          Checks if the tool should be triggered by the event.
 void setMapPane(SwtMapPane pane)
          Set the map pane that this cursor tool is associated with
 
Methods inherited from class MapMouseAdapter
onMouseClicked, onMouseDragged, onMouseEntered, onMouseExited, onMouseMoved, onMousePressed, onMouseReleased, onMouseWheelMoved
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ANY_BUTTON

public static final int ANY_BUTTON
Flag indicating that the tool should be triggered whenever any mouse button is used.

Constructor Detail

CursorTool

public CursorTool(int triggerButtonMask)
Constructs a new cursor 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

CursorTool

public CursorTool()
Constructs a new cursor tool which is triggered by any mouse button.

Method Detail

setMapPane

public void setMapPane(SwtMapPane pane)
Set the map pane that this cursor tool is associated with

Parameters:
pane - the map pane
Throws:
IllegalArgumentException - if mapPane is null

getMapPane

public SwtMapPane getMapPane()
Get the map pane that this tool is servicing

Returns:
the map pane

getCursor

public Cursor getCursor()
Get the cursor for this tool. Sub-classes should override this method to provide a custom cursor.

Returns:
the default cursor

canDraw

public abstract boolean canDraw()
Checks if the tool can draw when dragging.

Returns:
true if the tool can draw.

canMove

public abstract boolean canMove()
Checks if the tool can move the map when dragging.

Returns:
true if the tool can move the map while dragging.

isDrawing

public boolean isDrawing()
Returns true for any tool which is drawing while dragging. For tools which are triggered only by a certain mouse event it might be the case that canDraw() is true while they are actually not active.

Returns:
true if the tool is drawing while dragging

isTriggerMouseButton

protected boolean isTriggerMouseButton(MapMouseEvent event)
Checks if the tool should be triggered by the event.

Parameters:
event - event to be checked
Returns:
true if the tool is triggered by the event


Copyright © 1996-2014 Geotools. All Rights Reserved.