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
Constructors
Initializes a new instance of the BridgeManager class.
Default properties in this class and the insertDefaultCustomBridge method respectively.Parameters
Properties
Gets or sets the BridgeCrossingPolicy mode that is used by this instance.
See Also
Developer's Guide
Gets or sets the canvasComponent that should be managed by this instance.
See Also
Developer's Guide
false.Gets or sets the default implementation of the IBridgeCreator that will be used if addBridges is invoked with a null callback argument.
null callback argument.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.
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.
This property has no effect if defaultBridgeCrossingStyle is BridgeCrossingStyle.GAP, BridgeCrossingStyle.ARC_SCALED, BridgeCrossingStyle.RECTANGLE_SCALED, or BridgeCrossingStyle.TWO_SIDES_SCALED. In case of a scaled crossing style the height is determined by the defaultBridgeWidth.
The default value is 5.0d.
See Also
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 width of a bridge at a single orthogonal crossing typically corresponds to this property. For non-orthogonal crossings and if the value of the maximumBridgeWidth property is larger than this property, the actual bridge width increases as the intersection angles decrease to maintain a constant distance between the visible edge path and the obstacle.
A bridge that spans multiple obstacles at once can have a larger width than defaultBridgeWidth and maximumBridgeWidth.
The default value is 10.0 and maximumBridgeWidth has the same default value.
See Also
A bridge at a single orthogonal crossing typically has a width of defaultBridgeWidth. For non-orthogonal crossings, the actual width increases as the intersection angles decrease to maintain a constant distance between the visible edge path and the obstacle. This property specifies the maximum bridge width, as it would become very large for small angles. Bridges will have at least width defaultBridgeWidth, even if this property is set to a smaller value.
A bridge that spans multiple obstacles at once can have a larger width than maximumBridgeWidth.
For curved obstacles (PathType.CUBIC_TO and PathType.QUAD_TO), the bridge width is always defaultBridgeWidth.
The default value is 10.0 and defaultBridgeWidth has the same default value, which means that the actual bridge width is constant and does not depend on the intersection angle.
0.3d.Methods
Core method that will add bridges to a GeneralPath using the IBridgeCreator callback to determine the type of the bridges.
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.
Parameters
- provider: IObstacleProvider
- The provider instance to use for later queries.
See Also
Disposes of this instance by resetting the canvasComponent property to null.
null.Gets a hash code that describes the current state of the obstacles.
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 IBridgeCreator.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.
Parameters
- canvasComponent: CanvasComponent
- The canvasComponent.
Dynamically registers an obstacle path with the context during the rendering.
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.
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.
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.
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.
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.
Parameters
- provider: IObstacleProvider
- The provider instance to remove from this instance.
See Also
Reverts the install method.
Parameters
- canvasComponent: CanvasComponent
- The canvasComponent.