Remarks
LayoutPortCandidates defined for an endpoint of an edge specify sides or even exact locations at which the edge can be connected. This means that the edge can be connected to any of its associated LayoutPortCandidates (unless NodePortCandidates are specified for the incident node). In this case a candidate is selected that matches both with the candidates at the edges and the node.
Information about edge LayoutPortCandidates is specified using EdgePortCandidates. 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).
Not all layout and routing algorithms provide equal support for port candidates. Layout and routing algorithms that support both port candidates at edges and at nodes, typically try to match the candidates at the edges with candidates at the nodes. 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. For more details, see the respective algorithms.
See Also
Developer's Guide
Members
Constructors
Creates a new empty EdgePortCandidates instance.
Properties
Returns the LayoutPortCandidates added to this class.
Methods
Adds a fixed LayoutPortCandidate at a specific position.
offset is null, the offset values are determined dynamically during the execution time of the layout algorithm and correspond to the current port location of the associated edge (see sourcePortOffset and targetPortOffset).Parameters
- side: PortSides
- the side of the LayoutPortCandidate
- offset?: Point
- the offset of the LayoutPortCandidate relative to the center of the node;
nullif the current port location of the edge shall be chosen - cost?: number
- the cost of the LayoutPortCandidate
- matchingId?: any
- the matching ID of the LayoutPortCandidate
Return Value
- EdgePortCandidates
- The current collection of EdgePortCandidates, with the new candidate added.
Adds a free LayoutPortCandidate.
Parameters
- side: PortSides
- the side of the LayoutPortCandidate
- cost?: number
- the cost of the LayoutPortCandidate
- matchingId?: any
- the matching ID of the LayoutPortCandidate
Return Value
- EdgePortCandidates
- The current collection of EdgePortCandidates, with the new candidate added.