Modifying orthogonal link routing behaviour


#1

We need to change how JGo routes its links from the current method, which breaks the link away just after the source point like this:

to a method which breaks the link away at the target end instead, like this:

Is there an easy way to achieve this in the JGo platform? I’ve had a look at the routing source code, but it seems pretty complex.

We’d also like to retain the avoidance behaviour that routes around any other nodes too.

Thanks for any insight you can give.

Nathan.


#2
There no built-in option to achieve this. The method that determines link routing is JGoLink.calculateStroke. It is indeed a complex method, partly because it needs to be very general.
If you're only interested in orthogonal links, you can look at JGoLink.addOrthoPoints. This adds the stroke points between the two end segments in an orthogonal link. It's still complex, but link routing and avoiding nodes is a complex problem.

#3

In the meantime, I think I’ve managed to achieve this actually. I simply altered the JGoLink’s calculateStroke() method to artificially swap the start and end ports, and invert all the relevant methods (start->end and vice versa) and then reverse the link’s point order at the end to ensure consistency. Works like a charm.
If Northwoods (or anyone else) would like the specific code changes to support this reverse routing behaviour, let me know.