diff --git a/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Layout/SplineRouting/EdgeRouter.cs b/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Layout/SplineRouting/EdgeRouter.cs index 9cec3b0919..4215983829 100644 --- a/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Layout/SplineRouting/EdgeRouter.cs +++ b/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Layout/SplineRouting/EdgeRouter.cs @@ -16,9 +16,13 @@ namespace Debugger.AddIn.Visualizers.Graph.SplineRouting { } - public Dictionary RouteEdges(IEnumerable nodes, IEnumerable edges) where TEdge : class, IEdge + /// + /// Calculates routes for edges in a graph, so that they avoid nodes. + /// + public Dictionary RouteEdges(IEnumerable nodes, IEnumerable edges) + where TEdge : class, IEdge { - var routeGraph = RouteGraph.InitializeVertices(nodes, edges); + var routeGraph = RouteGraph.InitializeVertices(nodes, edges, 0, 0); var routedEdges = new Dictionary(); var occludedEdges = new List(); foreach (var edge in edges) { diff --git a/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Layout/SplineRouting/RouteGraph/RouteGraph.cs b/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Layout/SplineRouting/RouteGraph/RouteGraph.cs index 0166ecf0ed..007faed4fa 100644 --- a/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Layout/SplineRouting/RouteGraph/RouteGraph.cs +++ b/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Layout/SplineRouting/RouteGraph/RouteGraph.cs @@ -34,14 +34,21 @@ namespace Debugger.AddIn.Visualizers.Graph.SplineRouting pathFinder = new DijkstraShortestPathFinder(this); } - public static RouteGraph InitializeVertices(IEnumerable nodes, IEnumerable edges) + /// + /// Initializes the RouteGraph by vertices close to node corners. + /// + /// X coordinates of vertices cannot be lower than this value (so that edges stay in boundaries). + /// Y coordinates of vertices cannot be lower than this value (so that edges stay in boundaries). + public static RouteGraph InitializeVertices(IEnumerable nodes, IEnumerable edges, int boundX, int boundY) { var graph = new RouteGraph(); // add vertices for node corners foreach (var node in nodes) { graph.Boxes.Add(node); foreach (var vertex in GetRectCorners(node, boxPadding)) { - graph.Vertices.Add(vertex); + if (vertex.X >= boundX && vertex.Y >= boundY) { + graph.Vertices.Add(vertex); + } } } // add vertices for egde endpoints