C

BridgeManager

Helper class that calculates visual hints in a path where said path crosses an obstacle.
Inheritance Hierarchy

Remarks

Most notably this feature is used to render crossings of IEdges with other edges.

To set up bridges in a GraphComponent at the least the following is necessary:

Creating a BridgeManager for a GraphControl
// Create a BridgeManager and bind it to the GraphComponent
const bridgeManager = new BridgeManager()
bridgeManager.canvasComponent = graphComponent
// Add an obstacle provider that queries graph items (notably edges)
// for obstacles which can then be bridged
bridgeManager.addObstacleProvider(new GraphObstacleProvider())

Furthermore, an edge style that supports bridges is necessary; PolylineEdgeStyle is a good choice. Various other properties can be set to change the defaults, e.g. how bridges appear, or which way bridges point.

See Also

Developer's Guide

Demos

Shows the capabilities of the BridgeManager class for inserting bridges into edge paths.

Members

Show:

Constructors

Initializes a new instance of the BridgeManager class.
Initially the defaultBridgeCreator will be set to an instance that will delegate to the set of Default properties in this class and the insertDefaultCustomBridge method respectively.

Parameters

Properties

Gets or sets the BridgeCrossingPolicy mode that is used by this instance.
By default the HORIZONTAL_BRIDGES_VERTICAL mode is set.
conversionfinal

See Also

Developer's Guide
Gets or sets the canvasComponent that should be managed by this instance.
This method will install a preparation stage for the IRenderContext in the provided canvasComponent via the lookup mechanism.
final

See Also

Developer's Guide
Gets or sets a value that determines whether curves (cubic and quadratic) should be considered as obstacles.
This can be a costly operation so the default is false.
final
Gets or sets the default implementation of the IBridgeCreator that will be used if addBridges is invoked with a null callback argument.
Gets or sets the default BridgeCrossingStyle that will be used by the default implementation of the IBridgeCreator that is initially assigned to the defaultBridgeCreator property.
The default value is ARC.
conversionfinal

See Also

Developer's Guide
API
getCrossingStyle
Gets or sets the default height of a bridge that will be used by the default implementation of the IBridgeCreator that is initially assigned to the defaultBridgeCreator property.
The default value is 5.0d.
final

See Also

API
getBridgeHeight
Gets or sets the default BridgeOrientationStyle for bridges that will be used by the default implementation of the IBridgeCreator that is initially assigned to the defaultBridgeCreator property.
The default is UP.
conversionfinal

See Also

API
getOrientationStyle
Gets or sets the default width of a bridge that will be used by the default implementation of the IBridgeCreator that is initially assigned to the defaultBridgeCreator property.
The default value is 10.0d.
final

See Also

API
getBridgeWidth
Gets or sets a threshold value that determines below which zoom level, there should be no more bridge calculation.
Since the calculation of the bridges is a costly operation if there are many items visible and bridges are not clearly visible at low zoom levels, it is convenient to disable the calculation of bridges for these zoom levels to speed up the rendering process. The default value is 0.3d.
final

Methods

Core method that will add bridges to a GeneralPath using the IBridgeCreator callback to determine the type of the bridges.
This method may return path itself if no crossings have been determined. Otherwise, it will return a new path instance that has the bridges added at the corresponding places.

Parameters

context: IRenderContext
The context to use.
path: GeneralPath
The path to calculate the bridged variant for.
callback?: IBridgeCreator
The callback or null that determines the appearance of the bridges.

Return Value

GeneralPath
The path that might have been augmented by the bridges.
Adds another IObstacleProvider to query for obstacles.
The getObstacles method will be invoked during construction of the obstacles.

Parameters

provider: IObstacleProvider
The provider instance to use for later queries.

See Also

API
registerObstacles, removeObstacleProvider
Disposes of this instance by resetting the canvasComponent property to null.
Gets a hash code that describes the current state of the obstacles.
This method can be used to get a concise, digest snapshot of the current obstacle locations. Storing that result and comparing it to another snapshot later allows to determine quickly whether obstacles have changed since the last call. This is helpful, e.g. in implementations of IEdgeStyle that support bridges to not recreate the edge path (including bridges) in updateVisual if no obstacles changed.

Parameters

context: IRenderContext
The context to inspect.

Return Value

number
A hash of the state of the obstacles.
Implementation that will be called by the default value of the defaultBridgeCreator to satisfy requests to createCustomBridge.
This implementation will insert a gap style bridge by first creating a line to start and then moving to end.

Parameters

context: IRenderContext
The context for the call.
path: GeneralPath
The path to append the next segment to.
start: Point
The coordinates of the starting point of the bridge.
end: Point
The coordinates of the ending point of the bridge.
gapLength: number
The distance between the starting point and the end point.

See Also

API
createCustomBridge
Installs this manager for the specified canvasComponent.
protected

Parameters

canvasComponent: CanvasComponent
Dynamically registers an obstacle path with the context during the rendering.
Normally all obstacles will be registered initially by method registerObstacles. This method can be called during the rendering phase to register additional obstacles at a later point in time.

Parameters

context: IRenderContext
The context to register the obstacles with.
path: GeneralPath
The path that describes the obstacles.

See Also

API
registerObstacleLine
Dynamically registers a single obstacle cubic curve with the context during the rendering.
Normally all obstacles will be registered initially by method registerObstacles. This method can be called during the rendering phase to register additional obstacles at a later point in time.

Parameters

context: IRenderContext
The context to register the obstacles with.
p1: Point
The coordinates of the starting point of the line.
cp1: Point
The coordinates of the first control point of the curve.
cp2: Point
The coordinates of the second control point of the curve.
p2: Point
The coordinates of the ending point of the line.

See Also

API
registerObstacleLine
Dynamically registers a single obstacle line with the context during the rendering.
Normally all obstacles will be registered initially by method registerObstacles. This method can be called during the rendering phase to register additional obstacles at a later point in time.

Parameters

context: IRenderContext
The context to register the obstacles with.
p1: Point
The coordinates of the first point of the line.
p2: Point
The coordinates of the second point of the line.
Dynamically registers a single obstacle quadratic curve with the context during the rendering.
Normally all obstacles will be registered initially by method registerObstacles. This method can be called during the rendering phase to register additional obstacles at a later point in time.

Parameters

context: IRenderContext
The context to register the obstacles with.
p1: Point
The coordinates of the starting point of the line.
cp: Point
The coordinates of the control point of the curve.
p2: Point
The coordinates of the ending point of the line.

See Also

API
registerObstacleLine
Called to initialize the context with the obstacles.
protected

Parameters

context: IRenderContext
The context that will be used to store the obstacles within.

See Also

API
registerObstacle, registerObstacleLine
Removes a previously added IObstacleProvider from the list of registered providers.

Parameters

provider: IObstacleProvider
The provider instance to remove from this instance.

See Also

API
addObstacleProvider
Reverts the install method.
protected

Parameters

canvasComponent: CanvasComponent