Search this API

y.layout.tree
Class TreeLayouter

java.lang.Object
  extended by y.layout.CanonicMultiStageLayouter
      extended by y.layout.tree.TreeLayouter
All Implemented Interfaces:
Layouter

public class TreeLayouter
extends CanonicMultiStageLayouter

This layout algorithm arranges graphs with a tree structure.

Layout Style

TreeLayouter is designed to arrange directed and undirected trees that have a unique root node. All children are placed below their parent in relation to the main layout direction. The edges of the graph are routed as straight-line segments or in an orthogonal bus-like fashion.

Tree layout algorithms are commonly used for visualizing relational data and for producing diagrams of high quality that are able to reveal possible hierarchic properties of the graph. More precisely, they find applications in dataflow analysis, software engineering, bioinformatics and business administration.


A Dendrogram


A graph containing group nodes


Left-to-right layout with global layering

Concept

The layout algorithm starts from the root and recursively assigns coordinates to all tree nodes. In this manner, leaf nodes will be placed first, while each parent node is placed centered above its children.

Features

The layout algorithm supports custom sorting of sibling nodes by using a specific NodeOrderComparator. Each tree node may have an individual NodeOrderComparator that is stored in a DataProvider registered with the graph with NodeOrderComparator.NODE_ORDER_DPKEY. If this NodeOrderComparator uses the initial coordinates of the nodes, it allows the incremental insertion of child nodes while keeping the relative locations of the other nodes.

A custom node can be defined as root of the tree using a DataProvider registered with the graph with key SELECTED_ROOT_DPKEY.

TreeLayouter can be configured to reserve space for node labels. It can also place edge labels along edges such that the labels won't overlap with other graph elements. Edge labels are placed according to the information stored in a PreferredPlacementDescriptor instance. However, the placement along the edge will only affect the order of multiple labels at the same edge. The algorithm will always place the labels close to the target node.

Grouping of nodes can also be handled by this layout algorithm. It is important that a group node contains a whole subtree. Otherwise, the group nodes may overlap with each other or with other nodes. Furthermore, the user may specify minimum size constraints for each group node using DataProvider key GroupingKeys.MINIMUM_NODE_SIZE_DPKEY.

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. After the layout calculation, the stage will reinsert the edges that were removed and route them separately.

 

Field Summary
static int BORDER_CENTER_PORTS
          A constant defining that ports are placed at the center of the border of the nodes.
static int BORDER_DISTRIBUTED_PORTS
          A constant defining that ports are evenly distributed along the border of the nodes.
static byte CHILD_PLACEMENT_POLICY_ALL_LEAVES_ON_SAME_LAYER
          A policy for placing the leaf nodes in a Dendrogram-like fashion.
static byte CHILD_PLACEMENT_POLICY_LEAVES_STACKED
          A policy for placing the leaf nodes in a stack-like fashion with balanced stack heights.
static byte CHILD_PLACEMENT_POLICY_LEAVES_STACKED_LEFT
          A policy for placing the leaf nodes in a stack-like fashion using a single stack left.
static byte CHILD_PLACEMENT_POLICY_LEAVES_STACKED_LEFT_AND_RIGHT
          A policy for placing the leaf nodes in a stack-like fashion using two stacks.
static byte CHILD_PLACEMENT_POLICY_LEAVES_STACKED_RIGHT
          A policy for placing the leaf nodes in a stack-like fashion using a single stack right.
static byte CHILD_PLACEMENT_POLICY_SIBLINGS_ON_SAME_LAYER
          A policy for placing the leaf nodes with the same parent in the same layer.
static int NODE_CENTER_PORTS
          A constant defining that ports are placed at the center of the nodes.
static int ORTHOGONAL_STYLE
          A constant for routing the edges orthogonally in a bus-like fashion.
static int PLAIN_STYLE
          A constant for routing the edges as straight-line segments.
static int PORT_CONSTRAINTS_AWARE
          A constant defining that ports are assigned based on given port constraints.
static java.lang.Object SELECTED_ROOT_DPKEY
          A DataProvider key for marking the node that will be used as root node of the tree.
 
