From 3460bd0ba97f8ebdb0941fa09202c3d842198585 Mon Sep 17 00:00:00 2001 From: Emil Tin Date: Wed, 13 Aug 2014 11:28:41 +0200 Subject: [PATCH] fix problems with mode, 1 failing test left --- Extractor/ExtractorCallbacks.cpp | 4 ++++ RoutingAlgorithms/BasicRoutingInterface.h | 1 + features/bicycle/mode.feature | 8 +++---- features/testbot/mode.feature | 27 ++++++++++++++++++----- 4 files changed, 30 insertions(+), 10 deletions(-) diff --git a/Extractor/ExtractorCallbacks.cpp b/Extractor/ExtractorCallbacks.cpp index 4a175b6ab..a8881fcde 100644 --- a/Extractor/ExtractorCallbacks.cpp +++ b/Extractor/ExtractorCallbacks.cpp @@ -120,6 +120,8 @@ void ExtractorCallbacks::ProcessWay(ExtractionWay &parsed_way) { std::reverse(parsed_way.path.begin(), parsed_way.path.end()); parsed_way.direction = ExtractionWay::oneway; + parsed_way.travel_mode = parsed_way.backward_travel_mode; + parsed_way.backward_travel_mode = 0; } const bool split_edge = @@ -128,6 +130,7 @@ void ExtractorCallbacks::ProcessWay(ExtractionWay &parsed_way) ((parsed_way.speed != parsed_way.backward_speed) || (parsed_way.travel_mode != parsed_way.backward_travel_mode)); + BOOST_ASSERT(parsed_way.travel_mode>0); for (unsigned n = 0; n < (parsed_way.path.size() - 1); ++n) { external_memory.all_edges_list.push_back(InternalExtractorEdge( @@ -157,6 +160,7 @@ void ExtractorCallbacks::ProcessWay(ExtractionWay &parsed_way) if (split_edge) { // Only true if the way should be split + BOOST_ASSERT(parsed_way.backward_travel_mode>0); std::reverse(parsed_way.path.begin(), parsed_way.path.end()); for (std::vector::size_type n = 0; n < parsed_way.path.size() - 1; ++n) { diff --git a/RoutingAlgorithms/BasicRoutingInterface.h b/RoutingAlgorithms/BasicRoutingInterface.h index d36686ccd..8e2eedafc 100644 --- a/RoutingAlgorithms/BasicRoutingInterface.h +++ b/RoutingAlgorithms/BasicRoutingInterface.h @@ -301,6 +301,7 @@ template class BasicRoutingInterface for (std::size_t i = start_index; i != end_index; (start_index < end_index ? ++i : --i)) { BOOST_ASSERT(i < id_vector.size()); + BOOST_ASSERT(phantom_node_pair.target_phantom.travel_mode>0 ); unpacked_path.emplace_back(PathData{id_vector[i], phantom_node_pair.target_phantom.name_id, TurnInstruction::NoTurn, diff --git a/features/bicycle/mode.feature b/features/bicycle/mode.feature index 37e51fb77..2bfa4de5b 100644 --- a/features/bicycle/mode.feature +++ b/features/bicycle/mode.feature @@ -160,8 +160,8 @@ Feature: Bike - Mode flag When I route I should get | from | to | route | modes | - | a | b | ab | 2 | - | b | a | | | + | a | b | ab | 1 | + | b | a | ab | 2 | Scenario: Bicycle - Modes when starting on reverse oneway Given the node map @@ -173,5 +173,5 @@ Feature: Bike - Mode flag When I route I should get | from | to | route | modes | - | a | b | | | - | b | a | ab | 2 | + | a | b | ab | 2 | + | b | a | ab | 1 | diff --git a/features/testbot/mode.feature b/features/testbot/mode.feature index ed528fe6f..d68082aaf 100644 --- a/features/testbot/mode.feature +++ b/features/testbot/mode.feature @@ -135,9 +135,9 @@ Feature: Testbot - Mode flag | bd | steps | When I route I should get - | waypoints | route | modes | - | a,d,c | abc,bd,bd,abc | 1,5,6,1 | - | c,d,a | abc,bd,bd,abc | 1,5,6,1 | + | waypoints | route | modes | turns | + | a,d,c | abc,bd,bd,bd,abc | 1,5,5,6,1 | head,right,via,u_turn,right,destination | + | c,d,a | abc,bd,bd,bd,abc | 1,5,5,6,1 | head,left,via,u_turn,left,destination | @via Scenario: Testbot - Modes and via point at river @@ -153,9 +153,9 @@ Feature: Testbot - Mode flag | cd | primary | When I route I should get - | waypoints | route | modes | - | a,0,d | ab,bc,cd | 1,3,1 | - | d,0,a | cd,bc,ab | 1,4,1 | + | waypoints | route | modes | turns | + | a,0,d | ab,bc,bc,cd | 1,3,3,1 | head,straight,via,straight,destination | + | d,0,a | cd,bc,bc,ab | 1,4,4,1 | head,straight,via,straight,destination | Scenario: Testbot - Modes when starting on forward oneway Given the node map @@ -182,3 +182,18 @@ Feature: Testbot - Mode flag | from | to | route | modes | | a | b | | | | b | a | ab | 4 | + + Scenario: Testbot - Modes for each direction + Given the node map + | b | c | | | | + | | | | e | d | + + And the ways + | nodes | highway | + | bc | primary | + | ce | river | + | ed | primary | + + When I route I should get + | from | to | route | modes | + | e | b | ce,bc | 4,1 |