Skip to content

Commit

Permalink
bug fix for graphhopper#2716
Browse files Browse the repository at this point in the history
  • Loading branch information
karussell authored and Jean-Baptiste Rabin committed Mar 21, 2023
1 parent 48a221d commit ddffa62
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Expand Up @@ -23,11 +23,12 @@ public class FindMinMax {
public static void checkLMConstraints(CustomModel baseModel, CustomModel queryModel, EncodedValueLookup lookup) {
if (queryModel.isInternal())
throw new IllegalArgumentException("CustomModel of query cannot be internal");
double qmDI = queryModel.getDistanceInfluence() == null ? 0 : queryModel.getDistanceInfluence();
double bmDI = baseModel.getDistanceInfluence() == null ? 0 : baseModel.getDistanceInfluence();
if (qmDI < bmDI)
throw new IllegalArgumentException("CustomModel in query can only use " +
"distance_influence bigger or equal to " + bmDI + ", but was: " + qmDI);
if (queryModel.getDistanceInfluence() != null) {
double bmDI = baseModel.getDistanceInfluence() == null ? 0 : baseModel.getDistanceInfluence();
if (queryModel.getDistanceInfluence() < bmDI)
throw new IllegalArgumentException("CustomModel in query can only use distance_influence bigger or equal to "
+ bmDI + ", but was: " + queryModel.getDistanceInfluence());
}

checkMultiplyValue(queryModel.getPriority(), lookup);
checkMultiplyValue(queryModel.getSpeed(), lookup);
Expand Down
Expand Up @@ -59,8 +59,7 @@ private static GraphHopperServerConfiguration createConfig() {
putObject("import.osm.ignored_highways", "").
putObject("graph.encoded_values", "surface").
setProfiles(Arrays.asList(
// give strange profile names to ensure that we do not mix vehicle and profile:
new CustomProfile("car_custom").setCustomModel(new CustomModel()).setVehicle("car"),
new CustomProfile("car_custom").setCustomModel(new CustomModel().setDistanceInfluence(15d)).setVehicle("car"),
new Profile("foot_profile").setVehicle("foot").setWeighting("fastest"),
new CustomProfile("foot_custom").setCustomModel(new CustomModel()).setVehicle("foot"))).
setLMProfiles(Arrays.asList(new LMProfile("car_custom"), new LMProfile("foot_custom")));
Expand Down

0 comments on commit ddffa62

Please sign in to comment.