Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Link-Anchor behavior (Read 4592 times)
samuelt
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 7
Joined: Dec 23rd, 2010
Link-Anchor behavior
Jan 5th, 2011 at 4:24pm
Print Post  
Hi,

I would like to be able to glue a link to a node as a whole. The behaviors are as follows:

1. If I drop the link on the node, I would like it to link to the node as a whole.
2. Link is then drawn to the most efficient anchor.
3. If I move any of the node connected to the link, it automatically checks for the most reasonable connection point/anchor to connect to/from.

Note the following screenshots.
Any idea which demo or how to approach this in order to achieve this behavior?

Thanks.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Link-Anchor behavior
Reply #1 - Jan 5th, 2011 at 5:40pm
Print Post  
Hi,

Try these settings:

Code
Select All
diagram.RouteLinks = true;
diagram.RoutingOptions.Anchoring = Anchoring.Reassign;

private AnchorPattern anchorPoints = new AnchorPattern(new[]
{
	new AnchorPoint(50, 0),
	new AnchorPoint(100, 50),
	new AnchorPoint(50, 100),
	new AnchorPoint(0, 50)
});

private void OnNodeCreated(object sender, NodeEventArgs e)
{
	e.Node.AnchorPattern = anchorPoints;
}
 

  
Back to top
 
IP Logged
 
samuelt
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 7
Joined: Dec 23rd, 2010
Re: Link-Anchor behavior
Reply #2 - Jan 5th, 2011 at 7:27pm
Print Post  
Hi Stoyo,

Thanks for the prompt reply. I tried to implement your code on the sample FlowCharter and this is what I get.

It still does not change the connection point a.k.a anchor.

Thanks.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Link-Anchor behavior
Reply #3 - Jan 5th, 2011 at 7:57pm
Print Post  
Hi,

Adding just these two lines to the Window1 constructor in Flowcharter worked fine for me:

diagram.RouteLinks = true;
diagram.RoutingOptions.Anchoring = Anchoring.Reassign;

Have you changed anything else in the sample project?

Stoyan
  
Back to top
 
IP Logged
 
samuelt
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 7
Joined: Dec 23rd, 2010
Re: Link-Anchor behavior
Reply #4 - Jan 6th, 2011 at 6:06pm
Print Post  
Stoyan,

I haven't changed anything on the sample FlowCharter project except those 2 lines you mentioned.

Do you want me to send the code to you to check?
What's the expected behavior once you put those 2 lines in? What I'm currently seeing is the screenshot which I attached on the previous post.

Thanks.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Link-Anchor behavior
Reply #5 - Jan 6th, 2011 at 6:32pm
Print Post  
Please email it to support@mindfusion.eu. The expected behavior is that after moving nodes, the related links should reconnect to anchor points that would allow them to take shorter paths.

Stoyan
  
Back to top
 
IP Logged
 
samuelt
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 7
Joined: Dec 23rd, 2010
Re: Link-Anchor behavior
Reply #6 - Jan 6th, 2011 at 7:26pm
Print Post  
Stoyan,

I just sent it over.

Thanks.
  
Back to top
 
IP Logged
 
samuelt
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 7
Joined: Dec 23rd, 2010
Re: Link-Anchor behavior
Reply #7 - Jan 6th, 2011 at 8:46pm
Print Post  
Stoyan,

I added these lines and now it works like the sample "Routing":

Code
Select All
diagram.RoutingOptions.TriggerRerouting = RerouteLinks.WhileCreating | RerouteLinks.WhenModified;
diagram.LinkRouter = new GridRouter();

diagram.RoutingOptions.TurnCost = 18;
diagram.RoutingOptions.CrossingCost = 4;
diagram.RoutingOptions.LengthCost = 4;
diagram.RoutingOptions.NodeVicinityCost = 30;
diagram.RoutingOptions.NodeVicinitySize = 42;
 



I think it was missing the LinkRouter and rerouting trigger before.

Please let me know what you think.

Thanks.
Samuel
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Link-Anchor behavior
Reply #8 - Jan 7th, 2011 at 8:01am
Print Post  
Hi Samuel,

I think we have added support for Anchoring.Reassign to QuickRouter only recently, so you might be using an older version. Please try that with the latest version 2.5.

Even with an older version, you should be able to get the same functionality by doing something like this in the NodeModified or NodeModifying handler:

Code
Select All
var links = e.Node.GetAllLinks();
foreach (DiagramLink link in links)
	link.ReassignAnchorPoints();
diagram.LinkRouter.RouteLinks(links); 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint