Class CircularLayout

GoDiagram®
v10.0.11
by Northwoods Software®

This layout positions nodes in a circular arrangement.

Namespace: Northwoods.Go.Layouts
Assembly: Northwoods.GoDiagram.WinForms.CircularLayout.dll
Syntax
public class CircularLayout : NetworkLayout<CircularNetwork, CircularVertex, CircularEdge, CircularLayout>
Remarks

There are several samples that use CircularLayout. The layout cannot guarantee that it provides optimal positioning of nodes when trying to minimize link crossings.

If you want to experiment interactively with most of the properties, try the Circular Layout sample. See samples that make use of CircularLayout in the samples index.

This layout makes use of a Network<V, E, Y> of CircularVertexes and CircularEdges that normally correspond to the Nodes and Links of the Diagram.

Constructors

CircularLayout()

Constructs a CircularLayout with no Network and with no owning Diagram.

Declaration
public CircularLayout()

Properties

ActualCenter

This read-only property is the coordinates of the center of the laid-out ellipse immediately after the layout.

Declaration
public Point ActualCenter { get; }
Property Value
Type Description
Point

ActualSpacing

This read-only property is the effective spacing that may have been calculated by the layout.

Declaration
public double ActualSpacing { get; }
Property Value
Type Description
double

ActualXRadius

This read-only property is the effective X radius that may have been calculated by the layout.

Declaration
public double ActualXRadius { get; }
Property Value
Type Description
double

ActualYRadius

This read-only property is the effective Y radius that may have been calculated by the layout.

Declaration
public double ActualYRadius { get; }
Property Value
Type Description
double

Arrangement

Gets or sets how the nodes are spaced.

Declaration
public CircularArrangement Arrangement { get; set; }
Property Value
Type Description
CircularArrangement
Remarks

If Arrangement == Packed, the specified Radius will be ignored.

The default value is ConstantSpacing.

AspectRatio

Gets or sets the ratio of the arrangement's height to its width (1 for a circle, >1 for a vertically elongated ellipse).

Declaration
public double AspectRatio { get; set; }
Property Value
Type Description
double
Remarks

This is 1 by default. The value must be a positive number.

Modifying this value changes the height, but keeps the width and the Radius constant.

Comparer

Gets or sets the comparer which sorts the data when Sorting is set to Ascending or Descending.

Declaration
public Comparison<CircularVertex> Comparer { get; set; }
Property Value
Type Description
Comparison<CircularVertex>
Remarks

The default function compares the Text values of the vertexes' Nodes.

Direction

Gets or sets whether the nodes are arranged clockwise or counterclockwise.

Declaration
public CircularDirection Direction { get; set; }
Property Value
Type Description
CircularDirection
Remarks

The default value is Clockwise.

NodeDiameterFormula

Specifies how the diameter of nodes will be calculated.

Declaration
public CircularNodeDiameterFormula NodeDiameterFormula { get; set; }
Property Value
Type Description
CircularNodeDiameterFormula
Remarks

When a node is not circular, it is not clear what its diameter is.

The default is Pythagorean.

Radius

Gets or sets the horizontal radius of the elliptical arrangement.

Declaration
public double Radius { get; set; }
Property Value
Type Description
double
Remarks

The default value is NaN. NaN indicates that the Spacing will determine the size of the ring.

If Spacing is also NaN, the effective spacing will be 6. If Spacing is a number, the effective radius will be > radius if and only if the spacing between elements would otherwise be less than spacing.

The specified value for Radius will be ignored if Arrangement == Packed.

This property must always be positive or NaN.

Sorting

Gets or sets if and how the nodes are sorted.

Declaration
public CircularSorting Sorting { get; set; }
Property Value
Type Description
CircularSorting
Remarks

Forwards indicates that the nodes are arranged in the order the layout gets them. Reverse indicates that the nodes are arranged in the reverse order that the layout gets them. Ascending and Descending indicate that the nodes will be sorted using the Comparer. Optimized indicates that the nodes will be arranged to minimize link crossings.

The default value is Optimized.

Spacing

Gets or sets the distance between nodes (if Radius is NaN) or the minimum distance between nodes (if Radius is a number).

Declaration
public double Spacing { get; set; }
Property Value
Type Description
double
Remarks

The default value is 6. The value may be NaN.

If Spacing is NaN, there is no minimum spacing, allowing nodes to overlap, unless Radius is NaN, in which case the effective spacing will be 6 to determine an effective radius. If Spacing is a number but Radius isn't, the effective spacing will be spacing, and this will determine the effective radius. If both Spacing and Radius are numbers, the effective radius will be at least Radius, but may be larger so that the minimum spacing between nodes is Spacing.

StartAngle

Gets or sets the angle (in degrees, clockwise from the positive side of the X axis) of the first element.

Declaration
public double StartAngle { get; set; }
Property Value
Type Description
double
Remarks

The default value is 0.

SweepAngle

Gets or sets the absolute angle (in degrees) between the first and last node.

Declaration
public double SweepAngle { get; set; }
Property Value
Type Description
double
Remarks

The default value is 360. The value must be greater than zero and less than or equal to 360. If it is not in this range, it will be automatically set to 360.

Whether the arrangement is clockwise or counterclockwise does not depend on the sign of this value. The direction can be controlled by setting Direction. If 360 is the specified value, the actual value will be less to keep the first and last elements from overlapping, and the spacing between the first and last nodes will be determined the same way as for all other adjacent nodes.

Methods

CommitLayout()

Position each Node according to the Vertex position, and then position the Links.

Declaration
protected override void CommitLayout()
Overrides
Northwoods.Go.Layouts.NetworkLayout<Northwoods.Go.Layouts.CircularNetwork, Northwoods.Go.Layouts.CircularVertex, Northwoods.Go.Layouts.CircularEdge, Northwoods.Go.Layouts.CircularLayout>.CommitLayout()
Remarks

You should not call this method -- it is a "protected virtual" method.

Commit the position and routing of all edge links.

Declaration
protected virtual void CommitLinks()

This is called by CommitLayout(). This is only called if IsRouting is true. Please read the Introduction page on Extensions for how to override methods and how to call this base method.

CommitNodes()

Commit the position of all vertex nodes.

Declaration
protected virtual void CommitNodes()
Remarks

Please read the Introduction page on Extensions for how to override methods and how to call this base method.

DoLayout(IEnumerable<Part>)

Assign the positions of the vertexes in the network.

Declaration
public override void DoLayout(IEnumerable<Part> coll = null)
Parameters
Type Name Description
IEnumerable<Part> coll
Overrides