当前位置: 首页>>代码示例>>C#>>正文


C# GeometryGraph.FindNodeByUserData方法代码示例

本文整理汇总了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;
        }
开发者ID:mrkcass,项目名称:SuffixTreeExplorer,代码行数:39,代码来源:LayerConstraintsFromGeometrySampleForm.cs

示例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;
        }
开发者ID:mrkcass,项目名称:SuffixTreeExplorer,代码行数:45,代码来源:DrawingFromGeometryGraphForm.cs

示例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();
 }
开发者ID:WenzCao,项目名称:automatic-graph-layout,代码行数:8,代码来源:test.cs

示例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);

            }
        }
开发者ID:mrkcass,项目名称:SuffixTreeExplorer,代码行数:14,代码来源:LayerConstraintsFromGeometrySampleForm.cs

示例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;
        }
开发者ID:WenzCao,项目名称:automatic-graph-layout,代码行数:79,代码来源:Form1.cs


注:本文中的Microsoft.Msagl.Core.Layout.GeometryGraph.FindNodeByUserData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。