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:
// 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
BridgeManagerclass for inserting bridges into edge paths.
Members
Show:
Constructors
Initializes a new instance of the BridgeManager class.
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.
Gets or sets the BridgeCrossingPolicy mode that is used by this instance.
Gets or sets the canvasComponent that should be managed by this instance.
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
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 implementation of the IBridgeCreator that will be used if addBridges is invoked with a
null callback argument.final
See Also
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.
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.
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.
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.
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.
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.
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.
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.
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.
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
nullthat 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.
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
Disposes of this instance by resetting the canvasComponent property to null.
Disposes of this instance by resetting the canvasComponent property to
null.Gets a hash code that describes the current state of the obstacles.
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.
Implementation that will be called by the default value of the defaultBridgeCreator to satisfy requests to createCustomBridge.
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
Installs this manager for the specified canvasComponent.
Installs this manager for the specified canvasComponent.
Dynamically registers an obstacle path with the context during the rendering.
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
Dynamically registers a single obstacle cubic curve with the context during the rendering.
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
Dynamically registers a single obstacle line with the context during the rendering.
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.
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
Called to initialize the context with the obstacles.
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
Removes a previously added IObstacleProvider from the list of registered providers.
Removes a previously added IObstacleProvider from the list of registered providers.
Reverts the install method.
Reverts the install method.