本文整理汇总了C#中Microsoft.Msagl.Core.Layout.GeometryGraph.FindNodeByUserData方法的典型用法代码示例。如果您正苦于以下问题:C# GeometryGraph.FindNodeByUserData方法的具体用法?C# GeometryGraph.FindNodeByUserData怎么用?C# GeometryGraph.FindNodeByUserData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Msagl.Core.Layout.GeometryGraph
的用法示例。
在下文中一共展示了GeometryGraph.FindNodeByUserData方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateAndLayoutGraph
internal static GeometryGraph CreateAndLayoutGraph()
{
double w = 40;
double h = 10;
GeometryGraph graph = new GeometryGraph();
// columns
var col0 = new[] { "a", "b", "c" };
var col1 = new[] { "d", "e", "f", "g" };
var col2 = new[] { "k", "l", "m", "n" };
var col3 = new[] { "w", "y", "z" };
var settings = new SugiyamaLayoutSettings();
foreach (var id in col0)
DrawingUtilsForSamples.AddNode(id, graph, w, h);
foreach (var id in col1)
DrawingUtilsForSamples.AddNode(id, graph, w, h);
foreach (var id in col2)
DrawingUtilsForSamples.AddNode(id, graph, w, h);
foreach (var id in col3)
DrawingUtilsForSamples.AddNode(id, graph, w, h);
//pinning columns
settings.PinNodesToSameLayer(col0.Select(s => graph.FindNodeByUserData(s)).ToArray());
settings.PinNodesToSameLayer(col1.Select(s => graph.FindNodeByUserData(s)).ToArray());
settings.PinNodesToSameLayer(col2.Select(s => graph.FindNodeByUserData(s)).ToArray());
settings.PinNodesToSameLayer(col3.Select(s => graph.FindNodeByUserData(s)).ToArray());
AddEdgesBetweenColumns(col0, col1, graph);
AddEdgesBetweenColumns(col1, col2, graph);
AddEdgesBetweenColumns(col2, col3, graph);
// rotate layer to columns
settings.Transformation = PlaneTransformation.Rotation(Math.PI/2);
settings.NodeSeparation = 5;
settings.LayerSeparation = 100;
var ll = new LayeredLayout(graph, settings);
ll.Run();
return graph;
}
示例2: CreateAndLayoutGraph
internal static GeometryGraph CreateAndLayoutGraph()
{
GeometryGraph graph = new GeometryGraph();
double width = 40;
double height = 10;
foreach (string id in "0 1 2 3 4 5 6 A B C D E F G a b c d e".Split(' '))
{
DrawingUtilsForSamples.AddNode(id, graph, width, height);
}
graph.Edges.Add(new Edge(graph.FindNodeByUserData("A"), graph.FindNodeByUserData("B")));
graph.Edges.Add(new Edge(graph.FindNodeByUserData("A"), graph.FindNodeByUserData("C")));
graph.Edges.Add(new Edge(graph.FindNodeByUserData("A"), graph.FindNodeByUserData("D")));
graph.Edges.Add(new Edge(graph.FindNodeByUserData("D"), graph.FindNodeByUserData("E")));
graph.Edges.Add(new Edge(graph.FindNodeByUserData("B"), graph.FindNodeByUserData("E")));
graph.Edges.Add(new Edge(graph.FindNodeByUserData("D"), graph.FindNodeByUserData("F")));
graph.Edges.Add(new Edge(graph.FindNodeByUserData("0"), graph.FindNodeByUserData("F")));
graph.Edges.Add(new Edge(graph.FindNodeByUserData("1"), graph.FindNodeByUserData("F")));
graph.Edges.Add(new Edge(graph.FindNodeByUserData("2"), graph.FindNodeByUserData("F")));
graph.Edges.Add(new Edge(graph.FindNodeByUserData("3"), graph.FindNodeByUserData("F")));
graph.Edges.Add(new Edge(graph.FindNodeByUserData("4"), graph.FindNodeByUserData("F")));
graph.Edges.Add(new Edge(graph.FindNodeByUserData("5"), graph.FindNodeByUserData("F")));
graph.Edges.Add(new Edge(graph.FindNodeByUserData("6"), graph.FindNodeByUserData("F")));
graph.Edges.Add(new Edge(graph.FindNodeByUserData("a"), graph.FindNodeByUserData("b")));
graph.Edges.Add(new Edge(graph.FindNodeByUserData("b"), graph.FindNodeByUserData("c")));
graph.Edges.Add(new Edge(graph.FindNodeByUserData("c"), graph.FindNodeByUserData("d")));
graph.Edges.Add(new Edge(graph.FindNodeByUserData("d"), graph.FindNodeByUserData("e")));
graph.Edges.Add(new Edge(graph.FindNodeByUserData("A"), graph.FindNodeByUserData("a")));
graph.Edges.Add(new Edge(graph.FindNodeByUserData("B"), graph.FindNodeByUserData("a")));
graph.Edges.Add(new Edge(graph.FindNodeByUserData("C"), graph.FindNodeByUserData("a")));
graph.Edges.Add(new Edge(graph.FindNodeByUserData("D"), graph.FindNodeByUserData("a")));
graph.Edges.Add(new Edge(graph.FindNodeByUserData("E"), graph.FindNodeByUserData("a")));
graph.Edges.Add(new Edge(graph.FindNodeByUserData("F"), graph.FindNodeByUserData("a")));
graph.Edges.Add(new Edge(graph.FindNodeByUserData("G"), graph.FindNodeByUserData("a")));
var settings = new SugiyamaLayoutSettings {
Transformation = PlaneTransformation.Rotation(Math.PI/2),
EdgeRoutingSettings = {EdgeRoutingMode = EdgeRoutingMode.Spline}
};
var layout = new LayeredLayout(graph, settings);
layout.Run();
return graph;
}
示例3: CurveOnNodes
static ICurve CurveOnNodes(GeometryGraph graph, double pad, params string[] nodeIds) {
Rectangle rect = Rectangle.CreateAnEmptyBox();
foreach (string nodeId in nodeIds) {
rect.Add(graph.FindNodeByUserData(nodeId).BoundingBox);
}
rect.Pad(pad);
return rect.Perimeter();
}
示例4: AddEdgesBetweenColumns
static void AddEdgesBetweenColumns(string[] col0, string[] col1, GeometryGraph graph)
{
foreach (var id in col0)
{
Edge edge = new Edge(graph.FindNodeByUserData(id),
graph.FindNodeByUserData(col1[RandomGenerator.Next(col1.Length)])) {
EdgeGeometry = {TargetArrowhead = new Arrowhead()}
};
graph.Edges.Add(edge);
edge = new Edge(graph.FindNodeByUserData(id), graph.FindNodeByUserData(col1[RandomGenerator.Next(col1.Length)]));
graph.Edges.Add(edge);
}
}
示例5: CreateAndLayoutGraph
static internal GeometryGraph CreateAndLayoutGraph() {
GeometryGraph graph = new GeometryGraph();
double width = 40;
double height = 10;
foreach (string id in "0 1 2 3 4 5 6 A B C D E F G a b c d e".Split(' '))
{
AddNode(id, graph, width, height);
}
graph.Edges.Add(new Edge(graph.FindNodeByUserData("A"), graph.FindNodeByUserData("B")));
graph.Edges.Add(new Edge(graph.FindNodeByUserData("A"), graph.FindNodeByUserData("C")));
graph.Edges.Add(new Edge(graph.FindNodeByUserData("A"), graph.FindNodeByUserData("D")));
graph.Edges.Add(new Edge(graph.FindNodeByUserData("D"), graph.FindNodeByUserData("E")));
graph.Edges.Add(new Edge(graph.FindNodeByUserData("B"), graph.FindNodeByUserData("E")));
graph.Edges.Add(new Edge(graph.FindNodeByUserData("D"), graph.FindNodeByUserData("F")));
graph.Edges.Add(new Edge(graph.FindNodeByUserData("0"), graph.FindNodeByUserData("F")));
graph.Edges.Add(new Edge(graph.FindNodeByUserData("1"), graph.FindNodeByUserData("F")));
graph.Edges.Add(new Edge(graph.FindNodeByUserData("2"), graph.FindNodeByUserData("F")));
graph.Edges.Add(new Edge(graph.FindNodeByUserData("3"), graph.FindNodeByUserData("F")));
graph.Edges.Add(new Edge(graph.FindNodeByUserData("4"), graph.FindNodeByUserData("F")));
graph.Edges.Add(new Edge(graph.FindNodeByUserData("5"), graph.FindNodeByUserData("F")));
graph.Edges.Add(new Edge(graph.FindNodeByUserData("6"), graph.FindNodeByUserData("F")));
graph.Edges.Add(new Edge(graph.FindNodeByUserData("a"), graph.FindNodeByUserData("b")));
graph.Edges.Add(new Edge(graph.FindNodeByUserData("b"), graph.FindNodeByUserData("c")));
graph.Edges.Add(new Edge(graph.FindNodeByUserData("c"), graph.FindNodeByUserData("d")));
graph.Edges.Add(new Edge(graph.FindNodeByUserData("d"), graph.FindNodeByUserData("e")));
graph.Edges.Add(new Edge(graph.FindNodeByUserData("A"), graph.FindNodeByUserData("a")));
graph.Edges.Add(new Edge(graph.FindNodeByUserData("B"), graph.FindNodeByUserData("a")));
graph.Edges.Add(new Edge(graph.FindNodeByUserData("C"), graph.FindNodeByUserData("a")));
graph.Edges.Add(new Edge(graph.FindNodeByUserData("D"), graph.FindNodeByUserData("a")));
graph.Edges.Add(new Edge(graph.FindNodeByUserData("E"), graph.FindNodeByUserData("a")));
graph.Edges.Add(new Edge(graph.FindNodeByUserData("F"), graph.FindNodeByUserData("a")));
graph.Edges.Add(new Edge(graph.FindNodeByUserData("G"), graph.FindNodeByUserData("a")));
var settings = new SugiyamaLayoutSettings();
settings.Transformation = PlaneTransformation.Rotation(Math.PI/2);
settings.EdgeRoutingSettings.EdgeRoutingMode = EdgeRoutingMode.Spline;
var layout = new LayeredLayout(graph, settings);
layout.Run();
return graph;
// double w = 40;
// double h = 10;
// GeometryGraph graph = new GeometryGraph();
//columns
// var col0 = new[] { "a", "b", "c" };
// var col1 = new[] { "d", "e", "f", "g" };
// var col2 = new[] { "k", "l", "m", "n" };
// var col3 = new[] { "w", "y", "z" };
//
// var settings = new SugiyamaLayoutSettings();
//
// foreach (var id in col0)
// AddNode(id, graph, w, h);
// foreach (var id in col1)
// AddNode(id, graph, w, h);
// foreach (var id in col2)
// AddNode(id, graph, w, h);
// foreach (var id in col3)
// AddNode(id, graph, w, h);
//
//pinning columns
// settings.PinNodesToSameLayer(col0.Select(s=>graph.FindNodeByUserData(s)).ToArray());
// settings.PinNodesToSameLayer(col1.Select(s => graph.FindNodeByUserData(s)).ToArray());
// settings.PinNodesToSameLayer(col2.Select(s => graph.FindNodeByUserData(s)).ToArray());
// settings.PinNodesToSameLayer(col3.Select(s => graph.FindNodeByUserData(s)).ToArray());
//
// AddEdgesBetweenColumns(col0, col1, graph);
// AddEdgesBetweenColumns(col1, col2, graph);
// AddEdgesBetweenColumns(col2, col3, graph);
//rotate layer to columns
// graph.Transformation = PlaneTransformation.Rotation(Math.PI / 2);
// settings.NodeSeparation = 5;
// settings.LayerSeparation = 100;
// var ll = new LayeredLayout(graph, settings);
// ll.Run();
// return graph;
}