Class SuperZoomPanTool
java.lang.Object
com.vividsolutions.jump.workbench.ui.cursortool.AbstractCursorTool
com.vividsolutions.jump.workbench.ui.cursortool.DragTool
org.openjump.core.ui.plugin.view.SuperZoomPanTool
- All Implemented Interfaces:
CursorTool, MouseListener, MouseMotionListener, MouseWheelListener, EventListener
This tool have the following functions:
- zoom in/out with left/right mouse click
- pan with mouse drag
- zoom in/out with mousewheel and then left click for zoom or right click for cancel
In wheelMode you can see the new area after zooming. Also known as "Area of interest".
- Author:
- Matthias Scholz <ms@jammerhund.de>
-
Nested Class Summary
Nested classes/interfaces inherited from class AbstractCursorTool
AbstractCursorTool.Listener -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic Cursorstatic Cursorstatic Cursorstatic final intThe visual indicator (area of interest) is painted as an Image.static final intThe visual indicator (area of interest) is painted as a Shape.static final doublestatic final doubleFields inherited from class DragTool
DEFAULT_VIEW_CLICK_BUFFER, modelDestination, modelSourceFields inherited from class AbstractCursorTool
isLinuxOS, panel -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidactivate(LayerViewPanel layerViewPanel) voidcreateImageIfNeeded(Image currImage) Creates a new Image if currImage doesn't exist or is the wrong size for the panel.voidprotected voidbooleangetIcon()protected ImagegetImage()This method have to return an Image as a visual indicator.protected PointThis method have to return the position for the Image.intgetName()Returns a very brief description of this CursorTool.protected ShapegetShape()protected ShapebooleanvoidvoidvoidvoidBegins handling of the drag.voidvoidvoidRedraws the visual indicator.booleansetAnimatingZoom(boolean animating) voidsetIndicatorMode(int indicatorMode) Sets the indicatorMode.protected voidMethods inherited from class DragTool
getBoxInModelCoordinates, getModelDestination, getModelSource, getViewDestination, getViewSource, modelClickBuffer, setModelDestination, setModelSource, setViewClickBuffer, setViewDestination, setViewSource, wasClickMethods inherited from class AbstractCursorTool
add, allowSnapping, cancelGesture, check, cleanup, clearImage, clearShape, componentWithFocusIsHandledByCursorTools, createCursor, createCursor, createCursor, createStandardSnappingPolicies, drawImageXOR, drawImageXOR, drawShapeXOR, drawShapeXOR, execute, execute, fireGestureFinished, getColor, getPanel, getPanel, getSnapManager, getStroke, getTaskFrame, getWorkbench, getWorkbenchContext, isGestureInProgress, isRollingBackInvalidEdits, isShapeOnScreen, mouseEntered, mouseExited, name, prohibitSnapping, redrawImage, redrawShape, reportNothingToUndoYet, setColor, setControlPressed, setFilling, setPanel, setShiftPressed, setStroke, setup, snap, snap, supportsSnapping, toString, wasControlPressed, wasShiftPressed
-
Field Details
-
WHEEL_ZOOM_FACTOR
public static final double WHEEL_ZOOM_FACTOR- See Also:
-
ZOOM_IN_FACTOR
public static final double ZOOM_IN_FACTOR- See Also:
-
CURSOR_ZOOM
-
CURSOR_PAN
-
CURSOR_WHEEL
-
INDICATOR_MODE_SHAPE
public static final int INDICATOR_MODE_SHAPEThe visual indicator (area of interest) is painted as a Shape.- See Also:
-
INDICATOR_MODE_IMAGE
public static final int INDICATOR_MODE_IMAGEThe visual indicator (area of interest) is painted as an Image.- See Also:
-
-
Constructor Details
-
SuperZoomPanTool
-
-
Method Details
-
activate
- Specified by:
activatein interfaceCursorTool- Overrides:
activatein classAbstractCursorTool
-
deactivate
public void deactivate()- Specified by:
deactivatein interfaceCursorTool- Overrides:
deactivatein classDragTool
-
mouseWheelMoved
- Specified by:
mouseWheelMovedin interfaceMouseWheelListener
-
getShape
-
getImage
Description copied from class:AbstractCursorToolThis method have to return an Image as a visual indicator. Usually this method should to be abstract. But if we do this here, many other derived classes have to implement this method. Thereby we would break the compatibility for many other classes in OJ and 3rd party plugins.- Overrides:
getImagein classAbstractCursorTool- Returns:
- a Image or null if nothing should be drawn.
-
getImagePosition
Description copied from class:AbstractCursorToolThis method have to return the position for the Image. The position is the top left corner of the image for the Graphics2D.drawImage() method. This method is called after theAbstractCursorTool.getImage()method. For the abstract problematic please seeAbstractCursorTool.getImage().- Overrides:
getImagePositionin classAbstractCursorTool- Returns:
- the position for the Image
-
mouseMoved
- Specified by:
mouseMovedin interfaceMouseMotionListener- Overrides:
mouseMovedin classAbstractCursorTool
-
mouseClicked
- Specified by:
mouseClickedin interfaceMouseListener- Overrides:
mouseClickedin classAbstractCursorTool
-
mousePressed
Description copied from class:DragToolBegins handling of the drag. Subclasses can prevent handling of the drag by overriding this method and not calling it.- Specified by:
mousePressedin interfaceMouseListener- Overrides:
mousePressedin classDragTool
-
isRightMouseButtonUsed
public boolean isRightMouseButtonUsed()- Specified by:
isRightMouseButtonUsedin interfaceCursorTool- Overrides:
isRightMouseButtonUsedin classAbstractCursorTool- Returns:
- true if this CursorTool uses the right mouse button; false to allow the panel to show a popup-menu on right-clicks
-
getCursor
- Specified by:
getCursorin interfaceCursorTool- Overrides:
getCursorin classAbstractCursorTool
-
getIcon
- Specified by:
getIconin interfaceCursorTool- Returns:
- null to use a default icon
-
getName
Description copied from interface:CursorToolReturns a very brief description of this CursorTool.- Specified by:
getNamein interfaceCursorTool- Overrides:
getNamein classAbstractCursorTool- Returns:
- the name of this CursorTool
-
mouseDragged
- Specified by:
mouseDraggedin interfaceMouseMotionListener- Overrides:
mouseDraggedin classDragTool
-
mouseReleased
- Specified by:
mouseReleasedin interfaceMouseListener- Overrides:
mouseReleasedin classDragTool
-
getShape
-
gestureFinished
- Specified by:
gestureFinishedin classAbstractCursorTool- Throws:
NoninvertibleTransformException
-
createImageIfNeeded
-
cacheImage
public void cacheImage() -
setAnimatingZoom
public boolean setAnimatingZoom(boolean animating) -
getAnimatingZoom
public boolean getAnimatingZoom() -
zoomAt
protected void zoomAt(Point2D p, double zoomFactor, boolean animatingZoom) throws NoninvertibleTransformException - Throws:
NoninvertibleTransformException
-
redrawIndicator
public void redrawIndicator()Redraws the visual indicator. This can be a Shape or an Image. It depends of the indicatorMode value. -
getIndicatorMode
public int getIndicatorMode()- Returns:
- the indicatorMode
-
setIndicatorMode
public void setIndicatorMode(int indicatorMode) Sets the indicatorMode. Valid values areINDICATOR_MODE_SHAPE,INDICATOR_MODE_IMAGE.- Parameters:
indicatorMode- the indicatorMode to set
-