From d262c4dfaa11893c8322b3fcc67338f68f3a467e Mon Sep 17 00:00:00 2001 From: Michael Krasnyk Date: Thu, 1 Jun 2017 11:00:54 +0200 Subject: [PATCH] [skip ci] Add comments about order of post-processing calls --- include/engine/api/route_api.hpp | 4 ++++ src/engine/guidance/collapse_turns.cpp | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/include/engine/api/route_api.hpp b/include/engine/api/route_api.hpp index 1c9bf893d..1e13ef44d 100644 --- a/include/engine/api/route_api.hpp +++ b/include/engine/api/route_api.hpp @@ -165,6 +165,10 @@ class RouteAPI : public BaseAPI * to find a via point. * The same exit will be emitted, though, if we should start routing at S, making * the overall response consistent. + * + * ⚠ CAUTION: order of post-processing steps is important + * - postProcess must be called before collapseTurnInstructions that expects + * post-processed roundabouts without Exit instructions */ guidance::trimShortSegments(steps, leg_geometry); diff --git a/src/engine/guidance/collapse_turns.cpp b/src/engine/guidance/collapse_turns.cpp index e6bc60681..6b95a4bba 100644 --- a/src/engine/guidance/collapse_turns.cpp +++ b/src/engine/guidance/collapse_turns.cpp @@ -315,6 +315,12 @@ RouteSteps collapseTurnInstructions(RouteSteps steps) if (entersRoundabout(current_step->maneuver.instruction) || staysOnRoundabout(current_step->maneuver.instruction)) { + // If postProcess is called before then all corresponding leavesRoundabout steps are + // removed and the current roundabout step can be ignored by directly proceeding to + // the next step. + // If postProcess is not called before then all steps till the next leavesRoundabout + // step must be skipped to prevent incorrect roundabouts post-processing. + // are we done for good? if (current_step + 1 == steps.end()) break;