- I
- I
- I
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)) // falseSee Also
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.
Developer's Guide
Members
Properties
Gets the location of the bend in the world coordinate system.
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.locationSee Also
Implemented in
SimpleBend.locationGets the edge this bend instance belongs to.
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)) // trueSee Also
Implemented in
SimpleBend.ownerProperty Value
Examples
owner.tag = newTagconst tag = owner.tagSee Also
- Tags are presented in detail in the section The Graph Model.
Developer's Guide
Defined in
ITagOwner.tagMethods
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.Parameters
- type: Constructor<T>
- the type for which an instance shall be returned
Return Value
- T
- an instance that is assignable to the type or
null
See Also
Developer's Guide