Problem with AvoidsNodes


#1

I’m using Go.NET 1.1 to generate graphs and am running into a problem with the AvoidsNodes property of links.
Most of the time it works fine but in some cases (depending on the specific graph being drawn) nodes are overdrawn by links. The “problem” links are not drawn with all horizontal or vertical segments, as you’d expect, but instead are drawn diagonally.
What’s interesting is that if the affected node(s) are moved (ie dragged) slightly, after the graph is drawn, the links are then re-drawn correctly (ie without overwriting the nodes, using all horizonal and vertical segments). Because of this I’m suspecting that the problem is due to an interaction between the default CalculateStroke() method of the nodes and the autolayout routine.
Some background info:

  • All nodes in the graph derive from GoNode
    - The GoLayoutLayeredDigraph style of autolayout is used to arrange the nodes.
    The code for drawing the links is:
    private void DrawEdge(GoPort FromPort, GoPort ToPort)
    {

    GoLink Link = new GoLink();

    Link.Orthogonal = true;
    Link.Style = GoStrokeStyle.Line;
    Link.AvoidsNodes = true;

    Link.Selectable = false;
    Link.Brush = Brushes.Gray;
    Link.FromPort = FromPort;
    Link.ToPort = ToPort;

    m_View.Document.Add(Link);
    }

    Any help or input on how to fix this problem is appreciated!
    Paul


#2

It’s likely this is a bug in how the layered-digraph autolayout “commits” its links. I know that code changed a while ago. (Thanks for mentioning which version you are using!)
Try out the 2.1 Release Candidate: [EDIT: kit is now obsolete]