Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Layout Container Nodes (Read 3383 times)
mihai
Junior Member
**
Offline



Posts: 86
Joined: Jul 29th, 2009
Layout Container Nodes
Jul 29th, 2014 at 11:00am
Print Post  
Hi,

I'm having trouble with the auto-layout of ShapeNodes inside ContainerNodes. All I get is the nodes arranged in a horizontal row at the top of the diagram, outside the containers. I've tried the FlowchartLayout & OrthogonalLayout. By the way, the nodes are connected using links to custom anchor points.

If I recall correctly, this used to work in the past (when I used the WinForms version).

Any ideas what I might be missing?

Thanks,
-Mihai
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Layout Container Nodes
Reply #1 - Jul 29th, 2014 at 12:13pm
Print Post  
Hi,

Your old Windows Forms code should work without changes for these layout classes. It sounds as if you are now excluding the containers as in the OrthogonalRouter case?
http://mindfusion.eu/Forum/YaBB.pl?num=1406540021

You can find some code that arranges the child nodes of containers here:
http://mindfusion.eu/Forum/YaBB.pl?num=1273515591/1#1

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
mihai
Junior Member
**
Offline



Posts: 86
Joined: Jul 29th, 2009
Re: Layout Container Nodes
Reply #2 - Jul 29th, 2014 at 3:17pm
Print Post  
Hi Stoyan,

Thanks for the reply.

Quote:
It sounds as if you are now excluding the containers as in the OrthogonalRouter case?

Yes, that is correct.

Quote:
You can find some code that arranges the child nodes of containers here

Thanks. Part of the problem was that I didn't include the links in the list passed to the layout algorithm.

I'm almost there now, but still having an issue. I have many nodes that are connected in pairs. If I use the FlowchartLayout with the Orientation set to Horizontal, then the first pair has its notes in a row, which is what I want, roughly. However, the next pair is positioned at the right of the first pair, and I want it below it instead. Any ideas on how to achieve this? Technically, I could have more than just pairs, say even triplets, but I'd still like these to be laid out one below the other.

So not like this:

A -> B, C -> D, E -> F etc.

but like this:

A -> B
C -> D
E -> F
etc.

Can this be achieved? Maybe I should try a different layout algorithm? Should I perhaps group the nodes manually, and layout each group separately? I still need them in a big container though.

Thanks again,
-Mihai
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Layout Container Nodes
Reply #3 - Jul 29th, 2014 at 4:01pm
Print Post  
Hi Mihai,

Set the layout's MultipleGraphsPlacement property to Vertical to arrange the pairs in a column.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
mihai
Junior Member
**
Offline



Posts: 86
Joined: Jul 29th, 2009
Re: Layout Container Nodes
Reply #4 - Jul 29th, 2014 at 6:51pm
Print Post  
Hi Stoyan,

You're the man, thanks!
As a last bit, how do I make the nodes stay within the containers?

Thanks much,
-Mihai
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Layout Container Nodes
Reply #5 - Jul 29th, 2014 at 7:24pm
Print Post  
Hi Mihai,

If you won't be running an outer-layout as in the example, you could temporarily set diagram.Bounds = container.Bounds before calling Arrange to start arranging from a container's origin. This won't keep the arranged items within containers' width and height in the general case, you might still have to resize them after layout to make sure they fit the arranged children.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
mihai
Junior Member
**
Offline



Posts: 86
Joined: Jul 29th, 2009
Re: Layout Container Nodes
Reply #6 - Jul 30th, 2014 at 9:09am
Print Post  
Hi Stoyan,

Neat idea, but for some reason it didn't work for me. What I ended up doing is to move the nodes back into the container, after they have been arranged.

Thanks,
-Mihai
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint