From d4a4da7e43d1b9fd165680968277cb6170bd821c Mon Sep 17 00:00:00 2001 From: afischerdev Date: Tue, 25 Feb 2025 10:04:03 +0100 Subject: [PATCH] enable dynamic range for all --- .../src/main/java/btools/router/RoutingContext.java | 8 +++++--- .../src/main/java/btools/router/RoutingEngine.java | 6 ++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/brouter-core/src/main/java/btools/router/RoutingContext.java b/brouter-core/src/main/java/btools/router/RoutingContext.java index 2559f3a..718dd04 100644 --- a/brouter-core/src/main/java/btools/router/RoutingContext.java +++ b/brouter-core/src/main/java/btools/router/RoutingContext.java @@ -77,7 +77,8 @@ public final class RoutingContext { public boolean correctMisplacedViaPoints; public double correctMisplacedViaPointsDistance; public boolean useDynamicDistance; - + public boolean buildBeelineOnRange; + private void setModel(String className) { if (className == null) { pm = new StdModel(); @@ -120,7 +121,7 @@ public final class RoutingContext { considerTurnRestrictions = 0.f != expctxGlobal.getVariableValue("considerTurnRestrictions", footMode ? 0.f : 1.f); correctMisplacedViaPoints = 0.f != expctxGlobal.getVariableValue("correctMisplacedViaPoints", 1.f); - correctMisplacedViaPointsDistance = expctxGlobal.getVariableValue("correctMisplacedViaPointsDistance", 40.f); + correctMisplacedViaPointsDistance = expctxGlobal.getVariableValue("correctMisplacedViaPointsDistance", 0.f); // 0 == don't use distance // process tags not used in the profile (to have them in the data-tab) processUnusedTags = 0.f != expctxGlobal.getVariableValue("processUnusedTags", 0.f); @@ -169,7 +170,8 @@ public final class RoutingContext { // Constant power of the biker (in W) bikerPower = expctxGlobal.getVariableValue("bikerPower", 100.f); - useDynamicDistance = expctxGlobal.getVariableValue("use_dynamic_range", 0f) == 1f; + useDynamicDistance = expctxGlobal.getVariableValue("use_dynamic_range", 1f) == 1f; + buildBeelineOnRange = expctxGlobal.getVariableValue("add_beeline", 0f) == 1f; boolean test = expctxGlobal.getVariableValue("check_start_way", 1f) == 1f; if (!test) freeNoWays(); diff --git a/brouter-core/src/main/java/btools/router/RoutingEngine.java b/brouter-core/src/main/java/btools/router/RoutingEngine.java index 14fa36f..06de940 100644 --- a/brouter-core/src/main/java/btools/router/RoutingEngine.java +++ b/brouter-core/src/main/java/btools/router/RoutingEngine.java @@ -1085,6 +1085,7 @@ public class RoutingEngine extends Thread { private void matchWaypointsToNodes(List unmatchedWaypoints) { resetCache(false); boolean useDynamicDistance = routingContext.useDynamicDistance; + boolean bAddBeeline = routingContext.buildBeelineOnRange; double range = routingContext.waypointCatchingRange; boolean ok = nodesCache.matchWaypointsToNodes(unmatchedWaypoints, range, islandNodePairs); if (!ok && useDynamicDistance) { @@ -1093,7 +1094,8 @@ public class RoutingEngine extends Thread { range = -MAX_DYNAMIC_RANGE; List tmp = new ArrayList<>(); for (MatchedWaypoint mwp : unmatchedWaypoints) { - if (mwp.crosspoint == null || mwp.radius >= routingContext.waypointCatchingRange) tmp.add(mwp); + if (mwp.crosspoint == null || mwp.radius >= routingContext.waypointCatchingRange) + tmp.add(mwp); } ok = nodesCache.matchWaypointsToNodes(tmp, range, islandNodePairs); } @@ -1104,7 +1106,7 @@ public class RoutingEngine extends Thread { } } // add beeline points when not already done - if (useDynamicDistance && !useNodePoints) { + if (useDynamicDistance && !useNodePoints && bAddBeeline) { List waypoints = new ArrayList<>(); for (int i = 0; i < unmatchedWaypoints.size(); i++) { MatchedWaypoint wp = unmatchedWaypoints.get(i);