ca.utoronto.cs.prefuseextensions.layout
Class StarburstLayout

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 ca.utoronto.cs.prefuseextensions.layout.StarburstLayout

public class StarburstLayout
extends prefuse.action.layout.graph.TreeLayout

TreeLayout instance that computes a radial space filling layout, laying out subsequent depth levels of a tree on circles of progressively increasing radius. Based on radial layout implementation for node-link diagrams by jeffrey heer.

Author:
Christopher Collins

Nested Class Summary
static class StarburstLayout.LabelLayout
          Set label positions.
static class StarburstLayout.ScaleFontAction
           
static class StarburstLayout.WidthType
           
 
Field Summary
static int DEFAULT_RADIUS
           
static prefuse.data.Schema PARAMS_SCHEMA
          The schema for the parameters used by this layout.
 boolean rootRadiusHalf
          Flag to set the radius of the root node to have the radius increment of the other nodes (looks better).
 
Fields inherited from class prefuse.activity.Activity
DEFAULT_STEP_TIME, INFINITY
 
Constructor Summary
StarburstLayout(java.lang.String group)
          Creates a new StarburstLayout.
StarburstLayout(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.
 StarburstLayout.WidthType getWidthType()
           
 void run(double frac)
           
 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.
 void setRadiusIncrement(double inc)
          Set the radius increment to use between concentric circles.
 void setWidthType(StarburstLayout.WidthType widthType, java.lang.String widthField)
          Set the width type, which defines how angular widths are divided among nodes.
 
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, setVisualization
 
Methods inherited from class prefuse.activity.Activity
addActivityListener, alwaysRunAfter, cancel, 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
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_RADIUS

public static final int DEFAULT_RADIUS
See Also:
Constant Field Values

rootRadiusHalf

public boolean rootRadiusHalf
Flag to set the radius of the root node to have the radius increment of the other nodes (looks better).


PARAMS_SCHEMA

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

Constructor Detail

StarburstLayout

public StarburstLayout(java.lang.String group)
Creates a new StarburstLayout. 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.

StarburstLayout

public StarburstLayout(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

setWidthType

public void setWidthType(StarburstLayout.WidthType widthType,
                         java.lang.String widthField)
Set the width type, which defines how angular widths are divided among nodes. Width can either be calculated based on the total number of children under a node (default behaviour) or can be based on scores assigned to the node within a field. If using scores assigned in a field, the total angular width of the parent is divided among children proportional to their normalized score (scores are normalized among all children of a given node).

Parameters:
widthType - the new widthType to use for layout
widthField - if widthType FIELD is selected, this is the name of the float data field from which to take the counts for calculating the width such that childValue/parentValue = fraction of parent angle assigned to child

getWidthType

public StarburstLayout.WidthType getWidthType()

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)
Specified by:
run in class prefuse.action.GroupAction
See Also:
Action.run(double)