Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 10 Replies) Link route algorithm and anchor patterns (Read 4544 times)
Anna Malashkina
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 26
Joined: Sep 22nd, 2019
Link route algorithm and anchor patterns
Jan 15th, 2020 at 9:42am
Print Post  
Hi all,

I have found that link route algorithm ignores anchor patterns (such as leftInRightOut etc). Could you please implement this?
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3152
Joined: Oct 19th, 2005
Re: Link route algorithm and anchor patterns
Reply #1 - Jan 15th, 2020 at 6:20pm
Print Post  
Hi,

It seems to work well enough in the Anchors.html example. The link router keeps positions of link end points and only routes intermediate segments. Do you expect it to also select different anchor points from the pattern?

Regards,
Slavcho
  
Back to top
 
IP Logged
 
Anna Malashkina
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 26
Joined: Sep 22nd, 2019
Re: Link route algorithm and anchor patterns
Reply #2 - Jan 16th, 2020 at 9:37am
Print Post  
I expect that if I choose "leftInRightOut", I will have links coming from left (not from bottom) and outgoing from right (not from top), please see the picture.

I looked into the source code of the routing algorithm and found that in my case it choose "top" and "bottom" as the nearest sides. I suppose they should be "right" and "left" always basing on my anchor pattern.
  

ports.png ( 2 KB | 167 Downloads )
ports.png
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3152
Joined: Oct 19th, 2005
Re: Link route algorithm and anchor patterns
Reply #3 - Jan 16th, 2020 at 9:49am
Print Post  
Are you setting AnchorPattern after creating the links? This is not realigning link end points automatically, and the link router will keep the initial end point positions. You could call link.originConnection.chooseBestAnchorPoint(point) and link.destinationConnection.chooseBestAnchorPoint(point) methods after changing AnchorPattern to realign the points.

Also are you using the default Router class or GridRouter?
  
Back to top
 
IP Logged
 
Anna Malashkina
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 26
Joined: Sep 22nd, 2019
Re: Link route algorithm and anchor patterns
Reply #4 - Jan 16th, 2020 at 2:34pm
Print Post  
I'm setting AnchorPattern before creating the links. And as far as I understand the points located in the corners of nodes are suitable for different patterns (and for leftInRightOut as well). The issue is that links should go not from up and from down but from left and from right, please see the picture attached as an example.

I use default Router. Should I move to the GridRouter?
  

ports2.png ( 2 KB | 158 Downloads )
ports2.png
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3152
Joined: Oct 19th, 2005
Re: Link route algorithm and anchor patterns
Reply #5 - Jan 17th, 2020 at 10:20am
Print Post  
So you mean end points are at correct positions, but not orientation of link segments ? I guess changing to GridRouter might help, try setting diagram.router = new GridRouter(diagram) to check. Please attach or email us a saved diagram with which you get wrong results.
  
Back to top
 
IP Logged
 
Anna Malashkina
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 26
Joined: Sep 22nd, 2019
Re: Link route algorithm and anchor patterns
Reply #6 - Jan 24th, 2020 at 1:14pm
Print Post  
I sent the diagram about a week ago, have you received it?

Yes, the orientation is wrong here. And GridRouter did not help.
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3152
Joined: Oct 19th, 2005
Re: Link route algorithm and anchor patterns
Reply #7 - Jan 27th, 2020 at 8:41am
Print Post  
Sorry we've missed that, but found the email now. The image seems to show the result of layered layout, and then followed by call to routing methods? Check if it works better for you if you set layout.anchoring to Keep or Reassign, and run the layout while nodes' AnchorPattern is set. Otherwise we don't have a good criteria to choose first segment's orientation when router sees link end point exactly at node's corner (placed there by the layout class). We could add some property for preferred orientation, and then you'd be able to set it in sync with layout's orientation if you prefer layout to ignore anchor points.

Regards,
Slavcho
  
Back to top
 
IP Logged
 
Anna Malashkina
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 26
Joined: Sep 22nd, 2019
Re: Link route algorithm and anchor patterns
Reply #8 - Mar 10th, 2020 at 9:57am
Print Post  
Yes, the preferred orientation would be great! Could you please add the property?
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3152
Joined: Oct 19th, 2005
Re: Link route algorithm and anchor patterns
Reply #9 - Mar 11th, 2020 at 10:52am
Print Post  
Hi Anna,

We'll have it in mind for upcoming release.

Regards,
Slavcho
  
Back to top
 
IP Logged
 
Anna Malashkina
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 26
Joined: Sep 22nd, 2019
Re: Link route algorithm and anchor patterns
Reply #10 - May 13th, 2020 at 1:28pm
Print Post  
Hi!,

did not you have a chance to add the preferable orientation?
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3152
Joined: Oct 19th, 2005
Re: Link route algorithm and anchor patterns
Reply #11 - May 14th, 2020 at 6:46am
Print Post  
Hi,

We've added preferredOrientation flag to the default Router class, find a build on PM page. Our test case is -

Code
Select All
function testCornerRouting(diagram)
{
	diagram.setDefaultShape("Rectangle");
	var node1 = diagram.getFactory().createShapeNode(10, 60, 20, 20);
	var node2 = diagram.getFactory().createShapeNode(60, 10, 20, 20);
	diagram.getFactory().createDiagramLink(node1, node2);
	diagram.getLinkRouter().preferredOrientation = MindFusion.Diagramming.Orientation.Horizontal;
	diagram.routeAllLinks();
} 



Without setting the flag (default is Auto value) the link will have segments in different directions after routing, otherwise they should be oriented according to the flag.

That should help for links that start / end near node's corner. If you have some very tall layers in the horizontal layout, you might still end up with link that connect to top or bottom sides. If you need to enforce connections only on left/right sides, try using anchor points or something like the DistributeVertically method here -
https://mindfusion.eu/Forum/YaBB.pl?num=1302946461/1#1

Regards,
Slavcho
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint