- I
- I
Remarks
Layout Style
This layout algorithm only handles the paths of self-loops, that is, edges where the source node is equal to the target node. The nodes and other edges are optionally arranged by the coreLayout.
Self-loops are routed either ORTHOGONAL or with ROUNDED corners. The layout algorithm places the self-loops in the least crowded quadrant around a node. The default, when there is space, is a route starting at the top and ending at the right node side.
Concept
Self-loops are handled in four steps:
- Remove all self-loops of the input graph
- Invoke the core layout algorithm on the now self-loops free graph
- Reinsert all formerly removed self-loops
- Route the self-loops of the input graph
Features
SelfLoopRouter can either be used as a ILayoutStage wrapping an ILayoutAlgorithm which cannot handle self-loops. Then it will hide the self-loops from this coreLayout and take over the routing of them.
If no coreLayout is specified, SelfLoopRouter can work alone. It will route only the self-loops and keep the remaining graph unchanged.
Examples
const selfLoopRouter = new SelfLoopRouter()
const layoutData = selfLoopRouter.createLayoutData(graph)
// route only edges with a specific tag
layoutData.edges = (edge) => edge.tag == 'selected'Default Values of Properties
| Name | Default |
|---|---|
| coreLayout | null |
| routingStyle | SelfLoopRoutingStyle.ROUNDED |
See Also
Developer's Guide
Members
Constructors
Creates a new SelfLoopRouter with an optional coreLayout.
Parameters
- coreLayout?: ILayoutAlgorithm
- The core layout algorithm.
Properties
Gets or sets the core ILayoutAlgorithm that is wrapped by this stage.
Property Value
Default Value
Defined in
LayoutStageBase.coreLayoutFor rounded corners, the number of points should be at least 2. All smaller values will produce one bend and, therefore, an orthogonal path.
The number of points for a corner must be at least 1.
Property Value
Throws
- Exception ({ name: 'ArgumentError' })
- if the specified point count is less than
1
Default Value
Sample Graphs
2See Also
API
- routingStyle, ROUNDED
Property Value
Throws
- Exception ({ name: 'ArgumentError' })
- if the specified distance is negative
Default Value
Sample Graphs
5See Also
API
- ROUNDED
Gets or sets a value that determines whether this stage should do anything but execute the coreLayout.
By default, when constructed, stages should be enabled. Users may disable a stage's functionality by setting this property to false.
Stages that can guarantee that the graph will not change can choose to not even execute the coreLayout when disabled.
Defined in
LayoutStageBase.enabledGets or sets the routing style of the self-loops.
Property Value
Default Value
Methods
Implementation of the ILayoutAlgorithm interface and main entry point for the layout calculation.
Parameters
- graph: LayoutGraph
- The graph to apply the layout to.
Defined in
LayoutStageBase.applyLayoutDelegates the arrangement of nodes and edges to the coreLayout and routes the self-loops.
createLayoutData
(graph: LayoutGraph): EdgeScopeData<LayoutNode, LayoutEdge, LayoutNodeLabel, LayoutEdgeLabel, boolean>Returns an instance of LayoutData<TNode, TEdge, TNodeLabel, TEdgeLabel> that can be used to define the edges affected by the SelfLoopRouter.
createLayoutData
(graph: LayoutGraph): EdgeScopeData<LayoutNode, LayoutEdge, LayoutNodeLabel, LayoutEdgeLabel, boolean>Parameters
- graph: LayoutGraph
- the graph that determines the generic type arguments of the created layout data
Return Value
- EdgeScopeData<LayoutNode, LayoutEdge, LayoutNodeLabel, LayoutEdgeLabel, boolean>
- an instance of layout data that can be used to perform item-specific configurations for the given SelfLoopRouter.
Returns an instance of LayoutData<TNode, TEdge, TNodeLabel, TEdgeLabel> that can be used to define the edges affected by the SelfLoopRouter.
LayoutExecutor type is available at runtime.Parameters
- graph?: IGraph
- the graph that determines the generic type arguments of the created layout data
Return Value
- EdgeScopeData<INode, IEdge, ILabel, ILabel, boolean>
- an instance of layout data that can be used to perform item-specific configurations for the given SelfLoopRouter.