static void DemoRoutingFromPortToPort(GeometryGraph graph) { var edges = graph.Edges.ToArray(); SetCurvesToNull(edges); var portRouter = new InteractiveEdgeRouter(graph.Nodes.Select(n => n.BoundaryCurve), 3, 0.65*3, 0); portRouter.Run(); //calculates the whole visibility graph, takes a long time DrawEdgeWithPort(edges[0], portRouter, 0.3, 0.4); DrawEdgeWithPort(edges[1], portRouter, 0.7, 1.5*Math.PI); //I know here that my node boundary curves are ellipses so the parameters run from 0 to 2Pi //otherwise the curve parameter runs from curve.ParStart, to curve.ParEnd #if TEST LayoutAlgorithmSettings.ShowGraph(graph); #endif }
private void Route() { //foreach (var edge in graph.Edges) { // edge.EdgeGeometry.Curve = new LineSegment(edge.Source.Center, edge.Target.Center); //} //return; var edgeRouter = new InteractiveEdgeRouter(from v in AllLabels() select v.BoundaryCurve, this.locationRadius / 3, this.locationRadius/9, Math.PI/6); edgeRouter.Run();//it will calculate the visibility graph edgeRouter.GetVisibilityGraph(); foreach (var edge in Edges()) { SmoothedPolyline sp; edge.EdgeGeometry.Curve = edgeRouter.RouteSplineFromPortToPortWhenTheWholeGraphIsReady(new FloatingPort(edge.Source.BoundaryCurve, edge.Source.Center), new FloatingPort(null, edge.Target.Center), true, out sp); TrimAtSource(edge); } }