venice
Class VZoomEventHandler

java.lang.Object
  |
  +--venice.VZoomEventHandler
All Implemented Interfaces:
java.util.EventListener, java.io.Serializable, edu.umd.cs.jazz.event.ZEventHandler, edu.umd.cs.jazz.event.ZMouseListener, edu.umd.cs.jazz.event.ZMouseMotionListener

public class VZoomEventHandler
extends java.lang.Object
implements edu.umd.cs.jazz.event.ZEventHandler, edu.umd.cs.jazz.event.ZMouseListener, edu.umd.cs.jazz.event.ZMouseMotionListener, java.io.Serializable

VZoomEventhandler provides event handlers for basic zooming of a Jazz camera with the right and left buttons. The interaction is that the left button zooms in and right zooms out. Zooming volume can be changed. Class is derived from jazz ZoomEventHandler.

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

Warning: Serialized and ZSerialized objects of this class will not be compatible with future Jazz releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Jazz. A future release of Jazz will provide support for long term persistence.

THIS IS A MODIFIED VERSION OF ZOOMEVENTHANDLER FROM JAZZ CODE!

Author:
Benjamin B. Bederson, modified by Antti Pietarinen
See Also:
Serialized Form

Inner Class Summary
protected  class VZoomEventHandler.ZoomEventState
          Provides indirect access this event handlers private state.
 
Field Summary
private  boolean active
           
private  edu.umd.cs.jazz.ZCamera activeCamera
           
private  int allButton1Mask
           
private  int allButton3Mask
           
private  java.awt.geom.Point2D currentScreenPoint
           
private  double dx
           
private  boolean globallyActive
           
private  edu.umd.cs.jazz.ZCamera interactionCamera
           
private  boolean isZooming
           
private  double maxMag
           
private  double minMag
           
private  edu.umd.cs.jazz.ZNode node
           
private  java.awt.geom.Point2D pressObjectPoint
           
private  java.awt.geom.Point2D pressScreenPoint
           
private  VZoomEventHandler.ZoomEventState zoomEventState
           
 
Constructor Summary
VZoomEventHandler(edu.umd.cs.jazz.ZNode node)
          Constructs a new ZoomEventHandler.
VZoomEventHandler(edu.umd.cs.jazz.ZNode node, edu.umd.cs.jazz.ZCamera camera)
          Constructs a new ZoomEventHandler.
 
Method Summary
protected  java.awt.geom.AffineTransform generateNextViewTransform(VZoomEventHandler.ZoomEventState state, int in)
          Return the next view transform for the interaction cameras zooming sequence.
 boolean isActive()
          Determines if this event handler is active.
 void mouseClicked(edu.umd.cs.jazz.event.ZMouseEvent e)
          Invoked when the mouse has been clicked on a component.
 void mouseDragged(edu.umd.cs.jazz.event.ZMouseEvent e)
          Mouse drag event handler
 void mouseEntered(edu.umd.cs.jazz.event.ZMouseEvent e)
          Invoked when the mouse enters a component.
 void mouseExited(edu.umd.cs.jazz.event.ZMouseEvent e)
          Invoked when the mouse exits a component.
 void mouseMoved(edu.umd.cs.jazz.event.ZMouseEvent e)
          Invoked when the mouse button has been moved on a node (with no buttons no down).
 void mousePressed(edu.umd.cs.jazz.event.ZMouseEvent e)
          Mouse press event handler
 void mouseReleased(edu.umd.cs.jazz.event.ZMouseEvent e)
          Mouse release event handler
private  void readObject(java.io.ObjectInputStream in)
           
 void setActive(boolean active)
          Specifies whether this event handler is active or not.
 void setDx(int value)
           
 void setMaxMagnification(double newMaxMag)
          Set the maximum magnification that the camera can be set to with this event handler.
 void setMinMagnification(double newMinMag)
          Set the minimum magnification that the camera can be set to with this event handler.
 void startZooming(int in)
          Start animated zooming.
 void stopZooming()
          Stop animated zooming.
 void zoomOneStep(int in)
          Do one zooming step, sleep a short amount, and schedule the next zooming step.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

interactionCamera

private transient edu.umd.cs.jazz.ZCamera interactionCamera

currentScreenPoint

