Set<Shape> GetObstaclesFromPassport(Set<Shape> passport) { if (passport.Count == 0) return new Set<Shape>(root.Children); var commonAncestors = GetCommonAncestorsAbovePassport(passport); var allAncestors = GetAllAncestors(passport); var ret = new Set<Shape>(passport.SelectMany(p => p.Children.Where(child => !allAncestors.Contains(child)))); var enqueued = new Set<Shape>(passport.Concat(ret)); var queue = new Queue<Shape>(); foreach (var shape in passport.Where(shape => !commonAncestors.Contains(shape))) queue.Enqueue(shape); while (queue.Count > 0) { var a = queue.Dequeue(); foreach (var parent in a.Parents) { foreach (var sibling in parent.Children) if (!allAncestors.Contains(sibling)) ret.Insert(sibling); if (!commonAncestors.Contains(parent) && !enqueued.Contains(parent)) { queue.Enqueue(parent); enqueued.Insert(parent); } } } return ret; }
void RouteMultiEdges(List<Edge[]> multiEdges, InteractiveEdgeRouter interactiveEdgeRouter, Set<Shape> parents) { var mer = new MultiEdgeRouter(multiEdges, interactiveEdgeRouter, parents.SelectMany(p => p.Children).Select(s => s.BoundaryCurve), new BundlingSettings { InkImportance = 0.00001, EdgeSeparation = MultiEdgesSeparation}, MakeTransparentShapesOfEdgeGeometryAndGetTheShapes); //giving more importance to ink might produce weird routings with huge detours, maybe 0 is the best value here mer.Run(); }