Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Link issues (Read 3635 times)
yrauma
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 61
Joined: Mar 28th, 2010
Link issues
Nov 22nd, 2010 at 11:24pm
Print Post  
Hello Stoyan.

I have an issue with DiagramLinks that I can solve by myself.

I have a way to save my diagramLayout which is a class containing all my node's positions.
I use that to restore my graph when I restart my application.

I can also rearrange my diagram using a LayeredLayout where I can even set orientations.

Here is my probleme : If I do a rearrange with this layout for my whole graph, then backup my layout then close my application.

When I restart my application I reorganise my graph using my layout with SetBounds and Move function on each type of node.  But after all this is done, my graph is correct but not my links. Their anchor is not as the same place as they used to be.
It seems that the only way for me to have correct links is to rearrange all my diagram.

Is there a way to bypass that and have my links correctly placed such as in a ApplyLayout operation ?

I tried Diagram.RouteLinks() but the result is no way near what Im expecting.

How can I fix this issue ?

Amaury
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Link issues
Reply #1 - Nov 23rd, 2010 at 7:13am
Print Post  
Hi Amaury,

LayeredLayout places the link points at some specific positions that depend on the layers and cannot be recreated by the auto-routing. So apart from the node rectangles, you will also have to save and restore the links' ControlPoints collections. Restoring them should look like this:

Code
Select All
link.ControlPoints.Clear();
link.ControlPoints.AddRange(myPoints);
link.UpdateFromPoints(false, true); 



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


I love YaBB 1G - SP1!

Posts: 61
Joined: Mar 28th, 2010
Re: Link issues
Reply #2 - Nov 23rd, 2010 at 4:14pm
Print Post  
Thanks stoyan.

Can I just Save the Diagram.Links linkCollection
and to restore it, clear the current and restore with the old one.
Is it doable  ?

Also another question while you are here Cheesy
How hard is it to create my own layout ? Im not happy with the behavior of the layered, specially with containers.....
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Link issues
Reply #3 - Nov 23rd, 2010 at 4:31pm
Print Post  
Hi Amaury,

If you just need to store it in another object, you could Clone() the original collection an keep the copy. If you need to save it in a file, you could use the *PointCollection methods in XmlPersistContext.

What's wrong with LayeredLayout? Creating a custom one is not easy.

Stoyan
  
Back to top
 
IP Logged
 
yrauma
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 61
Joined: Mar 28th, 2010
Re: Link issues
Reply #4 - Nov 23rd, 2010 at 7:02pm
Print Post  
My issue is with containers into containers, the behavior does not make any sense. I use the layout inside my containers then for the whole graph and its
nevers does any good for a complex graph.

Do you think there is something I missed ?

Thanks for the help on the links. Im gonna try this.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Link issues
Reply #5 - Nov 24th, 2010 at 7:42am
Print Post  
Are you using this code?
http://mindfusion.eu/Forum/YaBB.pl?board=fcnet_disc;action=display;num=127351559...

It was designed for a single level of containers, it won't work for containers within parent containers.
  
Back to top
 
IP Logged
 
yrauma
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 61
Joined: Mar 28th, 2010
Re: Link issues
Reply #6 - Nov 24th, 2010 at 2:38pm
Print Post  
Yes I am !

Oups !

I am using it with layered layout for both inside and outside organization.

So what should I use ? Is it possible to do what I want ? Maybe just using this recursively might work you think ?

Thanks Stoyan !

By the way I finally fixed my link issue : I dynamically set the AnchorPattern of my nodes and set
layout.Anchoring = Anchoring.Keep; on my layout.
It does the job !

Amaury
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Link issues
Reply #7 - Nov 24th, 2010 at 6:18pm
Print Post  
I suppose it should be possible to do that recursively. E.g. modify the custom Arrange method to take a DiagramItemCollection, loop over the items and call Arrange recursively for each container, and finally call layout.Arrange(items) before returning from the current Arrange. Also layering might not work that well if containers vary much in size, so perhaps you should try another layout object as outerLayout, such as AnnealLayout or SpringLayout.

Stoyan
  
Back to top
 
IP Logged
 
yrauma
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 61
Joined: Mar 28th, 2010
Re: Link issues
Reply #8 - Nov 24th, 2010 at 6:25pm
Print Post  
The issue with these layouts is that they are way too slow for our application and does not represent the layout we want to offer to our clients.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint