This class associates LayoutPortCandidates with the nodes of a graph.
Remarks
LayoutPortCandidates defined on nodes specify sides or even exact locations at which edges can be connected. This means that an edge can be connected to any of the available node ports (unless edge LayoutPortCandidates are specified too). Each node LayoutPortCandidate has a capacity, i.e., a maximum number of edges allowed to connect to it.
It is recommended to set the NodePortCandidates using the corresponding properties nodePortCandidates and nodePortCandidates. Alternatively, NodePortCandidates can be specified for each node by an IMapper<K,V> that is registered with the graph using the keys NODE_PORT_CANDIDATES_DATA_KEY.
Not all layout and routing algorithms provide equal support for port candidates. Layout and routing algorithms that support both port candidates at nodes and at edges, 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 at least 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 NodePortCandidates instance.
Remarks
Properties
Returns the LayoutPortCandidates added to this class.
Methods
addFixedCandidate
(side: PortSides, offset: Point, cost?: number, capacity?: number, matchingId?: any) : NodePortCandidatesAdds a fixed LayoutPortCandidate at a specific position.
Remarks
The capacity value defines the maximum number of edges allowed to connect to the candidate. If no limitation for this number exists, 0x7FFFFFFF
can be used.
The capacity must be greater than zero.
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
- cost - number
- the cost of the LayoutPortCandidate
- capacity - number
- the capacity of the LayoutPortCandidate
- matchingId - any
- the matching ID of the LayoutPortCandidate
Returns
- ↪NodePortCandidates
- The current collection of NodePortCandidates, with the new candidate added.
Throws
- Exception({ name: 'ArgumentError' })
- if the given capacity is less than or equal to zero
addFreeCandidate
(side: PortSides, cost?: number, capacity?: number, matchingId?: any) : NodePortCandidatesAdds a free LayoutPortCandidate.
Remarks
The capacity value defines the maximum number of edges allowed to connect to the candidate. If no limitation for this number exists, 0x7FFFFFFF
can be used.
The capacity must be greater than zero.
Parameters
A map of options to pass to the method.
- side - PortSides
- the side of the LayoutPortCandidate
- cost - number
- the cost of the LayoutPortCandidate
- capacity - number
- the capacity of the LayoutPortCandidate
- matchingId - any
- the matching ID of the LayoutPortCandidate
Returns
- ↪NodePortCandidates
- The current collection of NodePortCandidates, with the new candidate added.
Throws
- Exception({ name: 'ArgumentError' })
- if the given capacity is less than or equal to zero
Constants
A data key for specifying a port candidate set for each node.