prefuse.util.display
Class DisplayLib

java.lang.Object
  extended by prefuse.util.display.DisplayLib

public class DisplayLib
extends java.lang.Object

Library routines pertaining to a prefuse Display.

Author:
jeffrey heer

Method Summary
static void fitViewToBounds(Display display, java.awt.geom.Rectangle2D bounds, long duration)
          Set the display view such that the given bounds are within view.
static void fitViewToBounds(Display display, java.awt.geom.Rectangle2D bounds, java.awt.geom.Point2D center, long duration)
          Set the display view such that the given bounds are within view, subject to a given center point being maintained.
static java.awt.geom.Rectangle2D getBounds(java.util.Iterator iter, double margin)
          Get a bounding rectangle of the VisualItems in the input iterator.
static java.awt.geom.Rectangle2D getBounds(java.util.Iterator iter, double margin, java.awt.geom.Rectangle2D b)
          Get a bounding rectangle of the VisualItems in the input iterator.
static java.awt.geom.Point2D getCentroid(java.util.Iterator iter)
          Return the centroid (averaged location) of a group of items.
static java.awt.geom.Point2D getCentroid(java.util.Iterator iter, java.awt.geom.Point2D p)
          Return the centroid (averaged location) of a group of items.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getBounds

public static java.awt.geom.Rectangle2D getBounds(java.util.Iterator iter,
                                                  double margin,
                                                  java.awt.geom.Rectangle2D b)
Get a bounding rectangle of the VisualItems in the input iterator.

Parameters:
iter - an iterator of VisualItems
margin - a margin to add on to the bounding rectangle
b - the Rectangle instance in which to store the result
Returns:
the bounding rectangle. This is the same object as the parameter b.

getBounds

public static java.awt.geom.Rectangle2D getBounds(java.util.Iterator iter,
                                                  double margin)
Get a bounding rectangle of the VisualItems in the input iterator.

Parameters:
iter - an iterator of VisualItems
margin - a margin to add on to the bounding rectangle
Returns:
the bounding rectangle. A new Rectangle2D instance is allocated and returned.

getCentroid

public static java.awt.geom.Point2D getCentroid(java.util.Iterator iter,
                                                java.awt.geom.Point2D p)
Return the centroid (averaged location) of a group of items.

Parameters:
iter - an iterator of VisualItems
p - a Point2D instance in which to store the result
Returns:
the centroid point. This is the same object as the parameter p.

getCentroid

public static java.awt.geom.Point2D getCentroid(java.util.Iterator iter)
Return the centroid (averaged location) of a group of items.

Parameters:
iter - an iterator of VisualItems
Returns:
the centroid point. A new Point2D instance is allocated and returned.

fitViewToBounds

public static void fitViewToBounds(Display display,
                                   java.awt.geom.Rectangle2D bounds,
                                   long duration)
Set the display view such that the given bounds are within view.

Parameters:
display - the Display instance
bounds - the bounds that should be visible in the Display view
duration - the duration of an animated transition. A value of zero will result in an instantaneous change.

fitViewToBounds

public static void fitViewToBounds(Display display,
                                   java.awt.geom.Rectangle2D bounds,
                                   java.awt.geom.Point2D center,
                                   long duration)
Set the display view such that the given bounds are within view, subject to a given center point being maintained.

Parameters:
display - the Display instance
bounds - the bounds that should be visible in the Display view
center - the point that should be the center of the Display
duration - the duration of an animated transition. A value of zero will result in an instantaneous change.


Copyright © 2007 Regents of the University of California