enable dynamic range for all

This commit is contained in:
afischerdev 2025-02-25 10:04:03 +01:00
parent bda582f4e3
commit d4a4da7e43
2 changed files with 9 additions and 5 deletions

View File

@ -77,6 +77,7 @@ public final class RoutingContext {
public boolean correctMisplacedViaPoints; public boolean correctMisplacedViaPoints;
public double correctMisplacedViaPointsDistance; public double correctMisplacedViaPointsDistance;
public boolean useDynamicDistance; public boolean useDynamicDistance;
public boolean buildBeelineOnRange;
private void setModel(String className) { private void setModel(String className) {
if (className == null) { if (className == null) {
@ -120,7 +121,7 @@ public final class RoutingContext {
considerTurnRestrictions = 0.f != expctxGlobal.getVariableValue("considerTurnRestrictions", footMode ? 0.f : 1.f); considerTurnRestrictions = 0.f != expctxGlobal.getVariableValue("considerTurnRestrictions", footMode ? 0.f : 1.f);
correctMisplacedViaPoints = 0.f != expctxGlobal.getVariableValue("correctMisplacedViaPoints", 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) // process tags not used in the profile (to have them in the data-tab)
processUnusedTags = 0.f != expctxGlobal.getVariableValue("processUnusedTags", 0.f); processUnusedTags = 0.f != expctxGlobal.getVariableValue("processUnusedTags", 0.f);
@ -169,7 +170,8 @@ public final class RoutingContext {
// Constant power of the biker (in W) // Constant power of the biker (in W)
bikerPower = expctxGlobal.getVariableValue("bikerPower", 100.f); 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; boolean test = expctxGlobal.getVariableValue("check_start_way", 1f) == 1f;
if (!test) freeNoWays(); if (!test) freeNoWays();

View File

@ -1085,6 +1085,7 @@ public class RoutingEngine extends Thread {
private void matchWaypointsToNodes(List<MatchedWaypoint> unmatchedWaypoints) { private void matchWaypointsToNodes(List<MatchedWaypoint> unmatchedWaypoints) {
resetCache(false); resetCache(false);
boolean useDynamicDistance = routingContext.useDynamicDistance; boolean useDynamicDistance = routingContext.useDynamicDistance;
boolean bAddBeeline = routingContext.buildBeelineOnRange;
double range = routingContext.waypointCatchingRange; double range = routingContext.waypointCatchingRange;
boolean ok = nodesCache.matchWaypointsToNodes(unmatchedWaypoints, range, islandNodePairs); boolean ok = nodesCache.matchWaypointsToNodes(unmatchedWaypoints, range, islandNodePairs);
if (!ok && useDynamicDistance) { if (!ok && useDynamicDistance) {
@ -1093,7 +1094,8 @@ public class RoutingEngine extends Thread {
range = -MAX_DYNAMIC_RANGE; range = -MAX_DYNAMIC_RANGE;
List<MatchedWaypoint> tmp = new ArrayList<>(); List<MatchedWaypoint> tmp = new ArrayList<>();
for (MatchedWaypoint mwp : unmatchedWaypoints) { 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); ok = nodesCache.matchWaypointsToNodes(tmp, range, islandNodePairs);
} }
@ -1104,7 +1106,7 @@ public class RoutingEngine extends Thread {
} }
} }
// add beeline points when not already done // add beeline points when not already done
if (useDynamicDistance && !useNodePoints) { if (useDynamicDistance && !useNodePoints && bAddBeeline) {
List<MatchedWaypoint> waypoints = new ArrayList<>(); List<MatchedWaypoint> waypoints = new ArrayList<>();
for (int i = 0; i < unmatchedWaypoints.size(); i++) { for (int i = 0; i < unmatchedWaypoints.size(); i++) {
MatchedWaypoint wp = unmatchedWaypoints.get(i); MatchedWaypoint wp = unmatchedWaypoints.get(i);