C

LayoutGraphLayerConstraints

This low-level helper class helps with the reading and writing layer constraints for nodes in a graph.
Inheritance Hierarchy

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

No filters for this type

Properties

Returns whether any constraints are defined.

readonlyfinal

Methods

Gets all the currently registered constraints as a tuple consisting of the source item, the constraint and the target item (can be null).
final

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.

final

Parameters

item: LayoutNode

The item to check for

Return Value

boolean

true if constraints are defined for the given item, false otherwise

Adds a constraint that places the node on the bottom layer.
final

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.
final

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.
Adds a constraint that forces the upperNode to lie at least minimumDistance layers above the lowerNode with a given weight penalty for larger layer differences.
The minimum distance includes potentially empty layers that are removed by the ILayerAssigner instance. In that case, the actual layer difference may be smaller than the minimum distance.
final

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.
final

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.

Removes the constraint defined for the given source item, ordering constraint, and target item.

This method does nothing if there is no constraint defined for the given combination of source item, target item, and ordering constraint.

final

Parameters

sourceItem: LayoutNode

the source item

orderingConstraint: OrderingConstraint

the ordering constraint

targetItem: LayoutNode

the target item or null if 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.

final

Static Methods

Creates an empty, modifiable constraints instance and registers the constraints with the given graph.
static

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.
If no information is associated with the graph, the returned instance will be empty. Note that you should not modify this instance - it is considered read-only.
static

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.

static

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.

See Also

API
createReadonlyView