Problem with connection class

Hi walter, i have got a problem which seems very odd to me. I create two nodes with a customized GoToolCreating. Then i set GoView.NewLinkClass to my link class (‘govMain.NewLinkClass = typeof(NetEdgeSankey);’, polygon around stroke as you might remember) and create a connection between the nodes. But somehow this new link is not “real”. It is not drawn correctly and e.g. can be erased if i drag the selction rectangle over the link. And sometimes an edge is cut of (horizontal or vertical). But when i move one of the nodes a bit, the link becomes “real” and always looks correct.

Do you have any idea, what might be wrong? I am quite sure that it occured a few days ago for the first time. And before that it was working about two month or so.

Sounds like the link’s Bounds are not right.
However, setting either the IGoLink.FromPort or .ToPort ought to be causing your polygon to be shaped as needed (presumably only when both ports are present), and thus its Bounds ought to be updated too.
And the right thing seems to actually be happening when either port is moved, so you already have the basic functionality you need.
So I’ll guess that you aren’t doing everything you need to do when either port is set.

Ok, i have done a few tests and the connection is created (and calculated) correctly if i call CalculateStroke manually in GoView.LinkCreated:
((NetEdgeSankey) e.GoObject).CalculateStroke();

The original link is created by GoToolLinkingNew (via GoView.NewLinkClass). Is there a better way to change GoToolLiningNew to call CalculateStroke (or what ever)? Or do you have any other suggestion?

But GoLink.CalculateStroke() is normally called when either the FromPort or the ToPort are set, as well as when either port’s Bounds changes. Is that not the case for your link class?

Uhh. You were right. In my link class i have not calculated the polygon until link.Initializing was false. After deleting the if statement, everything is working fine. I thought it was not necessary and

The same problem occured in my stress testing routine where i programmatically created 500 nodes and 500 edges with randomly inserted bending points (GoLabeledLink.InsertPoint). To calculate the exact starting point and ending point, i had to call CalculateStroke after inserting point. It was also necessary for calculating the polygon.

Thx again, walter :-)