Fields inherited from interface y.layout.Layouter
EDGE_ID_DPKEY, NODE_ID_DPKEY, SELECTED_EDGES, SELECTED_NODES
 
Constructor Summary
TreeLayouter()
          Creates a new TreeLayouter instance with default settings.
 
Method Summary
 boolean canLayoutCore(LayoutGraph graph)
          Accepts only graphs that are trees or multi-parent trees.
 void doLayoutCore(LayoutGraph graph)
          Arranges the given graph as a tree.
 double getBusAlignment()
          Returns the vertical bus alignment for orthogonally routed edge buses.
 byte getChildPlacementPolicy()
          Returns the layout policy for leaf nodes.
 java.util.Comparator getComparator()
          Returns the Comparator instance that is used for sorting the outgoing edges of each node of the tree.
 int getLayoutStyle()
          Returns the edge routing style used by this layout algorithm.
 double getMinimalLayerDistance()
          Returns the minimum distance between two adjacent layers.
 double getMinimalNodeDistance()
          Returns the minimum horizontal distance between adjacent nodes within the same layer.
 double getMinimumBusSegmentDistance()
          Returns the minimum (vertical) distance of the horizontal edge segments of the bus between the root node and the child nodes.
 AbstractRotatableNodePlacer.Matrix getModificationMatrix()
          Returns the modification matrix used for rotating / mirroring the layout.
 int getPortStyle()
          Returns the port assignment policy that will be applied.
 double getVerticalAlignment()
          Returns the vertical alignment of the nodes within their corresponding layers.
 boolean isEnforceGlobalLayering()
          Returns whether or not a global layering is enforced, that is, each node spans exactly one layer.
 boolean isGroupingSupported()
          Specifies whether or not group nodes are handled by the layout algorithm.
 boolean isIntegratedEdgeLabelingEnabled()
          Returns whether or not the layout algorithm reserves space for edge labels and places them.
 boolean isIntegratedNodeLabelingEnabled()
          Returns whether or not the layout algorithm reserves space for node labels.
 void setBusAlignment(double busAlignment)
          Specifies the vertical bus alignment for orthogonally routed edge buses.
 void setChildPlacementPolicy(byte policy)
          Specifies the layout policy for leaf nodes.
 void setComparator(java.util.Comparator comparator)
          Specifies the Comparator instance that is used for sorting the outgoing edges of 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 setEnforceGlobalLayering(boolean enabled)
          Returns whether or not a global layering is enforced, that is, each node spans exactly one layer.
 void setGroupingSupported(boolean groupingSupported)
          Specifies whether or not group nodes are handled by the layout algorithm.
 void setIntegratedEdgeLabelingEnabled(boolean integratedEdgeLabelingEnabled)
          Specifies whether or not the layout algorithm reserves space for edge labels and places them.
 void setIntegratedNodeLabelingEnabled(boolean integratedNodeLabelingEnabled)
          Specifies whether or not the layout algorithm reserves space for node labels.
 void setLayoutStyle(int style)
          Specifies the edge routing style used by this layout algorithm.
 void setMinimalLayerDistance(double dist)
          Specifies the minimum distance between two adjacent layers.
 void setMinimalNodeDistance(double dist)
          Specifies the minimum horizontal distance between adjacent nodes within the same layer.
 void setMinimumBusSegmentDistance(double minimumBusSegmentDistance)
          Specifies the minimum (vertical) distance of the horizontal edge segments of the bus between the root node and the child nodes.
 void setModificationMatrix(AbstractRotatableNodePlacer.Matrix modificationMatrix)
          Specifies the modification matrix used for rotating / mirroring the layout.
 void setParallelEdgeLayouterEnabled(boolean enabled)
          Specifies whether or not the LayoutStage used for routing parallel edges is activated.
 void setPortStyle(int style)
          Specifies the port assignment policy that will be applied.
 void setSelfLoopLayouterEnabled(boolean enabled)
          Specifies whether or not the LayoutStage used for routing self-loops is activated.
 void setVerticalAlignment(double verticalAlignment)
          Specifies the vertical alignment of the nodes within their corresponding layers.
 
