org.geotools.gui.tools
Class ClickZoomToolImpl

java.lang.Object
  extended byorg.geotools.gui.tools.AbstractTool
      extended byorg.geotools.gui.tools.ClickZoomToolImpl
All Implemented Interfaces:
ClickZoomTool, java.util.EventListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, Tool

public class ClickZoomToolImpl
extends AbstractTool
implements ClickZoomTool

Pan the map so that the new extent has the click point in the middle of the map and then zoom in/out by the zoomFactor.

Version:
$Id: ClickZoomToolImpl.java 17672 2006-01-19 00:25:55Z desruisseaux $
Author:
Cameron Shorter

Field Summary
 
Fields inherited from class org.geotools.gui.tools.AbstractTool
context
 
Constructor Summary
ClickZoomToolImpl()
          Construct a ZoomTool.
ClickZoomToolImpl(double zoomFactor)
          Construct a ZoomTool.
 
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)
           
 double getZoomFactor()
          The factor to zoom in out by, zoomFactor=0.5 means zoom in, zoomFactor=2 means zoom out.
 void mouseClicked(java.awt.event.MouseEvent e)
          Set up Click/Zoom.
 void setZoomFactor(double zoomFactor)
          The factor to zoom in out by, zoomFactor=0.5 means zoom in, zoomFactor=2 means zoom out.
 
Methods inherited from class org.geotools.gui.tools.AbstractTool
addMouseListener, addMouseMotionListener, destroy, getContext, getCursor, getName, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, 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
 

Constructor Detail

ClickZoomToolImpl

public ClickZoomToolImpl()
Construct a ZoomTool.


ClickZoomToolImpl

public ClickZoomToolImpl(double zoomFactor)
Construct a ZoomTool. @parma zoomFactor he factor to zoom in/out by, zoomFactor=2 means zoom in, zoomFactor=0.5 means zoom out.

Method Detail

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Set up Click/Zoom. Pan the map so that the new extent has the click point in the middle of the map and then zoom in/out by the zoomFactor.

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

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.
Throws:
java.lang.IllegalArgumentException - if an argument is null or the tool is being assigned a different context to before.

setZoomFactor

public void setZoomFactor(double zoomFactor)
The factor to zoom in out by, zoomFactor=0.5 means zoom in, zoomFactor=2 means zoom out. Defaults to 2.

Specified by:
setZoomFactor in interface ClickZoomTool
Parameters:
zoomFactor - the factor to zoom by.

getZoomFactor

public double getZoomFactor()
The factor to zoom in out by, zoomFactor=0.5 means zoom in, zoomFactor=2 means zoom out. Defaults to 2.

Specified by:
getZoomFactor in interface ClickZoomTool
Returns:
the factor to zoom by.

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.