Implements several algorithms for arranging tree structures.
Namespace: MindFusion.Diagramming.Layout
Assembly: MindFusion.Diagramming
C# Copy Code |
---|
public class TreeLayout : Layout |
Visual Basic Copy Code |
---|
Public Class TreeLayout |
Set the Type property of a TreeLayout instance to select which tree layout algorithm to run, and call the Arrange method to apply the layout on a tree/subtree in the current diagram.
As long as the graph is a tree, the algorithm can find the root node automatically. You can override it by setting the Root property, e.g. in order to arrange only a selected branch of the tree. The distance between the root and the second level and between all subsequent levels can be set through the LevelDistance property. The distance between adjacent nodes in the same level is set through NodeDistance.
In addition to arranging the tree nodes, TreeLayout also sets the shape of links as set through its LinkStyle property. Anchoring specifies whether the links should be attached to the anchor points of tree nodes. Note that links that are not part of the tree are ignored, e.g. graph links that go in opposite direction of the general parent-to-child flow or cross-links that connect different tree branches. The tree layout algorithm produces best results if it can place link ends at arbitrary positions over nodes' outlines, that is, when using the Ignore value. If your application logic requires links to be always attached to anchor points, use the other two values. In such cases Reassign would yield better results. You can post-process such links after calling Arrange, for example by setting their ControlPoints coordinates or by calling their Route method.
By default, the order of child nodes arranged under a parent corresponds to the order of links in the parent's OutgoingLinks collection. The Balance property can be set to Preserve to keep the original geometric order of child nodes when arranging them under their parent. This can be used to arrange tree branches in a specific order by first placing them in increasing horizontal or vertical positions. Another possibility is to apply TreeLayout from NodeModified handler to let users rearrange the tree branches by dragging and dropping a node.
System.Object
System.MarshalByRefObject
System.ComponentModel.Component
MindFusion.Diagramming.Layout.Layout
MindFusion.Diagramming.Layout.TreeLayout