- I
- I
Remarks
Concept
The path of an edge, i.e., its start and end point as well as the intermediate control points, are interpreted as the set of input points. A cubic Bezier curve is then fitted to these points.
After the fitting, the points of the processed edges can be interpreted as cubic Bezier control points. Each four consecutive points form a Bezier curve, where the first and last of the four points represent the start and end of the curve and the second and third point are the control points defining how the curve looks. The second and third point do not necessarily lie on the actual curve.
There are two exceptions to the stated rules:
- If an input edge only consists of a source and a target point, it will be ignored by this stage.
- Self-loop edges with only one intermediate control point are also ignored. Note that self-loops with more control points are, however, handled by this stage.
Features
The maximum allowed error for the fitting process can be selected to control how high the precision should be. A high allowed error means that the approximation process has a lot of freedom. Curves are only loosely bound to the original edge path. If this is not desired, e.g., because no new intersection with other graph elements should be introduced, then a rather low error value should be specified. The lower the error value, the larger the number of bend points of an approximated edge will be.
It is possible to define the set of edges that should be processed by this layout stage. Therefore, only paths of a sub-set of edges can be changed. Use an IMapper<K, V> registered with the selection key to mark edges which should be part of the considered sub-set.
Default Values of Properties
| Name | Default |
|---|---|
| coreLayout | null |
| maximumError | 4.0 |
| straightControlPointRatio | 0.33 |
Members
Constructors
Creates a new CurveFittingStage with an optional core layout algorithm.
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.coreLayoutGets 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.enabledThe error is defined as the minimum distance between an original input control point (i.e. bend) of and edge and the fitted bezier curve.
The maximum error must be greater than or equal to zero.
Property Value
Throws
- Exception ({ name: 'ArgumentError' })
- if the specified maximum error is negative
Default Value
0.33- the second and third control point are equally distributed between the first and fourth point.0.0- the first and second control point as well as the third and fourth point are equal.0.5- the second and third control point are equal and exactly the mid-point between the first and fourth point.
[0.0, 0.5].Property Value
Throws
- Exception ({ name: 'ArgumentError' })
- if the specified ratio is outside the interval
[0.0, 0.5]
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.applyLayoutChanges the edge paths of selected edges of the given graph such that they represent piecewise cubic Bezier curves which approximate the original points of the path.
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 CurveFittingStage.
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 CurveFittingStage.
Returns an instance of LayoutData<TNode, TEdge, TNodeLabel, TEdgeLabel> that can be used to define the edges affected by the CurveFittingStage.
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 CurveFittingStage.
Constants
A data key for selecting edges for curve fitting.
Assign true to an edge if a bezier curve should be fitted to the edge's path, or false otherwise.
If there is no IMapper<K, V> registered with this key, a curve is fitted to all edges.