prefuse.action.layout.graph
Class RadialTreeLayout

java.lang.Object
  extended by prefuse.activity.Activity
      extended by prefuse.action.Action
          extended by prefuse.action.GroupAction
              extended by prefuse.action.layout.Layout
                  extended by prefuse.action.layout.graph.TreeLayout
                      extended by prefuse.action.layout.graph.RadialTreeLayout

public class RadialTreeLayout
extends TreeLayout

TreeLayout instance that computes a radial layout, laying out subsequent depth levels of a tree on circles of progressively increasing radius.

The algorithm used is that of Ka-Ping Yee, Danyel Fisher, Rachna Dhamija, and Marti Hearst in their research paper Animated Exploration of Dynamic Graphs with Radial Layout, InfoVis 2001. This algorithm computes a radial layout which factors in possible variation in sizes, and maintains both orientation and ordering constraints to facilitate smooth and understandable transitions between layout configurations.

Author:
jeffrey heer

Nested Class Summary
static class RadialTreeLayout.Params
          Wrapper class holding parameters used for each node in this layout.
 
Field Summary
static int DEFAULT_RADIUS
           
protected  boolean m_autoScale
           
protected  int m_maxDepth
           
protected  java.awt.geom.Point2D m_origin
           
protected  NodeItem m_prevRoot
           
protected  double m_radiusInc
           
protected  boolean m_setTheta
           
protected  double m_theta1
           
protected  double m_theta2
           
static java.lang.String PARAMS
          The data field in which the parameters used by this layout are stored.
static Schema PARAMS_SCHEMA
          The schema for the parameters used by this layout.
 
Fields inherited from class prefuse.action.layout.graph.TreeLayout
m_root
 
Fields inherited from class prefuse.action.layout.Layout
m_anchor, m_bounds, m_bpts, m_insets, m_margin, m_tmpa, m_tmpb
 
Fields inherited from class prefuse.action.GroupAction
m_group
 
Fields inherited from class prefuse.action.Action
m_vis
 
Fields inherited from class prefuse.activity.Activity
DEFAULT_STEP_TIME, INFINITY
 
Constructor Summary
RadialTreeLayout(java.lang.String group)
          Creates a new RadialTreeLayout.
RadialTreeLayout(java.lang.String group, int radius)
          Creates a new RadialTreeLayout using the specified radius increment between levels of the layout.
 
Method Summary
 boolean getAutoScale()
          Indicates if the layout automatically scales to fit the layout bounds.
 double getRadiusIncrement()
          Set the radius increment to use between concentric circles.
protected  void initSchema(TupleSet ts)
           
protected  void layout(NodeItem n, double r, double theta1, double theta2)
          Compute the layout.
 void run(double frac)
          Runs this Action, triggering whatever processing this Action performs.
 void setAngularBounds(double theta, double width)
          Constrains this layout to the specified angular sector
 void setAutoScale(boolean s)
          Set whether or not the layout should automatically scale itself to fit the layout bounds.
protected  void setPolarLocation(NodeItem n, NodeItem p, double r, double t)
          Set the position of the given node, given in polar co-ordinates.
 void setRadiusIncrement(double inc)
          Set the radius increment to use between concentric circles.
protected  void setScale(java.awt.geom.Rectangle2D bounds)
           
 
Methods inherited from class prefuse.action.layout.graph.TreeLayout
getLayoutRoot, setLayoutRoot
 
Methods inherited from class prefuse.action.layout.Layout
getLayoutAnchor, getLayoutBounds, setLayoutAnchor, setLayoutBounds, setMargin, setX, setY
 
Methods inherited from class prefuse.action.GroupAction
getGroup, setGroup
 
Methods inherited from class prefuse.action.Action
getVisualization, run, setVisualization
 
