C

NodePortCandidates

This class associates LayoutPortCandidates with the nodes of a graph.
Inheritance Hierarchy

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.

Example of node port candidates. Circular ports represent node port candidates on source nodes of each edge. Square and rectangular ports are possible port candidates on the target node. Rectangular ports have zero cost of usage and unit capacity whereas square rectangles have unit cost and capacity.

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.

See Also

Developer's Guide

Members

Show:

Constructors

Creates a new empty NodePortCandidates instance.
Addition of LayoutPortCandidates to this set can be performed using addFreeCandidate and addFixedCandidate.

Properties

Returns the LayoutPortCandidates added to this class.
readonlyfinal

See Also

API
addFreeCandidate, addFixedCandidate

Methods

Adds a fixed LayoutPortCandidate at a specific position.

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.

final

Parameters

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

Return Value

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
Adds a free LayoutPortCandidate.

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.

final

Parameters

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

Return Value

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

All constants are filtered. Go to Filters.