public class ZoomInTool extends AbstractZoomTool
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.
Modifier and Type | Field and Description |
---|---|
static Point |
CURSOR_HOTSPOT
Cursor hotspot coordinates
|
static String |
CURSOR_IMAGE
Cursor
|
static String |
ICON_IMAGE
Icon for the control
|
static String |
TOOL_NAME
Tool name
|
static String |
TOOL_TIP
Tool tip text
|
DEFAULT_ZOOM_FACTOR, zoom
Constructor and Description |
---|
ZoomInTool()
Constructor
|
Modifier and Type | Method and 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 area
|
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
setDisplayArea method. |
getZoom, setZoom
getMapPane, setMapPane
onMouseEntered, onMouseExited, onMouseMoved, onMouseWheelMoved
public static final String TOOL_NAME
public static final String TOOL_TIP
public static final String CURSOR_IMAGE
public static final Point CURSOR_HOTSPOT
public static final String ICON_IMAGE
public void onMouseClicked(MapMouseEvent e)
onMouseClicked
in interface MapMouseListener
onMouseClicked
in class MapMouseAdapter
e
- map mapPane mouse eventpublic void onMousePressed(MapMouseEvent ev)
onMousePressed
in interface MapMouseListener
onMousePressed
in class MapMouseAdapter
ev
- the mouse eventpublic void onMouseDragged(MapMouseEvent ev)
onMouseDragged
in interface MapMouseListener
onMouseDragged
in class MapMouseAdapter
ev
- the mouse eventpublic void onMouseReleased(MapMouseEvent ev)
setDisplayArea
method.onMouseReleased
in interface MapMouseListener
onMouseReleased
in class MapMouseAdapter
ev
- the mouse eventpublic Cursor getCursor()
getCursor
in class CursorTool
public boolean drawDragBox()
drawDragBox
in class CursorTool
Copyright © 1996–2022 Geotools. All rights reserved.