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 2.16, “Some bridge rendering styles” presents some of the bridge styles supported by BridgeManager. The STYLE constants of BridgeManager are used to specify the styles.

Table 2.16. Some bridge rendering styles

Name Bridge Style
STYLE_GAP
STYLE_ARC
STYLE_RECTANGLE
STYLE_TWO_SIDES

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

Example 2.26. Using class BridgeManager with a GraphCanvasComponent

function enableBridgesForEdgePaths(canvas:GraphCanvasComponent):void {
  var bridges:BridgeManager = new BridgeManager();
  bridges.canvasComponent = 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-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 CanvasComponent. 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 BridgeDemo, 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. BridgeManager's DETERMINE constants are used to specify the determination policy. For example, edge segments that have predominant horizontal orientation can be chosen to always lie atop of edge segments having vertical orientation by setting BridgeManager's crossingDetermination to DETERMINE_MORE_HORIZONTAL_BRIDGES_LESS_HORIZONTAL.