Methods inherited from class y.layout.CanonicMultiStageLayouter
appendStage, calcLayout, calcLayout, canLayout, checkGroupNodeSize, checkNodeSize, doLayout, doLayout, enableOnlyCore, getComponentLayouter, getGroupNodeHider, getLabelLayouter, getLayoutOrientation, getOrientationLayouter, getParallelEdgeLayouter, getSelfLoopLayouter, getSubgraphLayouter, isComponentLayouterEnabled, isGroupNodeHidingEnabled, isLabelLayouterEnabled, isOrientationLayouterEnabled, isParallelEdgeLayouterEnabled, isSelfLoopLayouterEnabled, isSubgraphLayouterEnabled, prependStage, removeStage, setComponentLayouter, setGroupNodeHider, setGroupNodeHidingEnabled, setLabelLayouter, setLabelLayouterEnabled, setLayoutOrientation, setOrientationLayouter, setOrientationLayouterEnabled, setParallelEdgeLayouter, setSelfLoopLayouter, setSubgraphLayouter, setSubgraphLayouterEnabled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NODE_CENTER_PORTS

public static final int NODE_CENTER_PORTS
A constant defining that ports are placed at the center of the nodes.

This constant uses (0,0) as port offset.

See Also:
setPortStyle(int), Constant Field Values
Sample Graph:

BORDER_CENTER_PORTS

public static final int BORDER_CENTER_PORTS
A constant defining that ports are placed at the center of the border of the nodes.

See Also:
setPortStyle(int), Constant Field Values
Sample Graph:

BORDER_DISTRIBUTED_PORTS

public static final int BORDER_DISTRIBUTED_PORTS
A constant defining that ports are evenly distributed along the border of the nodes.

See Also:
setPortStyle(int), Constant Field Values
Sample Graph:

PORT_CONSTRAINTS_AWARE

public static final int PORT_CONSTRAINTS_AWARE
A constant defining that ports are assigned based on given port constraints.

See Also:
setPortStyle(int), Constant Field Values
Sample Graph:

PortConstraints at the bottom of the source node and right or left of the target nodes

PLAIN_STYLE

public static final int PLAIN_STYLE
A constant for routing the edges as straight-line segments.

See Also:
setLayoutStyle(int), Constant Field Values
Sample Graph:

ORTHOGONAL_STYLE

public static final int ORTHOGONAL_STYLE
A constant for routing the edges orthogonally in a bus-like fashion.

See Also:
setLayoutStyle(int), Constant Field Values
Sample Graph:

CHILD_PLACEMENT_POLICY_LEAVES_STACKED

public static final byte CHILD_PLACEMENT_POLICY_LEAVES_STACKED
A policy for placing the leaf nodes in a stack-like fashion with balanced stack heights.

In this context, a stack-like fashion means that leaf nodes that connect to the same parent node are placed one upon the other, resulting in horizontally compact layouts.

This policy tries to balance stack heights, i.e., for each subtree that consists only of leaf nodes, CHILD_PLACEMENT_POLICY_LEAVES_STACKED_RIGHT or CHILD_PLACEMENT_POLICY_LEAVES_STACKED_LEFT_AND_RIGHT will be used depending on the number of leaves in the subtree.

 
This policy has an effect only on subtrees where all children are leaf nodes.
See Also:
setChildPlacementPolicy(byte), getChildPlacementPolicy(), Constant Field Values
Sample Graph:

CHILD_PLACEMENT_POLICY_LEAVES_STACKED_LEFT

public static final byte CHILD_PLACEMENT_POLICY_LEAVES_STACKED_LEFT
A policy for placing the leaf nodes in a stack-like fashion using a single stack left.

In this context, a stack-like fashion means that leaf nodes that connect to the same root node are placed one upon the other, resulting in horizontally compact layouts.

