org.openjump.core.ui.plugin.view
Class SuperZoomPanTool

java.lang.Object
  extended by com.vividsolutions.jump.workbench.ui.cursortool.AbstractCursorTool
      extended by com.vividsolutions.jump.workbench.ui.cursortool.DragTool
          extended by org.openjump.core.ui.plugin.view.SuperZoomPanTool
All Implemented Interfaces:
CursorTool, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.event.MouseWheelListener, java.util.EventListener

public class SuperZoomPanTool
extends DragTool
implements java.awt.event.MouseWheelListener

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

Nested Class Summary
 
Nested classes/interfaces inherited from class com.vividsolutions.jump.workbench.ui.cursortool.AbstractCursorTool
AbstractCursorTool.Listener
 
Field Summary
static java.awt.Cursor CURSOR_PAN
           
static java.awt.Cursor CURSOR_WHEEL
           
static java.awt.Cursor CURSOR_ZOOM
           
static double WHEEL_ZOOM_FACTOR
           
static double ZOOM_IN_FACTOR
           
 
Fields inherited from class com.vividsolutions.jump.workbench.ui.cursortool.DragTool
DEFAULT_VIEW_CLICK_BUFFER, modelDestination, modelSource
 
Fields inherited from class com.vividsolutions.jump.workbench.ui.cursortool.AbstractCursorTool
isLinuxOS, panel
 
Constructor Summary
SuperZoomPanTool()
           
 
Method Summary
 void activate(LayerViewPanel layerViewPanel)
           
 void cacheImage()
           
 java.awt.Image createImageIfNeeded(java.awt.Image currImage)
          Creates a new Image if currImage doesn't exist or is the wrong size for the panel.
 void deactivate()
           
protected  void gestureFinished()
           
 boolean getAnimatingZoom()
           
 java.awt.Cursor getCursor()
           
 javax.swing.Icon getIcon()
           
 java.lang.String getName()
          Returns a very brief description of this CursorTool.
protected  java.awt.Shape getShape()
           
protected  java.awt.Shape getShape(java.awt.geom.Point2D source, java.awt.geom.Point2D destination)
           
 boolean isRightMouseButtonUsed()
           
 void mouseClicked(java.awt.event.MouseEvent e)
           
 void mouseDragged(java.awt.event.MouseEvent e)
           
 void mouseMoved(java.awt.event.MouseEvent e)
           
 void mousePressed(java.awt.event.MouseEvent e)
          Begins handling of the drag.
 void mouseReleased(java.awt.event.MouseEvent e)
           
 void mouseWheelMoved(java.awt.event.MouseWheelEvent e)
           
 boolean setAnimatingZoom(boolean animating)
           
protected  void zoomAt(java.awt.geom.Point2D p, double zoomFactor, boolean animatingZoom)
           
 
Methods inherited from class com.vividsolutions.jump.workbench.ui.cursortool.DragTool
getBoxInModelCoordinates, getModelDestination, getModelSource, getViewDestination, getViewSource, modelClickBuffer, setModelDestination, setModelSource, setViewClickBuffer, setViewDestination, setViewSource, wasClick
 
Methods inherited from class com.vividsolutions.jump.workbench.ui.cursortool.AbstractCursorTool
add, allowSnapping, cancelGesture, check, cleanup, clearShape, createCursor, createCursor, createStandardSnappingPolicies, drawShapeXOR, drawShapeXOR, execute, fireGestureFinished, getColor, getPanel, getSnapManager, getTaskFrame, getWorkbench, isGestureInProgress, isRollingBackInvalidEdits, isShapeOnScreen, mouseEntered, mouseExited, name, redrawShape, reportNothingToUndoYet, setColor, setFilling, setStroke, setStrokeWidth, setup, snap, snap, toString, wasControlPressed, wasShiftPressed, workbench, workbenchFrame
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

WHEEL_ZOOM_FACTOR

