Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 10 Replies) Autoroute of links when nodes are repositioning (Read 6530 times)
rajesh_patil74
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 220
Joined: Sep 3rd, 2009
Autoroute of links when nodes are repositioning
Jan 12th, 2010 at 12:33pm
Print Post  
Hi Stoyo

When following code is used for generating a tree layout

var layout = new MindFusion.Diagramming.Silverlight.Layout.TreeLayout();
                   layout.LinkStyle = MindFusion.Diagramming.Silverlight.Layout.TreeLayoutLinkType.Cascading3 ;
layout.Arrange(diagram);

And there is a link (with 90' right angle) between two nodes and user tries to reposition one of the node the line moves along with mouse cursor.

In my code, I am using my custom code to position the nodes ( to group leaf nodes one under another) and links between the nodes.
The autoroute property of links is set to "True" so repositioning the nodes preseves the angle which is already there but the effect is shown once node is repositioned.

How I update the link when user is reposition the node.

Regards
Rajesh
  
Back to top
WWW  
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Autoroute of links when nodes are repositionin
Reply #1 - Jan 12th, 2010 at 12:38pm
Print Post  
Hi Rajesh,

Set your links Style to Cascading if the problem is that the link angle changes while a node is being dragged.

Stoyan
  
Back to top
 
IP Logged
 
rajesh_patil74
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 220
Joined: Sep 3rd, 2009
Re: Autoroute of links when nodes are repositionin
Reply #2 - Jan 12th, 2010 at 12:54pm
Print Post  
Hi Stoyo

Thanks. Its working by setting the line style.

To fix following issue do I need to set any additional property.



In above fig.
1. Orignal Diagram
2. When I am moving selected node and after moving.
3. When I am moving it displays the line moving from within a node.
4. When mouse is released line is completely changed.

Can't I have line as shown in fig. 4 when moving is in progress.

-Rajesh
  
Back to top
WWW  
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Autoroute of links when nodes are repositionin
Reply #3 - Jan 12th, 2010 at 12:57pm
Print Post  
Routing is done automatically only after the node is dropped. You might try calling link.Route for all links connected to a node in response to the NodeModifying event.

Stoyan
  
Back to top
 
IP Logged
 
rajesh_patil74
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 220
Joined: Sep 3rd, 2009
Re: Autoroute of links when nodes are repositionin
Reply #4 - Jan 12th, 2010 at 2:24pm
Print Post  
Hi Stoyo

Instead of setting Line style to "Cascading" , I called the link.Route() method and i get same effect similar to setting line style = "Cascading".

At some point, with mouse move operation I still get effect as shown in fig. 3.

I found that , link.Route() returns "False" when link is drawn as shown in fig 3. It doesn't matter whether the "AutoRoute" or LinkStyle property is set or not.

I guess, it needs some fix in the code.

Regards
Rajesh
  
Back to top
WWW  
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Autoroute of links when nodes are repositionin
Reply #5 - Jan 12th, 2010 at 2:30pm
Print Post  
Route() returns false if it can't find any path. Is there any other node in the background at the point where the result is false?
  
Back to top
 
IP Logged
 
rajesh_patil74
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 220
Joined: Sep 3rd, 2009
Re: Autoroute of links when nodes are repositionin
Reply #6 - Jan 12th, 2010 at 3:06pm
Print Post  
Hi Stoyo

It seem that I am moving the node out of diagram bounds and then it is not working.

Will check more and get back to you.

Thanks
-Rajesh
  
Back to top
WWW  
IP Logged
 
rajesh_patil74
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 220
Joined: Sep 3rd, 2009
Re: Autoroute of links when nodes are repositionin
Reply #7 - Jan 13th, 2010 at 6:07am
Print Post  
Hi Stoyo

Ya. Its true when I try to move the node outside the diagram bounds link.Route returns false.

But false value is retuned only if I try to move on left side of the diagram. Moving item on right side works property and Link.Route() returns true.

Please have a look in following image.


In this Image, in first 3 images one can move node anywhere and link routing works properly but in 4th image it fails when moved out side the diagram bounds. ( As you see moving outside the diagram bounds worked in second image).

I tried to change the bounds of image in node modified event and some times it works proeprly. But changing diagram bounds i have another problem like below -
Changing bounds of diagram shows scrollbar. To show the diagram centrally, I changed bounds in all directions. In this situation if user now tries to move the node in side the bounds I can't change the bounds again ( In this situation i need to consider position of other nodes) and scrollbar  can't be removed.

In the image, 2nd image is my original image and repositioning the nodes I gets images like 1,3 and 4th.

I guess, operation shown in 4th should work similar to image 2.

Regards
Rajesh
  
Back to top
WWW  
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Autoroute of links when nodes are repositionin
Reply #8 - Jan 13th, 2010 at 9:51am
Print Post  
Hi Rajesh,

Are you using the QuickRouter or GridRouter class for link routing?

Stoyan
  
Back to top
 
IP Logged
 
rajesh_patil74
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 220
Joined: Sep 3rd, 2009
Re: Autoroute of links when nodes are repositionin
Reply #9 - Jan 13th, 2010 at 11:58am
Print Post  
Hi Stoyo

I didn't specified any link routing explicitly. The default one is getting used.

I am also not using any specific layout. The node are positioned with explcit calculation.

-Rajesh
  
Back to top
WWW  
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Autoroute of links when nodes are repositionin
Reply #10 - Jan 13th, 2010 at 2:41pm
Print Post  
If you set RoutingOptions.Anchoring, the link's end point should move to the right in this case and it should find a path.

Otherwise we'll add some margin property that will extend the routing-map bounds, which is set to the union of diagram.Bounds and diagram.GetContentBounds() by default. Until that's available, you might add two hidden nodes to the left and top of the diagram's left/top sides. Then GetContentBounds() will return a larger rectangle with enough space for the route.

Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint