most tests passing
This commit is contained in:
parent
6fd615b9cd
commit
6d6d299ea4
@ -723,15 +723,6 @@ TurnInstruction EdgeBasedGraphFactory::AnalyzeTurn(const NodeID node_u,
|
|||||||
const EdgeData &data1 = m_node_based_graph->GetEdgeData(edge1);
|
const EdgeData &data1 = m_node_based_graph->GetEdgeData(edge1);
|
||||||
const EdgeData &data2 = m_node_based_graph->GetEdgeData(edge2);
|
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
|
// roundabouts need to be handled explicitely
|
||||||
if (data1.roundabout && data2.roundabout)
|
if (data1.roundabout && data2.roundabout)
|
||||||
{
|
{
|
||||||
|
@ -53,7 +53,7 @@ struct ExtractionWay
|
|||||||
roundabout = false;
|
roundabout = false;
|
||||||
isAccessRestricted = false;
|
isAccessRestricted = false;
|
||||||
ignoreInGrid = false;
|
ignoreInGrid = false;
|
||||||
travel_mode = 0;
|
travel_mode = 1;
|
||||||
backward_travel_mode = 0;
|
backward_travel_mode = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,7 +228,7 @@ template <class DataFacadeT> class BasicRoutingInterface
|
|||||||
unsigned name_index = facade->GetNameIndexFromEdgeID(ed.id);
|
unsigned name_index = facade->GetNameIndexFromEdgeID(ed.id);
|
||||||
const TurnInstruction turn_instruction = facade->GetTurnInstructionForEdgeID(ed.id);
|
const TurnInstruction turn_instruction = facade->GetTurnInstructionForEdgeID(ed.id);
|
||||||
const TravelMode travel_mode = facade->GetTravelModeForEdgeID(ed.id);
|
const TravelMode travel_mode = facade->GetTravelModeForEdgeID(ed.id);
|
||||||
|
|
||||||
if (!facade->EdgeIsCompressed(ed.id))
|
if (!facade->EdgeIsCompressed(ed.id))
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(!facade->EdgeIsCompressed(ed.id));
|
BOOST_ASSERT(!facade->EdgeIsCompressed(ed.id));
|
||||||
|
@ -309,6 +309,13 @@ template <class DataFacadeT> class ShortestPathRouting : public BasicRoutingInte
|
|||||||
}
|
}
|
||||||
raw_route_data.unpacked_path_segments.resize(packed_legs1.size());
|
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()))
|
for (const std::size_t index : osrm::irange<std::size_t>(0, packed_legs1.size()))
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(!phantom_nodes_vector.empty());
|
BOOST_ASSERT(!phantom_nodes_vector.empty());
|
||||||
|
@ -155,6 +155,7 @@ template <class EdgeDataT> class InternalDataFacade : public BaseDataFacade<Edge
|
|||||||
for (unsigned i = 0; i < number_of_edges; ++i)
|
for (unsigned i = 0; i < number_of_edges; ++i)
|
||||||
{
|
{
|
||||||
edges_input_stream.read((char *)&(current_edge_data), sizeof(OriginalEdgeData));
|
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_via_node_list[i] = current_edge_data.via_node;
|
||||||
m_name_ID_list[i] = current_edge_data.name_id;
|
m_name_ID_list[i] = current_edge_data.name_id;
|
||||||
m_turn_instruction_list[i] = current_edge_data.turn_instruction;
|
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
|
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,
|
bool LocateClosestEndPointForCoordinate(const FixedPointCoordinate &input_coordinate,
|
||||||
|
@ -143,4 +143,19 @@ Feature: Testbot - Mode flag
|
|||||||
When I route I should get
|
When I route I should get
|
||||||
| waypoints | route | modes |
|
| waypoints | route | modes |
|
||||||
| a,0,d | ab,bc,cd | 1,3,1 |
|
| 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 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 |
|
||||||
|
@ -18,6 +18,7 @@ speed_profile = {
|
|||||||
["primary"] = 36,
|
["primary"] = 36,
|
||||||
["secondary"] = 18,
|
["secondary"] = 18,
|
||||||
["tertiary"] = 12,
|
["tertiary"] = 12,
|
||||||
|
["steps"] = 6,
|
||||||
["default"] = 24
|
["default"] = 24
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,7 +82,10 @@ function way_function (way)
|
|||||||
way.backward_mode = 4
|
way.backward_mode = 4
|
||||||
speed_forw = temp_speed*1.5
|
speed_forw = temp_speed*1.5
|
||||||
speed_back = temp_speed/1.5
|
speed_back = temp_speed/1.5
|
||||||
end
|
elseif highway == "steps" then
|
||||||
|
way.mode = 5
|
||||||
|
way.backward_mode = 6
|
||||||
|
end
|
||||||
|
|
||||||
if maxspeed_forward ~= nil and maxspeed_forward > 0 then
|
if maxspeed_forward ~= nil and maxspeed_forward > 0 then
|
||||||
speed_forw = maxspeed_forward
|
speed_forw = maxspeed_forward
|
||||||
|
Loading…
Reference in New Issue
Block a user