Temporarily modifies the LayoutGraphContext for the following layout algorithms.
Remarks
The ContextModificationStage can be used to temporarily hide, replace, or transfer data registered with the LayoutGraphContext using data keys. Common applications for this stage include applying multiple instances of the same ILayoutAlgorithm with e.g. different affected graph elements.
Context data can be hidden by this stage, in which case the coreLayout has no access to the data and resorts to the specified default behavior. Alternatively, the data can be replaced, in which case the coreLayout accesses the specified replacement data instead. In either case, all modifications to the context made by this stage are reversed after the coreLayout has returned.
The modifications to the context are applied in the same order in which they are added to this ContextModificationStage, so it is possible to, for example, transfer the data registered with one key to another and then hide the data on the original key afterward.
Type Details
- yFiles module
- algorithms
Constructors
Creates a new ContextModificationStage with the given algorithm as coreLayout or null
if no core layout is specified.
Parameters
A map of options to pass to the method.
- coreLayout - ILayoutAlgorithm
- the core layout algorithm
- enabled - boolean
Properties
Gets or sets the core ILayoutAlgorithm that is wrapped by this stage.
Gets or sets a value that determines whether this stage should do anything but execute the coreLayout.
Remarks
By default, when constructed, stages should be enabled. Users may disable a stage's functionality by setting this property to false
.
Stages that can guarantee that the graph will not change can choose to not even execute the coreLayout when disabled.
Implements
Methods
Adds the specified keys as a pair of keys whose associated data should be transferred.
Type Parameters
- T
- The type of the values that are returned by the
registered with the specified keys
Parameters
A map of options to pass to the method.
- sourceKey - NodeDataKey<T>
- The key whose associated data should temporarily be transferred
- targetKey - NodeDataKey<T>
- The key to which the data should temporarily be transferred
Adds the specified keys as a pair of keys whose associated data should be transferred.
Type Parameters
- T
- The type of the values that are returned by the
registered with the specified keys
Parameters
A map of options to pass to the method.
- sourceKey - EdgeDataKey<T>
- The key whose associated data should temporarily be transferred
- targetKey - EdgeDataKey<T>
- The key to which the data should temporarily be transferred
Adds the specified keys as a pair of keys whose associated data should be transferred.
Type Parameters
- T
- The type of the values that are returned by the
registered with the specified keys
Parameters
A map of options to pass to the method.
- sourceKey - NodeLabelDataKey<T>
- The key whose associated data should temporarily be transferred
- targetKey - NodeLabelDataKey<T>
- The key to which the data should temporarily be transferred
Adds the specified keys as a pair of keys whose associated data should be transferred.
Type Parameters
- T
- The type of the values that are returned by the
registered with the specified keys
Parameters
A map of options to pass to the method.
- sourceKey - EdgeLabelDataKey<T>
- The key whose associated data should temporarily be transferred
- targetKey - EdgeLabelDataKey<T>
- The key to which the data should temporarily be transferred
Adds the specified key to the data keys whose associated data is temporarily hidden by this stage.
Type Parameters
- T
- the type of the values that are returned by the
registered with the specified key
Parameters
A map of options to pass to the method.
- key - NodeDataKey<T>
- the key whose associated data should temporarily be hidden
Throws
- Exception({ name: 'ArgumentError' })
- if the specified key is
null
Adds the specified key to the data keys whose associated data is temporarily hidden by this stage.
Type Parameters
- T
- the type of the values that are returned by the
registered with the specified key
Parameters
A map of options to pass to the method.
- key - EdgeDataKey<T>
- the key whose associated data should temporarily be hidden
Throws
- Exception({ name: 'ArgumentError' })
- if the specified key is
null
Adds the specified key to the data keys whose associated data is temporarily hidden by this stage.
Type Parameters
- T
- the type of the values that are returned by the
registered with the specified key
Parameters
A map of options to pass to the method.
- key - NodeLabelDataKey<T>
- the key whose associated data should temporarily be hidden
Throws
- Exception({ name: 'ArgumentError' })
- if the specified key is
null
Adds the specified key to the data keys whose associated data is temporarily hidden by this stage.
Type Parameters
- T
- the type of the values that are returned by the
registered with the specified key
Parameters
A map of options to pass to the method.
- key - EdgeLabelDataKey<T>
- the key whose associated data should temporarily be hidden
Throws
- Exception({ name: 'ArgumentError' })
- if the specified key is
null
Adds the specified layout data to be temporarily applied by this stage.
Parameters
A map of options to pass to the method.
- data - LayoutData<LayoutNode,LayoutEdge,LayoutNodeLabel,LayoutEdgeLabel>
- the layout data to be temporarily applied
Adds the specified key to the data keys whose associated data is temporarily replaced by this stage.
Type Parameters
- T
- The type of the values that are returned by the
registered with the specified key
Parameters
A map of options to pass to the method.
- key - NodeDataKey<T>
- The key whose associated data should temporarily be replaced
- mapper - IMapper<LayoutNode,T>
- The mapper that should replace the data registered with the specified key
Throws
- Exception({ name: 'ArgumentError' })
- If the specified key is
null
Adds the specified key to the data keys whose associated data is temporarily replaced by this stage.
Type Parameters
- T
- The type of the values that are returned by the
registered with the specified key
Parameters
A map of options to pass to the method.
- key - EdgeDataKey<T>
- The key whose associated data should temporarily be replaced
- mapper - IMapper<LayoutEdge,T>
- The mapper that should replace the data registered with the specified key
Throws
- Exception({ name: 'ArgumentError' })
- If the specified key is
null
Adds the specified key to the data keys whose associated data is temporarily replaced by this stage.
Type Parameters
- T
- The type of the values that are returned by the
registered with the specified key
Parameters
A map of options to pass to the method.
- key - NodeLabelDataKey<T>
- The key whose associated data should temporarily be replaced
- mapper - IMapper<LayoutNodeLabel,T>
- The mapper that should replace the data registered with the specified key
Throws
- Exception({ name: 'ArgumentError' })
- If the specified key is
null
Adds the specified key to the data keys whose associated data is temporarily replaced by this stage.
Type Parameters
- T
- The type of the values that are returned by the
registered with the specified key
Parameters
A map of options to pass to the method.
- key - EdgeLabelDataKey<T>
- The key whose associated data should temporarily be replaced
- mapper - IMapper<LayoutEdgeLabel,T>
- The mapper that should replace the data registered with the specified key
Throws
- Exception({ name: 'ArgumentError' })
- If the specified key is
null
Implementation of the ILayoutAlgorithm interface and main entry point for the layout calculation.
Remarks
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- The graph to apply the layout to.
Implements
Temporarily modifies the LayoutGraphContext for the coreLayout run.
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the input graph