Skip to content

Commit

Permalink
add is_stop to ExtractionTurn, expose it to lua's process_turn and ad…
Browse files Browse the repository at this point in the history
…d tests testing intersection node tags
  • Loading branch information
chaupow committed Jan 24, 2018
1 parent 61e06fc commit c6b0d47
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 2 deletions.
42 changes: 42 additions & 0 deletions features/options/extract/turn_function.feature
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ Feature: Turn Function Information
end
function print_turn (profile, turn)
print ('is_stop ' .. string.format("%s", tostring(turn.is_stop)))
print ('source_restricted ' .. string.format("%s", tostring(turn.source_restricted)))
print ('source_is_motorway ' .. string.format("%s", tostring(turn.source_is_motorway)))
print ('source_is_link ' .. string.format("%s", tostring(turn.source_is_link)))
Expand Down Expand Up @@ -173,4 +174,45 @@ Feature: Turn Function Information



Scenario: Turns should show if intersection node is tagged with highway=stop
Given the node map
"""
a-b-c
"""
And the ways
| nodes | oneway |
| ab | yes |
| bc | yes |
And the nodes
| node | highway |
| b | stop |

And the data has been saved to disk

When I run "osrm-extract --profile {profile_file} {osm_file}"
Then it should exit successfully
And stdout should contain "is_stop true"


Scenario: Turns should not claim there is stop if there is not
Given the node map
"""
a-b-c
"""
And the ways
| nodes | oneway |
| ab | yes |
| bc | yes |
And the nodes
| node | highway |
| b | - |

And the data has been saved to disk

When I run "osrm-extract --profile {profile_file} {osm_file}"
Then it should exit successfully
And stdout should contain "is_stop false"




5 changes: 3 additions & 2 deletions include/extractor/extraction_turn.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ struct ExtractionTurn
bool is_u_turn,
bool has_traffic_light,
bool is_left_hand_driving,
bool is_stop,
bool source_restricted,
TravelMode source_mode,
bool source_is_motorway,
bool source_is_link,

int source_number_of_lanes,
int source_highway_turn_classification,
int source_access_turn_classification,
Expand All @@ -69,7 +69,7 @@ struct ExtractionTurn
const std::vector<ExtractionTurnLeg> &roads_on_the_right,
const std::vector<ExtractionTurnLeg> &roads_on_the_left)
: angle(180. - angle), number_of_roads(number_of_roads), is_u_turn(is_u_turn),
has_traffic_light(has_traffic_light), is_left_hand_driving(is_left_hand_driving),
has_traffic_light(has_traffic_light), is_left_hand_driving(is_left_hand_driving), is_stop(is_stop),

source_restricted(source_restricted), source_mode(source_mode),
source_is_motorway(source_is_motorway), source_is_link(source_is_link),
Expand All @@ -95,6 +95,7 @@ struct ExtractionTurn
const bool is_u_turn;
const bool has_traffic_light;
const bool is_left_hand_driving;
const bool is_stop;

// source info
const bool source_restricted;
Expand Down
1 change: 1 addition & 0 deletions src/extractor/edge_based_graph_factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,7 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
is_traffic_light,
m_edge_based_node_container.GetAnnotation(edge_data1.annotation_data)
.is_left_hand_driving,
false, // @CHAUTODO is_stop
// source info
edge_data1.flags.restricted,
m_edge_based_node_container.GetAnnotation(edge_data1.annotation_data).travel_mode,
Expand Down
1 change: 1 addition & 0 deletions src/extractor/graph_compressor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ void GraphCompressor::Compress(
true,
false,
false,
false,
TRAVEL_MODE_DRIVING,
false,
false,
Expand Down
2 changes: 2 additions & 0 deletions src/extractor/scripting_environment_lua.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,8 @@ void Sol2ScriptingEnvironment::InitContext(LuaScriptingContext &context)
&ExtractionTurn::has_traffic_light,
"is_left_hand_driving",
&ExtractionTurn::is_left_hand_driving,
"is_stop",
&ExtractionTurn::is_stop,

"source_restricted",
&ExtractionTurn::source_restricted,
Expand Down

0 comments on commit c6b0d47

Please sign in to comment.