The interface used in an IGraph implementation to control the layout of edges.
Remarks
IGraph
, this item supports the lookup method that can be used to query additional aspects of the item.Examples
const graph = graphComponent.graph
const node1 = graph.createNodeAt(new Point(0, 0))
const node2 = graph.createNodeAt(new Point(100, 0))
const edge = graph.createEdge(node1, node2)
// add a bend to the edge
const bend = graph.addBend(edge, new Point(50, 20))
// the newly created bend is part of the graph
console.log(graph.contains(bend)) // true
// the bend belongs to its owner
console.log(bend.owner === edge) // true
console.log(edge.bends.size) // 1
console.log(edge.bends.get(0) === bend) // true
// removing the bend removes it from the graph
graph.remove(bend)
console.log(graph.contains(bend)) // false
// and from its owner
console.log(edge.bends.size) // 0
console.log(bend.owner === null) // throws Error!!
console.log(graph.contains(bend)) // true
graph.remove(bend.owner)
console.log(graph.contains(bend)) // false
Related Reading in the Developer's Guide
The graph model with all relevant types and their relationships is presented in detail in the section The Graph Model.
Using the look-up mechanism is explained in the section Service Locator Pattern: Lookup.
Type Details
- yFiles module
- view
Properties
Gets the index of the bend at its owner.
See Also
Gets the location of the bend in the world coordinate system.
Remarks
Provides a live view of the location which will be updated when the location changes. To keep the current state of the location, callers need to create a copy of it, e.g. by calling toPoint on it.
To change the location for instances of the default implementation that were created via the factory methods on IGraph, use setBendLocation
Property Value
Examples
graph.setBendLocation(bend, new Point(x, y))
const location = bend.location
See Also
Gets the edge this bend instance belongs to.
Remarks
This implies that Owner.Bends
contains this instance.
Note that for instances of the default implementation that were created via the factory methods on IGraph, the owner can't be changed after creation and the bend has to be deleted and recreated with a new owner.
Property Value
Throws
- Exception({ name: 'InvalidOperationError' })
- if the bend has no owner.
Examples
// add a bend to the owner
const bend = graph.addBend(edge, new Point(x, y))
// the bend's Owner property is set to the owner
console.log(bend.owner === edge) // true
// the bend is in its owner's Bends collection
console.log(edge.bends.includes(bend)) // true
See Also
Gets or sets the tag object associated with this item instance.
Remarks
Property Value
Examples
owner.tag = newTag
const tag = owner.tag
Implements
Methods
Returns an instance that implements the given type or null
.
Remarks
null
implementations for the types, nor does it have to return the same instance any time. Also, it depends on the type and context whether the instance returned stays up to date or needs to be re-obtained for further use.Type Parameters
- T
Parameters
A map of options to pass to the method.
- type - Constructor<T>
- the type for which an instance shall be returned
Returns
- ↪T?
- an instance that is assignable to the type or
null