This is a migrated thread and some comments may be shown as answers.

Orthogonal routing service

1 Answer 60 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
Kevin
Top achievements
Rank 1
Kevin asked on 10 Dec 2014, 05:34 AM
I was wondering if anyone has ever created a custom router that acts much like schematic capture programs where the connections are all at right angles.  If you look at the youtube video (link is below) starting at 4m28s you can see how this works.  How would I go about creating an orthogonal routing service like this?  What I have done so far is below, which creates two points in the middle of the connection to allow this to sort of work, but it does not handle anything complex such as going around different shapes and adding additional points when needed.  Any thoughts?

public class OrthogonalRouter : IRouter
    {
        public System.Collections.Generic.IList<Point> GetRoutePoints(IConnection connection, bool showLastLine)
        {
            List<Point> pointList = new List<Point>();
            Point start = connection.StartPoint;
            Point end = connection.EndPoint;
 
            pointList.Add(new Point(start.X + (end.X - start.X) / 2, start.Y));
            pointList.Add(new Point(start.X + (end.X - start.X) / 2, end.Y));
 
            return pointList;
        }
    }


http://youtu.be/JutQuq1vFYY?t=4m28s

1 Answer, 1 is accepted

Sort by
0
Kevin
Top achievements
Rank 1
answered on 10 Dec 2014, 05:45 AM
Sorry, please delete this post.  I received an error when I posted it and thought it was gone.  I since posted the same topic.
Tags
Diagram
Asked by
Kevin
Top achievements
Rank 1
Answers by
Kevin
Top achievements
Rank 1
Share this question
or