Links looping round nodes

Hi, I'm using orthogonal links, with AvoidsNodes=true. GoDiagram 2.2.1. My nodes inherit from GoGeneralNode, My links inherit from GoLink and have GoStrokeStyle.RoundedLineWithJumpOvers, Curviness=0. (but the problem also occured in 2.1.2 using GoStrokeStyle.Line) After I move a node, I sometimes end up with lines taking the long way round, like this:

or this:

If I then redraw the whole diagram (from my model) using the same node positions, the lines are OK. This suggests that the nodes are not too close together. It shows that the GoDiagram line drawing algorithm can draw a reasonable line with the nodes this close together.


The problem occurs only if I have AvoidsNodes = true, but I don’t really want to turn that off.
Because the lines are OK when I redraw the whole diagram, I tried forcing the affected links (the ones connected to any node that is moved) to redraw:
link.AdjustingStyle = GoLinkAdjustingStyle.Calculate;
link.CalculateStroke();
link.InvalidateViews();
but this did not solve the problem.
Any suggestions?
Pete

I (and other readers) are not able to see the screenshots that you have stored on your machine–you needed to publish them on some web site.
Not knowing exactly what the problem is, could you override GoDocument.GetAvoidableRectangle to adjust the behavior?

I guess a file upload for the images would be more useful !

I have 2 nodes quite close to each other. When I move a node, and have AvoidsNodes=true, the link between the nodes sometimes turns away from the destination node, detours right round the source node, and finally arrives at the destination.
But, this only happens when I move one of the nodes. When I programatically create the nodes and the link (in the same final locations as above), the link goes the shortest route from the source node to the destination node, without detouring round either node.
I will try overriding GetAvoidableRectangle but the links are OK when the nodes are positioned programatically.

If the nodes are close to each other, the “Avoids Nodes” algorithm must be thinking that they are too close, so it reroutes all the way around.
The default behavior of GoLink.CalculateStroke does what you see at first; until the link and its connected nodes are part of the document, the “Avoids Nodes” functionality used by CalculateStroke can’t operate.
Then when the user moves the node around, obviously the link and the nodes are part of the document, so CalculateStroke can take the “Avoids Nodes” functionality into account.
Anyway, making the “avoidable rectangle” smaller should reduce the chance that “Avoids Nodes” thinks there isn’t enough room between two nodes.

Some of my node labels were wider than the node icons, so Overriding GetAvoidableRectangle to return a rectangle using the width of the nodes icon and the height of the whole node worked nicely. Thanks !