From 56459d37d1689c4c11c63844881defefc9a64f79 Mon Sep 17 00:00:00 2001 From: karenzshea Date: Tue, 28 Nov 2017 17:29:13 +0100 Subject: [PATCH] access way names through RouteStep in post processing --- .../guidance/collapse_scenario_detection.hpp | 5 +---- .../guidance/collapse_scenario_detection.cpp | 16 +++++++--------- src/engine/guidance/collapse_turns.cpp | 17 ++--------------- 3 files changed, 10 insertions(+), 28 deletions(-) diff --git a/include/engine/guidance/collapse_scenario_detection.hpp b/include/engine/guidance/collapse_scenario_detection.hpp index 2aa359317..b2f302339 100644 --- a/include/engine/guidance/collapse_scenario_detection.hpp +++ b/include/engine/guidance/collapse_scenario_detection.hpp @@ -36,10 +36,7 @@ bool isStaggeredIntersection(const RouteStepIterator step_prior_to_intersection, // a - > x bool isUTurn(const RouteStepIterator step_prior_to_intersection, const RouteStepIterator step_entering_intersection, - const RouteStepIterator step_leaving_intersection, - const std::string &step_prior_name, - const std::string &step_entering_name, - const std::string &step_leaving_name); + const RouteStepIterator step_leaving_intersection); // detect oscillating names where a name switch A->B->A occurs. This is often the case due to // bridges or tunnels. Any such oszillation is not supposed to show up diff --git a/src/engine/guidance/collapse_scenario_detection.cpp b/src/engine/guidance/collapse_scenario_detection.cpp index 2aed5cff9..4b7c82aff 100644 --- a/src/engine/guidance/collapse_scenario_detection.cpp +++ b/src/engine/guidance/collapse_scenario_detection.cpp @@ -43,12 +43,11 @@ bool noIntermediaryIntersections(const RouteStep &step) // Link roads, as far as we are concerned, are short unnamed segments between to named segments. bool isLinkRoad(const RouteStep &link_step, const std::string &pre_link_step_name, - const std::string &link_step_name, const std::string &post_link_step_name) { const constexpr double MAX_LINK_ROAD_LENGTH = 2 * MAX_COLLAPSE_DISTANCE; const auto is_short = link_step.distance <= MAX_LINK_ROAD_LENGTH; - const auto unnamed = link_step_name.empty(); + const auto unnamed = link_step.name.empty(); const auto between_named = !pre_link_step_name.empty() && !post_link_step_name.empty(); return is_short && unnamed && between_named && noIntermediaryIntersections(link_step); @@ -163,10 +162,10 @@ bool isStaggeredIntersection(const RouteStepIterator step_prior_to_intersection, bool isUTurn(const RouteStepIterator step_prior_to_intersection, const RouteStepIterator step_entering_intersection, - const RouteStepIterator step_leaving_intersection, - const std::string &step_prior_name, - const std::string &step_entering_name, - const std::string &step_leaving_name) + const RouteStepIterator step_leaving_intersection) +// const std::string &step_prior_name, +// const std::string &step_entering_name, +// const std::string &step_leaving_name) { if (!basicCollapsePreconditions( step_prior_to_intersection, step_entering_intersection, step_leaving_intersection)) @@ -200,9 +199,8 @@ bool isUTurn(const RouteStepIterator step_prior_to_intersection, noIntermediaryIntersections(*step_entering_intersection); return collapsable || isLinkRoad(*step_entering_intersection, - step_prior_name, - step_entering_name, - step_leaving_name) || + step_prior_to_intersection->name, + step_leaving_intersection->name) || only_allowed_turn; } diff --git a/src/engine/guidance/collapse_turns.cpp b/src/engine/guidance/collapse_turns.cpp index 6587ed7e3..77254f930 100644 --- a/src/engine/guidance/collapse_turns.cpp +++ b/src/engine/guidance/collapse_turns.cpp @@ -371,9 +371,6 @@ RouteSteps collapseTurnInstructions(RouteSteps steps, const datafacade::BaseData break; const auto previous_step = findPreviousTurn(current_step); - const auto previous_step_name = facade.GetNameForID(previous_step->name_id).to_string(); - const auto current_step_name = facade.GetNameForID(current_step->name_id).to_string(); - const auto next_step_name = facade.GetNameForID(next_step->name_id).to_string(); // don't collapse anything that does change modes if (current_step->mode != next_step->mode) @@ -390,12 +387,7 @@ RouteSteps collapseTurnInstructions(RouteSteps steps, const datafacade::BaseData TransferSignageStrategy(), NoModificationStrategy()); } - else if (isUTurn(previous_step, - current_step, - next_step, - previous_step_name, - current_step_name, - next_step_name)) + else if (isUTurn(previous_step, current_step, next_step)) { combineRouteSteps( *current_step, @@ -475,12 +467,7 @@ RouteSteps collapseTurnInstructions(RouteSteps steps, const datafacade::BaseData const auto far_back_step_name = facade.GetNameForID(far_back_step->name_id).to_string(); // due to name changes, we can find u-turns a bit late. Thats why we check far back as // well - if (isUTurn(far_back_step, - previous_step, - current_step, - far_back_step_name, - previous_step_name, - current_step_name)) + if (isUTurn(far_back_step, previous_step, current_step)) { combineRouteSteps( *previous_step,