The DefaultTreeLayoutPortAssignment provides some simple port assignment styles.
Remarks
Default Values of Properties
borderGapToPortGapRatio | 0.5 | |
mode | NONE
| |
reversedPortOrder | false | The normal order is used for the ports. |
Type Details
- yfiles module
- layout-tree
- yfiles-umd modules
- layout-orthogonal-compact, layout-orthogonal, layout-tree, layout
- Legacy UMD name
- yfiles.tree.DefaultPortAssignment
See Also
Constructors
Creates a new DefaultTreeLayoutPortAssignment instance using the given port assignment mode and ratio between the border and the ports and the gap between the ports themselves.
Remarks
Parameters
A map of options to pass to the method.
- mode - TreeLayoutPortAssignmentMode
- one of the predefined port assignment specifiers
- ratio - number
- the ratio of the distance between outer ports and the border to the distance between any two ports
- borderGapToPortGapRatio - number
The ratio of the border gap (distance between the outer ports to the node border) to the port gap (distance between adjacent ports). This option sets the borderGapToPortGapRatio property on the created object.
- reversedPortOrder - boolean
Whether or not the port assignment should reverse the order of the ports. This option sets the reversedPortOrder property on the created object.
Throws
- Exception({ name: 'ArgumentError' })
- if an unknown mode is specified or if the specified ratio is negative
Properties
Gets or sets the ratio of the border gap (distance between the outer ports to the node border) to the port gap (distance between adjacent ports).
Remarks
0
the ports will be distributed along the whole side of the node without a gap between the last port and the corner.Default Value
0.5
.Throws
- Exception({ name: 'ArgumentError' })
- if the specified ratio is negative
Sample Graphs
Gets or sets whether or not the port assignment should reverse the order of the ports.
Remarks
Default Value
false
.The normal order is used for the ports.
Sample Graphs
Methods
Assigns relative coordinates to the source port of the outgoing edge to a child of the given node.
Remarks
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the input graph
- node - YNode
- the node
- edge - Edge
- the edge to the child node
- index - number
- the zero-based index of the child edge
See Also
Assigns relative coordinates to the target port of the incoming edge from the parent of the given node.
Remarks
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the input graph
- node - YNode
- the node
- edge - Edge
- the edge from the parent node
See Also
Places the ports of edges connecting to the given node according to the port assignment mode.
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the input graph
- node - YNode
- the node whose adjacent edges' ports should be placed
See Also
Implements
Determines the distance between the outer ports and the border of the node.
Remarks
This implementation calculates the gap according to the number of edges at one side of the node. It also includes the ratio between border gap and port gap.
This method is called by assignChildEdgeSourcePort to calculate the location of the first port. It may be overridden to implement a different distribution of ports on the node's side.
Parameters
A map of options to pass to the method.
- sideLength - number
- the width/height of the side
- edgeCount - number
- the number of edges that connect to this side
Returns
- ↪number
- the absolute gap to be used on both sides of the ports
See Also
Determines the distance between two adjacent ports.
Remarks
This implementation calculates the gap according to the number of edges at one side of the node. The edges are distributed keeping the given gap to the border of the node.
This method is called by assignChildEdgeSourcePort to calculate the distance between two ports. It may be overridden to implement a different distribution of ports on the node's side.
Parameters
A map of options to pass to the method.
- sideLength - number
- the width/height of the side
- edgeCount - number
- the number of edges/ports that connect to this side
- portBorderGap - number
- the port border gap (i.e. calculated by getPortBorderGap)
Returns
- ↪number
- the absolute distance to be used between two adjacent ports
See Also
Retrieves the source PortConstraint for the given edge.
Remarks
This implementation accesses the IDataProvider registered with SOURCE_PORT_CONSTRAINT_DP_KEY.
This method is called by assignChildEdgeSourcePort in PORT_CONSTRAINT.
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the input graph
- edge - Edge
- the edge
- index - number
- the index of the child that is the target of the given edge
Returns
See Also
Retrieves the target PortConstraint for the given edge.
Remarks
This implementation accesses the IDataProvider registered with SOURCE_PORT_CONSTRAINT_DP_KEY.
This method is called by assignParentEdgeTargetPort in PORT_CONSTRAINT.
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the input graph
- edge - Edge
- the edge