[gnome-maps/gnome-42] graphHopper: Don't fold keep left/right instructions



commit c82179cf8eafc68126d5e75aad669edf4f1c4e4b
Author: Marcus Lundblad <ml dfupdate se>
Date:   Thu Apr 21 23:14:34 2022 +0200

    graphHopper: Don't fold keep left/right instructions
    
    In #171 we introduced "folding" of routing instructions
    for "continue straight" and keep left or right instructions
    to work around GraphHopper giving a lot of extra instructions
    while staying on the same road number/name.
    This has tended to take away a bit _too_ much, such as
    "keep right" instructions when exiting a highway (and the
    offramp has the same ref number as the main highway).
    So, only fold exact "continue on street" instructions now.

 src/graphHopper.js | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
---
diff --git a/src/graphHopper.js b/src/graphHopper.js
index 20df5898..831e6da6 100644
--- a/src/graphHopper.js
+++ b/src/graphHopper.js
@@ -239,15 +239,11 @@ var GraphHopper = class GraphHopper {
         for (let i = 1; i < instructions.length; i++) {
             let newInstruction = instructions[i];
             let newSign = newInstruction.sign;
-            let newStreetname = newInstruction.street_name;
 
-            /* if the direction is to continue straight, or keep left or keep
-             * right on the same street/road number, fold the instruction into
-             * the previous one
+            /* if the direction is to continue straight,
+             * fold the instruction into the previous one
              */
-            if (newSign === Sign.CONTINUE_ON_STREET ||
-                ((newSign === Sign.KEEP_LEFT || newSign === Sign.KEEP_RIGHT) &&
-                 newStreetname === currInstruction.street_name)) {
+            if (newSign === Sign.CONTINUE_ON_STREET) {
                 currInstruction.distance += newInstruction.distance;
             } else {
                 res.push(currInstruction);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]