Merge pull request #774 from afischerdev/avoid-uturns

Added a switch to avoid u-turns
This commit is contained in:
afischerdev 2025-04-12 16:14:25 +02:00 committed by GitHub
commit 64560d26c0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 2 deletions

View File

@ -77,6 +77,7 @@ public final class RoutingContext {
public double waypointCatchingRange; public double waypointCatchingRange;
public boolean correctMisplacedViaPoints; public boolean correctMisplacedViaPoints;
public double correctMisplacedViaPointsDistance; public double correctMisplacedViaPointsDistance;
public boolean continueStraight;
public boolean useDynamicDistance; public boolean useDynamicDistance;
public boolean buildBeelineOnRange; public boolean buildBeelineOnRange;
@ -126,6 +127,8 @@ public final class RoutingContext {
correctMisplacedViaPoints = 0.f != expctxGlobal.getVariableValue("correctMisplacedViaPoints", 1.f); correctMisplacedViaPoints = 0.f != expctxGlobal.getVariableValue("correctMisplacedViaPoints", 1.f);
correctMisplacedViaPointsDistance = expctxGlobal.getVariableValue("correctMisplacedViaPointsDistance", 0.f); // 0 == don't use distance correctMisplacedViaPointsDistance = expctxGlobal.getVariableValue("correctMisplacedViaPointsDistance", 0.f); // 0 == don't use distance
continueStraight = 0.f != expctxGlobal.getVariableValue("continueStraight", 0.f);
// 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);

View File

@ -995,7 +995,7 @@ public class RoutingEngine extends Thread {
} else { } else {
seg = searchTrack(matchedWaypoints.get(i), matchedWaypoints.get(i + 1), i == matchedWaypoints.size() - 2 ? nearbyTrack : null, refTracks[i]); seg = searchTrack(matchedWaypoints.get(i), matchedWaypoints.get(i + 1), i == matchedWaypoints.size() - 2 ? nearbyTrack : null, refTracks[i]);
wptIndex = i; wptIndex = i;
if (engineMode == BROUTER_ENGINEMODE_ROUNDTRIP) { if (routingContext.continueStraight) {
if (i < matchedWaypoints.size() - 2) { if (i < matchedWaypoints.size() - 2) {
OsmNode lastPoint = seg.containsNode(matchedWaypoints.get(i+1).node1) ? matchedWaypoints.get(i+1).node1 : matchedWaypoints.get(i+1).node2; OsmNode lastPoint = seg.containsNode(matchedWaypoints.get(i+1).node1) ? matchedWaypoints.get(i+1).node1 : matchedWaypoints.get(i+1).node2;
OsmNodeNamed nogo = new OsmNodeNamed(lastPoint); OsmNodeNamed nogo = new OsmNodeNamed(lastPoint);
@ -1137,7 +1137,12 @@ public class RoutingEngine extends Thread {
indexfore++; indexfore++;
if (routingContext.correctMisplacedViaPointsDistance > 0 && if (routingContext.correctMisplacedViaPointsDistance > 0 &&
wayDistance > routingContext.correctMisplacedViaPointsDistance) break; wayDistance > routingContext.correctMisplacedViaPointsDistance) {
removeVoiceHintList.clear();
removeBackList.clear();
removeForeList.clear();
return false;
}
} }