Helper class that calculates visual hints in a path where said path crosses an obstacle.
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.
Related Programming Samples
- Bridges
- Shows the capabilities of the
BridgeManager
class for inserting bridges into edge paths.
Type Details
- yFiles module
- view
Constructors
Initializes a new instance of the BridgeManager class.
Remarks
Default
properties in this class and the insertDefaultCustomBridge method respectively.Parameters
A map of options to pass to the method.
- defaultBridgeCreator - IBridgeCreator
- The default implementation of the IBridgeCreator that will be used if addBridges is invoked with a
null
callback argument. This option sets the defaultBridgeCreator property on the created object. - considerCurves - boolean
- A value that determines whether curves (cubic and quadratic) should be considered as obstacles. This option sets the considerCurves property on the created object.
- zoomThreshold - number
- A threshold value that determines below which zoom level, there should be no more bridge calculation. This option sets the zoomThreshold property on the created object.
- bridgeCrossingPolicy - BridgeCrossingPolicy
- The BridgeCrossingPolicy mode that is used by this instance. This option sets the bridgeCrossingPolicy property on the created object.
- canvasComponent - CanvasComponent
- The canvasComponent that should be managed by this instance. This option either sets the value directly or recursively sets properties to the instance of the canvasComponent property on the created object.
- defaultBridgeCrossingStyle - BridgeCrossingStyle
- The default BridgeCrossingStyle that will be used by the default implementation of the IBridgeCreator that is initially assigned to the defaultBridgeCreator property. This option sets the defaultBridgeCrossingStyle property on the created object.
- defaultBridgeWidth - number
- 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. This option sets the defaultBridgeWidth property on the created object.
- defaultBridgeHeight - number
- 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. This option sets the defaultBridgeHeight property on the created object.
- defaultBridgeOrientationStyle - BridgeOrientationStyle
- The default BridgeOrientationStyle for bridges that will be used by the default implementation of the IBridgeCreator that is initially assigned to the defaultBridgeCreator property. This option sets the defaultBridgeOrientationStyle property on the created object.
Properties
Gets or sets the BridgeCrossingPolicy mode that is used by this instance.
Remarks
Gets or sets the canvasComponent that should be managed by this instance.
Remarks
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.
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 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 a threshold value that determines below which zoom level, there should be no more bridge calculation.
Remarks
0.3d
.Methods
Core method that will add bridges to a GeneralPath using the IBridgeCreator callback to determine the type of the bridges.
Remarks
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
A map of options to pass to the method.
- 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.
Returns
- ↪GeneralPath
- The path that might have been augmented by the bridges.
Adds another IObstacleProvider to query for obstacles.
Remarks
Parameters
A map of options to pass to the method.
- provider - IObstacleProvider
- The provider instance to use for later queries.
See Also
Disposes of this instance by resetting the canvasComponent property to null
.
Gets a hash code that describes the current state of the obstacles.
Remarks
Parameters
A map of options to pass to the method.
- context - IRenderContext
- The context to inspect.
Returns
- ↪number
- A hash of the state of the obstacles.
insertDefaultCustomBridge
(context: IRenderContext, path: GeneralPath, start: Point, end: Point, gapLength: number)Implementation that will be called by the default value of the defaultBridgeCreator to satisfy requests to createCustomBridge.
Remarks
start
and then moving to end
.Parameters
A map of options to pass to the method.
- 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.
Parameters
A map of options to pass to the method.
- canvasComponent - CanvasComponent
- The canvasComponent.
Dynamically registers an obstacle path with the context during the rendering.
Remarks
Parameters
A map of options to pass to the method.
- 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.
Remarks
Parameters
A map of options to pass to the method.
- 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.
Remarks
Parameters
A map of options to pass to the method.
- 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.
Remarks
Parameters
A map of options to pass to the method.
- 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.
Parameters
A map of options to pass to the method.
- 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.
Parameters
A map of options to pass to the method.
- provider - IObstacleProvider
- The provider instance to remove from this instance.
See Also
Reverts the install method.
Parameters
A map of options to pass to the method.
- canvasComponent - CanvasComponent
- The canvasComponent.