Methods inherited from class prefuse.activity.Activity
addActivityListener, alwaysRunAfter, cancel, fireActivityCancelled, fireActivityFinished, fireActivityScheduled, fireActivityStarted, fireActivityStepped, getDuration, getNextTime, getPace, getPacingFunction, getStartTime, getStepTime, getStopTime, isEnabled, isRunning, isScheduled, removeActivityListener, run, runAfter, runAt, setDuration, setEnabled, setPacingFunction, setStartTime, setStepTime
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_RADIUS

public static final int DEFAULT_RADIUS
See Also:
Constant Field Values

m_maxDepth

protected int m_maxDepth

m_radiusInc

protected double m_radiusInc

m_theta1

protected double m_theta1

m_theta2

protected double m_theta2

m_setTheta

protected boolean m_setTheta

m_autoScale

protected boolean m_autoScale

m_origin

protected java.awt.geom.Point2D m_origin

m_prevRoot

protected NodeItem m_prevRoot

PARAMS

public static final java.lang.String PARAMS
The data field in which the parameters used by this layout are stored.

See Also:
Constant Field Values

PARAMS_SCHEMA

public static final Schema PARAMS_SCHEMA
The schema for the parameters used by this layout.

Constructor Detail

RadialTreeLayout

public RadialTreeLayout(java.lang.String group)
Creates a new RadialTreeLayout. Automatic scaling of the radius values to fit the layout bounds is enabled by default.

Parameters:
group - the data group to process. This should resolve to either a Graph or Tree instance.

RadialTreeLayout

public RadialTreeLayout(java.lang.String group,
                        int radius)
Creates a new RadialTreeLayout using the specified radius increment between levels of the layout. Automatic scaling of the radius values is disabled by default.

Parameters:
group - the data group to process. This should resolve to either a Graph or Tree instance.
radius - the radius increment to use between subsequent rings in the layout.
Method Detail

getRadiusIncrement

public double getRadiusIncrement()
Set the radius increment to use between concentric circles. Note that this value is used only if auto-scaling is disabled.

Returns:
the radius increment between subsequent rings of the layout when auto-scaling is disabled

setRadiusIncrement

public void setRadiusIncrement(double inc)
Set the radius increment to use between concentric circles. Note that this value is used only if auto-scaling is disabled.

Parameters:
inc - the radius increment between subsequent rings of the layout
See Also:
setAutoScale(boolean)

getAutoScale

public boolean getAutoScale()
Indicates if the layout automatically scales to fit the layout bounds.

Returns:
true if auto-scaling is enabled, false otherwise

setAutoScale

public void setAutoScale(boolean s)
Set whether or not the layout should automatically scale itself to fit the layout bounds.

Parameters:
s - true to automatically scale to fit display, false otherwise

setAngularBounds

public void setAngularBounds(double theta,
                             double width)
Constrains this layout to the specified angular sector

Parameters:
theta - the starting angle, in radians
width - the angular width, in radians

run

public void run(double frac)
Description copied from class: Action
Runs this Action, triggering whatever processing this Action performs. Subclass this method to create custom Actions.

Specified by:
run in class GroupAction
Parameters:
frac - the fraction of this Action's duration that has elapsed.
See Also:
Action.run(double)

setScale

protected void setScale(java.awt.geom.Rectangle2D bounds)

layout

protected void layout(NodeItem n,
                      double r,
                      double theta1,
                      double theta2)
Compute the layout.

Parameters:
n - the root of the current subtree under consideration
r - the radius, current distance from the center
theta1 - the start (in radians) of this subtree's angular region
theta2 - the end (in radians) of this subtree's angular region

setPolarLocation

protected void setPolarLocation(NodeItem n,
                                NodeItem p,
                                double r,
                                double t)
Set the position of the given node, given in polar co-ordinates.

Parameters:
n - the NodeItem to set the position
p - the referrer parent NodeItem
r - the radius
t - the angle theta

initSchema

protected void initSchema(TupleSet ts)


Copyright © 2007 Regents of the University of California