Class ZoomOutListenerImpl
- All Implemented Interfaces:
PointListener,ToolListener
Listener for doing a zoom out operation on the extent of the ViewPort of the associated MapControl
object, selecting a point of the MapControl by a single click of any mouse's button.
Calculates the new extent r with this equations:
ViewPort vp = mapControl.getMapContext().getViewPort();
Point2D p2 = vp.toMapPoint(event.getPoint());
double factor = 1/MapContext.ZOOMOUTFACTOR;
Rectangle2D.Double r = new Rectangle2D.Double();
double nuevoX = p2.getX() - ((vp.getExtent().getWidth() * factor) / 2.0);
double nuevoY = p2.getY() - ((vp.getExtent().getHeight() * factor) / 2.0);
r.x = nuevoX;
r.y = nuevoY;
r.width = vp.getExtent().getWidth() * factor;
r.height = vp.getExtent().getHeight() * factor;
vp.setExtent(r);
The ultimately extent will be an adaptation from that, calculated by the ViewPort
bearing in mind the ratio of the available rectangle.
- Author:
- Vicente Caballero Navarro
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionZoomOutListenerImpl(MapControl mapControl) Creates a newZoomOutListenerImplobject. -
Method Summary
Modifier and TypeMethodDescriptionbooleanDetermines if the drawing process that this tool executes on theMapControlinstance could be canceled or not.Gets theCursorassociated to this tool.voidpoint(PointEvent event) Called when one click is pressed on the associatedMapControl, or the location of the cursor of the mouse has changed on it.voidpointDoubleClick(PointEvent event) Called when a double click is pressed on the associatedMapControl.
-
Constructor Details
-
ZoomOutListenerImpl
Creates a new
ZoomOutListenerImplobject.- Parameters:
mapControl- theMapControlwhere will be applied the changes
-
-
Method Details
-
point
Description copied from interface:PointListenerCalled when one click is pressed on the associated
MapControl, or the location of the cursor of the mouse has changed on it.- Specified by:
pointin interfacePointListener- Parameters:
event- mouse event with the coordinates of the point selected on the associatedMapControl
-
getImageCursor
Description copied from interface:ToolListenerGets the
Cursorassociated to this tool.- Specified by:
getImageCursorin interfaceToolListener- Returns:
- component with the bitmap associated to this tool
-
cancelDrawing
public boolean cancelDrawing()Description copied from interface:ToolListenerDetermines if the drawing process that this tool executes on the
MapControlinstance could be canceled or not.- Specified by:
cancelDrawingin interfaceToolListener- Returns:
trueif is cancellable; otherwise returnsfalse
-
pointDoubleClick
Description copied from interface:PointListenerCalled when a double click is pressed on the associated
MapControl.- Specified by:
pointDoubleClickin interfacePointListener- Parameters:
event- mouse event and the coordinates of the point selected on the associatedMapControl
-