Table of Contents

Class SwimLaneLayout

Namespace
Northwoods.Go.Layouts.Extensions
Assembly
SwimLaneWinForms.dll

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

public class SwimLaneLayout : LayeredDigraphLayout
Inheritance
SwimLaneLayout
Inherited Members

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.

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.

protected Dictionary<string, int> LaneBreadths { get; }

Property Value

Dictionary<string, int>

LaneComparer

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

public StringComparer LaneComparer { get; set; }

Property Value

StringComparer

Remarks

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

LaneNames

Gets or sets a list of lane names.

public List<string> LaneNames { get; set; }

Property Value

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.

protected Dictionary<string, int> LanePositions { get; }

Property Value

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.

public string LaneProperty { get; set; }

Property Value

string

Remarks

The default value is "Lane".

LaneSpacing

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

public int LaneSpacing { get; set; }

Property Value

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.

public virtual int ComputeMinLaneWidth(string lane)

Parameters

lane string

Returns

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.

protected string FindLane(LayeredDigraphVertex v)

Parameters

v LayeredDigraphVertex

Returns

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.

protected string GetLane(LayeredDigraphVertex v)

Parameters

v LayeredDigraphVertex

Returns

string

Remarks

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