Specifies custom data for the PortPlacementStage.
Remarks
Type Details
- yfiles module
- view-layout-bridge
- yfiles-umd modules
- view-layout-bridge
- Legacy UMD name
- yfiles.layout.PortPlacementStageData
Constructors
Creates a new instance of PortPlacementStageData which helps configuring the PortPlacementStage.
Parameters
A map of options to pass to the method.
- sourcePortCandidates - ItemMapping<IEdge,ICollection<PortCandidate>>
A mapping from edges to a collection of their source port candidates. This option sets the sourcePortCandidates property on the created object.
- targetPortCandidates - ItemMapping<IEdge,ICollection<PortCandidate>>
A mapping from edges to a collection of their target port candidates. This option sets the targetPortCandidates property on the created object.
- sourcePortConstraints - ItemMapping<IEdge,PortConstraint>
A mapping from edges to their source PortConstraint. This option sets the sourcePortConstraints property on the created object.
- targetPortConstraints - ItemMapping<IEdge,PortConstraint>
A mapping from edges to their target PortConstraint. This option sets the targetPortConstraints property on the created object.
- nodePortCandidateSets - ItemMapping<INode,PortCandidateSet>
A mapping from nodes to their PortCandidateSet. This option sets the nodePortCandidateSets property on the created object.
- sourcePortGroupIds - ItemMapping<IEdge,Object>
A mapping from edges to an object representing their source port group. This option sets the sourcePortGroupIds property on the created object.
- targetPortGroupIds - ItemMapping<IEdge,Object>
A mapping from edges to an object representing their target port group. This option sets the targetPortGroupIds property on the created object.
Properties
Gets or sets a mapping from nodes to their PortCandidateSet.
Remarks
Examples
The simplest way to define node port candidate sets is to use the same PortCandidateSet for all nodes, if suitable for the use case:
The same effect can be achieved with a delegate as well, however, a more useful way to use a delegate would be to decide whether a node should get a port candidate set based on some data at the node, e.g., found in its tag:
If specific nodes should get a certain PortCandidateSet, it may sometimes be easier to use the mapper to set them:
See Also
Gets or sets a mapping from edges to a collection of their source port candidates.
Remarks
Port candidates allow to define where an edge can connect to its source node and allow fine control over port placement.
If all that is needed is to fix the source port in its location or on a node side, port constraints are easier to work with, since they are a slightly simpler concept. It is, however, recommended to not define both at the same time.
If candidates are assigned to edges (e.g. with this property) and to nodes (nodePortCandidateSets) the PortPlacementStage tries to match them. When there is no match, the port candidate with the lowest costs specified for the edge is chosen.
Examples
Source port candidates are effectively a collection of possible port placements with different costs and the layout algorithm is free to choose the candidate that fits best into the overall layout, while also preferring candidates with a lower cost. To set the same candidate list for all edges, it's easiest to use the constant property:
If certain edges need specific port candidates, it's usually convenient to use the mapper property:
For cases when the desired configuration of port candidates can be readily created from the edge itself, the delegate is often the most convenient option:
See Also
Sample Graphs
Gets or sets a mapping from edges to their source PortConstraint.
Remarks
Port constraints allow to define where an edge attaches to its source node and can either restrict that to one of the node's sides, or to a fixed port position.
A more general concept which allows finer control over where ports are placed, are port candidates. It is recommended to not define port constraints and port candidates at the same time.
Examples
If all edges should exit their source node on the same side, you can simply set a constant constraint for all edges:
To change the constraints for individual edges, it's usually easiest to use the mapper:
If a PortConstraint can readily be created from an edge, using a delegate is often easier:
See Also
Sample Graphs
Gets or sets a mapping from edges to an object representing their source port group.
Remarks
Examples
The simplest way to use source port groups is to use the same object as group ID for all edges. Since grouping is done per node, this has the effect of grouping all edges with the same source node together:
The same effect can be achieved with a delegate as well, by returning the source node as group ID for each edge. However, a more useful way to use a delegate here would be grouping edges by some commonality, such as the same color:
If only certain edges should be grouped it may sometimes be easier to use the mapper to set the group IDs:
See Also
Gets or sets a mapping from edges to a collection of their target port candidates.
Remarks
Port candidates allow to define where an edge can connect to its target node and allow fine control over port placement.
If all that is needed is to fix the target port in its location or on a node side, port constraints are easier to work with, since they are a slightly simpler concept. It is, however, recommended to not define both at the same time.
If candidates are assigned to edges (e.g. with this property) and to nodes (nodePortCandidateSets) the PortPlacementStage tries to match them. When there is no match, the port candidate with the lowest costs specified for the edge is chosen.
Examples
Target port candidates are effectively a collection of possible port placements with different costs and the layout algorithm is free to choose the candidate that fits best into the overall layout, while also preferring candidates with a lower cost. To set the same candidate list for all edges, it's easiest to use the constant property:
If certain edges need specific port candidates, it's usually convenient to use the mapper property:
For cases when the desired configuration of port candidates can be readily created from the edge itself, the delegate is often the most convenient option:
See Also
Sample Graphs
Gets or sets a mapping from edges to their target PortConstraint.
Remarks
Port constraints allow to define where an edge attaches to its target node and can either restrict that to one of the node's sides, or to a fixed port position.
A more general concept which allows finer control over where ports are placed, are port candidates. It is recommended to not define port constraints and port candidates at the same time.
Examples
If all edges should exit their source node on the same side, you can simply set a constant constraint for all edges:
To change the constraints for individual edges, it's usually easiest to use the mapper:
If a PortConstraint can readily be created from an edge, using a delegate is often easier:
See Also
Sample Graphs
Gets or sets a mapping from edges to an object representing their target port group.
Remarks
Examples
The simplest way to use target port groups is to use the same object as group ID for all edges. Since grouping is done per node, this has the effect of grouping all edges with the same target node together:
The same effect can be achieved with a delegate as well, by returning the target node as group ID for each edge. However, a more useful way to use a delegate here would be grouping edges by some commonality, such as the same color:
If only certain edges should be grouped it may sometimes be easier to use the mapper to set the group IDs:
See Also
Methods
Combines this instance with the given layout data.
Remarks
Parameters
A map of options to pass to the method.
- data - LayoutData
- The LayoutData to combine this instance with.
Returns
- ↪LayoutData
- The combined layout data.