most tests passing

This commit is contained in:
Emil Tin 2014-08-11 08:30:04 +02:00 committed by Emil Tin
parent 6fd615b9cd
commit 6d6d299ea4
7 changed files with 32 additions and 14 deletions

View File

@ -723,15 +723,6 @@ TurnInstruction EdgeBasedGraphFactory::AnalyzeTurn(const NodeID node_u,
const EdgeData &data1 = m_node_based_graph->GetEdgeData(edge1);
const EdgeData &data2 = m_node_based_graph->GetEdgeData(edge2);
if (!data1.travel_mode && data2.travel_mode)
{
return TurnInstruction::EnterAgainstAllowedDirection;
}
if (data1.travel_mode && !data2.travel_mode)
{
return TurnInstruction::LeaveAgainstAllowedDirection;
}
// roundabouts need to be handled explicitely
if (data1.roundabout && data2.roundabout)
{

View File

@ -53,7 +53,7 @@ struct ExtractionWay
roundabout = false;
isAccessRestricted = false;
ignoreInGrid = false;
travel_mode = 0;
travel_mode = 1;
backward_travel_mode = 0;
}

View File

@ -309,6 +309,13 @@ 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,6 +155,7 @@ template <class EdgeDataT> class InternalDataFacade : public BaseDataFacade<Edge
for (unsigned i = 0; i < number_of_edges; ++i)
{
edges_input_stream.read((char *)&(current_edge_data), sizeof(OriginalEdgeData));
std::cout << "read mode: " << (long)current_edge_data.travel_mode << std::endl;
m_via_node_list[i] = current_edge_data.via_node;
m_name_ID_list[i] = current_edge_data.name_id;
m_turn_instruction_list[i] = current_edge_data.turn_instruction;
@ -361,7 +362,7 @@ template <class EdgeDataT> class InternalDataFacade : public BaseDataFacade<Edge
TravelMode GetTravelModeForEdgeID(const unsigned id) const
{
return 15;//m_travel_mode_list.at(id);
return m_travel_mode_list.at(id);
}
bool LocateClosestEndPointForCoordinate(const FixedPointCoordinate &input_coordinate,

View File

@ -144,3 +144,18 @@ Feature: Testbot - Mode flag
| waypoints | route | modes |
| a,0,d | ab,bc,cd | 1,3,1 |
| d,0,a | cd,bc,ab | 1,4,1 |
Scenario: Testbot - Modes for opposite direction
Given the node map
| a | b | c | d | e |
And the ways
| nodes | highway |
| ab | primary |
| bc | primary |
| cd | river |
| de | river |
When I route I should get
| from | to | route | modes |
| a | e | ab,bc,cd,de | 1,1,3,3 |

View File

@ -18,6 +18,7 @@ speed_profile = {
["primary"] = 36,
["secondary"] = 18,
["tertiary"] = 12,
["steps"] = 6,
["default"] = 24
}
@ -81,6 +82,9 @@ function way_function (way)
way.backward_mode = 4
speed_forw = temp_speed*1.5
speed_back = temp_speed/1.5
elseif highway == "steps" then
way.mode = 5
way.backward_mode = 6
end
if maxspeed_forward ~= nil and maxspeed_forward > 0 then