This policy uses a single stack that lies to the left relative to the center of the parent node.

 
This policy has an effect only on subtrees where all children are leaf nodes.
See Also:
getChildPlacementPolicy(), setChildPlacementPolicy(byte), Constant Field Values
Sample Graph:

CHILD_PLACEMENT_POLICY_LEAVES_STACKED_RIGHT

public static final byte CHILD_PLACEMENT_POLICY_LEAVES_STACKED_RIGHT
A policy for placing the leaf nodes in a stack-like fashion using a single stack right.

In this context, a stack-like fashion means that leaf nodes that connect to the same root node are placed one upon the other, resulting in horizontally compact layouts.

This policy uses a single stack that lies to the right relative to the center of the parent node.

 
This policy has an effect only on subtrees where all children are leaf nodes.
See Also:
getChildPlacementPolicy(), setChildPlacementPolicy(byte), Constant Field Values
Sample Graph:

CHILD_PLACEMENT_POLICY_LEAVES_STACKED_LEFT_AND_RIGHT

public static final byte CHILD_PLACEMENT_POLICY_LEAVES_STACKED_LEFT_AND_RIGHT
A policy for placing the leaf nodes in a stack-like fashion using two stacks.

In this context, a stack-like fashion means that leaf nodes that connect to the same root node are placed one upon the other, resulting in horizontally compact layouts.

This policy distributes leaf nodes among two stacks, one to the left and one to the right relative to the center of the parent node.

 
This policy has an effect only on subtrees where all children are leaf nodes.
See Also:
getChildPlacementPolicy(), setChildPlacementPolicy(byte), Constant Field Values
Sample Graph:

CHILD_PLACEMENT_POLICY_ALL_LEAVES_ON_SAME_LAYER

public static final byte CHILD_PLACEMENT_POLICY_ALL_LEAVES_ON_SAME_LAYER
A policy for placing the leaf nodes in a Dendrogram-like fashion.

According to this policy, all leaf nodes are placed in one layer (i.e. all leaves are placed on one horizontal line in a top-to-bottom or in a bottom-to-top layout).

See Also:
getChildPlacementPolicy(), setChildPlacementPolicy(byte), Constant Field Values
Sample Graph:

CHILD_PLACEMENT_POLICY_SIBLINGS_ON_SAME_LAYER

public static final byte CHILD_PLACEMENT_POLICY_SIBLINGS_ON_SAME_LAYER
A policy for placing the leaf nodes with the same parent in the same layer.

For example, siblings are being placed on a horizontal line in a top-to-bottom or in a bottom-to-top layout.

This policy produces vertically compact layouts.

See Also:
getChildPlacementPolicy(), setChildPlacementPolicy(byte), Constant Field Values
Sample Graph:

SELECTED_ROOT_DPKEY

public static final java.lang.Object SELECTED_ROOT_DPKEY
A DataProvider key for marking the node that will be used as root node of the tree.

Constructor Detail

TreeLayouter

public TreeLayouter()
Creates a new TreeLayouter instance with default settings.

Method Detail

canLayoutCore

public boolean canLayoutCore(LayoutGraph graph)
Accepts only graphs that are trees or multi-parent trees.

Specified by:
canLayoutCore in class CanonicMultiStageLayouter
 
To apply this layout algorithm for general graphs, append TreeReductionStage.
Parameters:
graph - the input graph
Returns:
true if the given graph is a tree (or multi-parent tree), false otherwise

getMinimumBusSegmentDistance

public double getMinimumBusSegmentDistance()
Returns the minimum (vertical) distance of the horizontal edge segments of the bus between the root node and the child nodes. If this distance is set to 0, all segments are routed in a classical bus-like style.

 
The specified distance is only considered if the layout style is set to ORTHOGONAL_STYLE and option setEnforceGlobalLayering(boolean) is disabled.
Returns:
the minimum distance between horizontal edge segments
See Also:
setMinimumBusSegmentDistance(double)

setMinimumBusSegmentDistance

