|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.layout.CanonicMultiStageLayouter y.layout.tree.BalloonLayouter
public class BalloonLayouter
A tree layouter that lays out the subtrees of the tree in a balloon-like fashion.
Here is a sample layout output
Nested Class Summary | |
---|---|
static class |
BalloonLayouter.NodeInfo
Encapsulates information bound to a node during the algorithm calculates a layout |
Field Summary | |
---|---|
static byte |
CENTER_ROOT
Root node policy specifier constant. |
static byte |
CHILD_ORDERING_POLICY_COMPACT
Child ordering policy specifier constant. |
static byte |
CHILD_ORDERING_POLICY_SYMMETRIC
Child ordering policy specifier constant. |
static byte |
DIRECTED_ROOT
Root node policy specifier constant. |
protected LayoutGraph |
graph
The layout graph being acted upon. |
static byte |
WEIGHTED_CENTER_ROOT
Root node policy specifier constant. |
Fields inherited from interface y.layout.Layouter |
---|
EDGE_ID_DPKEY, NODE_ID_DPKEY, SELECTED_EDGES, SELECTED_NODES |
Constructor Summary | |
---|---|
BalloonLayouter()
|
Method Summary | |
---|---|
protected double |
calcAngles(Node root)
Calculates the angle wedge that has to be reserved for the subtree rooted at the given node. |
protected void |
calcChildArrangement(Node root)
Calculates the child nodes arrangement for a given root node of the tree. |
boolean |
canLayoutCore(LayoutGraph graph)
Returns true iff the core layouter can layout the given graph structure. |
protected Node |
determineRoot()
Determines the root node of graph according to the chosen root
node policy. |
void |
doLayoutCore(LayoutGraph graph)
Core layout routine. |
boolean |
getAllowOverlaps()
Returns whether or not to allow partially overlapping nodes. |
byte |
getChildOrderingPolicy()
Returns the current policy for sorting the children around the local roots. |
double |
getCompactnessFactor()
Returns the compactness factor for this layouter. |
Comparator |
getComparator()
Returns the Comparator that will be used
to sort the outgoing edges
of each local root in the tree before they are being arranged. |
protected BalloonLayouter.NodeInfo |
getInfo(Node v)
Returns the NodeInfo object that is associated with the given node while the layouter is active. |
int |
getMinimalEdgeLength()
Returns the minimal edge length that this layouter assigns to laid out edges. |
int |
getMinimalNodeDistance()
Returns the distance to keep between the nodes in the tree. |
int |
getPreferredChildWedge()
Returns the preferred child wedge angle. |
protected double |
getPreferredChildWedge(Node root)
Returns the preferred child wedge angle in degrees that is used for the children of the given root node. |
int |
getPreferredRootWedge()
Returns the preferred radial amount in degrees that stay unoccupied around the root node of the graph. |
byte |
getRootNodePolicy()
Returns the root node policy that determines which node is chosen as (virtual) tree root for the layout process. |
boolean |
isConsiderNodeLabelsEnabled()
Determines whether or not the layouter considers node labels for the next layout run. |
boolean |
isFromSketchModeEnabled()
Returns whether or not to take the coordinates of the input diagram into account when arranging the nodes of the elements of the tree. |
void |
setAllowOverlaps(boolean allow)
Specifies whether or not this layouter should allow (partially) overlapping nodes. |
void |
setChildOrderingPolicy(byte childOrderingPolicy)
Sets the policy for sorting the children around the local roots. |
void |
setCompactnessFactor(double factor)
Sets the compactness factor for this layouter. |
void |
setComparator(Comparator comparator)
Sets the Comparator that will be used
to sort the outgoing edges
of each local root in the tree before they are being arranged. |
void |
setConsiderNodeLabelsEnabled(boolean considerNodeLabelsEnabled)
Specifies whether or not the layouter considers node labels for the next layout run. |
void |
setFromSketchModeEnabled(boolean fromSketchModeEnabled)
Determines whether or not to take the coordinates of the input diagram into account when arranging the nodes of the elements of the tree. |
void |
setMinimalEdgeLength(int length)
Sets the minimal edge length that this layouter assigns to laid out edges. |
void |
setMinimalNodeDistance(int minimalNodeDistance)
Sets the minimal distance to keep between the nodes in the tree. |
void |
setPreferredChildWedge(int wedgeAngle)
Set the preferred radial amount in degrees that all child nodes may occupy around a parent node. |
void |
setPreferredRootWedge(int wedgeAngle)
Sets the preferred radial amount in degrees that stay unoccupied around the root node of the graph Allowed values lie within 0 and 360
degrees. |
void |
setRootNodePolicy(byte policy)
Sets the root node policy that determines which node is chosen as (virtual) tree root for the layout process. |
protected void |
sortChildNodes(Node root)
Sorts the child nodes of the given node. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final byte CHILD_ORDERING_POLICY_COMPACT
setChildOrderingPolicy(byte)
,
Constant Field Valuespublic static final byte CHILD_ORDERING_POLICY_SYMMETRIC
setChildOrderingPolicy(byte)
,
Constant Field Valuespublic static final byte DIRECTED_ROOT
public static final byte CENTER_ROOT
Trees.getCenterRoot(Graph)
,
Constant Field Valuespublic static final byte WEIGHTED_CENTER_ROOT
Trees.getCenterRoot(Graph)
,
Constant Field Valuesprotected LayoutGraph graph
Constructor Detail |
---|
public BalloonLayouter()
Method Detail |
---|
public Comparator getComparator()
Comparator
that will be used
to sort the outgoing edges
of each local root in the tree before they are being arranged.
The default value is null
which indicates that the algorithm should
use its built-in logic.
null
if the default
order should be used.setComparator(java.util.Comparator)
public void setComparator(Comparator comparator)
Comparator
that will be used
to sort the outgoing edges
of each local root in the tree before they are being arranged.
The default value is null
which indicates that the algorithm should
use its built-in logic.
comparator
- the new comparator to use or null
if the default
order should be used.getComparator()
public byte getChildOrderingPolicy()
CHILD_ORDERING_POLICY_COMPACT
and CHILD_ORDERING_POLICY_SYMMETRIC
.
Note: the policy is only considered if sketch mode is disabled (see method setFromSketchModeEnabled(boolean)
)
and no comparator is set (see method setComparator(java.util.Comparator)
).
public void setChildOrderingPolicy(byte childOrderingPolicy)
CHILD_ORDERING_POLICY_COMPACT
and CHILD_ORDERING_POLICY_SYMMETRIC
.
Note: the policy is only considered if sketch mode is disabled (see method setFromSketchModeEnabled(boolean)
)
and no comparator is set (see method setComparator(java.util.Comparator)
).
childOrderingPolicy
- the policy for sorting the childrenpublic int getMinimalNodeDistance()
public void setMinimalNodeDistance(int minimalNodeDistance)
setAllowOverlaps(boolean)
is set to true.
The default distance is 0.0.
setAllowOverlaps(boolean)
public boolean isFromSketchModeEnabled()
setFromSketchModeEnabled(boolean)
public void setFromSketchModeEnabled(boolean fromSketchModeEnabled)
public void setRootNodePolicy(byte policy)
DIRECTED_ROOT
is set.
policy
- one of DIRECTED_ROOT
, CENTER_ROOT
,
WEIGHTED_CENTER_ROOT
.public byte getRootNodePolicy()
setRootNodePolicy(byte)
public void setPreferredChildWedge(int wedgeAngle)
340
degrees which means that
the child nodes may radiate in almost any direction from a
parent node.
Allowed values lie within 0
and 360
degrees.
By default a child wedge of 340
degrees is used.
public void setPreferredRootWedge(int wedgeAngle)
0
and 360
degrees.
By default a root wedge of 360
degrees is used.
public int getPreferredRootWedge()
setPreferredRootWedge(int)
public int getPreferredChildWedge()
setPreferredChildWedge(int)
public void setAllowOverlaps(boolean allow)
false
.
public boolean getAllowOverlaps()
setAllowOverlaps(boolean)
public void setCompactnessFactor(double factor)
public double getCompactnessFactor()
setCompactnessFactor(double)
public void setMinimalEdgeLength(int length)
public int getMinimalEdgeLength()
setMinimalEdgeLength(int)
public boolean isConsiderNodeLabelsEnabled()
true
, if the layouter considers node labels for the next layout run, false
otherwise.setConsiderNodeLabelsEnabled(boolean)
public void setConsiderNodeLabelsEnabled(boolean considerNodeLabelsEnabled)
considerNodeLabelsEnabled
- true
, if the layouter shall consider node labels for the next layout
run, false
otherwise.public void doLayoutCore(LayoutGraph graph)
doLayoutCore
in class CanonicMultiStageLayouter
public boolean canLayoutCore(LayoutGraph graph)
canLayoutCore
in class CanonicMultiStageLayouter
protected BalloonLayouter.NodeInfo getInfo(Node v)
protected Node determineRoot()
graph
according to the chosen root
node policy.
graph
.getRootNodePolicy()
,
setRootNodePolicy(byte)
protected void calcChildArrangement(Node root)
protected void sortChildNodes(Node root)
fromSketchMode
is enabled.
Otherwise, it sorts the child nodes according to their wedge angle sizes, or, if present
uses the specified comparator
to sort the outgoing edges of
the local root node.
The biggest one receives median position in the sorting order.
The smaller the wedges the further away a node will be placed from the
median position.
This method gets called within method
calcChildArrangement(Node)
before coordinates are assigned and
just after the wedges sizes for all subgraphs rooted at root were determined.
protected double getPreferredChildWedge(Node root)
protected double calcAngles(Node root)
|
© Copyright 2000-2013, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |