public void SplineRoutingSmallCompleteGraph()
        {
            //DisplayGeometryGraph.SetShowFunctions();
            var g  = LoadGraph("K20.msagl.geom");
            var sw = new Stopwatch();

            sw.Start();
            var          loosePadding = SplineRouter.ComputeLooseSplinePadding(10, 2);
            SplineRouter splineRouter = new SplineRouter(g, 2, loosePadding, Math.PI / 6, null);

            splineRouter.Run();
            sw.Stop();
            TestContext.WriteLine("Edge routing took: {0} seconds.", sw.ElapsedMilliseconds / 1000.0);
        }
        public void RouteEdges_SplineRouting1138Bus()
        {
            var g  = LoadGraph("GeometryGraph_1138bus.msagl.geom");
            var sw = new Stopwatch();

            sw.Start();
            var          loosePadding = SplineRouter.ComputeLooseSplinePadding(10, 2);
            SplineRouter splineRouter = new SplineRouter(g, 2, loosePadding, Math.PI / 6, null);

            splineRouter.Run();

            sw.Stop();
            System.Diagnostics.Debug.WriteLine("Edge routing took: {0} seconds.", sw.ElapsedMilliseconds / 1000.0);
        }
        public void RouteEdges_Nodes50()
        {
            var g  = LoadGraph("nodes50.msagl.geom");
            var sw = new Stopwatch();

            sw.Start();
            const double TightPadding = 2.0;
            var          loosePadding = SplineRouter.ComputeLooseSplinePadding(10, TightPadding);
            SplineRouter splineRouter = new SplineRouter(g, TightPadding, loosePadding, Math.PI / 6, null);

            splineRouter.Run();
            sw.Stop();
            System.Diagnostics.Debug.WriteLine("Edge routing took: {0} seconds.", sw.ElapsedMilliseconds / 1000.0);
            CheckEdgesForOverlapWithNodes(TightPadding, g);
        }
예제 #4
0
        void RouteGraphEdgesAsSplines()
        {
            var geomGraph      = gViewer.Graph.GeometryGraph;
            var layoutSettings = gViewer.Graph.LayoutAlgorithmSettings;
            EdgeRoutingSettings routingSettings = layoutSettings.EdgeRoutingSettings;

            if (routingSettings.EdgeRoutingMode == EdgeRoutingMode.StraightLine)
            {
                RouteStraightLines();
            }
            else
            if (routingSettings.EdgeRoutingMode == EdgeRoutingMode.Spline)
            {
                var coneAngle = routingSettings.ConeAngle;
                var padding   = layoutSettings.NodeSeparation * gViewer.TightOffsetForRouting * 2;
                this.currentCancelToken = new CancelToken();
                var router = new SplineRouter(geomGraph, padding, 0.65 * padding, coneAngle, null);
                router.Run(this.currentCancelToken);
            }
            else if (routingSettings.EdgeRoutingMode == EdgeRoutingMode.SplineBundling)
            {
                var coneAngle    = routingSettings.ConeAngle;
                var padding      = layoutSettings.NodeSeparation / 3;
                var loosePadding = SplineRouter.ComputeLooseSplinePadding(layoutSettings.NodeSeparation, padding);
                if (layoutSettings.EdgeRoutingSettings.BundlingSettings == null)
                {
                    layoutSettings.EdgeRoutingSettings.BundlingSettings = new BundlingSettings();
                }
                var br = new SplineRouter(geomGraph, padding, loosePadding, coneAngle, layoutSettings.EdgeRoutingSettings.BundlingSettings);
                br.Run();
            }
            else
            {
                MessageBox.Show(String.Format("Mode {0} is not supported with this settings",
                                              routingSettings.EdgeRoutingMode));
                return;
            }

            new EdgeLabelPlacement(geomGraph).Run();

            InvalidateEdges();
        }