public void setMinimumBusSegmentDistance(double minimumBusSegmentDistance)
Specifies the minimum (vertical) distance of the horizontal edge segments of the bus between the root node and the child nodes. If this distance is set to 0, all segments are routed in a classical bus-like style.

 
The specified distance is only considered if the layout style is set to ORTHOGONAL_STYLE and option setEnforceGlobalLayering(boolean) is disabled.
Default Value:
The default value is 0.
Parameters:
minimumBusSegmentDistance - the minimum distance between horizontal edge segments
Throws:
java.lang.IllegalArgumentException - if the specified distance is smaller than 0
See Also:
setLayoutStyle(int), setPortStyle(int)
Sample Graphs:

Minimum edge distance 0 with centered port style

Minimum edge distance 0 with border-distributed port style

Minimum edge distance 5 with centered port style

Minimum edge distance 5 with border-distributed port style

isEnforceGlobalLayering

public boolean isEnforceGlobalLayering()
Returns whether or not a global layering is enforced, that is, each node spans exactly one layer.

If it is enabled, the algorithm ensures that nodes never span more than one layer. Otherwise, nodes with larger size might span two or more layers such that a more compact layout is produced.

This setting can be advantageous, if the hierarchical structure of the tree should be emphasized.

 
Disabling this feature to generate more compact layouts may force the algorithm to ignore the specified relative vertical alignment for nodes.
Returns:
true if global layering is enforced, false otherwise
See Also:
setEnforceGlobalLayering(boolean), getVerticalAlignment(), setVerticalAlignment(double)

setEnforceGlobalLayering

public void setEnforceGlobalLayering(boolean enabled)
Returns whether or not a global layering is enforced, that is, each node spans exactly one layer.

If it is enabled, the algorithm ensures that nodes never span more than one layer. Otherwise, nodes with larger size might span two or more layers such that a more compact layout is produced.

This setting can be advantageous, if the hierarchical structure of the tree should be emphasized.

 
Disabling this feature to generate more compact layouts may force the algorithm to ignore the specified relative vertical alignment for nodes.
Default Value:
The default value is false. Global layering is disabled.
Parameters:
enabled - true if global layering should be enforced, false otherwise
See Also:
getVerticalAlignment(), setVerticalAlignment(double)
Sample Graphs:

true

false

getChildPlacementPolicy

public byte getChildPlacementPolicy()
Returns the layout policy for leaf nodes.

Returns:
one of the predefined layout policies for leaf nodes
See Also:
setChildPlacementPolicy(byte)

setChildPlacementPolicy

public void setChildPlacementPolicy(byte policy)
Specifies the layout policy for leaf nodes.

Default Value:
The default value is CHILD_PLACEMENT_POLICY_SIBLINGS_ON_SAME_LAYER. Sibling nodes are placed on the same layer.
Parameters:
policy - one of the predefined layout policies for leaf nodes
Throws:
java.lang.IllegalArgumentException - if the specified policy is unknown

isGroupingSupported

public boolean isGroupingSupported()
Specifies whether or not group nodes are handled by the layout algorithm.

 
If this option is disabled, group nodes will be temporarily hidden and reinserted to enclose their content. This may lead to node overlaps.
 
Grouping only works correctly, if each group contains a complete subtree. This means that for each group there is a node such that the group contains exactly this node and all its descendants.
Returns:
true if grouping is supported, false otherwise
See Also:
CanonicMultiStageLayouter.setGroupNodeHidingEnabled(boolean)

setGroupingSupported

public void setGroupingSupported(boolean groupingSupported)
Specifies whether or not group nodes are handled by the layout algorithm.

 
If this option is disabled, group nodes will be temporarily hidden and reinserted to enclose their content. This may lead to node overlaps.
 
Grouping only works correctly, if each group contains a complete subtree. This means that for each group there is a node such that the group contains exactly this node and all its descendants.
Default Value:
The default value is true. Grouping is enabled.
Parameters:
groupingSupported - true if grouping should be supported, false otherwise
Sample Graph:

true

doLayoutCore

public void doLayoutCore(LayoutGraph graph)
Arranges the given graph as a tree.

Specified by:
doLayoutCore in class CanonicMultiStageLayouter
Parameters:
graph - the input graph

