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
+3 -15
View File
@@ -1,21 +1,9 @@
local GiveWay = {}
TrafficFlowControlNode = require("lib/traffic_flow_control_node")
function GiveWay.get_value(node)
local tag = node:get_value_by_key("highway")
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
return TrafficFlowControlNode.get_value(node, "give_way")
end
return GiveWay
+3 -14
View File
@@ -1,20 +1,9 @@
local StopSign = {}
TrafficFlowControlNode = require("lib/traffic_flow_control_node")
function StopSign.get_value(node)
local tag = node:get_value_by_key("highway")
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
return TrafficFlowControlNode.get_value(node, "stop")
end
return StopSign
@@ -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