edu.umd.cs.jazz.event
Class ZoomEventHandler

java.lang.Object
  |
  +--edu.umd.cs.jazz.event.ZFilteredEventHandler
        |
        +--edu.umd.cs.jazz.event.ZDragSequenceEventHandler
              |
              +--edu.umd.cs.jazz.event.ZoomEventHandler
All Implemented Interfaces:
ZEventHandler

public class ZoomEventHandler
extends ZDragSequenceEventHandler

ZoomEventhandler provides event handlers for basic zooming of a Jazz camera with the right button. The interaction is that the initial mouse press defines the zoom anchor point, and then moving the mouse to the right zooms with a speed proportional to the amount the mouse is moved to the right of the anchor point. Similarly, if the mouse is moved to the left, the the camera is zoomed out.

This event handler will properly pan within internal cameras if the clicked within an internal camera.

Author:
Benjamin B. Bederson, Jesse Grosjean

Inner classes inherited from class edu.umd.cs.jazz.event.ZFilteredEventHandler
ZFilteredEventHandler.ZFilteredEventDispatcher
 
Fields inherited from class edu.umd.cs.jazz.event.ZFilteredEventHandler
fFilteredEventDispatcher, fMouseFilter
 
Constructor Summary
ZoomEventHandler(ZSceneGraphObject aFilteredMouseEventSource)
          Constructs a new ZoomEventHandler.
 
Method Summary
protected  void endDrag(ZMouseEvent e)
          When the dragging action ends invoke stopZooming.
protected  java.awt.geom.AffineTransform generateNextViewTransform()
          Return the next view transform for the current cameras zooming sequence.
 double getMaxMagnification()
          Return the max magnification that the zooming action is bound by.
 double getMinMagnification()
          Return the min magnification that the zooming action is bound by.
 ZMouseFilter getMouseFilter()
          Return the current event filter.
protected  boolean isZooming()
          Return if is zooming.
protected  void isZooming(boolean aBoolean)
          Set if is zooming.
 void setMaxMagnification(double aMagnification)
          Set the maximum magnification that the camera can be set to with this event handler.
 void setMinMagnification(double aMagnification)
          Set the minimum magnification that the camera can be set to with this event handler.
protected  void startDrag(ZMouseEvent e)
          When the dragging action starts invoke startZooming.
protected  void startZooming(ZMouseEvent e)
          Start zooming around the given mouse point with the interaction camera.
protected  void stopZooming(ZMouseEvent e)
          Stop animated zooming.
protected  void zoomOneStep()
          Do one zooming step, sleep a short amount, and schedule the next zooming step.
 
Methods inherited from class edu.umd.cs.jazz.event.ZDragSequenceEventHandler
drag, dragInScreenCoords, filteredMouseDragged, filteredMousePressed, filteredMouseReleased, getCurrentScreenDelta, getCurrentScreenPoint, getDragStartScreenPoint, getMinDragStartDistance, getMousePressedScreenPoint, getPreviousScreenPoint, isDragging, setIsDragging, setMinDragStartDistance, shouldStartDragInteraction
 
Methods inherited from class edu.umd.cs.jazz.event.ZFilteredEventHandler
filteredKeyPressed, filteredKeyReleased, filteredKeyTyped, filteredMouseClicked, filteredMouseEntered, filteredMouseExited, filteredMouseMoved, getCurrentFilteredMouseEvent, getCurrentSelection, getFilteredEventDispatcher, getFilteredKeyEventSource, getFilteredMouseEventSource, getInteractionCamera, getTopCamera, isActive, setActive, setFilteredKeyEventSource, setFilteredMouseEventSource, setMouseFilter, wantsKeyEvents, wantsMouseEvents, wantsMouseMotionEvents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ZoomEventHandler

public ZoomEventHandler(ZSceneGraphObject aFilteredMouseEventSource)
Constructs a new ZoomEventHandler.
Parameters:
aFilteredMouseEventSource - the source for filtered ZMouseEvents and ZMouseMotionEvents. See the ZFilteredEventHandler class comment to customize this behavior.
Method Detail

getMouseFilter

public ZMouseFilter getMouseFilter()
Return the current event filter. If no filter is specified then return a filter that only accepts BUTTON3 by default.
Overrides:
getMouseFilter in class ZFilteredEventHandler
Returns:
the filter that is currently in effect.

getMinMagnification

public double getMinMagnification()
Return the min magnification that the zooming action is bound by. The default value is 0.
Returns:
the min camera magnification.

setMinMagnification

public void setMinMagnification(double aMagnification)
Set the minimum magnification that the camera can be set to with this event handler. Setting the min mag to <= 0 disables this feature. If the min mag is set to a value which is greater than the current camera magnification, then the camera is left at its current magnification.
Parameters:
newMinMag - the new minimum magnification

getMaxMagnification

public double getMaxMagnification()
Return the max magnification that the zooming action is bound by. If the value is <= 0 then this feature is disabled. The default value is -1.
Returns:
the max camera magnification.

setMaxMagnification

public void setMaxMagnification(double aMagnification)
Set the maximum magnification that the camera can be set to with this event handler. Setting the max mag to <= 0 disables this feature. If the max mag if set to a value which is less than the current camera magnification, then the camera is left at its current magnification.
Parameters:
newMaxMag - the new maximum magnification

startDrag

protected void startDrag(ZMouseEvent e)
When the dragging action starts invoke startZooming.
Overrides:
startDrag in class ZDragSequenceEventHandler
Parameters:
the - event starting the drag.

endDrag

protected void endDrag(ZMouseEvent e)
When the dragging action ends invoke stopZooming.
Overrides:
endDrag in class ZDragSequenceEventHandler
Parameters:
the - event ending the drag.

startZooming

protected void startZooming(ZMouseEvent e)
Start zooming around the given mouse point with the interaction camera.
Parameters:
the - event starting the zoom.

zoomOneStep

protected void zoomOneStep()
Do one zooming step, sleep a short amount, and schedule the next zooming step. This effectively continuously zooms while still accepting input events so that the zoom center point can be changed, and zooming can be stopped.

stopZooming

protected void stopZooming(ZMouseEvent e)
Stop animated zooming.
Parameters:
the - event stopping the zoom.

isZooming

protected boolean isZooming()
Return if is zooming.
Returns:
true if new zoom steps are currently being scheduled.

isZooming

protected void isZooming(boolean aBoolean)
Set if is zooming.

generateNextViewTransform

protected java.awt.geom.AffineTransform generateNextViewTransform()
Return the next view transform for the current cameras zooming sequence.
Returns:
the next view transform for the zooming camera.


Copyright © 2001 by University of Maryland, College Park, MD 20742, USA All rights reserved.