Orthogonal routing service

2 posts, 0 answers
  1. Kevin
    Kevin avatar
    13 posts
    Member since:
    Dec 2012

    Posted 09 Dec 2014 Link to this post

    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
  2. Kevin
    Kevin avatar
    13 posts
    Member since:
    Dec 2012

    Posted 09 Dec 2014 in reply to Kevin Link to this post

    Sorry, please delete this post.  I received an error when I posted it and thought it was gone.  I since posted the same topic.
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top