Layout morphing denotes the effect of smoothly transforming node and bend positions from their original positions to the ones newly calculated by a layout algorithm.
The following convenience method in class GraphControl can be used to quickly set up a such an effect for the control's graph:
void MorphLayout(ILayouter layouter, TimeSpan morphDuration, EventHandler doneHandler) |
|
| Description | Convenience (extension) method in GraphControl that uses the services of class LayoutExecutor. |
Example 3.6. Layout morphing for a GraphControl's IGraph-based graph
// 'graphControl' is of type yWorks.yFiles.UI.GraphControl. IncrementalHierarchicLayouter ihl = new IncrementalHierarchicLayouter(); graphControl.MorphLayout(ihl, TimeSpan.FromMilliseconds(500), null);
LayoutExecutor
provides support
for conveniently executing yFiles layout algorithms.
Optionally, a smooth animation that shows the transformation from the graph's original
layout to the newly calculated one can be shown.
This process is called "layout morphing."
void Start() |
|
| Description | Starts the layout calculation. |
The following properties can be used to configure the layout morphing process:
TimeSpan Duration { get; set; } |
|
| Description | Properties of the layout morphing animation. |
LayoutExecutor supports layout calculation and layout morphing to take place in a separate thread. The following property can be used to enable asynchronous execution:
bool RunInThread { get; set; } |
|
| Description | Property for asynchronous layout calculation and layout morphing. |
The following code example shows how to use LayoutExecutor to set up and start layout execution and morphing in a separate thread.
Example 3.7. Using LayoutExecutor for layout execution and morphing
// 'graphControl' is of type yWorks.yFiles.UI.GraphControl.
ILayouter layouter = new IncrementalHierarchicLayouter();
// Configure a LayoutExecutor.
var executor = new LayoutExecutor(graphControl, layouter) {
AnimateViewport = true,
EasedAnimation = true,
RunInThread = true,
UpdateContentRect = true,
Duration = TimeSpan.FromMilliseconds(500)
};
executor.Start();
|
Copyright ©2004-2011, yWorks GmbH. All rights reserved. |