|
Search this API | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objecty.layout.CanonicMultiStageLayouter
y.layout.tree.BalloonLayouter
public class BalloonLayouter
A tree layout algorithm that arranges the subtrees of the tree in a balloon-like fashion.
BalloonLayouter is designed to arrange directed and undirected tree graphs. Subtrees rooted at a node
are placed in a radial fashion around their root node. All direct children of one node can be placed on a
common circle around their parent node (depending on the alignment policy).
Therefore, subtrees look like balloons or stars, especially if subtrees have similar sizes. The edges of the
tree are drawn as straight lines.

Sample balloon-drawing of a large tree obtained with default settings

Sample balloon-drawing featuring interleaved child placement and ray-like node labels
The algorithm executes the following steps:
root policy.
arrange the children rooted at the node.
Children are sorted according to a specified
ordering policy and a distance to their parent is chosen. This
distance will be chosen such that subtrees rooted at the current node fit into the
preferred wedge angle.
The wedge angle defines how much radial space a subtree occupies around its parent; it is computed
using the convex hull of subtrees.
Finally, the convex hull of the subtree rooted at the current node is updated in order to include all the convex hulls of child nodes. This is possible, because distances and wedges of the child subtrees are now known.
The algorithm features integrated edge labeling as well
as node labeling. Edge labels and node labels are placed
automatically without generating overlaps with other labels or graph elements. There are different
ways to place node labels. Edge labeling will take the settings of
PreferredPlacementDescriptor into account.
Defining a preferred wedge angle has a great influence on the layout style.
Subtrees rooted at a node get a certain amount of radial space to be placed around the parent node, such
that a preferred angle close to 360 degrees will generate drawings where subtrees look like
balloons, while an angle close to 180 degrees could be chosen to get drawings where subtrees look like
semicircles.
Since it is computationally not very complex, BalloonLayouter is very well suited for large tree graphs. It
performs well even for huge graphs.
Node types are considered such that the type of the nodes is used as a
criterion for sorting the child nodes of a local root node, with the effect that nodes of the same type
are placed consecutively, if possible.
If defined, the getComparator() is stronger than the node type criterion
However, the node types are considered more important than the
getChildOrderingPolicy().
This layout algorithm can only handle graphs with a tree structure. To apply it to a general graph, a
TreeReductionStage can be appended. This stage will temporarily remove some edges of the input graph until
a tree is obtained. These edges will later be reinserted and routed separately.
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
| Nested Class Summary | |
|---|---|
static class |
BalloonLayouter.NodeInfo
Encapsulates information bound to a node while the algorithm calculates a layout. |
| Field Summary | |
|---|---|
static byte |
CENTER_ROOT
Root node policy for choosing the center node as root node of the tree. |
static byte |
CHILD_ALIGNMENT_COMPACT
Alignment policy for aligning child nodes such that the distances to their parent are kept short and drawings can potentially become more compact. |
static byte |
CHILD_ALIGNMENT_PLAIN
Alignment policy to align child nodes rooted at the same parent such that the border of their convex hull has the same distance to the parent node's center. |
static byte |
CHILD_ALIGNMENT_SAME_CENTER
Alignment policy to align child nodes rooted at the same parent such that each child has the same center-to-center distance to the parent node. |
static byte |
CHILD_ALIGNMENT_SMART
Alignment policy to align child nodes rooted at the same parent using a mixture of the other policies and aiming to achieve symmetry and compactness at the same time. |
static byte |
CHILD_ORDERING_POLICY_COMPACT
Child ordering policy which orders child nodes depending on their subtree size such that large subtrees are placed next to small ones in order to save space. |
static byte |
CHILD_ORDERING_POLICY_SYMMETRIC
Child ordering policy which sorts the child nodes according to their wedge angles. |
static byte |
DIRECTED_ROOT
Root node policy for choosing a node with indegree 0 as root node of the tree. |
protected LayoutGraph |
graph
The layout graph being acted upon. |
static byte |
INTERLEAVED_MODE_ALL_NODES
A child placement mode where nodes are placed in an interleaved fashion, that is, with two different, alternating distances to the parent node. |
static byte |
INTERLEAVED_MODE_OFF
A child placement mode where all child nodes are placed around their parent with equal distances. |
static byte |
INTERLEAVED_MODE_SELECTED_NODES
A child placement mode where child nodes of selected nodes are placed in an interleaved fashion, that is, with two different, alternating distances to the parent node. |
static java.lang.Object |
INTERLEAVED_NODES_DPKEY
A DataProvider key for marking nodes whose child nodes should be placed in an interleaved fashion
This DataProvider allows to individually configure the interleaving feature for each node in the graph. |
static byte |
SELECTED_ROOT
Root node policy for choosing a custom node as the root node of the tree. |
static java.lang.Object |
SELECTED_ROOT_DPKEY
A DataProvider key for marking the node that will be used as root node of the tree.
|
static byte |
WEIGHTED_CENTER_ROOT
Root node policy for choosing a weighted center node as root node of the tree. |
| Fields inherited from interface y.layout.Layouter |
|---|
EDGE_ID_DPKEY, NODE_ID_DPKEY, NODE_TYPE_DPKEY, SELECTED_EDGES, SELECTED_NODES |
| Constructor Summary | |
|---|---|
BalloonLayouter()
Creates a new BalloonLayouter instance with default settings. |
|
| Method Summary | |
|---|---|
protected double |
calcAngles(Node root)
Calculates the wedge angle that has to be reserved for the subtree rooted at the given node. |
protected double |
calcAngles(Node root,
double scaleFactor)
Calculates the wedge angle that has to be reserved for the subtree rooted at the given node scaling the distance with the given scale factor. |
protected void |
calcChildArrangement(Node root)
Calculates a child node arrangement for a given root node of the tree. |
boolean |
canLayoutCore(LayoutGraph graph)
This layout algorithm accepts only graphs that are trees. |
protected Node |
determineRoot()
Determines the root node of graph according to the
chosen root node policy. |
void |
doLayoutCore(LayoutGraph graph)
Arranges the given graph as a tree graph in a balloon-like fashion. |
boolean |
getAllowOverlaps()
Returns whether or not (partially) overlapping nodes are allowed. |
byte |
getChildAlignmentPolicy()
Returns the child alignment policy for this layout algorithm. |
byte |
getChildOrderingPolicy()
Returns the child ordering policy for sorting the child nodes around their parents. |
double |
getCompactnessFactor()
Returns the factor defining how compact layout results will potentially be, where a smaller factor produces potentially more compact layouts. |
java.util.Comparator |
getComparator()
Returns the Comparator instance that determines the order of the outgoing edges for each node of the tree. |
double |
getEdgeLabelSpacing()
Returns the distance between edge labels belonging to the same edge as well as the distance of the edge labels to the target node of the edge. |
protected BalloonLayouter.NodeInfo |
getInfo(Node node)
Returns the BalloonLayouter.NodeInfo object associated with the given node while
the layout algorithm is active. |
byte |
getInterleavedMode()
Returns the mode for child node arrangement. |
int |
getMinimalEdgeLength()
Returns the minimum length that this layout algorithm assigns to edges of the graph. |
int |
getMinimalNodeDistance()
Returns the minimum distance to be kept between the nodes in the tree. |
byte |
getNodeLabelingPolicy()
Returns the policy defining how node labels are placed by the integrated node labeling mechanism (for example, the desired label orientation). |
double |
getNodeLabelSpacing()
Returns the distance between node labels belonging to the same node. |
int |
getPreferredChildWedge()
Gets the preferred radial amount (wedge) in degrees that child nodes may in total occupy around their parent node. |
protected double |
getPreferredChildWedge(Node root)
Returns the preferred radial amount (wedge) in degrees that child nodes may in total occupy around the given node. |
int |
getPreferredRootWedge()
Gets the preferred radial amount (wedge) in degrees that child nodes may in total occupy around the global root. |
byte |
getRootNodePolicy()
Returns the root node selection policy of this layout algorithm. |
boolean |
isChainStraighteningModeEnabled()
Returns whether or not chains are drawn straight or not. |
boolean |
isConsiderNodeLabelsEnabled()
Returns whether or not the layout algorithm reserves space for node labels. |
boolean |
isFromSketchModeEnabled()
Returns whether or not to consider the given coordinates of the input diagram when arranging the tree. |
boolean |
isIntegratedEdgeLabelingEnabled()
Returns whether or not the layout algorithm automatically places edge labels. |
boolean |
isIntegratedNodeLabelingEnabled()
Returns whether or not the layout algorithm automatically places node labels. |
void |
setAllowOverlaps(boolean allow)
Specifies whether or not (partially) overlapping nodes are allowed. |
void |
setChainStraighteningModeEnabled(boolean chainStraighteningModeEnabled)
Specifies whether or not chains are drawn straight or not. |
void |
setChildAlignmentPolicy(byte childAlignmentPolicy)
Specifies the child alignment policy for this layout algorithm. |
void |
setChildOrderingPolicy(byte childOrderingPolicy)
Sets the child ordering policy for sorting the child nodes around their parents. |
void |
setCompactnessFactor(double factor)
Specifies the factor defining how compact layout results will potentially be, where a smaller factor produces potentially more compact layouts. |
void |
setComparator(java.util.Comparator comparator)
Sets the Comparator instance that determines the order of the outgoing edges for each node of the tree. |
void |
setComponentLayouterEnabled(boolean enabled)
Specifies whether or not the LayoutStage used for arranging the components of the graph is activated. |
void |
setConsiderNodeLabelsEnabled(boolean considerNodeLabelsEnabled)
Specifies whether or not the layout algorithm reserves space for node labels. |
void |
setEdgeLabelSpacing(double edgeLabelSpacing)
Specifies the distance between edge labels belonging to the same edge as well as the distance of the edge labels to the target node of the edge. |
void |
setFromSketchModeEnabled(boolean fromSketchModeEnabled)
Specifies whether or not to consider the given coordinates of the input diagram when arranging the tree. |
void |
setGroupNodeHidingEnabled(boolean groupNodeHidingEnabled)
Specifies whether or not the LayoutStage used for hiding group nodes is activated. |
void |
setIntegratedEdgeLabelingEnabled(boolean integratedEdgeLabelingEnabled)
Specifies whether or not the layout algorithm automatically places edge labels. |
void |
setIntegratedNodeLabelingEnabled(boolean integratedNodeLabelingEnabled)
Specifies whether or not the layout algorithm automatically places node labels. |
void |
setInterleavedMode(byte interleavedMode)
Specifies the mode for child node arrangement. |
void |
setMinimalEdgeLength(int length)
Sets the minimum length that this layout algorithm assigns to edges of the graph. |
void |
setMinimalNodeDistance(int minimalNodeDistance)
Sets the minimum distance to be kept between the nodes in the tree. |
void |
setNodeLabelingPolicy(byte nodeLabelingPolicy)
Specifies the policy defining how node labels are placed by the integrated node labeling mechanism (for example, the desired label orientation). |
void |
setNodeLabelSpacing(double nodeLabelSpacing)
Specifies the distance between node labels belonging to the same node. |
void |
setOrientationLayouterEnabled(boolean enabled)
Specifies whether or not the LayoutStage that modifies the orientation of the layout is activated. |
void |
setParallelEdgeLayouterEnabled(boolean enabled)
Specifies whether or not the LayoutStage used for routing parallel edges is activated. |
void |
setPreferredChildWedge(int wedgeAngle)
Sets the preferred radial amount (wedge) in degrees that child nodes may in total occupy around their parent node. |
void |
setPreferredRootWedge(int wedgeAngle)
Sets the preferred radial amount (wedge) in degrees that child nodes may in total occupy around the global root. |
void |
setRootNodePolicy(byte policy)
Specifies the root node selection policy of this layout algorithm. |
void |
setSelfLoopLayouterEnabled(boolean enabled)
Specifies whether or not the LayoutStage used for routing self-loops is activated. |
protected void |
sortChildNodes(Node root)
Sorts the child nodes (successors) 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 java.lang.Object INTERLEAVED_NODES_DPKEY
DataProvider key for marking nodes whose child nodes should be placed in an interleaved fashion
This DataProvider allows to individually configure the interleaving feature for each node in the graph.
DataProvider is only considered if the interleaved
mode is set to INTERLEAVED_MODE_SELECTED_NODES.setInterleavedMode(byte)public static final byte INTERLEAVED_MODE_OFF
public static final byte INTERLEAVED_MODE_ALL_NODES
public static final byte INTERLEAVED_MODE_SELECTED_NODES
All other nodes are placed without interleaving. The node selection can be specified by registering an
appropriate DataProvider for key INTERLEAVED_NODES_DPKEY.
public static final byte CHILD_ALIGNMENT_PLAIN
public static final byte CHILD_ALIGNMENT_SAME_CENTER
All nodes will be placed on a common radius around their parent, respective to their center coordinates.
public static final byte CHILD_ALIGNMENT_COMPACT
This policy realizes the exact same child alignment as CHILD_ALIGNMENT_PLAIN if there are
no edge labels associated with edges going to child nodes or if
integrated edge labeling is disabled.
If edge labels need to be considered, edge labels will be added to the convex hull of the child node to which the edge connects. This means that child nodes connected with a labeled edge will be aligned at the border where the edge label begins. In consequence, edge labels will be aligned with neighboring edge labels as well as neighboring child nodes if a child node has no edge label at its incoming edge.
This alignment strategy is especially effective if large edge labels need to be considered while drawings should still be compact and distances from parent to child nodes short.
public static final byte CHILD_ALIGNMENT_SMART
Similar to CHILD_ALIGNMENT_SAME_CENTER, this policy aims to achieve alignments featuring equal
distances between parent and child node centers. However, a much larger distance for all child nodes
caused by single large subtrees is avoided by this policy. In such cases, the smaller subtrees
may be placed on a common radius and the large subtrees are placed with different distances.
getInterleavedMode(). In that case, a
plain child alignment will be applied instead.setChildAlignmentPolicy(byte),
Constant Field Valuespublic static final byte CHILD_ORDERING_POLICY_COMPACT
The actual area of a subtree is used as the subtree size. The smallest subtree is placed next to the largest subtree, followed by the second smallest subtree and so on. This way, drawings can become more compact, because the adjacent placement of large subtrees is avoided (which would require edges to become longer for subtrees to fit next to each other).
public static final byte CHILD_ORDERING_POLICY_SYMMETRIC
The node with the greatest angle gets median position in the sorting order. The smaller the wedges, the farther away a node will be placed from the median position. Using this policy, the produced results are often more symmetric.
public static final byte DIRECTED_ROOT
0 as root node of the tree.
The selection of the root node will happen according to Trees.getRoot(Graph).
public static final byte CENTER_ROOT
A center node induces a minimum depth tree when
being used as the root of that tree.
public static final byte WEIGHTED_CENTER_ROOT
A weighted center node is a node which is part of the
greatest number of all undirected paths in a graph.
public static final byte SELECTED_ROOT
The root node is specified using a DataProvider registered
with the graph with key SELECTED_ROOT_DPKEY.
public static final java.lang.Object SELECTED_ROOT_DPKEY
DataProvider key for marking the node that will be used as root node of the tree.
DataProvider is only considered if the
root node policy is set to SELECTED_ROOT.setRootNodePolicy(byte)protected LayoutGraph graph
| Constructor Detail |
|---|
public BalloonLayouter()
BalloonLayouter instance with default settings.
| Method Detail |
|---|
public java.util.Comparator getComparator()
Comparator instance that determines the order of the outgoing edges for each node of the tree.
If no Comparator is specified (i.e. the Comparator is null), the outgoing edges
will be sorted
according to the current child ordering policy.
From Sketch mode is enabled, the specified
comparator does not have any effect.Comparator instance to sort outgoing edges or null if edges are
sorted according to the child ordering policysetComparator(Comparator),
setChildOrderingPolicy(byte),
setFromSketchModeEnabled(boolean)public void setComparator(java.util.Comparator comparator)
Comparator instance that determines the order of the outgoing edges for each node of the tree.
If no Comparator is specified (i.e. the Comparator is null), the outgoing edges
will be sorted
according to the current child ordering policy.
From Sketch mode is enabled, the specified
comparator does not have any effect.comparator - a Comparator instance to sort outgoing edges or null if edges should be
sorted according to the child ordering policysetChildOrderingPolicy(byte),
setFromSketchModeEnabled(boolean)public byte getChildOrderingPolicy()
The sorting policy can affect the compactness of drawings. Advantageous orderings allow adjacent subtrees to be close together and can thus make the whole layout more compact.
From Sketch mode is enabled.setChildOrderingPolicy(byte),
setFromSketchModeEnabled(boolean),
setComparator(Comparator)public void setChildOrderingPolicy(byte childOrderingPolicy)
The sorting policy can affect the compactness of drawings. Advantageous orderings allow adjacent subtrees to be close together and can thus make the whole layout more compact.
From Sketch mode is enabled.CHILD_ORDERING_POLICY_COMPACTchildOrderingPolicy - one of the predefined child ordering policies
java.lang.IllegalArgumentException - if an unknown ordering policy is givensetFromSketchModeEnabled(boolean),
setComparator(Comparator)public int getMinimalNodeDistance()
The distance needs to be a non-negative integer value.
allowed.setMinimalNodeDistance(int),
setAllowOverlaps(boolean)public void setMinimalNodeDistance(int minimalNodeDistance)
The distance needs to be a non-negative integer value.
allowed.minimalNodeDistance - the non-negative minimum node distance
java.lang.IllegalArgumentException - if the given minimum distance is negativesetAllowOverlaps(boolean)![]() Minimum distance 0 (default) | ![]() Minimum distance 60 |
public boolean isFromSketchModeEnabled()
Enabling this feature, the original circular order of child nodes around their parent nodes will be maintained according to the initial coordinates when determining the order of the child nodes.
true if the initial coordinates of the nodes are considered,
false otherwisesetFromSketchModeEnabled(boolean)public void setFromSketchModeEnabled(boolean fromSketchModeEnabled)
Enabling this feature, the original circular order of child nodes around their parent nodes will be maintained according to the initial coordinates when determining the order of the child nodes.
fromSketchModeEnabled - true if the initial coordinates of the nodes should be considered,
false otherwise![]() Example of initial graph with child ordering from smallest to largest node | ![]() true - the initial ordering was maintained | ![]() false - the initial ordering was not maintained |
public void setRootNodePolicy(byte policy)
The policy determines which node is chosen as (virtual) tree root during the layout process.
DIRECTED_ROOTpolicy - one of the predefined root node policies
java.lang.IllegalArgumentException - if an unknown root node policy is givenpublic byte getRootNodePolicy()
The policy determines which node is chosen as (virtual) tree root during the layout process.
setRootNodePolicy(byte)public void setPreferredChildWedge(int wedgeAngle)
The wedge angle controls the degree to which the child nodes may radiate from the center of layout.
A value close to 360 means that the child nodes may radiate in (almost) any direction from their
parent node, edge lengths can in consequence stay rather small. On the other hand, a small value means that
children are restricted to a small angle; thus, edge lengths (and drawings) may become large.
The minimum allowed wedge angle is 1 and the maximum allowed value is 359.
360 is needed.setPreferredRootWedge(int).wedgeAngle - the preferred wedge angle in degrees from the interval [1,359]
java.lang.IllegalArgumentException - if the given angle is smaller than 1 or larger than 359setPreferredRootWedge(int)![]() Child wedge angle 359 (same for root node) | ![]() Child wedge angle 180 (359 for the root node) | ![]() Child wedge angle 90 (359 for the root node) |
public void setPreferredRootWedge(int wedgeAngle)
This property allows to separately control the wedge angle for the designated root node of the tree,
while setPreferredChildWedge(int) controls the angles of all child nodes. The root node will
be determined depending on the root node policy.
The minimum allowed root wedge angle is 1 and the maximum allowed value is 360.
wedgeAngle - the preferred wedge angle in degrees from the interval [1,360]
java.lang.IllegalArgumentException - if the given angle is smaller than 1 or larger than 360setPreferredChildWedge(int)![]() Root wedge angle 180 | ![]() Root wedge angle 360 |
public int getPreferredRootWedge()
This property allows to separately control the wedge angle for the designated root node of the tree,
while setPreferredChildWedge(int) controls the angles of all child nodes. The root node will
be determined depending on the root node policy.
The minimum allowed root wedge angle is 1 and the maximum allowed value is 360.
[1,360]setPreferredRootWedge(int),
setPreferredChildWedge(int)public int getPreferredChildWedge()
The wedge angle controls the degree to which the child nodes may radiate from the center of layout.
A value close to 360 means that the child nodes may radiate in (almost) any direction from their
parent node, edge lengths can in consequence stay rather small. On the other hand, a small value means that
children are restricted to a small angle; thus, edge lengths (and drawings) may become large.
The minimum allowed wedge angle is 1 and the maximum allowed value is 359.
[1,359]setPreferredChildWedge(int),
setPreferredRootWedge(int)public void setAllowOverlaps(boolean allow)
If overlaps are allowed, the resulting layouts can become significantly more compact. Overlaps will mostly occur at the borders of nodes. Nodes will not be totally covered by other nodes.
allow - true if node overlaps should be allowed, false otherwise![]() false | ![]() true |
public boolean getAllowOverlaps()
If overlaps are allowed, the resulting layouts can become significantly more compact. Overlaps will mostly occur at the borders of nodes. Nodes will not be totally covered by other nodes.
true if node overlaps are allowed, false otherwisesetAllowOverlaps(boolean)public void setCompactnessFactor(double factor)
The algorithm tries to optimize the child node arrangement around each tree node such that each subtree
is as close to its root as possible, while still fitting into the preferred
wedge angle and not overlapping with adjacent subtrees.
High compactness factor values induce the optimization procedure to be less strict and accept less optimal results, while low factor values mean that the optimization will only stop when being nearly optimal. Thus, lower values lead to a potentially higher runtime.
The minimum factor value is 0.05 and the maximum is 1.0.
factor - the compactness factor from the interval [0.05, 1.0]
java.lang.IllegalArgumentException - if the factor is smaller than 0.05 or greater than 1.0public double getCompactnessFactor()
The algorithm tries to optimize the child node arrangement around each tree node such that each subtree
is as close to its root as possible, while still fitting into the preferred
wedge angle and not overlapping with adjacent subtrees.
High compactness factor values induce the optimization procedure to be less strict and accept less optimal results, while low factor values mean that the optimization will only stop when being nearly optimal. Thus, lower values lead to a potentially higher runtime.
The minimum factor value is 0.05 and the maximum is 1.0.
setCompactnessFactor(double)public void setMinimalEdgeLength(int length)
A lower minimum edge length allows generally more compact layouts. It has the highest effect if most nodes of the graph have a low degree, as the minimum can potentially be met for such graphs.
The minimum length must be non-negative.
length - the non-negative minimum edge length
java.lang.IllegalArgumentException - if the given length is negative![]() 20 | ![]() 60 |
public int getMinimalEdgeLength()
A lower minimum edge length allows generally more compact layouts. It has the highest effect if most nodes of the graph have a low degree, as the minimum can potentially be met for such graphs.
The minimum length must be non-negative.
setMinimalEdgeLength(int)public boolean isConsiderNodeLabelsEnabled()
The size of nodes will temporarily be adjusted such that the label is included. Therefore, result drawings may get significantly larger if this feature is enabled.
layout orientation
is set to LayoutOrientation.TOP_TO_BOTTOM (which is the default).
Changing the layout orientation for an undirected layout algorithm like the
BalloonLayouter doesn't make sense.true if node labels are considered, false otherwisesetConsiderNodeLabelsEnabled(boolean)public void setConsiderNodeLabelsEnabled(boolean considerNodeLabelsEnabled)
The size of nodes will temporarily be adjusted such that the label is included. Therefore, result drawings may get significantly larger if this feature is enabled.
layout orientation
is set to LayoutOrientation.TOP_TO_BOTTOM (which is the default).
Changing the layout orientation for an undirected layout algorithm like the
BalloonLayouter doesn't make sense.integrated node labeling
mechanism is disabled.considerNodeLabelsEnabled - true if node labels should be considered,
false otherwise![]() false | ![]() true |
public byte getInterleavedMode()
Child nodes are either placed interleaved or on a single layer around their parent node. Interleaved placement means that child nodes are placed around their common parent in two different layers in an alternating fashion. For example, the first child is on the inner layer, the second child on the outer layer, the third one again on the inner layer, etc.
Independent of this mode, the alignment of child nodes on the same layer is still defined by
the alignment policy. However, CHILD_ALIGNMENT_SMART is only
supported for non-interleaved arrangement.
ordering policy to have no more effect for those nodes.setInterleavedMode(byte),
setChildAlignmentPolicy(byte)public void setInterleavedMode(byte interleavedMode)
Child nodes are either placed interleaved or on a single layer around their parent node. Interleaved placement means that child nodes are placed around their common parent in two different layers in an alternating fashion. For example, the first child is on the inner layer, the second child on the outer layer, the third one again on the inner layer, etc.
Independent of this mode, the alignment of child nodes on the same layer is still defined by
the alignment policy. However, CHILD_ALIGNMENT_SMART is only
supported for non-interleaved arrangement.
ordering policy to have no more effect for those nodes.INTERLEAVED_MODE_OFF. Interleaved placement is disabled.interleavedMode - the mode for interleaved child node arrangement
java.lang.IllegalArgumentException - if an unknown mode for interleaved arrangement is givensetChildAlignmentPolicy(byte)public byte getChildAlignmentPolicy()
This policy influences the distance of child nodes to their parent nodes and the alignment of children with the same parent.
integrated
labeling is enabled.setChildAlignmentPolicy(byte)public void setChildAlignmentPolicy(byte childAlignmentPolicy)
This policy influences the distance of child nodes to their parent nodes and the alignment of children with the same parent.
integrated
labeling is enabled.CHILD_ALIGNMENT_COMPACTchildAlignmentPolicy - one of the predefined child alignment policies
java.lang.IllegalArgumentException - if an unknown policy is givenpublic boolean isIntegratedNodeLabelingEnabled()
If enabled, this layout algorithm will calculate the positions for the node labels assuring that no overlaps occur.
Different labeling strategies may be selected using setNodeLabelingPolicy(byte).
FreeNodeLabelModel
as the NodeLabelModel for the nodes.consideration mechanism has no more effect.true if integrated node labeling is enabled,
false otherwise.setIntegratedNodeLabelingEnabled(boolean)public void setIntegratedNodeLabelingEnabled(boolean integratedNodeLabelingEnabled)
If enabled, this layout algorithm will calculate the positions for the node labels assuring that no overlaps occur.
Different labeling strategies may be selected using setNodeLabelingPolicy(byte).
FreeNodeLabelModel
as the NodeLabelModel for the nodes.consideration mechanism has no more effect.integratedNodeLabelingEnabled - true if integrated node labeling should be enabled,
false otherwise.setNodeLabelingPolicy(byte)![]() false - Note that assumed label positions before the layout run were not changed | ![]() true - Labels were automatically placed |
public boolean isIntegratedEdgeLabelingEnabled()
If enabled, this layout algorithm will calculate the positions for the edge labels assuring that no overlaps occur.
FreeEdgeLabelModel
as the EdgeLabelModel for the edges.true if integrated edge labeling is enabled,
false otherwise.setIntegratedEdgeLabelingEnabled(boolean)public void setIntegratedEdgeLabelingEnabled(boolean integratedEdgeLabelingEnabled)
If enabled, this layout algorithm will calculate the positions for the edge labels assuring that no overlaps occur.
FreeEdgeLabelModel
as the EdgeLabelModel for the edges.chain straightening, because
edge labels (especially large ones) may lead to significantly non-straight node chains.integratedEdgeLabelingEnabled - true if integrated edge labeling should be enabled,
false otherwise.![]() false | ![]() true |
public byte getNodeLabelingPolicy()
integrated
node labeling is enabled.setNodeLabelingPolicy(byte),
setIntegratedNodeLabelingEnabled(boolean)public void setNodeLabelingPolicy(byte nodeLabelingPolicy)
integrated
node labeling is enabled.NodeLabelingPolicy.NODE_LABELING_RAYLIKEnodeLabelingPolicy - one of the predefined node labeling policies
java.lang.IllegalArgumentException - if an unknown labeling policy is givensetIntegratedNodeLabelingEnabled(boolean)public void setNodeLabelSpacing(double nodeLabelSpacing)
It also defines the distance between labels and the node they belong to in case of label placement
outside of the node (e.g. for ray-like label placement).
The spacing must have a non-negative value.
0, node labels will be maximally close to each other and to their node.integrated node labeling is enabled.nodeLabelSpacing - the non-negative node label spacing
java.lang.IllegalArgumentException - if the given spacing value is negativeisIntegratedNodeLabelingEnabled()![]() Default node label spacing of 4.0 | ![]() Node label spacing set to 16.0 |
public double getNodeLabelSpacing()
It also defines the distance between labels and the node they belong to in case of label placement
outside of the node (e.g. for ray-like label placement).
The spacing must have a non-negative value.
integrated node labeling is enabled.setIntegratedNodeLabelingEnabled(boolean),
setNodeLabelSpacing(double)public void setEdgeLabelSpacing(double edgeLabelSpacing)
The spacing must have a non-negative value.
0, labels will touch each other and the target node.integrated edge labeling is enabled.edgeLabelSpacing - the non-negative edge label spacing
java.lang.IllegalArgumentException - if the given label spacing value is negativesetIntegratedEdgeLabelingEnabled(boolean)![]() Default edge label spacing of 4.0 | ![]() Edge label spacing set to 16.0 |
public double getEdgeLabelSpacing()
The spacing must have a non-negative value.
integrated edge labeling is enabled.setIntegratedEdgeLabelingEnabled(boolean),
setEdgeLabelSpacing(double)public boolean isChainStraighteningModeEnabled()
A chain is defined as a tree node with exactly one child node. If this feature is enabled, then the incoming edge and outgoing edge of the chain will have the same orientation, i.e., the whole chain looks straight.
Straightening all chains can lead to smoother, more symmetric results.
true if chains are drawn straight,
false otherwise.setChainStraighteningModeEnabled(boolean)public void setChainStraighteningModeEnabled(boolean chainStraighteningModeEnabled)
A chain is defined as a tree node with exactly one child node. If this feature is enabled, then the incoming edge and outgoing edge of the chain will have the same orientation, i.e., the whole chain looks straight.
Straightening all chains can lead to smoother, more symmetric results.
chainStraighteningModeEnabled - true if chains should be drawn straight,
false otherwise.![]() false | ![]() true |
public void setComponentLayouterEnabled(boolean enabled)
LayoutStage used for arranging the components of the graph is activated.
setComponentLayouterEnabled in class CanonicMultiStageLayouterBalloonLayouter can only handle single components. Disabling ComponentLayouter
will lead to errors during execution.enabled - true if the stage that arranges the graph components is activated,
false otherwiseCanonicMultiStageLayouter.isComponentLayouterEnabled(),
CanonicMultiStageLayouter.setComponentLayouter(LayoutStage),
ComponentLayouterpublic void setGroupNodeHidingEnabled(boolean groupNodeHidingEnabled)
LayoutStage used for hiding group nodes is activated.
setGroupNodeHidingEnabled in class CanonicMultiStageLayouterBalloonLayouter cannot handle group nodes. Disabling GroupNodeHider will lead to errors
during execution.groupNodeHidingEnabled - true if the stage used for hiding group nodes is activated,
false otherwiseCanonicMultiStageLayouter.isGroupNodeHidingEnabled(),
CanonicMultiStageLayouter.setGroupNodeHider(LayoutStage),
GroupNodeHiderpublic void setOrientationLayouterEnabled(boolean enabled)
LayoutStage that modifies the orientation of the layout is activated.
setOrientationLayouterEnabled in class CanonicMultiStageLayouterLayoutOrientation.TOP_TO_BOTTOM, the orientation of
the layout will not be modified.OrientationLayouter has no significant
effect.LayoutStage is activated.enabled - true if the stage that modifies the orientation is activated,
false otherwiseCanonicMultiStageLayouter.isOrientationLayouterEnabled(),
CanonicMultiStageLayouter.setOrientationLayouter(LayoutStage),
CanonicMultiStageLayouter.setLayoutOrientation(byte),
OrientationLayouterpublic void setParallelEdgeLayouterEnabled(boolean enabled)
LayoutStage used for routing parallel edges is activated.
setParallelEdgeLayouterEnabled in class CanonicMultiStageLayouterBalloonLayouter cannot handle parallel edges. Disabling ParallelEdgeLayouter
will lead to errors during execution.enabled - true if the stage responsible for routing parallel edges is activated,
false otherwiseCanonicMultiStageLayouter.isParallelEdgeLayouterEnabled(),
CanonicMultiStageLayouter.setParallelEdgeLayouter(LayoutStage),
ParallelEdgeLayouterpublic void setSelfLoopLayouterEnabled(boolean enabled)
LayoutStage used for routing self-loops is activated.
setSelfLoopLayouterEnabled in class CanonicMultiStageLayouterBalloonLayouter cannot handle self-loops. Disabling SelfLoopLayouter will lead
to errors during execution.enabled - true if the stage responsible for routing self-loops is activated, false otherwiseCanonicMultiStageLayouter.isSelfLoopLayouterEnabled(),
CanonicMultiStageLayouter.setSelfLoopLayouter(LayoutStage),
SelfLoopLayouterpublic void doLayoutCore(LayoutGraph graph)
doLayoutCore in class CanonicMultiStageLayoutergraph - the input graph
WrongGraphStructure - if the given graph is not a treepublic boolean canLayoutCore(LayoutGraph graph)
canLayoutCore in class CanonicMultiStageLayouterTreeReductionStage.graph - the input graph
true if the given graph is a tree, false otherwiseTrees.isTree(Graph)protected BalloonLayouter.NodeInfo getInfo(Node node)
BalloonLayouter.NodeInfo object associated with the given node while
the layout algorithm is active.
The returned object contains detailed information describing the placement of a node in the layout being computed, e.g., a node's distance to its parent or the wedge angle of the subtree rooted at a node.
Subclasses may want to override this method to realize another node information setup. This method is called throughout the algorithm, each time some information associated with a node needs to be retrieved or stored.
node - the node whose information object should be retrieved
BalloonLayouter.NodeInfo instance associated to the given nodeBalloonLayouter.NodeInfoprotected Node determineRoot()
graph according to the
chosen root node policy.
This method may be overridden to implement some other strategy for choosing the root node of the
input graph. It is called before the rest of the layout process within doLayoutCore(LayoutGraph).
root node policy is set to SELECTED_ROOT and more
than one node is marked as potential root node, only one will be considered as root.
If no nodes are selected, the root node will be defined according to Trees.getRoot(Graph).graphsetRootNodePolicy(byte)protected void calcChildArrangement(Node root)
During the arrangement, child nodes of root will be sorted.
Furthermore, distances of the child nodes will be chosen such that the wedge of the subtree of
root fits into the preferred wedge angle, which is either defined via
setPreferredRootWedge(int) or setPreferredChildWedge(int). Calculated distances are stored
in BalloonLayouter.NodeInfo.dist.
The angle values - upper and lower wedge angle - may also be updated during this process and stored in
BalloonLayouter.NodeInfo.upperAngle and BalloonLayouter.NodeInfo.lowerAngle, respectively.
To compute the angles of wedges, method calcAngles(Node) is used.
This method may be overridden to perform a custom child node arrangement.
If support for available features like interleaving should be
maintained, then these features need to be carefully considered during the arrangement.
root - the node for whose children to compute an arrangementprotected void sortChildNodes(Node root)
This implementation uses the original node coordinates if From Sketch mode
is enabled. Otherwise it uses the specified comparator to sort the outgoing edges
and thus the children of root.
If there is no such comparator, then the sorting depends on whether or not the child nodes are placed in an
interleaved fashion:
child ordering policy.
This method may be overridden to realize a custom child node ordering.
It gets called in method calcChildArrangement(Node) before coordinates are assigned and
just after the wedge sizes for all subtrees rooted at root are determined.
root - the node whose child nodes will be sortedprotected double getPreferredChildWedge(Node root)
The wedge angle controls the degree to which the child nodes may radiate from the center of layout.
A value close to 360 means that the child nodes may radiate in (almost) any direction from their
parent node, edge lengths can in consequence stay rather small. On the other hand, a small value means that
children are restricted to a small angle; thus, edges lengths (and drawings) may become large.
This method returns the preferred root wedge if node root
was selected as global root node (setRootNodePolicy(byte)).
Otherwise, it either returns getPreferredChildWedge() or if the given node has an outdegree equal
to 2, it returns the minimum of getPreferredChildWedge() and 180.
This method may be overridden to provide a custom child wedge function.
root - the node to get the preferred wedge angle for
root in degreessetPreferredChildWedge(int),
setPreferredRootWedge(int)protected double calcAngles(Node root)
Given some distance the upper angle and lower angle of the wedge belonging to the subtree
rooted at root will be calculated and stored in the BalloonLayouter.NodeInfo
instance associated with root (getInfo(Node)).
This method is a convenience method to calculate the wedge angle without any scaling to the node
distance. It calls calcAngles(Node, double) with a
scaling factor of 1.0.
This method may be overridden to perform a custom wedge angle assignment scheme. The method is called when
arranging child nodes. Large edge labels on the incoming edge
to root need to be considered, if integrated edge labeling should still work properly.
node information instance associated with
node root.root - the node for which the wedge angles are calculated
rootcalcAngles(Node, double),
calcChildArrangement(Node)
protected double calcAngles(Node root,
double scaleFactor)
distance with the given scale factor.
Given some distance the upper angle and lower angle of the wedge belonging to the subtree
rooted at root will be calculated and stored in the BalloonLayouter.NodeInfo
instance associated with root (getInfo(Node)).
This method may be overridden to perform a custom wedge angle assignment scheme. The method is called when
arranging child nodes. Large edge labels on the incoming edge
to root need to be considered, if integrated edge labeling should still work properly.
node information instance associated with
node root.root - the node for which the wedge angles are calculatedscaleFactor - a factor to be applied to the distance
of root
calcChildArrangement(Node)
|
© Copyright 2000-2025, yWorks GmbH. All rights reserved. |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||