org.geotools.swing.tool
Class ZoomInTool

java.lang.Object
  extended by org.geotools.swing.event.MapMouseAdapter
      extended by org.geotools.swing.tool.CursorTool
          extended by org.geotools.swing.tool.AbstractZoomTool
              extended by org.geotools.swing.tool.ZoomInTool
All Implemented Interfaces:
MapMouseListener

public class ZoomInTool
extends AbstractZoomTool

A zoom-in tool for JMapPane.

For mouse clicks, the display will be zoomed-in such that the map centre is the position of the mouse click and the map width and height are calculated as:

   len = len.old / z 
where z is the linear zoom increment (>= 1.0)

The tool also responds to the user drawing a box on the map mapPane with mouse click-and-drag to define the zoomed-in area.

Since:
2.6
Version:
$Id: ZoomInTool.java 34138 2009-10-13 06:35:19Z mbedward $
Author:
Michael Bedward

Field Summary
static java.awt.Point CURSOR_HOTSPOT
          Cursor hotspot coordinates
static java.lang.String CURSOR_IMAGE
          Cursor
static java.lang.String ICON_IMAGE
          Icon for the control
static java.lang.String TOOL_NAME
          Tool name
static java.lang.String TOOL_TIP
          Tool tip text
 
Fields inherited from class org.geotools.swing.tool.AbstractZoomTool
DEFAULT_ZOOM_FACTOR, zoom
 
Constructor Summary
ZoomInTool()
          Constructor
 
Method Summary
 boolean drawDragBox()
          Returns true to indicate that this tool draws a box on the map display when the mouse is being dragged to show the zoom-in area
 java.awt.Cursor getCursor()
          Get the mouse cursor for this tool
 void onMouseClicked(MapMouseEvent e)
          Zoom in by the currently set increment, with the map centred at the location (in world coords) of the mouse click
 void onMouseDragged(MapMouseEvent ev)
          Records that the mouse is being dragged
 void onMousePressed(MapMouseEvent ev)
          Records the map position of the mouse event in case this button press is the beginning of a mouse drag
 void onMouseReleased(MapMouseEvent ev)
          If the mouse was dragged, determines the bounds of the box that the user defined and passes this to the mapPane's JMapPane.setDisplayArea(org.opengis.geometry.Envelope) method
 
Methods inherited from class org.geotools.swing.tool.AbstractZoomTool
getZoom, setZoom
 
Methods inherited from class org.geotools.swing.tool.CursorTool
getMapPane, setMapPane
 
Methods inherited from class org.geotools.swing.event.MapMouseAdapter
onMouseEntered, onMouseExited, onMouseMoved, onMouseWheelMoved
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TOOL_NAME

public static final java.lang.String TOOL_NAME
Tool name


TOOL_TIP

public static final java.lang.String TOOL_TIP
Tool tip text


CURSOR_IMAGE

public static final java.lang.String CURSOR_IMAGE
Cursor

See Also:
Constant Field Values

CURSOR_HOTSPOT

public static final java.awt.Point CURSOR_HOTSPOT
Cursor hotspot coordinates


ICON_IMAGE

public static final java.lang.String ICON_IMAGE
Icon for the control

See Also:
Constant Field Values
Constructor Detail

ZoomInTool

public ZoomInTool()
Constructor

Method Detail

onMouseClicked

public void onMouseClicked(MapMouseEvent e)
Zoom in by the currently set increment, with the map centred at the location (in world coords) of the mouse click

Specified by:
onMouseClicked in interface MapMouseListener
Overrides:
onMouseClicked in class MapMouseAdapter
Parameters:
e - map mapPane mouse event

onMousePressed

public void onMousePressed(MapMouseEvent ev)
Records the map position of the mouse event in case this button press is the beginning of a mouse drag

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

onMouseDragged

public void onMouseDragged(MapMouseEvent ev)
Records that the mouse is being dragged

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

onMouseReleased

public void onMouseReleased(MapMouseEvent ev)
If the mouse was dragged, determines the bounds of the box that the user defined and passes this to the mapPane's JMapPane.setDisplayArea(org.opengis.geometry.Envelope) method

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

getCursor

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

Overrides:
getCursor in class CursorTool
Returns:
the default cursor

drawDragBox

public boolean drawDragBox()
Returns true to indicate that this tool draws a box on the map display when the mouse is being dragged to show the zoom-in area

Overrides:
drawDragBox in class CursorTool
Returns:
true if this tool supports drawing a drag-box on the map; false otherwise


Copyright © 1996-2010 Geotools. All Rights Reserved.