private transient java.awt.geom.Point2D currentScreenPoint

pressObjectPoint

private transient java.awt.geom.Point2D pressObjectPoint

pressScreenPoint

private transient java.awt.geom.Point2D pressScreenPoint

minMag

private double minMag

maxMag

private double maxMag

isZooming

private boolean isZooming

active

private boolean active

globallyActive

private boolean globallyActive

node

private edu.umd.cs.jazz.ZNode node

activeCamera

private edu.umd.cs.jazz.ZCamera activeCamera

zoomEventState

private VZoomEventHandler.ZoomEventState zoomEventState

dx

private double dx

allButton3Mask

private int allButton3Mask

allButton1Mask

private int allButton1Mask
Constructor Detail

VZoomEventHandler

public VZoomEventHandler(edu.umd.cs.jazz.ZNode node)
Constructs a new ZoomEventHandler.
Parameters:
node - The node this event handler attaches to.

VZoomEventHandler

public VZoomEventHandler(edu.umd.cs.jazz.ZNode node,
                         edu.umd.cs.jazz.ZCamera camera)
Constructs a new ZoomEventHandler.
Parameters:
node - The node this event handler attaches to.
camera - The camera to which this event handler attaches
Method Detail

setActive

public void setActive(boolean active)
Specifies whether this event handler is active or not.
Specified by:
setActive in interface edu.umd.cs.jazz.event.ZEventHandler
Parameters:
active - True to make this event handler active

isActive

public boolean isActive()
Determines if this event handler is active.
Specified by:
isActive in interface edu.umd.cs.jazz.event.ZEventHandler
Returns:
True if active

mousePressed

public void mousePressed(edu.umd.cs.jazz.event.ZMouseEvent e)
Mouse press event handler
Specified by:
mousePressed in interface edu.umd.cs.jazz.event.ZMouseListener
Parameters:
e - The event.

mouseDragged

public void mouseDragged(edu.umd.cs.jazz.event.ZMouseEvent e)
Mouse drag event handler
Specified by:
mouseDragged in interface edu.umd.cs.jazz.event.ZMouseMotionListener
Parameters:
e - The event.

mouseReleased

public void mouseReleased(edu.umd.cs.jazz.event.ZMouseEvent e)
Mouse release event handler
Specified by:
mouseReleased in interface edu.umd.cs.jazz.event.ZMouseListener
Parameters:
e - The event.

mouseEntered

public void mouseEntered(edu.umd.cs.jazz.event.ZMouseEvent e)
Invoked when the mouse enters a component.
Specified by:
mouseEntered in interface edu.umd.cs.jazz.event.ZMouseListener

mouseExited

public void mouseExited(edu.umd.cs.jazz.event.ZMouseEvent e)
Invoked when the mouse exits a component.
Specified by:
mouseExited in interface edu.umd.cs.jazz.event.ZMouseListener

mouseClicked

public void mouseClicked(edu.umd.cs.jazz.event.ZMouseEvent e)
Invoked when the mouse has been clicked on a component.
Specified by:
mouseClicked in interface edu.umd.cs.jazz.event.ZMouseListener

mouseMoved

public void mouseMoved(edu.umd.cs.jazz.event.ZMouseEvent e)
Invoked when the mouse button has been moved on a node (with no buttons no down).
Specified by:
mouseMoved in interface edu.umd.cs.jazz.event.ZMouseMotionListener

startZooming

public void startZooming(int in)
Start animated zooming.

setMinMagnification

public void setMinMagnification(double newMinMag)
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 if 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

setMaxMagnification

public void setMaxMagnification(double newMaxMag)
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

stopZooming

public void stopZooming()
Stop animated zooming.

zoomOneStep

public void zoomOneStep(int in)
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.

generateNextViewTransform

protected java.awt.geom.AffineTransform generateNextViewTransform(VZoomEventHandler.ZoomEventState state,
                                                                  int in)
Return the next view transform for the interaction cameras zooming sequence.
Parameters:
state - provides access to the current state of the event handler. ZoomEventState is declared as a protected inner class in ZoomEventHandler.

setDx

public void setDx(int value)

readObject

private void readObject(java.io.ObjectInputStream in)
                 throws java.io.IOException,
                        java.lang.ClassNotFoundException