Last few problems inside 2of 2 :¬)

Hi again
Last problem i can think if at the moment is to do with AutoLayout Usage
Out of the box I used the Auto layout() as below
void buttonItem_auto_layout_Activate(System::Object * sender, System::EventArgs * e)
{
GoLayoutLayeredDigraph *l=new GoLayoutLayeredDigraph();
l->Document=goView1->Document;
l->DirectionOption=Northwoods::Go::Layout::GoLayoutDirect ion::Down;
goView1->StartTransaction();
l->PerformLayout();
goView1->FinishTransaction(“Automatic Layout”);
}
Although this does produce a top down flow as desired its mostly gibberish
links overwrite themseves and links go over the top of Text Nodes
Also the links dont obey the roundwithjumps or avoidnodes prototype i set up in previous post
http://www.nwoods.com/forum/forum_posts.asp?TID=937&PN=1

Thanks again
Mac

Are all of the links connected to either the TopPort or the BottomPort of your GoTextNodes?

Hi Walter :¬)
I have a construtor function that creates many types of GoTextNode depending on an integer type passed in
most of the types are emulating the types found in the flow diagram c# example - i copied and converted them to c++ keeping their port usage etc
The other type is that composite image/text one and that only has top bottom
They all have various port configurations some have 1 some 2 some 3 some 4 ports
Some have ValidPortTo and ValidPortFrom tweaked as well
Since the fix for 1/2 looks better but still weird after 1 press of the autolayout button it looks like image2.jpg link below
http://www.nwoods.com/forum/uploads/938_Image2.jpg
after another press of the autolayout and it goes wrong in the left bottom corner of the input node, as in link below
http://www.nwoods.com/forum/uploads/938_Image3.jpg
I have had it never find a stable autolayout as well where continual pressing of the autolayout button causes it to grow and corrupt
Thanks :)
Mac

I thik i might have edited this post whilst you was reading it sorry :¬(

Sorry if this seems like a duplicate question but i tried and failed to get this performlayout() to work for me and I must bedoing something wrong :¬(
I used this code
void buttonItem_auto_layout_Activate(System::Object * sender, System::EventArgs * e)
{
GoLayoutLayeredDigraph *l=new GoLayoutLayeredDigraph();
l->Document=goView1->Document;
l->Network=NULL;
l->DirectionOption=Northwoods::Go::Layout::GoLayoutDirect ion::Down;
goView1->StartTransaction();
l->PerformLayout();
goView1->FinishTransaction(“Automatic Layout”);
}
And made this simple graph
http://www.nwoods.com/forum/uploads/938_Image4.jpg
After activating the functio above i get this
http://www.nwoods.com/forum/uploads/938_Image5.jpg
If i keep activating the function epending on the initial layout it cangrow in width and the links can get twited and corruped
This is my last major problem and have nearly convinced people we should buy this soon
Any ideas ?
Thanks for all the help
p.s. sorry about using my own web as a link i cant understand how to upload images :¬(
Mac

Looks like the layered digraph autolayout can’t handle those sideways connections
I assume all the links are Orthogonal. You could try setting AvoidsNodes to true as well. Then after the PerformLayout(), try iterating over all of the links and call GoLink.CalculateStroke() on each one.

Do you think this “cant handle sideways connections” is a bug in the layout system ?
So i am already using AvoidNodes
The initialisation code for new links is this
goView1->NewLinkClass=__typeof(GoLabeledLink);
goView1->NewGoLabeledLink->Orthogonal=true;
goView1->NewGoLabeledLink->ToArrow=true;
goView1->NewGoLabeledLink->Style=GoStrokeStyle::Rounde dLineWithJumpOvers;
goView1->NewGoLabeledLink->AvoidsNodes=true;
goView1->PortGravity=30;

I will try to manualy loop over all links and call GoLink->CalculateStroke() but it seems to me that this should be part of a PerformLayout() as it is realy a layout feature.
Brb :¬)
Thanks

Hi Walter :¬)
As expected your suggestion fixes the problem as seen in
http://www.nwoods.com/forum/uploads/938_Image6.jpg
but i must be doing something wrong to have to itterate over all my links like this or maybe a small buggly :¬)
The funtion now looks like this for example sake
void buttonItem_auto_layout_Activate(System::Object * sender, System::EventArgs * e)
{
GoLayoutLayeredDigraph *l=new GoLayoutLayeredDigraph();
l->Document=goView1->Document;
l->Network=NULL;
l->DirectionOption=Northwoods::Go::Layout::GoLayoutDirect ion::Down;
goView1->StartTransaction();
l->PerformLayout();
GoLayerCollectionObjectEnumerator thePain=goView1->Document->GetEnumerator();
GoLayerCollectionObjectEnumerator *theChildren=&thePain;
while(theChildren->MoveNext()){
GoLabeledLink *n=NULL;
try{n=__try_cast<GoLabeledLink *>(theChildren->Current);}
catch(System::InvalidCastException *){continue;}
if(n==NULL)continue;
if(n->GetType()==__typeof(GoLabeledLink)){
n->CalculateStroke();
}
}
goView1->FinishTransaction(“Automatic Layout”);
}

Any ideas?
Mac

PerformLayout should not do that automatically, because CalculateStroke would remove potentially useful routing information provided by the layout algorithm.

Thanks
So… is what i have done then is a valid piece of code not a workround?
I was kind of expecting performLayout to produce this kind of result with out me doing the CalculateStroke

hi walter
Sorry ask again but am I supposed to call CalculateStroke on all my links after every call to PerformLayout? or am i doing something wrong.
mac

Only if you need to for getting the results you want.

thank you :)
i now know im not doing bad coding