org.geotools.gui.tools
Class PanToolImpl

java.lang.Object
  extended byorg.geotools.gui.tools.AbstractTool
      extended byorg.geotools.gui.tools.PanToolImpl
All Implemented Interfaces:
java.util.EventListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, PanTool, Tool
Direct Known Subclasses:
ClickPanToolImpl, ZoomToolImpl

public class PanToolImpl
extends AbstractTool
implements PanTool

Provides both Click/Pan and Drap/Pan functionality. Processes MouseEvents on behalf of MapPanel and constructs a CordinateTransform for the map's Context.

Version:
$Revision: 1.20 $
Author:
$author$

Field Summary
protected  CoordinatePoint pressPoint
          The Mouse button press down point in a click/drag operation
protected  CoordinatePoint releasePoint
          The Mouse button release point in a click/drag operation
 
Fields inherited from class org.geotools.gui.tools.AbstractTool
context
 
Constructor Summary
PanToolImpl()
          Construct a PanTool.
 
Method Summary
 void addMouseListener(java.awt.Component component, MapContext context)
          Register this tool to receive MouseEvents from component.
 void addMouseMotionListener(java.awt.Component component, MapContext context)
           
protected  void applyZoomTransform(CoordinatePoint midPoint, double inverseZoomFactor)
          Calculate a transform based on the new midpoint and zoomFactor.
 void mouseClicked(java.awt.event.MouseEvent e)
          Process Click and Drag Pan.
 void mousePressed(java.awt.event.MouseEvent e)
          Set the press point in a click-drag operation.
 void mouseReleased(java.awt.event.MouseEvent e)
          Set the release point in a click-drag operation and process the drag operation.
 
Methods inherited from class org.geotools.gui.tools.AbstractTool
addMouseListener, addMouseMotionListener, destroy, getContext, getCursor, getName, mouseDragged, mouseEntered, mouseExited, mouseMoved, paint, removeMouseListeners, setCursor, setName, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.geotools.gui.tools.Tool
destroy, getContext, getCursor, getName, paint, removeMouseListeners, setCursor, setName
 

Field Detail

pressPoint

protected CoordinatePoint pressPoint
The Mouse button press down point in a click/drag operation


releasePoint

protected CoordinatePoint releasePoint
The Mouse button release point in a click/drag operation

Constructor Detail

PanToolImpl

public PanToolImpl()
Construct a PanTool.

Method Detail

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Process Click and Drag Pan.

Specified by:
mouseClicked in interface java.awt.event.MouseListener
Overrides:
mouseClicked in class AbstractTool
Parameters:
e - The mouse clicked event.

applyZoomTransform

protected void applyZoomTransform(CoordinatePoint midPoint,
                                  double inverseZoomFactor)
Calculate a transform based on the new midpoint and zoomFactor. ZoomFactor will be 1 for Pan, anything for Zoom.

Parameters:
midPoint - The midPoint of the new AreaOfInterest
inverseZoomFactor - The inverse of the zoomFactor to zoom by, inverseZoomFactor=0.5 means zoom in.

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Set the press point in a click-drag operation.

Specified by:
mousePressed in interface java.awt.event.MouseListener
Overrides:
mousePressed in class AbstractTool
Parameters:
e - contains the mouse click.

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Set the release point in a click-drag operation and process the drag operation.

Specified by:
mouseReleased in interface java.awt.event.MouseListener
Overrides:
mouseReleased in class AbstractTool
Parameters:
e - contains the mouse click.

addMouseListener

public void addMouseListener(java.awt.Component component,
                             MapContext context)
Register this tool to receive MouseEvents from component.

Specified by:
addMouseListener in interface Tool
Parameters:
component - The tool will process mouseEvents from this component.
context - The Context that will be changed by this Tool.

addMouseMotionListener

public void addMouseMotionListener(java.awt.Component component,
                                   MapContext context)
                            throws java.lang.IllegalArgumentException
Specified by:
addMouseMotionListener in interface Tool
Throws:
java.lang.IllegalArgumentException


Copyright © GeoTools. All Rights Reserved.