The PortPlacementStage assigns edges to the ports specified by PortConstraints or PortCandidates after calling the core layout algorithm.
Remarks
It can be used for adjusting ports for layout algorithms that cannot handle PortConstraints.
If PortCandidates are assigned for edges and nodes, this stage tries to match them. When there is no match, the PortCandidate with the lowest costs specified for the edge is chosen. While PortConstraints are also matched to PortCandidates at nodes and edges, it is not recommended to mix them because they belong to different concepts.
This stage also considers port groups (see SOURCE_PORT_GROUP_ID_DP_KEY and TARGET_PORT_GROUP_ID_DP_KEY). It assigns the same port to edges that are port-grouped at a common node. Importantly, port grouping is prioritized over other constraints, for example, if two port-grouped edges do not have at least one common PortCandidate or the same PortConstraint, then the port of one of the edges will be chosen for both, violating the constraint of the other edge.
Furthermore, option pathCorrection allows to specify whether the edge path should be corrected after correcting a port.
It is recommended that the PortPlacementStage is prepended to the core layout algorithm in order to be able to process all the edges and especially, self-loops and parallel edges. Note that edges that might be hidden by other ILayoutStages cannot be handled by PortPlacementStage.
Default Values of Properties
pathCorrection | false | Edge paths are not orthogonally corrected. |
Type Details
- yfiles module
- router-other
- yfiles-umd modules
- layout-familytree, layout-multipage, layout-orthogonal-compact, layout, router-bus, router-other
- Legacy UMD name
- yfiles.layout.PortPlacementStage
See Also
Constructors
Creates a new PortPlacementStage instance with an optional core layout algorithm.
Parameters
A map of options to pass to the method.
- coreLayout - ILayoutAlgorithm
- The core layout algorithm.
- pathCorrection - boolean
Whether or not this ILayoutStage corrects the edge paths after moving the port to the location specified by a PortConstraint or PortCandidates. This option sets the pathCorrection property on the created object.
Properties
Gets or sets the core layout algorithm that is wrapped by this stage.
Gets or sets whether or not this ILayoutStage corrects the edge paths after moving the port to the location specified by a PortConstraint or PortCandidates.
Remarks
Default Value
false
.Edge paths are not orthogonally corrected.
Sample Graphs
Methods
Corrects the ports of the edges considering PortConstraints and PortCandidates.
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the input graph
See Also
Implements
Invokes the layout process of the core layout algorithm.
Remarks
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the input graph