Take stop signs into account during routing

This commit is contained in:
Siarhei Fedartsou 2022-10-31 21:45:20 +01:00
parent be1b86657c
commit b887e72d0b
5 changed files with 29 additions and 38 deletions

View File

@ -1,7 +1,6 @@
@routing @testbot @turn_function @routing @testbot @turn_function
Feature: Turn Function Information Feature: Turn Function Information
// TODO
Background: Background:
Given the profile file Given the profile file
""" """

View File

@ -11,14 +11,8 @@ namespace osrm
namespace extractor namespace extractor
{ {
// Stop Signs tagged on nodes can be present or not. In addition Stop Signs have // The direction annotation is extracted from node tags.
// an optional way direction they apply to. If the direction is unknown from the // The directions in which traffic flow object applies are relative to the way containing the node.
// data we have to compute by checking the distance to the next intersection.
//
// Impl. detail: namespace + enum instead of enum class to make Luabind happy
// The traffic light annotation is extracted from node tags.
// The directions in which the traffic light applies are relative to the way containing the node.
enum class TrafficFlowControlNodeDirection : std::uint8_t enum class TrafficFlowControlNodeDirection : std::uint8_t
{ {
NONE = 0, NONE = 0,

View File

@ -1,21 +1,9 @@
local GiveWay = {} local GiveWay = {}
TrafficFlowControlNode = require("lib/traffic_flow_control_node")
function GiveWay.get_value(node) function GiveWay.get_value(node)
local tag = node:get_value_by_key("highway") return TrafficFlowControlNode.get_value(node, "give_way")
if "give_way" == tag then
local direction = node:get_value_by_key("direction")
if direction then
if "forward" == direction then
return traffic_flow_control_direction.direction_forward
end
if "backward" == direction then
return traffic_flow_control_direction.direction_reverse
end
end
return traffic_flow_control_direction.direction_all
end
return traffic_flow_control_direction.none
end end
return GiveWay return GiveWay

View File

@ -1,20 +1,9 @@
local StopSign = {} local StopSign = {}
TrafficFlowControlNode = require("lib/traffic_flow_control_node")
function StopSign.get_value(node) function StopSign.get_value(node)
local tag = node:get_value_by_key("highway") return TrafficFlowControlNode.get_value(node, "stop")
if "stop" == tag then
local direction = node:get_value_by_key("direction")
if direction then
if "forward" == direction then
return traffic_flow_control_direction.direction_forward
end
if "backward" == direction then
return traffic_flow_control_direction.direction_reverse
end
end
return traffic_flow_control_direction.direction_all
end
return traffic_flow_control_direction.none
end end
return StopSign return StopSign

View File

@ -0,0 +1,21 @@
local TrafficFlowControlNode = {}
function TrafficFlowControlNode.get_value(node, tag_name)
local tag = node:get_value_by_key("highway")
if tag_name == tag then
local direction = node:get_value_by_key("direction")
if direction then
if "forward" == direction then
return traffic_flow_control_direction.direction_forward
end
if "backward" == direction then
return traffic_flow_control_direction.direction_reverse
end
end
return traffic_flow_control_direction.direction_all
end
return traffic_flow_control_direction.none
end
return TrafficFlowControlNode