private void DisplayRealGraph() { _graph.CreateGeometryGraph(); foreach (var navigationPoint in airfield.NavigationGraph.Vertices) { var dnode = _graph.Nodes.FirstOrDefault(node => node.Id.Equals(navigationPoint.Name)); if (dnode != null) { dnode.GeometryNode.BoundaryCurve = CreateLabelAndBoundary(navigationPoint, dnode); } else { MessageBox.Show($"Error Displaying {navigationPoint.Name}", "Display Error", MessageBoxButton.OK, MessageBoxImage.Error); } } LayoutHelpers.RouteAndLabelEdges(_graph.GeometryGraph, settings, _graph.GeometryGraph.Edges); _graphViewer = new GraphViewer { LayoutEditingEnabled = false, NeedToCalculateLayout = false }; _graphViewer.BindToPanel(GraphPanel); _graphViewer.MouseDown += MouseDownHandler; _graphViewer.MouseUp += MouseUpHandler; _graphViewer.Graph = _graph; }
public IViewerEdge RouteEdge(DrawingEdge drawingEdge) { var geomEdge = GeometryGraphCreator.CreateGeometryEdgeFromDrawingEdge(drawingEdge); var geomGraph = drawingGraph.GeometryGraph; LayoutHelpers.RouteAndLabelEdges(geomGraph, drawingGraph.LayoutAlgorithmSettings, new[] { geomEdge }); return(CreateEdge(drawingEdge, drawingGraph.LayoutAlgorithmSettings as LgLayoutSettings)); }
private void Update() { if (reposition) { PositionNodes(); Center(); reposition = false; } if (redraw) { RedrawEdges(); redraw = false; } if (relayout) { if (graphTask == null) { UpdateNodes(); graphTask = Task.Run(() => { LayoutHelpers.CalculateLayout(graph, settings, null); LayoutHelpers.RouteAndLabelEdges(graph, settings, graph.Edges); }); Forget(graphTask, () => { graphTask = null; reposition = true; redraw = true; }); relayout = false; } } if (reroute) { if (graphTask == null) { UpdateNodes(); graphTask = Task.Run(() => LayoutHelpers.RouteAndLabelEdges(graph, settings, graph.Edges)); Forget(graphTask, () => { graphTask = null; redraw = true; }); reroute = false; } } }
/// <summary> /// The actual layout process /// </summary> protected override void RunInternal() { var openedClusters = modifiedNodes.OfType <Cluster>().Where(cl => !cl.IsCollapsed).ToArray(); if (openedClusters.Length > 0) { new InitialLayoutByCluster(graph, openedClusters, clusterSettings).Run(); } Visit(graph.RootCluster); // routing edges that cross cluster boundaries InitialLayoutByCluster.RouteParentEdges(graph, clusterSettings(graph.RootCluster).EdgeRoutingSettings); LayoutHelpers.RouteAndLabelEdges(graph, clusterSettings(graph.RootCluster), graph.Edges.Where(BetweenClusterOnTheRightLevel)); graph.UpdateBoundingBox(); ProgressComplete(); }