fix problems with mode, 1 failing test left

This commit is contained in:
Emil Tin 2014-08-13 11:28:41 +02:00
parent 4dd0377eb8
commit 3460bd0ba9
4 changed files with 30 additions and 10 deletions

View File

@ -120,6 +120,8 @@ void ExtractorCallbacks::ProcessWay(ExtractionWay &parsed_way)
{ {
std::reverse(parsed_way.path.begin(), parsed_way.path.end()); std::reverse(parsed_way.path.begin(), parsed_way.path.end());
parsed_way.direction = ExtractionWay::oneway; parsed_way.direction = ExtractionWay::oneway;
parsed_way.travel_mode = parsed_way.backward_travel_mode;
parsed_way.backward_travel_mode = 0;
} }
const bool split_edge = const bool split_edge =
@ -128,6 +130,7 @@ void ExtractorCallbacks::ProcessWay(ExtractionWay &parsed_way)
((parsed_way.speed != parsed_way.backward_speed) || ((parsed_way.speed != parsed_way.backward_speed) ||
(parsed_way.travel_mode != parsed_way.backward_travel_mode)); (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) for (unsigned n = 0; n < (parsed_way.path.size() - 1); ++n)
{ {
external_memory.all_edges_list.push_back(InternalExtractorEdge( external_memory.all_edges_list.push_back(InternalExtractorEdge(
@ -157,6 +160,7 @@ void ExtractorCallbacks::ProcessWay(ExtractionWay &parsed_way)
if (split_edge) if (split_edge)
{ // Only true if the way should be split { // 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()); std::reverse(parsed_way.path.begin(), parsed_way.path.end());
for (std::vector<NodeID>::size_type n = 0; n < parsed_way.path.size() - 1; ++n) for (std::vector<NodeID>::size_type n = 0; n < parsed_way.path.size() - 1; ++n)
{ {

View File

@ -301,6 +301,7 @@ template <class DataFacadeT> class BasicRoutingInterface
for (std::size_t i = start_index; i != end_index; (start_index < end_index ? ++i : --i)) for (std::size_t i = start_index; i != end_index; (start_index < end_index ? ++i : --i))
{ {
BOOST_ASSERT(i < id_vector.size()); BOOST_ASSERT(i < id_vector.size());
BOOST_ASSERT(phantom_node_pair.target_phantom.travel_mode>0 );
unpacked_path.emplace_back(PathData{id_vector[i], unpacked_path.emplace_back(PathData{id_vector[i],
phantom_node_pair.target_phantom.name_id, phantom_node_pair.target_phantom.name_id,
TurnInstruction::NoTurn, TurnInstruction::NoTurn,

View File

@ -160,8 +160,8 @@ Feature: Bike - Mode flag
When I route I should get When I route I should get
| from | to | route | modes | | from | to | route | modes |
| a | b | ab | 2 | | a | b | ab | 1 |
| b | a | | | | b | a | ab | 2 |
Scenario: Bicycle - Modes when starting on reverse oneway Scenario: Bicycle - Modes when starting on reverse oneway
Given the node map Given the node map
@ -173,5 +173,5 @@ Feature: Bike - Mode flag
When I route I should get When I route I should get
| from | to | route | modes | | from | to | route | modes |
| a | b | | | | a | b | ab | 2 |
| b | a | ab | 2 | | b | a | ab | 1 |

View File

@ -135,9 +135,9 @@ Feature: Testbot - Mode flag
| bd | steps | | bd | steps |
When I route I should get When I route I should get
| waypoints | route | modes | | waypoints | route | modes | turns |
| a,d,c | abc,bd,bd,abc | 1,5,6,1 | | 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,abc | 1,5,6,1 | | c,d,a | abc,bd,bd,bd,abc | 1,5,5,6,1 | head,left,via,u_turn,left,destination |
@via @via
Scenario: Testbot - Modes and via point at river Scenario: Testbot - Modes and via point at river
@ -153,9 +153,9 @@ Feature: Testbot - Mode flag
| cd | primary | | cd | primary |
When I route I should get When I route I should get
| waypoints | route | modes | | waypoints | route | modes | turns |
| a,0,d | ab,bc,cd | 1,3,1 | | a,0,d | ab,bc,bc,cd | 1,3,3,1 | head,straight,via,straight,destination |
| d,0,a | cd,bc,ab | 1,4,1 | | d,0,a | cd,bc,bc,ab | 1,4,4,1 | head,straight,via,straight,destination |
Scenario: Testbot - Modes when starting on forward oneway Scenario: Testbot - Modes when starting on forward oneway
Given the node map Given the node map
@ -182,3 +182,18 @@ Feature: Testbot - Mode flag
| from | to | route | modes | | from | to | route | modes |
| a | b | | | | a | b | | |
| b | a | ab | 4 | | 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 |