added new dynamic

This commit is contained in:
afischerdev 2025-03-12 19:01:57 +01:00
parent a07fd6a400
commit a134c128bc
2 changed files with 5 additions and 2 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;
public AreaInfo ai; public AreaInfo ai;
@ -171,7 +172,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

@ -1473,6 +1473,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) {
@ -1493,7 +1494,7 @@ public class RoutingEngine extends Thread {
} }
} }
// add beeline points when not already done // add beeline points when not already done
if (useDynamicDistance && !useNodePoints && engineMode != BROUTER_ENGINEMODE_ROUNDTRIP) { 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);