C

LayoutPortCandidate

This class represents a candidate port on which edges can be connected to their source and/or target node.
Inheritance Hierarchy

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.

Example of using edge port candidates. Edge port candidates are colored uniquely based on the edge with which they are associated.

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

Show:

Properties

Gets the number of possible connections to this candidate.
Note that the number of possible connections is only relevant for candidates that belong to a node.
readonlyfinal

Property Value

The number of possible connections of this candidate

Default Value

The default value is: 1
The port candidate can only be used by one edge
Gets the penalty cost for using this candidate instance.
Candidates with lower costs are preferred by the layout or routing algorithms. The exact procedure depends on the chosen layout or routing algorithm.
readonlyfinal

Property Value

the penalty cost of this candidate

Default Value

The default value is: 0
the candidate has no cost
Gets the matching ID of this candidate.
The matching ID is used when determining which candidates specified at edges match with which candidates specified at nodes. If the matching ID is null, this candidate may match with all other candidates. Otherwise, it matches only with other candidates whose matching ID is equal or null.
readonlyfinal

Property Value

the matching ID of this candidate

Default Value

The default value is: null
the candidate may match with all other candidates
Gets the offset of the candidate relative to the center of the corresponding node.
The offset encodes the horizontal and vertical distance of the port relative to the center of a node. If the type of the candidate is not FIXED_OFFSET, the offset is zero.
This property is only meaningful if the type of the candidate is FIXED_OFFSET. In particular, if the type is FIXED_FROM_SKETCH, it does not consider the current offset of the port.
readonlyfinal

Property Value

the offset of this candidate relative to the center of the node

Default Value

The default value is: PointD.Origin
the port is at the center of the node
Gets the side of this candidate.
It specifies at which sides the edge may connect to the node. To specify that the side does not matter, use ANY.
Even though it is possible to specify multiple sides by or-ing them, support for such candidate by the layout and routing algorithms is limited. It is best to only specify one side (or ANY).
readonlyfinal

Property Value

The side of this candidate
Gets the type of this candidate.
readonlyfinal

Property Value

the type of this candidate

Methods

Returns whether this candidate is equal to another candidate.
final

Parameters

other: any
the object with which to compare

Return Value

boolean
true if this object is the same as the other candidate, false otherwise
Returns the side of this candidate where the sides relative to the flow are replaced by absolute sides.

If the side is ANY, then the return value is ANY.

If flowDirection is set to null and the side does not include any absolute side, ANY is returned. If it includes absolute sides, the sides relative to the flow are ignored.

final

Parameters

flowDirection: Direction
The direction of the flow or null if there is no flow direction.

Return Value

PortSides
The side of this candidate where the sides relative to the flow are replaced by absolute sides.
Returns a hash code value for this candidate based on the internal attributes.
final

Return Value

number
a hash code value
Returns whether this candidate can be placed at any side.
If flowDirection is set to null and the side includes one of the sides that are relative to the flow, true is returned.
final

Parameters

flowDirection?: Direction
The current direction of the flow or null if there is no flow direction

Return Value

boolean
true if this candidate can be placed at any side, false otherwise

See Also

API
getSideForFlow
Returns whether this candidate lies on the given side.

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.

This method does not resolve the sides that are relative to the flow (if there is any).

final

Parameters

testSide: PortSides
one of the default side specifiers

Return Value

boolean
true if this candidate lies on the given side, false otherwise
Returns whether this candidate lies on the given side after resolving the sides relative to the flow direction.

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.

final

Parameters

testSide: PortSides
one of the default side specifiers
flowDirection: Direction
the current direction of the flow or null if there is no flow direction

Return Value

boolean
true if this candidate lies on the given side, false otherwise

See Also

API
getSideForFlow
Returns a string representation of this candidate.
final

Return Value

string
A string representation of this candidate

Static Methods

All static methods are filtered. Go to Filters.