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.
Modifier and Type | Class and Description |
---|---|
static class |
RadialTreeLayout.Params
Wrapper class holding parameters used for each node in this layout.
|
Modifier and Type | Field and Description |
---|---|
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.
|
m_root
m_anchor, m_bounds, m_bpts, m_insets, m_margin, m_tmpa, m_tmpb
m_group
DEFAULT_STEP_TIME, INFINITY
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
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) |
getLayoutRoot, setLayoutRoot
getLayoutAnchor, getLayoutBounds, setLayoutAnchor, setLayoutBounds, setMargin, setX, setY
getGroup, setGroup
getVisualization, run, setVisualization
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
public static final int DEFAULT_RADIUS
protected int m_maxDepth
protected double m_radiusInc
protected double m_theta1
protected double m_theta2
protected boolean m_setTheta
protected boolean m_autoScale
protected java.awt.geom.Point2D m_origin
protected NodeItem m_prevRoot
public static final java.lang.String PARAMS
public static final Schema PARAMS_SCHEMA
public RadialTreeLayout(java.lang.String group)
group
- the data group to process. This should resolve to
either a Graph or Tree instance.public RadialTreeLayout(java.lang.String group, int radius)
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.public double getRadiusIncrement()
public void setRadiusIncrement(double inc)
inc
- the radius increment between subsequent rings of the layoutsetAutoScale(boolean)
public boolean getAutoScale()
public void setAutoScale(boolean s)
s
- true to automatically scale to fit display, false otherwisepublic void setAngularBounds(double theta, double width)
theta
- the starting angle, in radianswidth
- the angular width, in radianspublic void run(double frac)
Action
run
in class GroupAction
frac
- the fraction of this Action's duration that has elapsed.Action.run(double)
protected void setScale(java.awt.geom.Rectangle2D bounds)
protected void layout(NodeItem n, double r, double theta1, double theta2)
n
- the root of the current subtree under considerationr
- the radius, current distance from the centertheta1
- the start (in radians) of this subtree's angular regiontheta2
- the end (in radians) of this subtree's angular regionprotected void setPolarLocation(NodeItem n, NodeItem p, double r, double t)
n
- the NodeItem to set the positionp
- the referrer parent NodeItemr
- the radiust
- the angle thetaprotected void initSchema(TupleSet ts)
Copyright ? 2013 Regents of the University of California