Namespace: yWorks.yFiles.UI.Model
Assembly: yWorks.yFilesWPF.Adapter (in yWorks.yFilesWPF.Adapter.dll) Version: 2.2.0.2 (2.2.0.2)
Assembly: yWorks.yFilesWPF.Adapter (in yWorks.yFilesWPF.Adapter.dll) Version: 2.2.0.2 (2.2.0.2)
Syntax
| C# |
|---|
public class LayoutGraphAdapter : IGraphLayout, IGraphInterface |
| Visual Basic |
|---|
Public Class LayoutGraphAdapter _ Implements IGraphLayout, IGraphInterface |
Remarks
This adapter needs to be used in order to apply layout algorithms to IGraph instances.
The following pattern should be used:
CopyC#
Alternatively one can use the LayoutMorpherWrapper to morph the layout:
CopyC#
Class CopiedLayoutIGraph is a convenience class that can be used
to quickly assign new layouts to an IGraph:
CopyC#
or even:
CopyC#
This class will use the provided SelectionModel
to attach IDataProvider instances to the GraphInterface
for the SelectedNodesDpKey and SelectedEdgesDpKey
data provider keys. Also it will automatically wrap IMapper<(Of <(<'K, V>)>)> instances
registered with the IMapperRegistry found in the Lookup(Type)
of the IGraph and wrap those instances in IDataProvider instances.
// build the adapter LayoutGraphAdapter adapter = new LayoutGraphAdapter(graph, selectionModel); // create a copy for improved performance and stability CopiedLayoutGraph layoutGraph = new CopiedLayoutGraph(adapter, adapter); // perform the layout on the copy layouter.DoLayout(layoutGraph); // apply the results to the original IGraph layoutGraph.CommitLayoutToOriginalGraph();
// build the adapter LayoutGraphAdapter adapter = new LayoutGraphAdapter(graph, selectionModel); // create a copy for improved performance and stability CopiedLayoutGraph layoutGraph = new CopiedLayoutGraph(adapter, adapter); // perform the layout on the copy layouter.DoLayout(layoutGraph); // create the animation object LayoutMorpherWrapper morpher = new LayoutMorpherWrapper(graph, layoutGraph, TimeSpan.FromSeconds(1)); // and play Animator animator = new Animator(view); animator.Animate(morpher);
// build the adapter copy CopiedLayoutIGraph copy = new CopiedLayoutIGraph(graph); // perform the layout on the copy layouter.DoLayout(copy); // apply the results to the original IGraph copy.CommitLayoutToOriginalGraph();
CopiedLayoutIGraph.ApplyLayout(graph, layouter);
Related Reading in the Developer's Guide
Inheritance Hierarchy
System..::..Object
yWorks.yFiles.UI.Model..::..LayoutGraphAdapter
yWorks.yFiles.UI.Model..::..LayoutGraphAdapter