Unexpected results using GoLayoutLayeredDigraph

Hi Guys,

I have this very simple layout made by GoLayoutLayeredDigraph engine:





Now, after collapsing the “IfElse4” node the “IfElse4” label moves to the middle right position while I expect it to be in the center.





Second problem: After inserting another node inside the “Yes” node (see pic):





When I collapse the “IfElse4” node I get strange behavior of the connecting links:





I have no hidden nodes or something special in my model.



Can you suggest anything to fix the issues. Are they related?



Thank you,

Adi Barda

GoLayoutLayeredDigraph isn’t going to change the position of the label “IfElse4”, so I suspect that may be an issue in your subgraph’s LayoutChildren.



The link issue… what sort of nodes/ports do you have here?

Hi Jake,

Most of the nodes are “MultiPortSubGraph” taken from the demo application with minor modifications.

which has this layout function:

public override void LayoutChildren(GoObject childchanged)

{

// implementations of LayoutChildren shouldn’t do anything when Initializing is true

if (this.Initializing) return;

base.LayoutChildren(childchanged);

// don’t call LayoutAllPorts when the child whose bounds were changed was a port

if (childchanged == null || !this.MultiPorts.Contains(childchanged))

LayoutAllPorts();

}







Plus, we have “CollapsingRecordNode” objects also taken from the demo apps.

which has this layout function:

public override void LayoutChildren(GoObject childchanged)

{

base.LayoutChildren(childchanged);

GoImage img = this.Image;

GoText lab = this.Label;

if (img != null && lab != null)

{

PointF p = lab.GetSpotLocation(MiddleLeft);

p.X -= 4; // space between image and label

img.SetSpotLocation(MiddleRight, p);

}



LayoutAllPorts();



}





The ports are “MultiPortSubGraphPort” again from the demo app.



hope it helps,

Adi

Well, in your last screenshot, I think the links from Start and to End are the way they are because Test Flow node isn’t centered. But the links in and out of IfElse4 look like the ports are mispositioned. And that would imply a missed call to LayoutChildren?? (one way to check would be to code a method that goes through your hierarchy and calls LayoutChildren on everything, then tie that to a temporary button so you can force a call to it… see if that “fixes” the display)

Thanks Jake,

I’ll check the call to LayoutChildren and see if it’s possible that it is not called in a given situation. Strange thing is that it doesn’t happen all the time. for example if the flow is empty:





and I collapse the “IfElse”:





It looks fine (except the label moving to the right but this is a minor issue…)

So, sometimes the LayoutChildern is called for the entire hierarchy and sometimes not… This I have to check…



Adi

if you “wiggle” a node when the appearance is wrong, do the links snap to the right location?