documentationfor yFiles for HTML 3.0.0.2

LayoutPortCandidate

This class represents a candidate port on which edges can be connected to their source and/or target node.

Inheritance Hierarchy
LayoutPortCandidate

Remarks

LayoutPortCandidates can be associated with both edges and nodes. Moreover, more than one LayoutPortCandidate can be specified for an edge or a node.

Information about edge LayoutPortCandidates can be specified using EdgePortCandidates that allow to define specific sides or exact locations on which a given edge can be connected to its source or target node. It is recommended to set the EdgePortCandidates using the corresponding properties sourcePortCandidates and targetPortCandidates, respectively. Alternatively, the EdgePortCandidates can be given via IMapper<K,V>s that are registered with the graph using the keys SOURCE_PORT_CANDIDATES_DATA_KEY (to specify EdgePortCandidates on the source node) and TARGET_PORT_CANDIDATES_DATA_KEY (to specify EdgePortCandidates on the target node).

NodePortCandidates determine available ports on the nodes to which edges can be connected. This means that an edge of the graph can be connected to any of these node ports (unless EdgePortCandidates are specified too). To register and define node LayoutPortCandidates refer to NodePortCandidates.

A LayoutPortCandidate is described by the following attributes:

  • type: FREE candidates specify that the port may be placed anywhere on the side. Fixed candidates with an offset specify that the location of the port relative to the center of the node is given by offset. Fixed-from-sketch candidates specify that the location of the port relative to the center of the node is the same as in the input.
  • offset: The X-offset (Y-offset) determines the horizontal (vertical) distance of the candidate relative to the center of the node. It is only meaningful if the type is FIXED_OFFSET.
  • side: Corresponds to the sides of the nodes at which the edges connect to their target or source nodes.
  • cost: Represents the cost of usage of the candidate. During the processing of an edge by a layout or routing algorithm, candidates of lower cost will be preferred.
  • matchingId: When matching candidates that belong to an edge to ones that belong to a node in a layout or routing algorithm, only candidates with the same ID can match. By default, the matching ID is null, which matches all matching IDs.
  • capacity: Represents the maximum number of edges that may connect to the candidate. The capacity is only relevant for candidates that belong to a node.

Example of using edge port candidates. Edge port candidates are colored uniquely based on the edge with which they are associated.

Not all layout and routing algorithms are able to handle port candidates. Major layout algorithms that consider them are HierarchicalLayout and EdgeRouter.

This class cannot be instantiated

Default Values of Properties

Type Details

yFiles module
algorithms

See Also

PortPlacementStage can be appended to any layout algorithm that cannot handle port candidates in order to assign edges to the specified ports after calling the core layout algorithm.

Properties

Methods

Static Methods