diff --git a/core/src/main/java/com/graphhopper/routing/Router.java b/core/src/main/java/com/graphhopper/routing/Router.java index 204eb668f5e..b7ea9f340d3 100644 --- a/core/src/main/java/com/graphhopper/routing/Router.java +++ b/core/src/main/java/com/graphhopper/routing/Router.java @@ -49,11 +49,11 @@ import java.util.*; -import static com.graphhopper.util.TurnCostsConfig.INFINITE_U_TURN_COSTS; import static com.graphhopper.util.DistanceCalcEarth.DIST_EARTH; import static com.graphhopper.util.Parameters.Algorithms.ALT_ROUTE; import static com.graphhopper.util.Parameters.Algorithms.ROUND_TRIP; import static com.graphhopper.util.Parameters.Routing.*; +import static com.graphhopper.util.TurnCostsConfig.INFINITE_U_TURN_COSTS; public class Router { protected final BaseGraph graph; @@ -103,6 +103,7 @@ public GHResponse route(GHRequest request) { checkPointHints(request); checkCurbsides(request); checkNoBlockArea(request); + checkCustomModel(request); Solver solver = createSolver(request); solver.checkRequest(); @@ -180,6 +181,11 @@ private void checkNoBlockArea(GHRequest request) { throw new IllegalArgumentException("The `block_area` parameter is no longer supported. Use a custom model with `areas` instead."); } + private void checkCustomModel(GHRequest request) { + if (request.getCustomModel() != null && request.getCustomModel().isInternal()) + throw new IllegalArgumentException("CustomModel of query cannot be internal"); + } + protected Solver createSolver(GHRequest request) { final boolean disableCH = getDisableCH(request.getHints()); final boolean disableLM = getDisableLM(request.getHints()); diff --git a/core/src/main/java/com/graphhopper/routing/weighting/custom/FindMinMax.java b/core/src/main/java/com/graphhopper/routing/weighting/custom/FindMinMax.java index 06b8245ba0a..6d4ffb520c0 100644 --- a/core/src/main/java/com/graphhopper/routing/weighting/custom/FindMinMax.java +++ b/core/src/main/java/com/graphhopper/routing/weighting/custom/FindMinMax.java @@ -35,8 +35,6 @@ public class FindMinMax { * is based on baseModel). */ public static void checkLMConstraints(CustomModel baseModel, CustomModel queryModel, EncodedValueLookup lookup) { - if (queryModel.isInternal()) - throw new IllegalArgumentException("CustomModel of query cannot be internal"); if (queryModel.getDistanceInfluence() != null) { double bmDI = baseModel.getDistanceInfluence() == null ? 0 : baseModel.getDistanceInfluence(); if (queryModel.getDistanceInfluence() < bmDI)