DefaultSeriesParallelLayoutPortAssignment implements the default port assignment strategy.
Remarks
Ports are either placed at the center or get distributed at the sides of the node.
If PortConstraints are specified, the strong PortConstraints are handled separately and keep their initial location relative to the node while weak PortConstraints just influence on which side of the node the port is placed.
If there are edge groups specified, the edges which belong to the same group get the same port locations.
Default Values of Properties
borderGapToPortGapRatio | 0.5 | |
mode | CENTER
|
Type Details
- yfiles module
- layout-seriesparallel
- yfiles-umd modules
- layout-seriesparallel, layout
- Legacy UMD name
- yfiles.seriesparallel.DefaultPortAssignment
See Also
Constructors
DefaultSeriesParallelLayoutPortAssignment
(mode?: SeriesParallelLayoutPortAssignmentMode, ratio?: number)Creates a new DefaultSeriesParallelLayoutPortAssignment instance using the given mode and a given value for the ratio of the gap between the border and the ports to the gap between the ports themselves.
Remarks
Parameters
A map of options to pass to the method.
- mode - SeriesParallelLayoutPortAssignmentMode
- one of the predefined port assignment modes
- ratio - number
- the ratio of the distance between outer ports and the border to the distance between any two ports
- borderGapToPortGapRatio - number
The ratio of the border gap (distance between the outer ports and the node border) to the port gap (distance between adjacent ports). This option sets the borderGapToPortGapRatio property on the created object.
- forkStyle - ForkStyle
The fork style which influences the port assignment. This option sets the forkStyle property on the created object.
Throws
- Exception({ name: 'ArgumentError' })
- if the given mode is unknown or the given ratio is negative
Properties
Gets or sets the ratio of the border gap (distance between the outer ports and the node border) to the port gap (distance between adjacent ports).
Remarks
0
, the ports will be distributed along the whole side of the node without a gap between the last port and the corner.Default Value
0.5
.Throws
- Exception({ name: 'ArgumentError' })
- if the specified ratio is negative
Sample Graphs
Gets or sets the fork style which influences the port assignment.
Remarks
If the fork style is set to OUTSIDE_NODE, edges without port constraints will be assigned in flow direction.
If the fork style is set to AT_NODE, the ports of edges in flow direction also get distributed to the sides unless they are without bends. Due to large minimum first/last segment lengths edges may overlap.
Default Value
OUTSIDE_NODE.Throws
- Exception({ name: 'ArgumentError' })
- if the specified fork style is unknown
Methods
Places the ports of edges connecting to the given node according to the port assignment mode.
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the input graph
- node - YNode
- the node whose adjacent edges' ports should be placed
See Also
Implements
Determines the distance between the outer ports and the border of the node.
Remarks
This implementation calculates the gap according to the number of edges at one side of the node. It also includes the ratio between border gap and port gap.
This method is called by assignPorts to calculate the location of the first port. It may be overridden to implement a different distribution of ports on the node's side.
Parameters
A map of options to pass to the method.
- sideLength - number
- the width/height of the side
- edgeCount - number
- the number of edges that connect to this side
Returns
- ↪number
- the absolute gap to be used on both sides of the ports
See Also
Determines the distance between two adjacent ports.
Remarks
This implementation calculates the gap according to the number of edges at one side of the node. The edges are distributed keeping the given gap to the border of the node.
This method is called by assignPorts to calculate the distance between two ports. It may be overridden to implement a different distribution of ports on the node's side.
Parameters
A map of options to pass to the method.
- sideLength - number
- the width/height of the side
- edgeCount - number
- the number of edges/ports that connect to this side
- portBorderGap - number
- the port border gap (i.e. calculated by getPortBorderGap)
Returns
- ↪number
- the absolute distance to be used between two adjacent ports