The RemoveCollinearBendsStage removes all collinear bends found in a graph.
Remarks
The algorithm traverses each edge path from source to target and removes for each triple of consecutive collinear bends the middle one.
A collinear bend forms a straight line with its preceding bend and its subsequent bend. The angle between the connecting edge segments is either 0
or 180
degrees.
Default Values of Properties
removeStraightOnly | false | All collinear bends are removed from the edges. |
scale | 2 | Bend coordinates are rounded to the second decimal position before comparing. |
Type Details
- yFiles module
- algorithms
Constructors
Creates a new RemoveCollinearBendsStage instance with default settings.
Parameters
A map of options to pass to the method.
- scale - number
- The scale that defines how accurate the algorithm is when it comes to comparing the coordinates of two bends. This option sets the scale property on the created object.
- removeStraightOnly - boolean
- Whether the algorithm removes only collinear bends which lie in the middle of their neighbors or all collinear bends. This option sets the removeStraightOnly property on the created object.
- enabled - boolean
- coreLayout - ILayoutAlgorithm
- The core ILayoutAlgorithm that is wrapped by this stage. This option sets the coreLayout property on the created object.
Properties
Gets or sets the core ILayoutAlgorithm that is wrapped by this stage.
Gets or sets a value that determines whether this stage should do anything but execute the coreLayout.
Remarks
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.
Implements
Gets or sets whether the algorithm removes only collinear bends which lie in the middle of their neighbors or all collinear bends.
Remarks
180
degrees, while in the second case, the angle can be either 180
degrees or 0
degrees.Default Value
false
.All collinear bends are removed from the edges.
Property Value
true
if only bends with 180
degrees are removed, false
otherwiseGets or sets the scale that defines how accurate the algorithm is when it comes to comparing the coordinates of two bends.
Remarks
- Positive scale values: the value denotes the number of decimal positions that are considered (e.g.
10.2345
becomes10.23
for a scale factor of2
). - Scale value zero: coordinates are rounded to the next integer coordinates (e.g.
10.2345
becomes10
). - Negative scale values: the coordinates are rounded to the next multiple of
10
,100
and so on (e.g.10.2345
becomes0
for a scale factor of-2
).
Default Value
2
.Bend coordinates are rounded to the second decimal position before comparing.
Property Value
Methods
Implementation of the ILayoutAlgorithm interface and main entry point for the layout calculation.
Remarks
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- The graph to apply the layout to.
Implements
Removes collinear bends of the edges in the given graph.
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the input graph