documentationfor yFiles for HTML 3.0.0.2

PortPlacementStage

The PortPlacementStage assigns edges to the ports specified by LayoutPortCandidates or NodePortCandidates after calling the coreLayout.

Inheritance Hierarchy
LayoutStageBase
PortPlacementStage
Implemented Interfaces

Remarks

It can be used for adjusting ports for layout algorithms that cannot handle such constraints.

If LayoutPortCandidates are assigned for edges and nodes, this stage tries to match them. An edge port candidate matches a node port candidate if

  • their matchingIds are equal or one type is null,
  • they belong to a common side or one side is ANY, and
  • if both candidates are fixed, they describe the same positions.

The position of a port candidate is defined by offset or the actual offset of the edge endpoint for fixed-from-sketch candidates. This stage determines an assignment of minimum total cost, where the cost of the port of an edge is given by the sum of the costs of the chosen candidate specified at the edge and the corresponding matching candidate specified at the node. All costs of ports exceeding 10,000 are considered to be equal, and negative costs are treated as 0. When there is no matching candidates for an edge, the LayoutPortCandidate with the lowest costs specified for the edge is chosen.

This stage also considers port groups (see sourcePortGroupIds and targetPortGroupIds). 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 LayoutPortCandidate, then the port of one of the edges will be chosen for both, violating the constraint of the other edge.

Furthermore, property routeCorrectionPolicy allows to specify how the edge path should be corrected after correcting a port.

It is recommended that the PortPlacementStage is prepended to the coreLayout 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

routeCorrectionPolicyMOVE_PORTS_TO_BORDERThe ports are just moved.

Type Details

yFiles module
algorithms

See Also

This stage cannot properly deal with the case that the current ports are outside of the bounds of the adjacent nodes. The current ports are expected to be on the border or inside the node (e.g. center).

Constructors

Properties

Methods