setComparator

public void setComparator(java.util.Comparator comparator)
Specifies the Comparator instance that is used for sorting the outgoing edges of each node of the tree. This comparator defines the relative order of the child nodes in the layout.

Default Value:
The default value is Comparator. An implementation that compares the x-coordinates of the nodes.
Parameters:
comparator - a Comparator instance

getComparator

public java.util.Comparator getComparator()
Returns the Comparator instance that is used for sorting the outgoing edges of each node of the tree. This comparator defines the relative order of the child nodes in the layout.

Default Value:
The default value is Comparator. An implementation that compares the x-coordinates of the nodes.
Returns:
a Comparator instance
See Also:
setComparator(Comparator)

setPortStyle

public void setPortStyle(int style)
Specifies the port assignment policy that will be applied.

Default Value:
The default value is NODE_CENTER_PORTS. Ports are placed at the center of the nodes.
Parameters:
style - one of the predefined port assignment policies

getPortStyle

public int getPortStyle()
Returns the port assignment policy that will be applied.

Returns:
one of the predefined port assignment policies
See Also:
setPortStyle(int)

setLayoutStyle

public void setLayoutStyle(int style)
Specifies the edge routing style used by this layout algorithm.

If PLAIN_STYLE is set, all edges will be routed as straight-line segments. If ORTHOGONAL_STYLE is set, all edges will be routed orthogonally in a bus-like fashion.

Default Value:
The default value is PLAIN_STYLE. Edges are routed as straight-line segments.
Parameters:
style - one of the predefined edge routing styles
Throws:
java.lang.IllegalArgumentException - if an invalid layout style is provided

getLayoutStyle

public int getLayoutStyle()
Returns the edge routing style used by this layout algorithm.

If PLAIN_STYLE is set, the edges will be routed as straight-line segments. If ORTHOGONAL_STYLE is set, all edges will be routed orthogonally in a bus-like fashion.

Returns:
one of PLAIN_STYLE or ORTHOGONAL_STYLE
See Also:
setLayoutStyle(int)

setMinimalNodeDistance

public void setMinimalNodeDistance(double dist)
Specifies the minimum horizontal distance between adjacent nodes within the same layer.

Default Value:
The default value is 20.
Parameters:
dist - the non-negative minimum distance
Throws:
java.lang.IllegalArgumentException - if the given distance is negative
Sample Graphs:

Minimum node distance set to 20

Minimum node distance set to 60

getMinimalNodeDistance

public double getMinimalNodeDistance()
Returns the minimum horizontal distance between adjacent nodes within the same layer.

Returns:
the non-negative minimum distance
See Also:
setMinimalNodeDistance(double)

setMinimalLayerDistance

public void setMinimalLayerDistance(double dist)
Specifies the minimum distance between two adjacent layers.

Default Value:
The default value is 40.
Parameters:
dist - the non-negative minimum distance
Throws:
java.lang.IllegalArgumentException - if the given distance is negative
Sample Graphs:

Minimum layer distance 40

Minimum layer distance 80

getMinimalLayerDistance

public double getMinimalLayerDistance()
Returns the minimum distance between two adjacent layers.

Returns:
the non-negative minimum distance
See Also:
setMinimalLayerDistance(double)

isIntegratedNodeLabelingEnabled

public boolean isIntegratedNodeLabelingEnabled()
Returns whether or not the layout algorithm reserves space for node labels.

 
When enabling this property, any previously specified labeling algorithm will be overwritten and when disabling it, any currently specified labeling algorithm will be disabled via property CanonicMultiStageLayouter.setLabelLayouterEnabled(boolean). Therefore, it is recommended to only use this convenience property instead of manually changing the mentioned other properties.
Returns:
true if node labels are considered, false otherwise
See Also:
setIntegratedNodeLabelingEnabled(boolean)

setIntegratedNodeLabelingEnabled

