Class RadialLayout
- Namespace
- Northwoods.Go.Layouts.Extensions
- Assembly
- RadialWinForms.dll
Given a root Node, this arranges connected nodes in concentric rings, layered by the minimum link distance from the root.
public class RadialLayout : NetworkLayout<RadialNetwork, RadialVertex, RadialEdge, RadialLayout>
- Inheritance
-
RadialLayout
- Inherited Members
Constructors
RadialLayout()
Create a Radial layout.
public RadialLayout()
Properties
LayerThickness
Gets or sets the thickness of each ring representing a layer.
public int LayerThickness { get; set; }
Property Value
Remarks
The default value is 100.
MaxLayers
Gets or sets the maximum number of layers to be shown, in addition to the root node at layer zero.
public int MaxLayers { get; set; }
Property Value
Remarks
The default value is int.MaxValue.
Root
Gets or sets the Node that acts as the root or central node of the radial layout.
public Node Root { get; set; }
Property Value
Methods
CommitLayers()
Override this method in order to create background circles indicating the layers of the radial layout.
public virtual void CommitLayers()
Remarks
By default this method does nothing.
CommitLayout()
Commit changes to the diagram by setting Node positions and by routing the Links. This is called by UpdateParts() within a transaction.
protected override void CommitLayout()
Remarks
You should not call this method -- it is a "protected virtual" method. This may be overridden by subclasses of NetworkLayout. By default this method is implemented as follows:
protected virtual void CommitLayout() {
if (Network == null) return;
foreach (var vert in Network.Vertexes) {
vert.Commit();
}
if (IsRouting) {
foreach (var edge in Network.Edges) {
edge.Commit();
}
}
}
Please read the Introduction page on Extensions for how to override methods and how to call this base method.
ComputeBreadth(RadialVertex)
Compute the proportion of arc that the given vertex should take relative to its siblings.
public virtual double ComputeBreadth(RadialVertex v)
Parameters
Returns
Remarks
The default behavior is to give each child arc according to the sum of the maximum breadths of each of its children. This assumes that all nodes have the same breadth -- i.e. that they will occupy the same sweep of arc. It does not take the Node.ActualBounds into account, nor the angle at which the node will be location relative to the origin, nor the distance the node will be from the root node.
In order to give each child of a vertex the same fraction of arc, override this method:
public override double ComputeBreadth(RadialVertex v) { return 1; }
In order to give each child of a vertex a fraction of arc proportional to how many children the child has:
public override double ComputeBreadth(RadialVertex v) { return Math.Max(1, v.Children.Count); }
DoLayout(IEnumerable<Part>)
Find distances between root and vertexes, and then lay out radially.
public override void DoLayout(IEnumerable<Part> coll = null)
Parameters
coll
IEnumerable<Part>
RotateNode(Node, double, double, double)
Override this method in order to modify each node as it is laid out.
public virtual void RotateNode(Node node, double angle, double sweep, double radius)
Parameters
Remarks
By default this method does nothing.