public double FindVerticalRoutingSlotLeft(double right, double top, double bottom) { Rect r = new Rect(new Point(right - 10, Math.Min(top, bottom)), new Size(10, Math.Abs(bottom - top))); var p = _horizontallySortedBounds.UpperBound(r); while (p != null && p.Data.Right >= r.Left) { if (p.Data.Item.Bounds.IntersectsWith(r)) { r.X = p.Data.Left - 15; } p = p.Previous; } return(r.Right); }
public double FindHorizontalRoutingSlotTop(double bottom, double left, double right) { Rect r = new Rect(new Point(Math.Min(left, right), bottom - 10), new Size(Math.Abs(right - left), 10)); var lower = _verticallySortedBounds.UpperBound(r); var p = lower; while (p != null && p.Data.Bottom >= r.Top) { if (p.Data.Item.Bounds.IntersectsWith(r)) { r.Y = p.Data.Top - 30; // the height is 10 so we have to move up 15 } p = p.Previous; } return(r.Bottom); }