Class SwimLaneLayout

GoDiagram®
v10.0.8
by Northwoods Software®

A custom LayeredDigraphLayout that knows about "lanes" and that positions each node in its respective lane.

Namespace: Northwoods.Go.Layouts.Extensions
Assembly: SwimLaneWinForms.dll
Syntax
public class SwimLaneLayout : LayeredDigraphLayout
Remarks

This assumes that each Node.Data.Lane property is a string that names the lane the node should be in. You can set the LaneProperty property to use a different data property name. It is commonplace to set this property to be the same as the NodeGroupKeyProperty, so that the one property indicates that a particular node data is a member of a particular group and thus that that group represents a lane.

The lanes can be sorted by specifying the LaneComparer function.

You can add extra space between the lanes by increasing LaneSpacing from its default of zero. That number's unit is columns, ColumnSpacing, not in document coordinates.

Constructors

SwimLaneLayout()

Constructs a SwimLaneLayout.

Declaration
public SwimLaneLayout()

Properties

LaneBreadths

The computed breadths (widths or heights depending on the direction) of each lane, in the form of a dictionary mapping lane names (strings) to numbers.

Declaration
protected Dictionary<string, int> LaneBreadths { get; }
Property Value
Type Description
Dictionary<string, int>

LaneComparer

Gets or sets a comparer by which to compare lane names, for ordering the lanes within the LaneNames list.

Declaration
public StringComparer LaneComparer { get; set; }
Property Value
Type Description
StringComparer
Remarks

By default the function is null -- the lanes are not sorted.

LaneNames

Gets or sets a list of lane names.

Declaration
public List<string> LaneNames { get; set; }
Property Value
Type Description
List<string>
Remarks

If you set this before a layout happens, it will use those lanes in that order. Any additional lane names that it discovers will be added to the end of this list.

This property is reset to an empty list at the end of each layout. The default value is an empty list.

LanePositions

The computed positions of each lane, in the form of a dictionary mapping lane names (strings) to numbers.

Declaration
protected Dictionary<string, int> LanePositions { get; }
Property Value
Type Description
Dictionary<string, int>

LaneProperty

Gets or sets the name of the data property that holds the string which is the name of the lane that the node should be in.

Declaration
public string LaneProperty { get; set; }
Property Value
Type Description
string
Remarks

The default value is "Lane".

LaneSpacing

Gets or sets the amount of additional space it allocates between the lanes.

Declaration
public int LaneSpacing { get; set; }
Property Value
Type Description
int
Remarks

This number specifies the number of columns, with the same meaning as ColumnSpacing. The number unit is not in document coordinate or pixels. The default value is zero columns.

Methods

ComputeMinLaneWidth(string)

Return the minimum lane width, in columns.

Declaration
public virtual int ComputeMinLaneWidth(string lane)
Parameters
Type Name Description
string lane
Returns
Type Description
int

FindLane(LayeredDigraphVertex)

This is just like GetLane(LayeredDigraphVertex) but handles dummy vertexes for which the GetLane(LayeredDigraphVertex) returns null by returning the lane of the edge's source or destination vertex.

Declaration
protected string FindLane(LayeredDigraphVertex v)
Parameters
Type Name Description
LayeredDigraphVertex v
Returns
Type Description
string
Remarks

This can only be called after the lanes have been set up internally.

GetLane(LayeredDigraphVertex)

Given a vertex, get the lane (name) that its node belongs in.

Declaration
protected string GetLane(LayeredDigraphVertex v)
Parameters
Type Name Description
LayeredDigraphVertex v
Returns
Type Description
string
Remarks

If the lane appears to be undefined, this returns the empty string. For dummy vertexes (with no node) this will return null.