Rendering-related Features

Bridges

Class BridgeManager provides support for inserting so-called bridges into edge paths. Bridges are a means to resolve the visual ambiguity induced by intersecting edge paths. Each segment of an edge path that intersects with at least one other segment (from either the same or another edge path), can be augmented with a bridge in one of a variety of different styles.

Table 4.15, “Some bridge rendering styles” presents some of the bridge styles supported by BridgeManager. Enumeration type CrossingStyle is used to specify the styles.

Table 4.15. Some bridge rendering styles

Name Bridge Style
Gap
Arc
Rectangle
TwoSides

Example 4.27, “Using class BridgeManager with a GraphControl” shows how to use a BridgeManager with default configuration to add bridges to the edge paths of a canvas's graph.

Example 4.27. Using class BridgeManager with a GraphControl

void EnableBridgesForEdgePaths(GraphControl canvas) {
  BridgeManager bridges = new BridgeManager();
  bridges.CanvasControl = canvas;
  bridges.AddObstacleProvider(new GraphObstacleProvider());
}

Class BridgeManager uses an implementation of interface IObstacleProvider to determine "obstacles" that need to be taken into account during rendering. The interface's single method is used to get a GeneralPath that defines an actual obstacle.

Note

By default, an appropriate implementation of IObstacleProvider can be found in the Lookup of each edge that uses a PathBasedEdgeStyleRenderer<TStyle>-based style renderer.

GraphObstacleProvider, which is used in the above example code, is a convenience implementation that by default incorporates the obstacle definitions returned by all edges from the current graph in the BridgeManager's GraphControl. Optionally, using the QueryNodes property, obstacle definitions returned by all nodes can also be incorporated.

Note that obstacles are not restricted to describe edge segments alone. In tutorial demo application BridgesWindow, for example, an IObstacleProvider implementation is presented that defines the border of group nodes as obstacles as well.

Class BridgeManager knows several policies for determining crossings between obstacles. For example, edge segments that have either predominant horizontal or vertical orientation can be chosen to always lie atop of edge segments having contrary orientation. Enumeration type CrossingDetermination is used to specify the determination policy.

Tutorial demo application BridgesWindow demonstrates all aspects of how the bridging functionality is enabled in order to visually resolve intersecting edge paths.