public void setIntegratedNodeLabelingEnabled(boolean integratedNodeLabelingEnabled)
Specifies whether or not the layout algorithm reserves space for node labels.

 
When enabling this property, any previously specified labeling algorithm will be overwritten and when disabling it, any currently specified labeling algorithm will be disabled via property CanonicMultiStageLayouter.setLabelLayouterEnabled(boolean). Therefore, it is recommended to only use this convenience property instead of manually changing the mentioned other properties.
Default Value:
The default value is false. Node labels are not considered.
Parameters:
integratedNodeLabelingEnabled - true if node labels should be considered, false otherwise
Sample Graphs:

false

true

isIntegratedEdgeLabelingEnabled

public boolean isIntegratedEdgeLabelingEnabled()
Returns whether or not the layout algorithm reserves space for edge labels and places them.

To define the desired placement for each label add a PreferredPlacementDescriptor on EdgeLabelLayout.

This method is a convenience method that assures that the label layouter is of type LabelLayoutTranslator and LabelLayoutTranslator.setTranslateEdgeLabelsEnabled(boolean) is set to true.

 
Optimal label placement with integrated labeling can be achieved using FreeEdgeLabelModel as the label model for the edges.
 
When enabling this property, any previously specified labeling algorithm will be overwritten and when disabling it, any currently specified labeling algorithm will be disabled via property CanonicMultiStageLayouter.setLabelLayouterEnabled(boolean). Therefore, it is recommended to only use this convenience property instead of manually changing the mentioned other properties.
Returns:
true if integrated edge labeling is enabled, false otherwise
See Also:
setIntegratedEdgeLabelingEnabled(boolean)

setIntegratedEdgeLabelingEnabled

public void setIntegratedEdgeLabelingEnabled(boolean integratedEdgeLabelingEnabled)
Specifies whether or not the layout algorithm reserves space for edge labels and places them.

To define the desired placement for each label add a PreferredPlacementDescriptor on EdgeLabelLayout.

This method is a convenience method that assures that the label layouter is of type LabelLayoutTranslator and LabelLayoutTranslator.setTranslateEdgeLabelsEnabled(boolean) is set to true.

 
Optimal label placement with integrated labeling can be achieved using FreeEdgeLabelModel as the label model for the edges.
 
When enabling this property, any previously specified labeling algorithm will be overwritten and when disabling it, any currently specified labeling algorithm will be disabled via property CanonicMultiStageLayouter.setLabelLayouterEnabled(boolean). Therefore, it is recommended to only use this convenience property instead of manually changing the mentioned other properties.
Default Value:
The default value is false. Integrated edge labeling is disabled.
Parameters:
integratedEdgeLabelingEnabled - true if integrated edge labeling should be enabled, false otherwise
Sample Graphs:

false

true

getBusAlignment

public double getBusAlignment()
Returns the vertical bus alignment for orthogonally routed edge buses.

The bus alignment determines the relative position of an edge bus between two subsequent layers. The value of this property must lie within the interval [0,1] where:

 
Bus alignment is taken into account only for:
Returns:
a value from the interval [0,1]
See Also:
setBusAlignment(double), setLayoutStyle(int), setEnforceGlobalLayering(boolean), setChildPlacementPolicy(byte)

setBusAlignment

public void setBusAlignment(double busAlignment)
Specifies the vertical bus alignment for orthogonally routed edge buses.

The bus alignment determines the relative position of an edge bus between two subsequent layers. The value of this property must lie within the interval [0,1] where:

 
Bus alignment is taken into account only for:
Default Value:
The default value is 0.3. The bus is placed closer to the parent node than to the child nodes.
Parameters:
busAlignment - a value from the interval [0,1]
Throws:
java.lang.IllegalArgumentException - if busAlignment is not in [0,1]
See Also:
setLayoutStyle(int), setEnforceGlobalLayering(boolean), setChildPlacementPolicy(byte)
Sample Graphs:

Bus alignment 0.0: top alignment

Bus alignment 0.5: center alignment

Bus alignment 1.0: bottom alignment

getVerticalAlignment

public double getVerticalAlignment()
Returns the vertical alignment of the nodes within their corresponding layers.

The value for the vertical alignment is considered as relative to the height of the corresponding layer, which is determined by the maximum height of the nodes that belong to the particular layer.

