A CopiedLayoutGraph is a LayoutGraph that serves as a copy of another graph with layout information.
Remarks
A CopiedLayoutGraph comes to use if a layout algorithm should not run directly on the original graph. Using a copy, the calculated layout will not be applied to the original graph before the layout algorithm finished successfully. This can prevent inconsistencies in case something goes wrong during layout calculations.
Concept
CopiedLayoutGraph contains corresponding nodes and edges for each node and edge in the original graph and copies the labels of the original nodes and edges. It also delegates all IDataProviders registered with the original graph.
To preserve the relations between the original elements and the copied elements in this graph, CopiedLayoutGraph updates mappings between those elements.
If there are structural changes to the original graph, they can be transferred to this copied graph using syncStructure. Then the copied graph will be altered, adding and removing elements, until it corresponds to the original again.
Method commitLayoutToOriginalGraph will transfer updated layout information to the original graph. The original graph will stay unchanged until this method is called.
Type Details
- yfiles module
- layout-core
- yfiles-umd modules
- All layout modules, view-layout-bridge
- Legacy UMD name
- yfiles.layout.CopiedLayoutGraph
See Also
Constructors
Creates a new CopiedLayoutGraph instance which is a copy of the given graph.
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the original graph
Properties
Gets an array of all data provider look-up keys that are registered with this graph.
Defined in
Gets the number of edges in this graph.
Defined in
Gets a list of all edges in the graph.
Defined in
Yields a dynamic IEnumerable<T> for Edges that can be used to iterate over the edges that are contained in this instance.
Remarks
Defined in
Gets true
if this graph contains no nodes.
Defined in
Gets the number of nodes in this graph.
Defined in
Yields a dynamic IEnumerable<T> for YNodes that can be used to iterate over the nodes that are contained in this instance.
Remarks
Defined in
Gets all edge maps that have been created by this graph but have not yet been disposed.
Gets all node maps that have been created by this graph but have not yet been disposed.
Methods
Registers the given data provider using the given look-up key.
Remarks
Defined in
Redefines an edge's end points.
Remarks
Edge e
has source node v := e1.source()
and target node w := e2.target()
.
Edge e
is inserted in such a way that an iteration over the edges at v
returns e
- after
e1
, ifd1 == AFTER
- before
e1
, ifd1 == BEFORE
,
and an iteration over the edges at w
returns e
- after
e2
, ifd2 == AFTER
- before
e2
, ifd2 == BEFORE
.
Preconditions
- Edges
e
,e1
, ande2
must belong to this graph.
Parameters
A map of options to pass to the method.
- e - Edge
- The edge to be changed.
- e1 - Edge
- Reference edge for insertion at a new source node.
- e2 - Edge
- Reference edge for insertion at a new target node.
- d1 - GraphElementInsertion
- d2 - GraphElementInsertion
Defined in
changeEdge
(e: Edge, newSource: YNode, sourceReference: Edge, sourceD: GraphElementInsertion, newTarget: YNode, targetReference: Edge, targetD: GraphElementInsertion)Redefines an edge's end points.
Remarks
Edge e
has source node v := sourceReference.source()
or v := newSource
, if sourceReference == null
and target node w := targetReference.target()
or w := newTarget
, if targetReference == null
.
Edge e
is inserted in such a way that an iteration over the edges at v
returns e
- after
sourceReference
, ifsourceD == AFTER
- before
sourceReference
, ifsourceD == BEFORE
,
and an iteration over the edges at w
returns e
- after
targetReference
, iftargetD == AFTER
- before
targetReference
, iftargetD == BEFORE
.
Preconditions
- Edge
e
must belong to this graph. Also, eithersourceReference
ornewSource
must be non-null and belong to this graph, and eithertargetReference
ornewTarget
must be non-null and belong to this graph.
Parameters
A map of options to pass to the method.
- e - Edge
- The edge to be changed.
- newSource - YNode
- The new source node.
- sourceReference - Edge
- Reference edge for insertion at the new source node.
- sourceD - GraphElementInsertion
- newTarget - YNode
- The new target node.
- targetReference - Edge
- Reference edge for insertion at the new target node.
- targetD - GraphElementInsertion
Defined in
Redefines an edge's end points.
Remarks
Preconditions
newSource
andnewTarget
must belong to this graph.
Parameters
A map of options to pass to the method.
- e - Edge
- The edge to be changed.
- newSource - YNode
- The new source node of the given edge.
- newTarget - YNode
- The new target node of the given edge.
Defined in
Removes all nodes and edges from this graph.
Defined in
Returns whether or not this graph contains an edge that connects the given nodes.
Parameters
A map of options to pass to the method.
See Also
Defined in
Creates an edge in the copied graph that corresponds to the given original edge.
Remarks
The edge will connect to the copies of the source and target of the original edge. All labels of the original edge will be also copied and assigned to this edge.
The mappings are updated. Hence, it is possible to look up the newly created edge by using getCopiedEdge or the original edge by using getOriginalEdge.
This method can be used for keeping the CopiedLayoutGraph in sync with the original graph.
Parameters
A map of options to pass to the method.
- originalEdge - Object
- the original edge
Returns
- ↪Edge
- the copy of the original edge
Creates a node in the copied graph that corresponds to the given original node.
Remarks
All labels of the original node will be copied and assigned to this node.
The mappings are updated. Hence, it is possible to look up the newly created node by using getCopiedNode or the original node by using getOriginalNode.
This method can be used for keeping the CopiedLayoutGraph in sync with the original graph.
Parameters
A map of options to pass to the method.
- originalNode - Object
- the original node
Returns
- ↪YNode
- the copy of the original node
Creates a new edge in this graph.
Remarks
The new edge has source node v
and target node w
, i.e., would be written as edge e = (v, w)
.
The edge is appended to the lists of incoming and outgoing edges at the source node and target node, respectively.
Parameters
A map of options to pass to the method.
Returns
- ↪Edge
- The newly created Edge object.
Defined in
createEdge
(v: YNode, e1: Edge, w: YNode, e2: Edge, d1: GraphElementInsertion, d2: GraphElementInsertion) : EdgeCreates a new edge in this graph to be ordered before or after a given edge.
Remarks
The new edge e
has source node v
and target node w
, i.e., would be written as edge e = (v, w)
.
Edge e
is inserted in such a way that an iteration over the edges at node v
returns e
- after
e1
, ifd1 == AFTER
- before
e1
, ifd1 == BEFORE
,
and an iteration over the edges at w
returns e
- after
e2
, ifd2 == AFTER
- before
e2
, ifd2 == BEFORE
.
Preconditions
- Edge
e1
must have source nodev
and edgee2
must have target nodew
.
Parameters
A map of options to pass to the method.
- v - YNode
- The source node of the edge.
- e1 - Edge
- An edge with source node
v
. - w - YNode
- The target node of the edge.
- e2 - Edge
- An edge with target node
w
. - d1 - GraphElementInsertion
- d2 - GraphElementInsertion
Returns
- ↪Edge
- The newly created Edge object.
Defined in
Returns a newly created edge map that is valid for the edges in this graph.
Remarks
The implementation returned by this method can be used for any edge that is part of this Graph instance at any point of time, i.e., it is safe to modify the graph structure (add and remove nodes and edges) freely.
The implementation returned uses O(m)
memory at all times and provides true O(1)
read and write access for each edge.
In order to release the resources held by this map, disposeEdgeMap has to be called.
Defined in
Creates a new ILabelLayoutFactory for this CopiedLayoutGraph.
Remarks
Returns
- ↪ILabelLayoutFactory
- the new label layout factory
Implements
Returns a newly created node map that is valid for the nodes in this graph.
Remarks
The implementation returned by this method can be used for any node that is part of this Graph instance at any point of time, i.e., it is safe to modify the graph structure (add and remove nodes and edges) freely.
The implementation returned uses O(n)
memory at all times and provides true O(1)
read and write access for each node.
In order to release the resources held by this map, disposeNodeMap has to be called.
Defined in
Informs the graph that the given edge map is no longer needed.
Remarks
This method is used for EdgeMap implementations that have been obtained using the createEdgeMap factory method.
Calling this method will destroy the edge map and associated resources can be freed. It is strongly recommended to dispose of all edge maps that are not needed anymore using this method.
Defined in
Informs the graph that the given node map is no longer needed.
Remarks
This method is used for NodeMap implementations that have been obtained using the createNodeMap factory method.
Calling this method will destroy the node map and associated resources can be freed. It is strongly recommended to dispose of all node maps that are not needed anymore using this method.
Defined in
Returns the rectangle describing the bounding box of the given node.
Parameters
A map of options to pass to the method.
- node - YNode
- the node
Returns
- ↪YRectangle
- the bounds of the node
See Also
Defined in
Returns the x-coordinate of the given node's center.
Parameters
A map of options to pass to the method.
- node - YNode
- the node
Returns
- ↪number
- the x-value of the node's center coordinate
See Also
Defined in
Returns the y-coordinate of the given node's center.
Parameters
A map of options to pass to the method.
- node - YNode
- the node
Returns
- ↪number
- the y-value of the node's center coordinate
See Also
Defined in
Returns the data provider that is registered with the graph using the given look-up key.
Remarks
Defined in
Provides access to the edges of the graph.
Returns the height of the given node.
Parameters
A map of options to pass to the method.
- node - YNode
- the node
Returns
- ↪number
- the height of the node
See Also
Defined in
Returns the layout information for all labels associated with the given node of the copied graph.
Remarks
Parameters
A map of options to pass to the method.
- copiedNode - YNode
- the node
Returns
- ↪INodeLabelLayout[]
- the label layout information for all labels of the given node
Implements
Returns the layout information for all labels associated with the given edge of the copied graph.
Remarks
Parameters
A map of options to pass to the method.
- copiedEdge - Edge
- the edge
Returns
- ↪IEdgeLabelLayout[]
- the label layout information for all labels of the given edge
Implements
Returns the layout information for the given node of the copied graph.
Remarks
Parameters
A map of options to pass to the method.
- copiedNode - YNode
- the node
Returns
- ↪INodeLayout
- the layout information for the node
Implements
Returns the layout information for the given edge of the copied graph.
Remarks
Parameters
A map of options to pass to the method.
- copiedEdge - Edge
- the edge
Returns
- ↪IEdgeLayout
- the layout information for the edge
Implements
Provides access to the nodes of the graph.
Returns the edge of the copied graph to which the given IEdgeLabelLayout belongs.
Parameters
A map of options to pass to the method.
- labelLayout - IEdgeLabelLayout
- a label layout information of an edge in the copied graph
Returns
- ↪Edge
- the edge that belongs to the given label layout
Implements
Returns the node of the copied graph to which the given INodeLabelLayout belongs.
Parameters
A map of options to pass to the method.
- labelLayout - INodeLabelLayout
- a label layout information of a node in the copied graph
Returns
- ↪YNode
- the node that belongs to the given label layout
Implements
Returns the path of an edge, including the ports.
Remarks
Parameters
A map of options to pass to the method.
- edge - Edge
- the edge
Returns
- ↪YPointPath
- the path of the given edge
Defined in
Returns the path of an edge, including the ports.
Remarks
Parameters
A map of options to pass to the method.
- edge - Edge
- the edge
Returns
See Also
Defined in
Returns the control points of an edge.
Parameters
A map of options to pass to the method.
- edge - Edge
- the edge
Returns
See Also
Defined in
Returns the control points of an edge.
Parameters
A map of options to pass to the method.
- edge - Edge
- the edge
Returns
- ↪YPointPath
- a YPointPath representing the sequence of control points of the edge
See Also
Defined in
Returns the size of the given node.
Parameters
A map of options to pass to the method.
- node - YNode
- the node
Returns
- ↪YDimension
- the size of the node
See Also
Defined in
Returns the relative coordinates of the source point of the given edge.
Returns the relative coordinates of the target point of the given edge.
Returns the width of the given node.
Parameters
A map of options to pass to the method.
- node - YNode
- the node
Returns
- ↪number
- the width of the node
See Also
Defined in
Returns the x-coordinate of the given node's upper-left corner.
Parameters
A map of options to pass to the method.
- node - YNode
- the node
Returns
- ↪number
- the x-value of the node's upper-left corner
See Also
Defined in
Returns the y-coordinate of the given node's upper-left corner.
Parameters
A map of options to pass to the method.
- node - YNode
- the node
Returns
- ↪number
- the y-value of the node's upper-left corner
See Also
Defined in
Hides the given edge from this graph.
Remarks
Hiding an edge means to (temporarily) remove the edge from the graph.
Generally, hiding should only be used in the sense of temporarily removing an object that will be reinserted shortly after.
To reinsert a hidden edge use unhide.
See Also
Defined in
Hides the given node from this graph.
Remarks
Hiding a node means to (temporarily) remove the node from the graph.
Generally, hiding should only be used in the sense of temporarily removing an object that will be reinserted shortly after.
To reinsert a hidden node use unhide.
See Also
Defined in
Moves the upper-left corner of a node by a given vector.
Parameters
A map of options to pass to the method.
- node - YNode
- the node
- dx - number
- the x-component of the vector
- dy - number
- the y-component of the vector
Defined in
For internal debugging purposes only.
Defined in
Reinserts a formerly removed edge into this graph.
Remarks
The reinserted edge is appended to the sequence of edges in this graph, i.e., normally, its new position does not match the position before its removal. The same holds for the edge's positions in the list of incoming and outgoing edges at its source node and target node, respectively.
Note that reinserting an edge whose source/target is not in the graph (e.g., because it's currently hidden/removed) causes an exception. Hence, in such cases, you first have to unhide/reinsert the corresponding endpoints.
Parameters
A map of options to pass to the method.
- e - Edge
- The edge to be reinserted.
See Also
Defined in
Reinserts a formerly removed node into this graph.
Remarks
Parameters
A map of options to pass to the method.
- v - YNode
- The node to be reinserted.
See Also
Defined in
Removes the given node from this graph.
Specifies the center coordinates of the given node.
Parameters
A map of options to pass to the method.
See Also
Defined in
Specifies the center coordinates of the given node.
Parameters
A map of options to pass to the method.
- node - YNode
- the node
- x - number
- the new x-coordinate of the node's center
- y - number
- the new y-coordinate of the node's center
See Also
Defined in
Specifies the coordinates of the upper-left corner of the given node.
Parameters
A map of options to pass to the method.
- node - YNode
- the node
- x - number
- the new x-coordinate of the upper-left corner
- y - number
- the new y-coordinate of the upper-left corner
See Also
Defined in
Specifies the coordinates of the upper-left corner of the given node.
Parameters
A map of options to pass to the method.
See Also
Defined in
Sets the path of the given edge.
Remarks
The path of an edge is the position of the source port, followed by the positions of the bends, followed by the position of the target port.
Both source and target port are expected to be given in absolute coordinates.
Preconditions
- The length of the path must be at least
2
.
Parameters
A map of options to pass to the method.
- edge - Edge
- an edge in the graph
- path - YPointPath
- the new path sequence of the edge
Defined in
Sets the path of the given edge.
Remarks
The path of an edge is the position of the source port, followed by the positions of the bends, followed by the position of the target port.
Both source and target port are expected to be given in absolute coordinates.
Preconditions
- The length of the path must be at least
2
.
Parameters
A map of options to pass to the method.
- edge - Edge
- an edge in the graph
- path - YList
- the list of YPoints representing the new path sequence of the edge
See Also
Defined in
Sets the control points of the given edge.
Remarks
Parameters
A map of options to pass to the method.
- edge - Edge
- an edge in the graph
- points - YPointPath
- the new sequence of control points
Defined in
Sets the control points of the given edge.
Remarks
Parameters
A map of options to pass to the method.
- edge - Edge
- an edge in the graph
- points - YList
- the list of YPoints representing the new sequence of control points
See Also
Defined in
Specifies the width and height of the given node.
Parameters
A map of options to pass to the method.
- node - YNode
- the node
- width - number
- the new width of the node
- height - number
- the new height of the node
See Also
Defined in
Specifies the size of the given node.
Parameters
A map of options to pass to the method.
- node - YNode
- the node
- size - YDimension
- the new size of the node
See Also
Defined in
Specifies the absolute coordinates of the source point of the given edge.
Parameters
A map of options to pass to the method.
See Also
Defined in
Specifies the relative coordinates of the source point of the given edge.
Remarks
Parameters
A map of options to pass to the method.
See Also
Defined in
Specifies the absolute coordinates of the target point of the given edge.
Parameters
A map of options to pass to the method.
See Also
Defined in
Specifies the relative coordinates of the target point of the given edge.
Remarks
Parameters
A map of options to pass to the method.
See Also
Defined in
Sorts the internally held list of edges.
Remarks
null
, then the edges will not be sorted. This list determines the order of the edges as returned by getEdgeCursor.Parameters
A map of options to pass to the method.
- comparer - IComparer<Object>
- The comparator used for the edges.
Defined in
Sorts incoming and outgoing edges at each node of the graph.
Remarks
null
, then the corresponding edges (i.e., incoming/outgoing) will not be sorted. This sorts the order of the edges as returned by getOutEdgeCursor and getInEdgeCursor respectively.Parameters
A map of options to pass to the method.
- inComparer - IComparer<Object>
- The comparator used for the incoming edges at each node.
- outComparer - IComparer<Object>
- The comparator used for the outgoing edges at each node.
Defined in
Sorts the internally held list of nodes.
Remarks
null
, then the nodes will not be sorted. This list determines the order of the nodes as returned by getNodeCursor.Parameters
A map of options to pass to the method.
- comparer - IComparer<Object>
- The comparator used for the nodes.
Defined in
Synchronizes the structure of the CopiedLayoutGraph with the actual structure of the underlying original graph.
Returns a String representation of this graph.
Remarks
Defined in
Unhides the given edge in this graph.
Remarks
Unhiding an edge means to reinsert an edge that was formerly hidden from this graph by a call to hide.
Note that unhiding an edge whose source/target is not in the graph (e.g., because it's currently hidden/removed) causes an exception. Hence, in such cases, you first have to unhide/reinsert the corresponding endpoints.