Package org.geotools.swing.tool
Class ZoomInTool
- Object
-
- MapMouseAdapter
-
- CursorTool
-
- AbstractZoomTool
-
- ZoomInTool
-
- All Implemented Interfaces:
MapMouseListener
public class ZoomInTool extends AbstractZoomTool
A cursor tool to zoom in the map pane display.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
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
- Author:
- Michael Bedward
-
-
Field Summary
Fields Modifier and Type Field Description static Point
CURSOR_HOTSPOT
Cursor hotspot coordinatesstatic String
CURSOR_IMAGE
Cursorstatic String
ICON_IMAGE
Icon for the controlstatic String
TOOL_NAME
Tool namestatic String
TOOL_TIP
Tool tip text-
Fields inherited from class AbstractZoomTool
DEFAULT_ZOOM_FACTOR, zoom
-
-
Constructor Summary
Constructors Constructor Description ZoomInTool()
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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 areaCursor
getCursor()
Get the mouse cursor for this toolvoid
onMouseClicked(MapMouseEvent e)
Zoom in by the currently set increment, with the map centred at the location (in world coords) of the mouse clickvoid
onMouseDragged(MapMouseEvent ev)
Records that the mouse is being draggedvoid
onMousePressed(MapMouseEvent ev)
Records the map position of the mouse event in case this button press is the beginning of a mouse dragvoid
onMouseReleased(MapMouseEvent ev)
If the mouse was dragged, determines the bounds of the box that the user defined and passes this to the mapPane'ssetDisplayArea
method.-
Methods inherited from class AbstractZoomTool
getZoom, setZoom
-
Methods inherited from class CursorTool
getMapPane, setMapPane
-
Methods inherited from class MapMouseAdapter
onMouseEntered, onMouseExited, onMouseMoved, onMouseWheelMoved
-
-
-
-
Field Detail
-
TOOL_NAME
public static final String TOOL_NAME
Tool name
-
TOOL_TIP
public static final String TOOL_TIP
Tool tip text
-
CURSOR_IMAGE
public static final String CURSOR_IMAGE
Cursor- See Also:
- Constant Field Values
-
CURSOR_HOTSPOT
public static final Point CURSOR_HOTSPOT
Cursor hotspot coordinates
-
ICON_IMAGE
public static final String ICON_IMAGE
Icon for the control- See Also:
- Constant Field Values
-
-
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 interfaceMapMouseListener
- Overrides:
onMouseClicked
in classMapMouseAdapter
- 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 interfaceMapMouseListener
- Overrides:
onMousePressed
in classMapMouseAdapter
- Parameters:
ev
- the mouse event
-
onMouseDragged
public void onMouseDragged(MapMouseEvent ev)
Records that the mouse is being dragged- Specified by:
onMouseDragged
in interfaceMapMouseListener
- Overrides:
onMouseDragged
in classMapMouseAdapter
- 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'ssetDisplayArea
method.- Specified by:
onMouseReleased
in interfaceMapMouseListener
- Overrides:
onMouseReleased
in classMapMouseAdapter
- Parameters:
ev
- the mouse event
-
getCursor
public Cursor getCursor()
Get the mouse cursor for this tool- Overrides:
getCursor
in classCursorTool
- 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 classCursorTool
- Returns:
- true if this tool supports drawing a drag-box on the map; false otherwise
-
-