The value of this property must lie within the interval [0,1], where:

 
If global layering is not enforced, the value of this property is usually ignored.
Returns:
a value from the interval [0,1]
See Also:
setVerticalAlignment(double), setEnforceGlobalLayering(boolean)

setVerticalAlignment

public void setVerticalAlignment(double verticalAlignment)
Specifies the vertical alignment of the nodes within their corresponding layers.

The value for the vertical alignment is considered as relative to the height of the corresponding layer, which is determined by the maximum height of the nodes that belong to the particular layer.

The value of this property must lie within the interval [0,1], where:

 
If global layering is not enforced, the value of this property is usually ignored.
Default Value:
The default value is 0.5. Nodes of the same layer are center-aligned.
Parameters:
verticalAlignment - a value from the interval [0,1]
Throws:
java.lang.IllegalArgumentException - if vertical alignment value does not lie within [0,1]
See Also:
setEnforceGlobalLayering(boolean)
Sample Graphs:

Vertical alignment 0.0: top alignment

Vertical alignment 0.5: center alignment

Vertical alignment 1.0: bottom alignment

setModificationMatrix

public void setModificationMatrix(AbstractRotatableNodePlacer.Matrix modificationMatrix)
Specifies the modification matrix used for rotating / mirroring the layout.

Default Value:
The default value is AbstractRotatableNodePlacer.Matrix.DEFAULT
Parameters:
modificationMatrix - the given modification matrix

getModificationMatrix

public AbstractRotatableNodePlacer.Matrix getModificationMatrix()
Returns the modification matrix used for rotating / mirroring the layout.

Returns:
the current modification matrix
See Also:
setModificationMatrix(AbstractRotatableNodePlacer.Matrix)

setComponentLayouterEnabled

public void setComponentLayouterEnabled(boolean enabled)
Specifies whether or not the LayoutStage used for arranging the components of the graph is activated.

Overrides:
setComponentLayouterEnabled in class CanonicMultiStageLayouter
 
TreeLayouter can only handle single components. Disabling ComponentLayouter will lead to errors during execution.
Default Value:
The default value is true. The stage that arranges connected graph components is activated.
Parameters:
enabled - true if the stage that arranges the graph components is activated, false otherwise
See Also:
CanonicMultiStageLayouter.isComponentLayouterEnabled(), CanonicMultiStageLayouter.setComponentLayouter(LayoutStage), ComponentLayouter

setParallelEdgeLayouterEnabled

public void setParallelEdgeLayouterEnabled(boolean enabled)
Specifies whether or not the LayoutStage used for routing parallel edges is activated.

Overrides:
setParallelEdgeLayouterEnabled in class CanonicMultiStageLayouter
 
TreeLayouter cannot handle parallel edges. Disabling ParallelEdgeLayouter will lead to errors during execution.
Default Value:
The default value is true. The stage that routes parallel edges is activated.
Parameters:
enabled - true if the stage responsible for routing parallel edges is activated, false otherwise
See Also:
CanonicMultiStageLayouter.isParallelEdgeLayouterEnabled(), CanonicMultiStageLayouter.setParallelEdgeLayouter(LayoutStage), ParallelEdgeLayouter

setSelfLoopLayouterEnabled

public void setSelfLoopLayouterEnabled(boolean enabled)
Specifies whether or not the LayoutStage used for routing self-loops is activated.

Overrides:
setSelfLoopLayouterEnabled in class CanonicMultiStageLayouter
 
TreeLayouter cannot handle self-loops. Disabling SelfLoopLayouter will lead to errors during execution.
Default Value:
The default value is true. The stage that routes self-loops is activated.
Parameters:
enabled - true if the stage responsible for routing self-loops is activated, false otherwise
See Also:
CanonicMultiStageLayouter.isSelfLoopLayouterEnabled(), CanonicMultiStageLayouter.setSelfLoopLayouter(LayoutStage), SelfLoopLayouter

© Copyright 2000-2021,
yWorks GmbH.
All rights reserved.