private void RelocateGraph() { Children.Clear(); if (VerticesLocator == null) { return; } VerticesLocator.Locate(); nodes = VerticesLocator.Nodes.Select(n => new NodeView(n.Number, Graph[n.Number]) { Center = new Point(n.Location.X, n.Location.Y) }).ToList(); arrows = new List <ArrowView>(Graph.ArrowsCount); for (var i = 0; i < nodes.Count; i++) { SetZIndex(nodes[i], 10); foreach (var connection in Graph.GetNeighbours(i)) { var line = new ArrowView(nodes[i], nodes[connection]); Children.Add(line); nodes[i].Arrows.Add(line); nodes[connection].Arrows.Add(line); arrows.Add(line); } Children.Add(nodes[i]); } }
private void ArrangeArrow(ArrowView arrowView, Size arrangeSize) { var startArrowPoint = CalcShiftFor(arrowView.StartNode.Center); var endArrowPoint = CalcShiftFor(arrowView.EndNode.Center); arrowView.SetCanvasParameters(startArrowPoint, endArrowPoint, verticesScale); arrowView.Arrange(new Rect(new Point(), arrangeSize)); }