This class is a default IDrawingDistanceCalculator implementation that is used by HierarchicalLayout to configure the ICoordinateAssigner.
Default Values of Properties
adaptiveMinimumEdgeDistanceEnabled | true | An adaptive minimum distance is used. |
edgeDistance | 20.0d | |
nodeDistance | 30.0d | |
nodeToEdgeDistance | 15.0d |
Type Details
- yFiles module
- algorithms
Constructors
Creates a new instance of DrawingDistanceCalculator with default settings.
Parameters
options - Object
A map of options to pass to the method.
A map of options to pass to the method.
- adaptiveMinimumEdgeDistanceEnabled - boolean
- Whether or not an adaptive minimum edge distance is used. This option sets the adaptiveMinimumEdgeDistanceEnabled property on the created object.
- compaction - boolean
- Whether or not the compaction option is enabled. This option sets the compaction property on the created object.
- nodeDistance - number
- The minimum distance between two LayoutNodes. This option sets the nodeDistance property on the created object.
- nodeToEdgeDistance - number
- The minimum distance between a LayoutNode and a (non-adjacent) LayoutEdge. This option sets the nodeToEdgeDistance property on the created object.
- edgeDistance - number
- The minimum distance between two edges. This option sets the edgeDistance property on the created object.
Properties
Gets or sets whether or not an adaptive minimum edge distance is used.
Remarks
If this option is enabled, the minimum distance between two adjacent edges is the minimum of the current minimum edge distance and the distance of the edges' source/target points.
Default Value
The default value is
true
.An adaptive minimum distance is used.
Property Value
true
if an adaptive minimum distance should be used, false
otherwiseGets or sets whether or not the compaction option is enabled.
Default Value
The default value is
false
.Compaction is disabled.
Property Value
true
if compaction is enabled, false
otherwiseThis option is automatically set by the layout algorithm if option nodeCompaction or labelCompaction is enabled.
Gets or sets the minimum distance between two edges.
Remarks
Minimum distance should be greater than
0
.Default Value
The default value is
20.0d
.Property Value
the given minimum distance
Throws
- Exception({ name: 'ArgumentError' })
- if the minimum distance is negative
Sample Graphs
Gets or sets the minimum distance between two LayoutNodes.
Remarks
Minimum distance should be greater than
0
.Default Value
The default value is
30.0d
.Property Value
the minimum distance
Throws
- Exception({ name: 'ArgumentError' })
- if the minimum distance is negative
Sample Graphs
Gets or sets the minimum distance between a LayoutNode and a (non-adjacent) LayoutEdge.
Remarks
Minimum distance should be greater than
0
.Default Value
The default value is
15.0d
.Property Value
the minimum distance
Throws
- Exception({ name: 'ArgumentError' })
- if the minimum distance is negative
Sample Graphs
Methods
Disposes of internal data structures.
Remarks
Implementations should release internally held data structures when they are not needed anymore.
Parameters
options - Object
A map of options to pass to the method.
A map of options to pass to the method.
- graph - LayoutGraph
- the input graph that contains all elements that are used during the node placement
- layoutContext - HierarchicalLayoutContext
- the HierarchicalLayoutContext instance which provides access to the HierarchicalLayoutNodeContext and HierarchicalLayoutEdgeContext instances, as well as the layers instance that will be used during subsequent calls.
See Also
Implements
getMinimumDistance
(graph: LayoutGraph, layer: HierarchicalLayoutLayer, layoutContext: HierarchicalLayoutContext, left: LayoutNode, right: LayoutNode) : numberDetermines the minimum distance between two LayoutNodes of the same layer.
Parameters
options - Object
A map of options to pass to the method.
A map of options to pass to the method.
- graph - LayoutGraph
- The input graph
- layer - HierarchicalLayoutLayer
- The layer object that will be used during subsequent calls
- layoutContext - HierarchicalLayoutContext
- The HierarchicalLayoutContext used for querying information
- left - LayoutNode
- The left of the two LayoutNodes whose minimum distance is to be determined or
null
if only the left border of the right LayoutNode is of interest - right - LayoutNode
- The right of the two LayoutNodes whose minimum distance is to be determined or
null
if only the right border of the left LayoutNode is of interest
Returns
- ↪number
- The minimum distances between LayoutNodes of the same layer
Implements
Initializes internal data structures.
Remarks
Implementations may cache lengthy calculations in the initialization phase.
Parameters
options - Object
A map of options to pass to the method.
A map of options to pass to the method.
- graph - LayoutGraph
- the input graph that contains all elements that are used during the node placement
- layoutContext - HierarchicalLayoutContext
- The HierarchicalLayoutContext instance which provides access to context information for the graph elements.