es.prodevelop.gvsig.mobile.gui.tool.listener
Class DistanceAreaListener

java.lang.Object
  extended byes.prodevelop.gvsig.mobile.gui.tool.listener.DistanceAreaListener
All Implemented Interfaces:
PointToolListener, ToolListener

public class DistanceAreaListener
extends java.lang.Object
implements PointToolListener

This listener is associated with the measurement tools (distance/area). It will compute areas / accumulative distances each time a point event happens. Of course it needs geographic information about scales, provided by the MapControl.

Author:
jldominguez
See Also:
PointBehavior

Field Summary
static int DRAG_LIMIT
           
 
Constructor Summary
DistanceAreaListener(int x, int y, boolean area)
          Constructor.
 
Method Summary
 boolean cancelDrawing()
          This method asks the listener to cancel the current drawing process (currently unsued)
 java.awt.Cursor getCursor()
          Gets the cursor to be used while this tool is active.
 void point(PointEvent event)
          This method will be called when a point event happens.
 void setMapControl(MapControl mc)
          Sets the MapControl object that will be updated by this listener.
 void start()
          This method cleans the listener (resets distance/area to zer and removes geometry).
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DRAG_LIMIT

public static int DRAG_LIMIT
Constructor Detail

DistanceAreaListener

public DistanceAreaListener(int x,
                            int y,
                            boolean area)
Constructor. The coordinates of the initial point are needed for refresh purposes.

Parameters:
x - the x coordinate of the starting point clicked by the user
y - the y coordinate of the starting point clicked by the user
area - whether an area (true) or a distance (false) has to be computed.
Method Detail

point

public void point(PointEvent event)
This method will be called when a point event happens. The listener will computer again the area/distance.

Specified by:
point in interface PointToolListener
Parameters:
event - the relevant point event the tool is waiting for.

getCursor

public java.awt.Cursor getCursor()
Gets the cursor to be used while this tool is active.

Specified by:
getCursor in interface ToolListener
Returns:
the cursor to be used while this tool is active.

cancelDrawing

public boolean cancelDrawing()
This method asks the listener to cancel the current drawing process (currently unsued)

Specified by:
cancelDrawing in interface ToolListener
Returns:
whether it was possible to cancel the drawing

setMapControl

public void setMapControl(MapControl mc)
Sets the MapControl object that will be updated by this listener.

Specified by:
setMapControl in interface ToolListener
Parameters:
mc - the MapControl object to be used by this listener.

start

public void start()
This method cleans the listener (resets distance/area to zer and removes geometry). It's used when the tool is activated/deactivated.