public static final double WHEEL_ZOOM_FACTOR
See Also:
Constant Field Values

ZOOM_IN_FACTOR

public static final double ZOOM_IN_FACTOR
See Also:
Constant Field Values

CURSOR_ZOOM

public static java.awt.Cursor CURSOR_ZOOM

CURSOR_PAN

public static java.awt.Cursor CURSOR_PAN

CURSOR_WHEEL

public static java.awt.Cursor CURSOR_WHEEL
Constructor Detail

SuperZoomPanTool

public SuperZoomPanTool()
Method Detail

activate

public void activate(LayerViewPanel layerViewPanel)
Specified by:
activate in interface CursorTool
Overrides:
activate in class AbstractCursorTool

deactivate

public void deactivate()
Specified by:
deactivate in interface CursorTool
Overrides:
deactivate in class AbstractCursorTool

mouseWheelMoved

public void mouseWheelMoved(java.awt.event.MouseWheelEvent e)
Specified by:
mouseWheelMoved in interface java.awt.event.MouseWheelListener

getShape

protected java.awt.Shape getShape()
                           throws java.lang.Exception
Overrides:
getShape in class DragTool
Returns:
null if nothing should be drawn
Throws:
java.lang.Exception

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent e)
Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener
Overrides:
mouseMoved in class AbstractCursorTool

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Specified by:
mouseClicked in interface java.awt.event.MouseListener
Overrides:
mouseClicked in class AbstractCursorTool

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Description copied from class: DragTool
Begins handling of the drag. Subclasses can prevent handling of the drag by overriding this method and not calling it.

Specified by:
mousePressed in interface java.awt.event.MouseListener
Overrides:
mousePressed in class DragTool

isRightMouseButtonUsed

public boolean isRightMouseButtonUsed()
Specified by:
isRightMouseButtonUsed in interface CursorTool
Overrides:
isRightMouseButtonUsed in class AbstractCursorTool
Returns:
true if this CursorTool uses the right mouse button; false to allow the panel to show a popup-menu on right-clicks

getCursor

public java.awt.Cursor getCursor()
Specified by:
getCursor in interface CursorTool
Overrides:
getCursor in class AbstractCursorTool

getIcon

public javax.swing.Icon getIcon()
Specified by:
getIcon in interface CursorTool
Returns:
null to use a default icon

getName

public java.lang.String getName()
Description copied from interface: CursorTool
Returns a very brief description of this CursorTool.

Specified by:
getName in interface CursorTool
Overrides:
getName in class AbstractCursorTool
Returns:
the name of this CursorTool

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent e)
Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener
Overrides:
mouseDragged in class DragTool

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Specified by:
mouseReleased in interface java.awt.event.MouseListener
Overrides:
mouseReleased in class DragTool

getShape

protected java.awt.Shape getShape(java.awt.geom.Point2D source,
                                  java.awt.geom.Point2D destination)
Overrides:
getShape in class DragTool
Returns:
null if nothing should be drawn

gestureFinished

protected void gestureFinished()
                        throws java.awt.geom.NoninvertibleTransformException
Specified by:
gestureFinished in class AbstractCursorTool
Throws:
java.awt.geom.NoninvertibleTransformException

createImageIfNeeded

public java.awt.Image createImageIfNeeded(java.awt.Image currImage)
Creates a new Image if currImage doesn't exist or is the wrong size for the panel.

Parameters:
currImage - an image buffer
Returns:
a new image, or the existing one if it's compatible

cacheImage

public void cacheImage()

setAnimatingZoom

public boolean setAnimatingZoom(boolean animating)

getAnimatingZoom

public boolean getAnimatingZoom()

zoomAt

protected void zoomAt(java.awt.geom.Point2D p,
                      double zoomFactor,
                      boolean animatingZoom)
               throws java.awt.geom.NoninvertibleTransformException
Throws:
java.awt.geom.NoninvertibleTransformException