This commit is contained in:
Emil Tin 2014-08-12 10:02:29 +02:00
parent 181dbe8493
commit a5ee7e78f6
6 changed files with 19 additions and 15 deletions

View File

@ -95,6 +95,7 @@ NodeBasedDynamicGraphFromImportEdges(int number_of_nodes, std::vector<ImportEdge
edge.data.type = import_edge.type;
edge.data.isAccessRestricted = import_edge.access_restricted;
edge.data.travel_mode = import_edge.travel_mode;
edges_list.push_back(edge);
if (!import_edge.is_split)

View File

@ -54,7 +54,7 @@ struct ExtractionWay
isAccessRestricted = false;
ignoreInGrid = false;
travel_mode = 1;
backward_travel_mode = 0;
backward_travel_mode = 1;
}
enum Directions

View File

@ -114,9 +114,6 @@ void ExtractorCallbacks::ProcessWay(ExtractionWay &parsed_way)
bool split_edge = parsed_way.IsBidirectional() && parsed_way.HasDiffDirections();
//const bool split_edge =
// (parsed_way.backward_speed > 0) && (parsed_way.speed != parsed_way.backward_speed);
for (unsigned n = 0; n < (parsed_way.path.size() - 1); ++n)
{
external_memory.all_edges_list.push_back(InternalExtractorEdge(

View File

@ -228,7 +228,8 @@ template <class DataFacadeT> class BasicRoutingInterface
unsigned name_index = facade->GetNameIndexFromEdgeID(ed.id);
const TurnInstruction turn_instruction = facade->GetTurnInstructionForEdgeID(ed.id);
const TravelMode travel_mode = facade->GetTravelModeForEdgeID(ed.id);
if (!facade->EdgeIsCompressed(ed.id))
{
BOOST_ASSERT(!facade->EdgeIsCompressed(ed.id));
@ -257,7 +258,7 @@ template <class DataFacadeT> class BasicRoutingInterface
BOOST_ASSERT(start_index <= end_index);
for (std::size_t i = start_index; i < end_index; ++i)
{
unpacked_path.emplace_back(id_vector[i], name_index, TurnInstruction::NoTurn, 0, 0);
unpacked_path.emplace_back(id_vector[i], name_index, TurnInstruction::NoTurn, 0, travel_mode);
}
unpacked_path.back().turn_instruction = turn_instruction;
unpacked_path.back().segment_duration = ed.distance;
@ -304,7 +305,7 @@ template <class DataFacadeT> class BasicRoutingInterface
phantom_node_pair.target_phantom.name_id,
TurnInstruction::NoTurn,
0,
0});
phantom_node_pair.target_phantom.travel_mode});
}
}

View File

@ -309,13 +309,6 @@ template <class DataFacadeT> class ShortestPathRouting : public BasicRoutingInte
}
raw_route_data.unpacked_path_segments.resize(packed_legs1.size());
//TODO - needed?
// set mode of first instruction
// if the best route started from the opposite edge, use backward mode rather than forward
//if( packed_legs1.front() == phantom_nodes_vector[0].source_phantom.reverse_node_id ) {
// phantom_nodes_vector[0].source_phantom.travel_mode = phantom_nodes_vector[0].source_phantom.backward_travel_mode;
//}
for (const std::size_t index : osrm::irange<std::size_t>(0, packed_legs1.size()))
{
BOOST_ASSERT(!phantom_nodes_vector.empty());

View File

@ -155,4 +155,16 @@ Feature: Testbot - Mode flag
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 |
| d,0,a | cd,bc,ab | 1,4,1 |
Scenario: Testbot - Modes when starting on opposite oneway
Given the node map
| a | b |
And the ways
| nodes | highway | oneway |
| ab | river | -1 |
When I route I should get
| from | to | route | modes |
| b | a | ab | 4 |