A PortConstraint represents a constraint for the source or target port of an edge path.
Remarks
It determines the location at which an edge path can be connected to its source and/or target node. There exist two different types of PortConstraints:
- Weak PortConstraints specify the side where an edge should enter/leave a node.
- Strong PortConstraints specify the exact coordinates of the point where an edge should enter/leave a node. Therefore, for edges with strong port constraints, layout algorithms supporting such constraints use the current source/target point coordinates as returned by method getSourcePointRel and getTargetPointRel respectively.
Information about PortConstraints is held by IDataProviders that are registered with the graph using keys SOURCE_PORT_CONSTRAINT_DP_KEY (to specify PortConstraints for an edge on its source node) and TARGET_PORT_CONSTRAINT_DP_KEY (to specify PortConstraints for an edge on its target node).
Not all layout and routing algorithms are able to handle PortConstraints. Major layout algorithms that obey them are HierarchicLayout, TreeLayout, EdgeRouter, ChannelEdgeRouter and BusRouter.
Type Details
- yfiles module
- layout-core
- yfiles-umd modules
- All layout modules, view-layout-bridge
- Legacy UMD name
- yfiles.layout.PortConstraint
See Also
Properties
Gets whether or not this PortConstraint instance is associated with side ANY.
Gets whether or not this PortConstraint instance is associated with side EAST.
Gets whether or not this PortConstraint instance is associated with side NORTH.
Gets whether or not this PortConstraint instance is associated with side SOUTH.
Gets whether or not this PortConstraint instance is associated with side WEST.
Gets the side of the node to which an edge should connect.
Gets whether or not this PortConstraint instance represents a strong constraint.
Remarks
Methods
Returns whether or not this PortConstraint is equal to another PortConstraint based on whether they are both strong constraints or not and the side attribute.
Parameters
A map of options to pass to the method.
- other - Object
- the reference PortConstraint object with which to compare
Returns
- ↪boolean
Returns a hash code value for this PortConstraint instance based on whether it is a strong constraint or not and the side attribute.
Returns
- ↪number
- a hash code value
Returns a string representation of this PortConstraint instance.
Returns
- ↪string
- a string representation of the PortConstraint
Static Methods
Creates a new PortConstraint that constrains the edge to connect to the given side of a node and that can be either strong or weak.
Remarks
Parameters
A map of options to pass to the method.
- side - PortSide
- one of the default side specifiers
- strong - boolean
Returns
- ↪PortConstraint
- a new PortConstraint instance
Throws
- Exception({ name: 'ArgumentError' })
- if an unknown side is given
Returns the source PortConstraint associated with the given edge.
Remarks
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the input graph
- e - Edge
- the edge
Returns
- ↪PortConstraint
- the source PortConstraint of the given edge or
null
if there is none
Returns the target PortConstraint associated with the given edge.
Remarks
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the input graph
- e - Edge
- the edge
Returns
- ↪PortConstraint
- the target PortConstraint of the given edge or
null
if there is none
Checks whether or not there exist source or target PortConstraints associated with the given edge.
Remarks
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the input graph
- e - Edge
- the edge
Returns
- ↪boolean
Checks whether or not there exist source PortConstraints associated with the given edge.
Remarks
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the input graph
- e - Edge
- the edge
Returns
- ↪boolean
Checks whether or not there exist target PortConstraints associated with the given edge.
Remarks
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the input graph
- e - Edge
- the edge
Returns
- ↪boolean