Remarks
Layer constraints affect the assignment of nodes to the layers.
Instead of using this class, it is highly recommended to define constraints more conveniently via the layout data property layerConstraints.
This class cannot be instantiated
See Also
Developer's Guide
Members
Properties
Methods
Gets all the currently registered constraints as a tuple consisting of the source item, the constraint and the target item (can be null).
Return Value
- IEnumerable<any[]>
- A collection of tuples representing all registered constraints. The first item is the item for which the constraint is defined, the second item is the constraint itself and the third item is the relational other item. The other item can be null if the constraint is one that does not need such an item.
Returns whether any constraints are defined for the given item.
Returns whether any constraints are defined for the given item.
Parameters
- item: LayoutNode
The item to check for
Return Value
- boolean
trueif constraints are defined for the given item,falseotherwise
Adds a constraint that places the node on the bottom layer.
node on the bottom layer.Parameters
- node: LayoutNode
- The node that should lie on the bottom layer
- priority?: number
- The priority of the constraint. If multiple constraints conflict, the ones with lower priority will be discarded.
Adds a constraint that places the given node on the topmost layer.
node on the topmost layer.Parameters
- node: LayoutNode
- The node that should lie on the top layer
- priority?: number
- The priority of the constraint. If multiple constraints conflict, the ones with lower priority will be discarded.
Parameters
- upperNode: LayoutNode
- The upper node
- lowerNode: LayoutNode
- The lower node that should lie below the upper node
- minimumDistance?: number
- The minimum layer distance between the upper and lower node
- weight?: number
- The weight penalty for larger layer differences
- priority?: number
- The priority of the constraint. If multiple constraints conflict, the ones with lower priority will be discarded.
Adds a constraint that forces node1 to lie in the same layer as node2.
node1 to lie in the same layer as node2.Parameters
- node1: LayoutNode
- the first node
- node2: LayoutNode
- the second node that should lie in the same layer
- priority?: number
- the priority of the constraint. If multiple constraints conflict, the ones with lower priority will be discarded.
This method does nothing if there is no constraint defined for the given combination of source item, target item, and ordering constraint.
Parameters
- sourceItem: LayoutNode
the source item
- orderingConstraint: OrderingConstraint
the ordering constraint
- targetItem: LayoutNode
the target item or
nullif there is none for this constraint
Return Value
- void
Disposes of all constraints modified via this instance (if it was created using createEmpty or createWritableCopy) and so restores the state of the constraints before creation of this instance.
Restore should always be called at some point constraints were modified.
If this instance is a read-only one created via createReadonlyView, then this method has no effect.
Static Methods
Creates an empty, modifiable constraints instance and registers the constraints with the given graph.
Parameters
- graph: LayoutGraph
- The graph for which the newly created empty constraints instance is registered.
Return Value
- LayoutGraphLayerConstraints
- An empty, modifiable instance.
Factory that reads the current state from the given graph's context.
Parameters
- graph: LayoutGraph
- The graph to read the data from.
Return Value
- LayoutGraphLayerConstraints
- A read-only, potentially empty instance that contains the constraints associated with this graph.
Factory that reads the current state from the given graph's context and copies it to a mutable instance.
Newly created constraints on the writable copy are automatically registered for the given graph without destroying the old constraints (if some existed).
If no information was associated with the graph, the returned instance will be empty.
Parameters
- graph: LayoutGraph
- The graph to read and copy the initial data from.
Return Value
- LayoutGraphLayerConstraints
- A potentially empty instance that contains the constraints associated with this graph.