This class is a default IPortAllocator implementation.
Remarks
Default Values of Properties
considerFixedPorts | true | Edges with strong/fixed ports are considered. |
defaultPortBorderGapRatio | 0.5d | Ports are distributed along the side of the node. |
Type Details
- yfiles module
- layout-hierarchic
- yfiles-umd modules
- layout-familytree, layout-hierarchic, layout-radial, layout
- Legacy UMD name
- yfiles.hierarchic.DefaultPortAllocator
Constructors
Creates a new instance of DefaultPortAllocator with default settings.
Parameters
A map of options to pass to the method.
- considerFixedPorts - boolean
Whether or not this IPortAllocator considers edges with strong PortConstraints or fixed PortCandidate. This option sets the considerFixedPorts property on the created object.
- defaultPortBorderGapRatio - number
The border gap ratio for the default port. This option sets the defaultPortBorderGapRatio property on the created object.
See Also
Properties
Gets or sets whether or not this IPortAllocator considers edges with strong PortConstraints or fixed PortCandidate.
Remarks
Default Value
true
.Edges with strong/fixed ports are considered.
Gets or sets the border gap ratio for the default port.
Remarks
This ratio determines the gap between a corner of the node and the first assigned port.
The ratio should be greater than 0
.
A value of 0.0d
results in ports being placed directly on the corner of the node (if there is more than one port).
A value of 0.5d
results in ports being distributed along the side of the node so that the distance between the corner of the node and the first port is half as wide as the distance between two adjacent ports.
A value of Double.POSITIVE_INFINITY
results in all ports being centered at the side in one point.
Default Value
0.5d
.Ports are distributed along the side of the node.
Throws
- Exception({ name: 'ArgumentError' })
- if the given ratio is negative
Sample Graphs
Methods
assignPorts
(graph: LayoutGraph, layers: ILayers, ldp: ILayoutDataProvider, itemFactory: IItemFactory)Assigns source and target port coordinates to each edge of the graph.
Remarks
This method assigns:
This method is called by HierarchicLayoutCore after the sequencing phase.
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the input graph
- layers - ILayers
- the given ILayers instance containing the layering structure
- ldp - ILayoutDataProvider
- the ILayoutDataProvider containing information about the nodes and edges of the graph
- itemFactory - IItemFactory
- the IItemFactory used for creating and destroying helper structures
Implements
getPortBorderGap
(graph: LayoutGraph, ldp: ILayoutDataProvider, node: YNode, sideIndex: number, sideLength: number, edgeCount: number) : numberCallback method used for determining the port border gap for each node and side.
Remarks
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the input graph
- ldp - ILayoutDataProvider
- the ILayoutDataProvider containing information about the nodes and edges of the graph
- node - YNode
- the given node
- sideIndex - number
- the zero-based (top is 0) clock-wise index of the side of the node (for top-to-bottom layouts)
- sideLength - number
- the width/height of the side
- edgeCount - number
- the number of edges/ports that connect to this side
Returns
- ↪number
- the absolute gap on both sides of the ports
See Also
getPortBorderGapRatio
(graph: LayoutGraph, ldp: ILayoutDataProvider, node: YNode, sideIndex: number, sideLength: number, edgeCount: number) : numberCallback method used for determining the port border gap ratio.
Remarks
See defaultPortBorderGapRatio for an explanation.
It may be overridden for a custom calculation of port border gap ratio on a given node.
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the input graph
- ldp - ILayoutDataProvider
- the ILayoutDataProvider containing information about the nodes and edges of the graph
- node - YNode
- the given node
- sideIndex - number
- the zero-based (top is 0) clock-wise index of the side of the node (for top-to-bottom layouts)
- sideLength - number
- the width/height of the side
- edgeCount - number
- the number of edges/ports that connect to this side
Returns
- ↪number
- the border gap ratio
getPortDistanceDelta
(graph: LayoutGraph, ldp: ILayoutDataProvider, node: YNode, sideIndex: number, sideLength: number, edgeCount: number, portBorderGap: number) : numberCallback method used for determining the distance between two adjacent ports.
Remarks
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the input graph
- ldp - ILayoutDataProvider
- the ILayoutDataProvider containing information about the nodes and edges of the graph
- node - YNode
- the given node
- sideIndex - number
- the zero-based (top is 0) clock-wise index of the side of the node (for top-to-bottom layouts)
- sideLength - number
- the width/height of the side
- edgeCount - number
- the number of edges/ports that connect to this side
- portBorderGap - number
- the previously calculated port border gap
Returns
- ↪number
- the absolute distance between two adjacent ports