Class ZoomInListenerImpl
- All Implemented Interfaces:
RectangleListener,ToolListener
Listener for doing a zoom in operation of the extent of the ViewPort of the associated MapControl
object, defining a rectangular area.
If the area defined is smaller than 3 pixels x 3 pixels holds the zoom, otherwise, calculates the new extent r
with this equations:
double factor = 1/MapContext.ZOOMINFACTOR;
Rectangle2D rect = event.getWorldCoordRect();
Rectangle2D.Double r = new Rectangle2D.Double();
ViewPort vp = mapCtrl.getMapContext().getViewPort();
double nuevoX = rect.getMaxX() - ((vp.getExtent().getWidth() * factor) / 2.0);
double nuevoY = rect.getMaxY() - ((vp.getExtent().getHeight() * factor) / 2.0);
Rectangle2D.Double r; // This will be the new extent
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 where display the graphical information.
- Author:
- Vicente Caballero Navarro
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionZoomInListenerImpl(MapControl mapCtrl) Creates a newZoomInListenerImplobject. -
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.voidrectangle(EnvelopeEvent event) Called when user executes a double click with the mouse, finishing the drawn of the rectangle.
-
Constructor Details
-
ZoomInListenerImpl
public ZoomInListenerImpl() -
ZoomInListenerImpl
Creates a new
ZoomInListenerImplobject.- Parameters:
mapCtrl- theMapControlwhere is defined the rectangle
-
-
Method Details
-
rectangle
Description copied from interface:RectangleListenerCalled when user executes a double click with the mouse, finishing the drawn of the rectangle.
All features of the active and vector layers of the associated
MapControlobject that their area intersect with the polygonal area defined in the event, will be selected.- Specified by:
rectanglein interfaceRectangleListener- Parameters:
event- mouse event and information about the rectangle defined
-
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
-