This class associates LayoutPortCandidates with the endpoints of edges of a graph.
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.
Type Details
- yFiles module
- algorithms
See Also
Constructors
Creates a new empty EdgePortCandidates instance.
Remarks
Properties
Returns the LayoutPortCandidates added to this class.
Methods
addFixedCandidate
(side: PortSides, offset?: Point, cost?: number, matchingId?: any) : EdgePortCandidatesAdds a fixed LayoutPortCandidate at a specific position.
Remarks
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
A map of options to pass to the method.
- side - PortSides
- the side of the LayoutPortCandidate
- offset - Point
- the offset of the LayoutPortCandidate relative to the center of the node;
null
if 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
Returns
- ↪EdgePortCandidates
- The current collection of EdgePortCandidates, with the new candidate added.
See Also
Adds a free LayoutPortCandidate.
Parameters
A map of options to pass to the method.
- side - PortSides
- the side of the LayoutPortCandidate
- cost - number
- the cost of the LayoutPortCandidate
- matchingId - any
- the matching ID of the LayoutPortCandidate
Returns
- ↪EdgePortCandidates
- The current collection of EdgePortCandidates, with the new candidate added.
Constants
A data key for specifying source port candidates for each edge.
Remarks
null
if no source EdgePortCandidates are specified.See Also
A data key for specifying target port candidates for each edge.
Remarks
null
if no target EdgePortCandidates are specified.