Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Controlling cascading link route (Read 2327 times)
adavis
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 9
Joined: May 6th, 2009
Controlling cascading link route
Jun 11th, 2009 at 6:34pm
Print Post  
Hi everyone. I'm experimenting with an application to graphically display the parse tree of a script file, and I'm having some issues getting cascading links to consistently go down and then across, as illustrated here:



Originally, I just drew the links initially as single-segment polylines, then created a TreeLayout object (link style=cascading3), configured it and used the UpdateLink method to get the cascading links. This worked perfectly, but was too slow -- the real-world script files we'd be examining with this application can result in diagrams with up to 20,000 links or more, and iterating through all of those to update them added 50% or more to the processing time needed to draw the diagram.

So instead I thought I'd try to just draw the links in tree form when initially creating the diagram. I set the Diagram object's LinkStyle to Cascading and LinkSegments to 2, and manually set the anchoring on each node like so:

Code
Select All
AnchorPattern anchors = new AnchorPattern(new AnchorPoint[] {
                                            new AnchorPoint(0, 50, true, false),
                                            new AnchorPoint(Math.Min((DELTA_X / 2) / lNode.Bounds.Width * 100, 85), 100, false, true),
                                            new AnchorPoint(100, 50, false, true)
                                                            }
                                                     ); 



And this is what gets me the behavior illustrated in the screenshot above. It seems to be related to the size of the node at the source of the link, as I've been able to reproduce it by shortening nodes (for example, the when I edited the script to change the "else" in the screenshot above to just "e", the link under that node also routed incorrectly).

Is there anything I can do to get these links to route consistently without having to use TreeLayout.UpdateLink() after creating the link?
  
Back to top
 
IP Logged
 
adavis
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 9
Joined: May 6th, 2009
Re: Controlling cascading link route
Reply #1 - Jun 11th, 2009 at 8:04pm
Print Post  
After experimenting a little more I've found that this also seems to depend on the amount of vertical spacing between the source and destination nodes.  Normally I have a vertical distance of 15 units between 'rows' in the tree, and when I reduced this to 10, the link routing issue occurred in many more places.  Then, when I increased the vertical spacing to 19 units, the badly-routed link in the screenshot above routed correctly.

Is it something to do with whether the horizontal segment of the link is longer than the vertical segment?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Controlling cascading link route
Reply #2 - Jun 11th, 2009 at 8:07pm
Print Post  
I think the links start with a horizal segment if the horizontal distance between the nodes is greater than the vertical distance. You could try forcing the links to start vertical by setting CascadeOrientation to Vertical. You could also use the methods from this post to set the exact link points:
http://mindfusion.eu/Forum/YaBB.pl?board=wpfdg_disc;action=display;num=123843592...

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
adavis
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 9
Joined: May 6th, 2009
Re: Controlling cascading link route
Reply #3 - Jun 12th, 2009 at 1:13pm
Print Post  
Thanks!  8)  Setting Diagram.LinkCascadeOrientation to Vertical worked perfectly.  Somehow I missed that property completely when I was looking through the list before.   Embarrassed
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint