Skip to content

Commit

Permalink
Allow weighting and edge_based parameters for now (remove after #1980)
Browse files Browse the repository at this point in the history
  • Loading branch information
easbar committed Apr 1, 2020
1 parent b27ced4 commit bbda427
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
10 changes: 6 additions & 4 deletions core/src/main/java/com/graphhopper/GraphHopper.java
Expand Up @@ -1020,12 +1020,14 @@ public List<Path> calcPaths(GHRequest request, GHResponse ghRsp) {
try {
if (!request.getVehicle().isEmpty())
throw new IllegalArgumentException("GHRequest may no longer contain a vehicle, use the profile parameter instead, see #1958");
if (!request.getWeighting().isEmpty())
throw new IllegalArgumentException("GHRequest may no longer contain a weighting, use the profile parameter instead, see #1958");
// todo: #1980, weighting should be also forbidden
// if (!request.getWeighting().isEmpty())
// throw new IllegalArgumentException("GHRequest may no longer contain a weighting, use the profile parameter instead, see #1958");
if (request.getHints().has(Routing.TURN_COSTS))
throw new IllegalArgumentException("GHRequest may no longer contain the turn_costs=true/false parameter, use the profile parameter instead, see #1958");
if (request.getHints().has(Routing.EDGE_BASED))
throw new IllegalArgumentException("GHRequest may no longer contain the edge_based=true/false parameter, use the profile parameter instead, see #1958");
// todo: #1980, edge based should also be forbidden
// if (request.getHints().has(Routing.EDGE_BASED))
// throw new IllegalArgumentException("GHRequest may no longer contain the edge_based=true/false parameter, use the profile parameter instead, see #1958");

// todo later: do not allow things like short_fastest.distance_factor or u_turn_costs unless CH is disabled and only under certain conditions for LM

Expand Down
Expand Up @@ -243,9 +243,10 @@ private void enableEdgeBasedIfThereAreCurbsides(List<String> curbsides, GHReques

private void removeLegacyParameters(GHRequest request) {
// these parameters should only be used to resolve the profile, but should not be passed to GraphHopper
request.getHints().setWeighting("");
// todo: #1980, these parameters should be removed as well?!
// request.getHints().setWeighting("");
request.getHints().setVehicle("");
request.getHints().remove("edge_based");
// request.getHints().remove("edge_based");
request.getHints().remove("turn_costs");
}

Expand Down

0 comments on commit bbda427

Please sign in to comment.