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.
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
See Also
Developer's Guide
Members
Properties
Property Value
Default Value
Property Value
Default Value
null, this candidate may match with all other candidates. Otherwise, it matches only with other candidates whose matching ID is equal or null.Property Value
Default Value
Gets the offset of the candidate relative to the center of the corresponding node.
Property Value
Default Value
Gets the side of this candidate.
Property Value
Gets the type of this candidate.
- 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.
Property Value
Methods
Parameters
- other: any
- the object with which to compare
Return Value
- boolean
trueif this object is the same as the other candidate,falseotherwise
Return Value
- number
- a hash code value
Returns whether this candidate can be placed at any side.
flowDirection is set to null and the side includes one of the sides that are relative to the flow, true is returned.Parameters
- flowDirection?: Direction
- The current direction of the flow or
nullif there is no flow direction
Return Value
- boolean
trueif this candidate can be placed at any side,falseotherwise
See Also
Returns whether this candidate lies on the given side.
Parameters
- testSide: PortSides
- one of the default side specifiers
Return Value
- boolean
trueif this candidate lies on the given side,falseotherwise
This method tests whether this candidate contains any of the given sides. It does not check if other sides are included. In particular, if side is ANY, true is returned for all non-zero values of testSide.
Similarly, if testSide is set to ANY, true is returned for all non-zero values of side. To check whether the port can be placed on ANY side, use isOnAnySide instead.
If flowDirection is set to null and the side includes one of the sides that are relative to the flow direction, true is returned.
Parameters
- testSide: PortSides
- one of the default side specifiers
- flowDirection: Direction
- the current direction of the flow or
nullif there is no flow direction
Return Value
- boolean
trueif this candidate lies on the given side,falseotherwise