Make Router extendable

It’s great that we have been able to extract the Router logic from GraphHopper.java. I just wanted to modify something for a custom project. Unfortunately, it seems that it’s not possible to easily modify the new RouterClass.

With PR #1923, we created a nice option to customize the RoutingTemplates. This doesn’t work anymore with the new Router. (Also the RoutingTemplates got pretty much impossible to extend since everything is static :slight_smile:, but that’s a different topic).

One thing that could be nice would be to create 3 protected functions within the Router.java. One for each routing option so to speak:

  • RoundTrip
  • AltRouting
  • Via

WDYT? Does this make sense? This could reduce bigger copying efforts :slight_smile:.

Do you mean we should split this big if/else block starting with

if (ROUND_TRIP.equalsIgnoreCase(request.getAlgorithm())) {

into three methods which we then make protected? Sure why not?

Yes that’s exactly what I meant. Ok, I will provide a PR for this :+1:.

For reference, this is the PR: https://github.com/graphhopper/graphhopper/pull/2100

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.