prefuse.controls
Class AbstractZoomControl

java.lang.Object
  extended by prefuse.controls.ControlAdapter
      extended by prefuse.controls.AbstractZoomControl
All Implemented Interfaces:
java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.event.MouseWheelListener, java.util.EventListener, Control
Direct Known Subclasses:
WheelZoomControl, ZoomControl

public class AbstractZoomControl
extends ControlAdapter

Abstract base class for zoom controls.

Author:
jeffrey heer

Field Summary
static double DEFAULT_MAX_SCALE
           
static double DEFAULT_MIN_SCALE
           
protected  double m_maxScale
           
protected  double m_minScale
           
protected  boolean m_zoomOverItem
           
protected static int MAX_ZOOM
          Indicates the maximum allowed zoom level has been reached.
protected static int MIN_ZOOM
          Indicates the minimum allowed zoom level has been reached.
protected static int NO_ZOOM
          Indicates no zooming can be performed.
protected static int ZOOM
          Indicates a zoom operation completed successfully.
 
Fields inherited from interface prefuse.controls.Control
LEFT_MOUSE_BUTTON, MIDDLE_MOUSE_BUTTON, RIGHT_MOUSE_BUTTON
 
Constructor Summary
AbstractZoomControl()
           
 
Method Summary
 double getMaxScale()
          Gets the maximum scale value allowed by this zoom control
 double getMinScale()
          Gets the minimum scale value allowed by this zoom control
 boolean isZoomOverItem()
          Indicates if the zoom control will work while the mouse is over a VisualItem.
 void setMaxScale(double maxScale)
          Sets the maximum scale value allowed by this zoom control
 void setMinScale(double minScale)
          Sets the minimum scale value allowed by this zoom control
 void setZoomOverItem(boolean zoomOverItem)
          Determines if the zoom control will work while the mouse is over a VisualItem
protected  int zoom(Display display, java.awt.geom.Point2D p, double zoom, boolean abs)
          Zoom the given display at the given point by the zoom factor, in either absolute (item-space) or screen co-ordinates.
 
Methods inherited from class prefuse.controls.ControlAdapter
isEnabled, itemClicked, itemDragged, itemEntered, itemExited, itemKeyPressed, itemKeyReleased, itemKeyTyped, itemMoved, itemPressed, itemReleased, itemWheelMoved, keyPressed, keyReleased, keyTyped, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, mouseWheelMoved, setEnabled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_MIN_SCALE

public static final double DEFAULT_MIN_SCALE
See Also:
Constant Field Values

DEFAULT_MAX_SCALE

public static final double DEFAULT_MAX_SCALE
See Also:
Constant Field Values

ZOOM

protected static final int ZOOM
Indicates a zoom operation completed successfully.

See Also:
Constant Field Values

MIN_ZOOM

protected static final int MIN_ZOOM
Indicates the minimum allowed zoom level has been reached.

See Also:
Constant Field Values

MAX_ZOOM

protected static final int MAX_ZOOM
Indicates the maximum allowed zoom level has been reached.

See Also:
Constant Field Values

NO_ZOOM

protected static final int NO_ZOOM
Indicates no zooming can be performed. This is often due to a transformation activity in progress.

See Also:
Constant Field Values

m_minScale

protected double m_minScale

m_maxScale

protected double m_maxScale

m_zoomOverItem

protected boolean m_zoomOverItem
Constructor Detail

AbstractZoomControl

public AbstractZoomControl()
Method Detail

zoom

protected int zoom(Display display,
                   java.awt.geom.Point2D p,
                   double zoom,
                   boolean abs)
Zoom the given display at the given point by the zoom factor, in either absolute (item-space) or screen co-ordinates.

Parameters:
display - the Display to zoom
p - the point to center the zoom upon
zoom - the scale factor by which to zoom
abs - if true, the point p should be assumed to be in absolute coordinates, otherwise it will be treated as scree (pixel) coordinates
Returns:
a return code indicating the status of the zoom operation. One of ZOOM, NO_ZOOM, MIN_ZOOM, MAX_ZOOM.

getMaxScale

public double getMaxScale()
Gets the maximum scale value allowed by this zoom control

Returns:
the maximum scale value

setMaxScale

public void setMaxScale(double maxScale)
Sets the maximum scale value allowed by this zoom control

Parameters:
maxScale - the maximum scale value

getMinScale

public double getMinScale()
Gets the minimum scale value allowed by this zoom control

Returns:
the minimum scale value

setMinScale

public void setMinScale(double minScale)
Sets the minimum scale value allowed by this zoom control

Parameters:
minScale - the minimum scale value

isZoomOverItem

public boolean isZoomOverItem()
Indicates if the zoom control will work while the mouse is over a VisualItem.

Returns:
true if the control still operates over a VisualItem

setZoomOverItem

public void setZoomOverItem(boolean zoomOverItem)
Determines if the zoom control will work while the mouse is over a VisualItem

Parameters:
zoomOverItem - true to indicate the control operates over VisualItems, false otherwise


Copyright © 2007 Regents of the University of California