Ejemplo n.º 1
0
        static IEnumerable <Point> LeftRightLine(RoutingAssistent assist, Point start, Point end, double distance)
        {
            List <Point> linePoints = new List <Point>();

            if (start.X > end.X)
            {
                linePoints.Add(start);
                linePoints.Add(new Point {
                    X = start.X * distance + end.X * (1 - distance), Y = start.Y
                });
                linePoints.Add(new Point {
                    X = start.X * distance + end.X * (1 - distance), Y = end.Y
                });
                linePoints.Add(end);
            }
            else
            {
                {
                    var    middleX = (start.X + end.X) / 2;
                    double middleY;
                    if (start.Y > end.Y)
                    {
                        middleY = assist.FindHorizontalRoutingSlotBottom((start.Y + end.Y) / 2, start.X + MinimalDistance, end.X - MinimalDistance);
                    }
                    else
                    {
                        middleY = assist.FindHorizontalRoutingSlotTop((start.Y + end.Y) / 2, start.X + MinimalDistance, end.X - MinimalDistance);
                    }
                    linePoints.AddRange(LeftLeftLine(assist, start, new Point(middleX, middleY), 0.5));
                    linePoints.AddRange(RightRightLine(assist, new Point(middleX, middleY), end, 0.5));
                }
            }
            return(linePoints);
        }
Ejemplo n.º 2
0
        static IEnumerable <Point> TopTopLine(RoutingAssistent assist, Point start, Point end, double distance)
        {
            var minY  = Math.Min(start.Y, end.Y) - distance * NormalDistance;
            var minY2 = assist.FindHorizontalRoutingSlotTop(Math.Min(start.Y, end.Y) - MinimalDistance,
                                                            start.X, end.X);

            minY = Math.Min(minY, minY2);
            List <Point> linePoints = new List <Point>()
            {
                start,
                new Point {
                    X = start.X, Y = minY
                },
                new Point {
                    X = end.X, Y = minY
                },
                end,
            };

            return(linePoints);
        }