public class BalloonLayout extends MultiStageLayout
BalloonLayout
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
root policy
.
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, BalloonLayout
is very well suited for large tree graphs. It
performs well even for huge graphs.
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.
Modifier and Type | Class and Description |
---|---|
static class |
BalloonLayout.NodeInfo
Encapsulates information bound to a node while the algorithm calculates a layout.
|
Modifier and Type | Field and Description |
---|---|
protected LayoutGraph |
graph
The layout graph being acted upon.
|
static NodeDpKey<Boolean> |
INTERLEAVED_NODES_DPKEY
A
DataProvider key for marking nodes whose child nodes should be placed in an interleaved fashion
This IDataProvider allows to individually configure the interleaving feature for each node in the graph. |
static NodeDpKey<Boolean> |
SELECTED_ROOT_DPKEY
A
DataProvider key for marking the node that will be used as root node of the tree.
|
Constructor and Description |
---|
BalloonLayout()
Creates a new
BalloonLayout instance with default settings. |
Modifier and Type | Method and Description |
---|---|
void |
applyLayoutCore(LayoutGraph graph)
Arranges the given graph as a tree graph in a balloon-like fashion.
|
protected double |
calculateAngles(Node root)
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 double |
calculateAngles(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 |
calculateChildArrangement(Node root)
Calculates a child node arrangement for a given root node of the tree.
|
protected Node |
determineRoot()
Determines the root node of
graph according to the chosen
root node policy . |
ChildAlignmentPolicy |
getChildAlignmentPolicy()
Gets the child alignment policy for this layout algorithm.
|
ChildOrderingPolicy |
getChildOrderingPolicy()
Gets the child ordering policy for sorting the child nodes around their parents.
|
double |
getCompactnessFactor()
Gets the factor defining how compact layout results will potentially be, where a smaller factor produces potentially
more compact layouts.
|
Comparator<Object> |
getComparator()
Gets the
Comparator instance that determines the order of the outgoing edges for each node of the tree. |
double |
getEdgeLabelSpacing()
Gets 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.
|
InterleavedMode |
getInterleavedMode()
Gets the mode for child node arrangement.
|
int |
getMinimumEdgeLength()
Gets the minimum length that this layout algorithm assigns to edges of the graph.
|
int |
getMinimumNodeDistance()
Gets the minimum distance to be kept between the nodes in the tree.
|
NodeLabelingPolicy |
getNodeLabelingPolicy()
Gets the policy defining how node labels are placed by the integrated node labeling mechanism (for example, the desired
label orientation).
|
double |
getNodeLabelSpacing()
Gets 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.
|
RootNodePolicy |
getRootNodePolicy()
Gets the root node selection policy of this layout algorithm.
|
boolean |
isChainStraighteningModeEnabled()
Gets whether or not chains are drawn straight or not.
|
boolean |
isFromSketchModeEnabled()
Gets whether or not to consider the given coordinates of the input diagram when arranging the tree.
|
boolean |
isIntegratedEdgeLabelingEnabled()
Gets whether or not the layout algorithm automatically places edge labels.
|
boolean |
isIntegratedNodeLabelingEnabled()
Gets whether or not the layout algorithm automatically places node labels.
|
boolean |
isNodeLabelConsiderationEnabled()
Gets whether or not the layout algorithm reserves space for node labels.
|
boolean |
isOverlapsAllowed()
Gets whether or not (partially) overlapping nodes are allowed.
|
void |
setChainStraighteningModeEnabled(boolean value)
Sets whether or not chains are drawn straight or not.
|
void |
setChildAlignmentPolicy(ChildAlignmentPolicy value)
Sets the child alignment policy for this layout algorithm.
|
void |
setChildOrderingPolicy(ChildOrderingPolicy value)
Sets the child ordering policy for sorting the child nodes around their parents.
|
void |
setCompactnessFactor(double value)
Sets the factor defining how compact layout results will potentially be, where a smaller factor produces potentially
more compact layouts.
|
void |
setComparator(Comparator<Object> value)
Sets the
Comparator instance that determines the order of the outgoing edges for each node of the tree. |
void |
setComponentLayoutEnabled(boolean value)
Sets whether or not the
ILayoutStage used for arranging the components of the graph is activated. |
void |
setEdgeLabelSpacing(double value)
Sets 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 value)
Sets whether or not to consider the given coordinates of the input diagram when arranging the tree.
|
void |
setHideGroupsStageEnabled(boolean value)
Sets whether or not the
ILayoutStage used for hiding group nodes is activated. |
void |
setIntegratedEdgeLabelingEnabled(boolean value)
Sets whether or not the layout algorithm automatically places edge labels.
|
void |
setIntegratedNodeLabelingEnabled(boolean value)
Sets whether or not the layout algorithm automatically places node labels.
|
void |
setInterleavedMode(InterleavedMode value)
Sets the mode for child node arrangement.
|
void |
setMinimumEdgeLength(int value)
Sets the minimum length that this layout algorithm assigns to edges of the graph.
|
void |
setMinimumNodeDistance(int value)
Sets the minimum distance to be kept between the nodes in the tree.
|
void |
setNodeLabelConsiderationEnabled(boolean value)
Sets whether or not the layout algorithm reserves space for node labels.
|
void |
setNodeLabelingPolicy(NodeLabelingPolicy value)
Sets the policy defining how node labels are placed by the integrated node labeling mechanism (for example, the desired
label orientation).
|
void |
setNodeLabelSpacing(double value)
Sets the distance between node labels belonging to the same node.
|
void |
setOrientationLayoutEnabled(boolean value)
Sets whether or not the
ILayoutStage that modifies the orientation of the layout is activated. |
void |
setOverlapsAllowed(boolean value)
Sets whether or not (partially) overlapping nodes are allowed.
|
void |
setParallelEdgeRouterEnabled(boolean value)
Sets whether or not the
ILayoutStage used for routing parallel edges is activated. |
void |
setPreferredChildWedge(int value)
Sets the preferred radial amount (wedge) in degrees that child nodes may in total occupy around their parent node.
|
void |
setPreferredRootWedge(int value)
Sets the preferred radial amount (wedge) in degrees that child nodes may in total occupy around the global root.
|
void |
setRootNodePolicy(RootNodePolicy value)
Sets the root node selection policy of this layout algorithm.
|
void |
setSelfLoopRouterEnabled(boolean value)
Sets whether or not the
ILayoutStage used for routing self-loops is activated. |
protected void |
sortChildNodes(Node root)
Sorts the child nodes (successors) of the given node.
|
appendStage, applyLayout, checkNodeSize, disableAllStages, getComponentLayout, getHideGroupsStage, getLabeling, getLayoutOrientation, getOrientationLayout, getParallelEdgeRouter, getSelfLoopRouter, getSubgraphLayout, isComponentLayoutEnabled, isHideGroupsStageEnabled, isLabelingEnabled, isOrientationLayoutEnabled, isParallelEdgeRouterEnabled, isSelfLoopRouterEnabled, isSubgraphLayoutEnabled, prependStage, removeStage, setComponentLayout, setHideGroupsStage, setLabeling, setLabelingEnabled, setLayoutOrientation, setOrientationLayout, setParallelEdgeRouter, setSelfLoopRouter, setSubgraphLayout, setSubgraphLayoutEnabled
protected LayoutGraph graph
public static final NodeDpKey<Boolean> INTERLEAVED_NODES_DPKEY
DataProvider
key for marking nodes whose child nodes should be placed in an interleaved fashion
This IDataProvider
allows to individually configure the interleaving feature for each node in the graph.
IDataProvider
is only considered if the interleaved mode is set to
InterleavedMode.MARKED_NODES
.setInterleavedMode(InterleavedMode)
public static final NodeDpKey<Boolean> SELECTED_ROOT_DPKEY
DataProvider
key for marking the node that will be used as root node of the tree.
IDataProvider
is only considered if the root node policy
is set to RootNodePolicy.SELECTED_ROOT
.setRootNodePolicy(RootNodePolicy)
public BalloonLayout()
BalloonLayout
instance with default settings.public void applyLayoutCore(LayoutGraph graph)
applyLayoutCore
in class MultiStageLayout
InvalidGraphStructureException
- if the given graph is not a treegraph
- the input graphprotected final double calculateAngles(Node root)
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 BalloonLayout.NodeInfo
instance associated with root
(com.yworks.yfiles.layout.tree.BalloonLayout.getInfo(com.yworks.yfiles.algorithms.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.
com.yworks.yfiles.layout.tree.BalloonLayout.getInfo(com.yworks.yfiles.algorithms.Node)
associated with node
root
.root
- the node for which the wedge angles are calculatedcalculateChildArrangement(Node)
protected double calculateAngles(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 BalloonLayout.NodeInfo
instance associated with root
(com.yworks.yfiles.layout.tree.BalloonLayout.getInfo(com.yworks.yfiles.algorithms.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.
com.yworks.yfiles.layout.tree.BalloonLayout.getInfo(com.yworks.yfiles.algorithms.Node)
associated with node
root
.root
- the node for which the wedge angles are calculatedscaleFactor
- a factor to be applied to the distance
of root
calculateChildArrangement(Node)
protected void calculateChildArrangement(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 PreferredRootWedge
or
PreferredChildWedge
. Calculated distances are stored in BalloonLayout.NodeInfo.dist
.
The angle values - upper and lower wedge angle - may also be updated during this process and stored in BalloonLayout.NodeInfo.upperAngle
and BalloonLayout.NodeInfo.lowerAngle
, respectively. To compute the angles of wedges, method calculateAngles(Node, double)
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 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 applyLayoutCore(LayoutGraph)
.
root node policy
is set to RootNodePolicy.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(com.yworks.yfiles.algorithms.Graph)
.graph
setRootNodePolicy(RootNodePolicy)
public ChildAlignmentPolicy getChildAlignmentPolicy()
This policy influences the distance of child nodes to their parent nodes and the alignment of children with the same parent.
IllegalArgumentException
- if an unknown policy is givenintegrated labeling
is enabled.ChildAlignmentPolicy.COMPACT
setChildAlignmentPolicy(ChildAlignmentPolicy)
public ChildOrderingPolicy 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.
IllegalArgumentException
- if an unknown ordering policy is givenFrom Sketch mode
is enabled.ChildOrderingPolicy.COMPACT
setFromSketchModeEnabled(boolean)
,
setComparator(Comparator)
,
setChildOrderingPolicy(ChildOrderingPolicy)
public 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
.
IllegalArgumentException
- if the factor is smaller than 0.05
or greater than 1.0
setCompactnessFactor(double)
public Comparator<Object> 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.null
. The algorithm uses a built-in sorting logic.Comparator
instance to sort outgoing edges or null
if edges are sorted according to the
child ordering policy
setChildOrderingPolicy(ChildOrderingPolicy)
,
setFromSketchModeEnabled(boolean)
,
setComparator(Comparator)
public double getEdgeLabelSpacing()
The spacing must have a non-negative value.
IllegalArgumentException
- if the given label spacing value is negative0
, labels will touch each other and the target node.integrated edge labeling
is
enabled.setIntegratedEdgeLabelingEnabled(boolean)
,
setEdgeLabelSpacing(double)
public InterleavedMode 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, ChildAlignmentPolicy.SMART
is only supported
for non-interleaved arrangement.
IllegalArgumentException
- if an unknown mode for interleaved arrangement is givenordering policy
to have no more effect for those nodes.InterleavedMode.OFF
. Interleaved placement is disabled.setChildAlignmentPolicy(ChildAlignmentPolicy)
,
setInterleavedMode(InterleavedMode)
public int getMinimumEdgeLength()
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.
IllegalArgumentException
- if the given length is negativesetMinimumEdgeLength(int)
public int getMinimumNodeDistance()
The distance needs to be a non-negative integer value.
IllegalArgumentException
- if the given minimum distance is negativeallowed
.setOverlapsAllowed(boolean)
,
setMinimumNodeDistance(int)
public NodeLabelingPolicy getNodeLabelingPolicy()
IllegalArgumentException
- if an unknown labeling policy is givenintegrated node labeling
is
enabled.NodeLabelingPolicy.RAY_LIKE
setIntegratedNodeLabelingEnabled(boolean)
,
setNodeLabelingPolicy(NodeLabelingPolicy)
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.
IllegalArgumentException
- if the given spacing value is negative0
, node labels will be maximally close to each other and to their node.integrated node labeling
is
enabled.isIntegratedNodeLabelingEnabled()
,
setNodeLabelSpacing(double)
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
.
IllegalArgumentException
- if the given angle is smaller than 1
or larger than 359
360
is needed.PreferredRootWedge
.[1,359]
setPreferredRootWedge(int)
,
setPreferredChildWedge(int)
protected 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 (RootNodePolicy
). Otherwise, it either returns PreferredChildWedge
or if the given node has an outdegree equal to 2
, it returns the minimum of PreferredChildWedge
and 180
.
This method may be overridden to provide a custom child wedge function.
root
- the node to get the preferred wedge angle forroot
in degreessetPreferredChildWedge(int)
,
setPreferredRootWedge(int)
public int getPreferredRootWedge()
This property allows to separately control the wedge angle for the designated root node of the tree, while PreferredChildWedge
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
.
IllegalArgumentException
- if the given angle is smaller than 1
or larger than 360
[1,360]
setPreferredChildWedge(int)
,
setPreferredRootWedge(int)
public RootNodePolicy getRootNodePolicy()
The policy determines which node is chosen as (virtual) tree root during the layout process.
IllegalArgumentException
- if an unknown root node policy is givenRootNodePolicy.DIRECTED_ROOT
setRootNodePolicy(RootNodePolicy)
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.
false
. There is no guarantee that chains are drawn straight.true
if chains are drawn straight, false
otherwise.setChainStraighteningModeEnabled(boolean)
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.
false
. The coordinates of the input are not considered.true
if the initial coordinates of the nodes are considered, false
otherwisesetFromSketchModeEnabled(boolean)
public boolean isIntegratedEdgeLabelingEnabled()
If enabled, this layout algorithm will calculate the positions for the edge labels assuring that no overlaps occur.
FreeEdgeLabelLayoutModel
as the IEdgeLabelLayoutModel
for the edges.chain straightening
, because edge labels (especially large ones)
may lead to significantly non-straight node chains.false
. Edge labels are not placed by this algorithm.true
if integrated edge labeling is enabled, false
otherwise.setIntegratedEdgeLabelingEnabled(boolean)
public 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
NodeLabelingPolicy
.
FreeNodeLabelLayoutModel
as the INodeLabelLayoutModel
for the nodes.consideration mechanism
has no more effect.false
. Node labels are not placed by this algorithm.true
if integrated node labeling is enabled, false
otherwise.setNodeLabelingPolicy(NodeLabelingPolicy)
,
setIntegratedNodeLabelingEnabled(boolean)
public boolean isNodeLabelConsiderationEnabled()
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 BalloonLayout
doesn't make sense.integrated node labeling
mechanism is
disabled.false
. Node labels are not considered.true
if node labels are considered, false
otherwisesetNodeLabelConsiderationEnabled(boolean)
public boolean isOverlapsAllowed()
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.
false
. Nodes are not allowed to overlap.true
if node overlaps are allowed, false
otherwisesetOverlapsAllowed(boolean)
public void setChainStraighteningModeEnabled(boolean value)
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.
false
. There is no guarantee that chains are drawn straight.value
- true
if chains are drawn straight, false
otherwise.isChainStraighteningModeEnabled()
public void setChildAlignmentPolicy(ChildAlignmentPolicy value)
This policy influences the distance of child nodes to their parent nodes and the alignment of children with the same parent.
IllegalArgumentException
- if an unknown policy is givenintegrated labeling
is enabled.ChildAlignmentPolicy.COMPACT
value
- one of the predefined child alignment policiesgetChildAlignmentPolicy()
public void setChildOrderingPolicy(ChildOrderingPolicy value)
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.
IllegalArgumentException
- if an unknown ordering policy is givenFrom Sketch mode
is enabled.ChildOrderingPolicy.COMPACT
value
- one of the predefined child ordering policiessetFromSketchModeEnabled(boolean)
,
setComparator(Comparator)
,
getChildOrderingPolicy()
public void setCompactnessFactor(double value)
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
.
IllegalArgumentException
- if the factor is smaller than 0.05
or greater than 1.0
value
- the compactness factor from the interval [0.05, 1.0]getCompactnessFactor()
public void setComparator(Comparator<Object> value)
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.null
. The algorithm uses a built-in sorting logic.value
- a Comparator
instance to sort outgoing edges or null
if edges are sorted according to the
child ordering policy
setChildOrderingPolicy(ChildOrderingPolicy)
,
setFromSketchModeEnabled(boolean)
,
getComparator()
public void setComponentLayoutEnabled(boolean value)
ILayoutStage
used for arranging the components of the graph is activated.setComponentLayoutEnabled
in class MultiStageLayout
BalloonLayout
can only handle single components. Disabling ComponentLayout
will
lead to errors during execution.true
. The stage that arranges connected graph components is activated.value
- true
if the stage that arranges the graph components is activated, false
otherwiseMultiStageLayout.isComponentLayoutEnabled()
,
MultiStageLayout.setComponentLayout(ILayoutStage)
,
ComponentLayout
public void setEdgeLabelSpacing(double value)
The spacing must have a non-negative value.
IllegalArgumentException
- if the given label spacing value is negative0
, labels will touch each other and the target node.integrated edge labeling
is
enabled.value
- the non-negative edge label spacingsetIntegratedEdgeLabelingEnabled(boolean)
,
getEdgeLabelSpacing()
public void setFromSketchModeEnabled(boolean value)
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.
false
. The coordinates of the input are not considered.value
- true
if the initial coordinates of the nodes are considered, false
otherwiseisFromSketchModeEnabled()
public void setHideGroupsStageEnabled(boolean value)
ILayoutStage
used for hiding group nodes is activated.setHideGroupsStageEnabled
in class MultiStageLayout
BalloonLayout
cannot handle group nodes. Disabling HideGroupsStage
will lead to errors during
execution.true
. The stage responsible for hiding group nodes is activated.value
- true
if the stage used for hiding group nodes is activated, false
otherwiseMultiStageLayout.isHideGroupsStageEnabled()
,
MultiStageLayout.setHideGroupsStage(ILayoutStage)
,
HideGroupsStage
public void setIntegratedEdgeLabelingEnabled(boolean value)
If enabled, this layout algorithm will calculate the positions for the edge labels assuring that no overlaps occur.
FreeEdgeLabelLayoutModel
as the IEdgeLabelLayoutModel
for the edges.chain straightening
, because edge labels (especially large ones)
may lead to significantly non-straight node chains.false
. Edge labels are not placed by this algorithm.value
- true
if integrated edge labeling is enabled, false
otherwise.isIntegratedEdgeLabelingEnabled()
public void setIntegratedNodeLabelingEnabled(boolean value)
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
NodeLabelingPolicy
.
FreeNodeLabelLayoutModel
as the INodeLabelLayoutModel
for the nodes.consideration mechanism
has no more effect.false
. Node labels are not placed by this algorithm.value
- true
if integrated node labeling is enabled, false
otherwise.setNodeLabelingPolicy(NodeLabelingPolicy)
,
isIntegratedNodeLabelingEnabled()
public void setInterleavedMode(InterleavedMode value)
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, ChildAlignmentPolicy.SMART
is only supported
for non-interleaved arrangement.
IllegalArgumentException
- if an unknown mode for interleaved arrangement is givenordering policy
to have no more effect for those nodes.InterleavedMode.OFF
. Interleaved placement is disabled.value
- the mode for interleaved child node arrangementsetChildAlignmentPolicy(ChildAlignmentPolicy)
,
getInterleavedMode()
public void setMinimumEdgeLength(int value)
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.
IllegalArgumentException
- if the given length is negativevalue
- the non-negative minimum edge lengthgetMinimumEdgeLength()
public void setMinimumNodeDistance(int value)
The distance needs to be a non-negative integer value.
IllegalArgumentException
- if the given minimum distance is negativeallowed
.value
- the non-negative minimum node distancesetOverlapsAllowed(boolean)
,
getMinimumNodeDistance()
public void setNodeLabelConsiderationEnabled(boolean value)
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 BalloonLayout
doesn't make sense.integrated node labeling
mechanism is
disabled.false
. Node labels are not considered.value
- true
if node labels are considered, false
otherwiseisNodeLabelConsiderationEnabled()
public void setNodeLabelingPolicy(NodeLabelingPolicy value)
IllegalArgumentException
- if an unknown labeling policy is givenintegrated node labeling
is
enabled.NodeLabelingPolicy.RAY_LIKE
value
- one of the predefined node labeling policiessetIntegratedNodeLabelingEnabled(boolean)
,
getNodeLabelingPolicy()
public void setNodeLabelSpacing(double value)
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.
IllegalArgumentException
- if the given spacing value is negative0
, node labels will be maximally close to each other and to their node.integrated node labeling
is
enabled.value
- the non-negative node label spacingisIntegratedNodeLabelingEnabled()
,
getNodeLabelSpacing()
public void setOrientationLayoutEnabled(boolean value)
ILayoutStage
that modifies the orientation of the layout is activated.setOrientationLayoutEnabled
in class MultiStageLayout
LayoutOrientation.TOP_TO_BOTTOM
, the orientation of the layout will not be
modified.OrientationLayout
has no significant
effect.true
. The orientation ILayoutStage
is activated.value
- true
if the stage that modifies the orientation is activated, false
otherwiseMultiStageLayout.isOrientationLayoutEnabled()
,
MultiStageLayout.setOrientationLayout(ILayoutStage)
,
MultiStageLayout.setLayoutOrientation(com.yworks.yfiles.layout.LayoutOrientation)
,
OrientationLayout
public void setOverlapsAllowed(boolean value)
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.
false
. Nodes are not allowed to overlap.value
- true
if node overlaps are allowed, false
otherwiseisOverlapsAllowed()
public void setParallelEdgeRouterEnabled(boolean value)
ILayoutStage
used for routing parallel edges is activated.setParallelEdgeRouterEnabled
in class MultiStageLayout
BalloonLayout
cannot handle parallel edges. Disabling ParallelEdgeRouter
will
lead to errors during execution.true
. The stage that routes parallel edges is activated.value
- true
if the stage responsible for routing parallel edges is activated, false
otherwiseMultiStageLayout.isParallelEdgeRouterEnabled()
,
MultiStageLayout.setParallelEdgeRouter(ILayoutStage)
,
ParallelEdgeRouter
public void setPreferredChildWedge(int value)
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
.
IllegalArgumentException
- if the given angle is smaller than 1
or larger than 359
360
is needed.PreferredRootWedge
.value
- the preferred wedge angle in degrees from the interval [1,359]
setPreferredRootWedge(int)
,
getPreferredChildWedge()
public void setPreferredRootWedge(int value)
This property allows to separately control the wedge angle for the designated root node of the tree, while PreferredChildWedge
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
.
IllegalArgumentException
- if the given angle is smaller than 1
or larger than 360
value
- the preferred wedge angle in degrees from the interval [1,360]
setPreferredChildWedge(int)
,
getPreferredRootWedge()
public void setRootNodePolicy(RootNodePolicy value)
The policy determines which node is chosen as (virtual) tree root during the layout process.
IllegalArgumentException
- if an unknown root node policy is givenRootNodePolicy.DIRECTED_ROOT
value
- one of the predefined root node policiesgetRootNodePolicy()
public void setSelfLoopRouterEnabled(boolean value)
ILayoutStage
used for routing self-loops is activated.setSelfLoopRouterEnabled
in class MultiStageLayout
BalloonLayout
cannot handle self-loops. Disabling SelfLoopRouter
will lead to
errors during execution.true
. The stage that routes self-loops is activated.value
- true
if the stage responsible for routing self-loops is activated, false
otherwiseMultiStageLayout.isSelfLoopRouterEnabled()
,
MultiStageLayout.setSelfLoopRouter(ILayoutStage)
,
SelfLoopRouter
protected 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 calculateChildArrangement(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 sorted