Swim lane constraints (HL)
Swim lanes are rectangular areas orthogonal to the levels.
-
If the link flow direction is towards the bottom or top, the levels are horizontal rows and the swim lanes are vertical columns.
-
If the flow direction is towards the left or right, the levels are vertical columns and the swim lanes are horizontal rows.
You can use swim lanes if the nodes are partitioned into
groups, to indicate which nodes belong to a certain group. The nodes
in the same swim lane are placed so that it is possible to draw a
surrounding rectangle around them. Swim lanes allow you to organize
the graph in a table-like manner. For example, you may have a workflow
diagram where nodes represent actions; the swim lanes could then represent
the departments that perform these actions. Each node can belong to
only one swim lane.
To assign a group of nodes to a swim lane:
In Java
In Java™
, call:
layout.addConstraint(new IlvSwimLaneConstraint(new IlvNodeGroup(nodeVector)));
All nodes of the node vector will be placed in the same
swim lane rectangle. If a graph has many swim lane rectangles, the
relative order of these swim lanes is determined automatically. The
size of the swim lane rectangle depends on the nodes that belong to
the swim lane. However, you can specify the relative order, relative
size, and the margins of the swim lane as well by using the constructor:
public IlvSwimLaneConstraint(IlvNodeGroup group,
float relativeSize,
int positionIndex,
float westMinMargin,
float eastMinMargin)
Swim Lanes
The relative size indicates how large this swim lane
is compared to the other swim lanes. Assume that the flow direction
is towards the bottom. In this case, the relative size indicates the
width of the swim lane. All swim lanes with the same relative size
will have the same width. A swim lane with a relative size that is
twice the value of another swim lane will have twice the width of
the other swim lane. The actual number of this parameter does not
matter, only how large the value is compared to the other swim lanes.
If you do not want to restrict the size of the swim lane, set the
value to 0. In this case, the width of the swim lane will be independent
of the other swim lanes.
The minimum margin is the margin of the swim lane in
absolute coordinates. If the flow direction is towards the bottom,
then the west minimum margin is the minimum horizontal distance between
the leftmost node of the swimlane and the left swim lane border, and
the east minimum margin is the minimum horizontal distance between
the rightmost node of the swimlane and the right swim lane border.
The position index indicates the order of the swim lanes.
Just as nodes have position indices, the swim lanes are placed sequentially
at relative positions numbered from 0 to n. In a top-down layout,
the swim lane with position 0 is the leftmost swim lane, and the swim
lanes with higher position indices are placed farther to the right.
If the swim lanes have the position index -1, the layout algorithm
determines the appropriate position automatically.
A swim lane constraint is always evaluated, even if the
incremental mode is enabled. The constraint has a higher priority
than the relative position constraint and the side-by-side constraint.
You can specify side-by-side constraints for a group of nodes that
belong to the same swim lane, but side-by-side constraints of nodes
of different swim lanes are ignored. You can specify relative position
constraints between nodes of the same swim lane. You can also specify
relative position constraints between one entire swim lane group and
another swim lane group, which effectively orders the swim lanes.
But relative position constraints are ignored if they would require
breaking the swim lanes apart. The swim lane constraint dominates
the specified position indices and the extremity constraints, that
is, if a swim lane constraint is used, you cannot specify position
indices or east/west extremity constraints for any node.
Tip
Tip
The automatic conflict resolution can handle conflicting
constraints. However, to speed up the layout, it is recommended that
you specify constraints in such a way that there are no conflicts.






