wip
This commit is contained in:
@@ -7,6 +7,8 @@ Sequence = require('lib/sequence')
|
||||
Handlers = require("lib/way_handlers")
|
||||
Relations = require("lib/relations")
|
||||
TrafficSignal = require("lib/traffic_signal")
|
||||
StopSign = require("lib/stop_sign")
|
||||
GiveWay = require("lib/give_way")
|
||||
find_access_tag = require("lib/access").find_access_tag
|
||||
limit = require("lib/maxspeed").limit
|
||||
Utils = require("lib/utils")
|
||||
@@ -362,6 +364,12 @@ function process_node(profile, node, result, relations)
|
||||
|
||||
-- check if node is a traffic light
|
||||
result.traffic_lights = TrafficSignal.get_value(node)
|
||||
|
||||
-- check if node is stop sign
|
||||
result.stop_sign = StopSign.get_value(node)
|
||||
|
||||
-- check if node is a give way sign
|
||||
result.give_way = GiveWay.get_value(node)
|
||||
end
|
||||
|
||||
function process_way(profile, way, result, relations)
|
||||
@@ -472,6 +480,9 @@ function process_turn(profile, turn)
|
||||
|
||||
if turn.has_traffic_light then
|
||||
turn.duration = profile.properties.traffic_light_penalty
|
||||
elseif turn.has_stop_sign then
|
||||
-- TODO: use another constant
|
||||
turn.duration = profile.properties.traffic_light_penalty
|
||||
end
|
||||
|
||||
if turn.number_of_roads > 2 or turn.source_mode ~= turn.target_mode or turn.is_u_turn then
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
local GiveWay = {}
|
||||
|
||||
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 give_way.direction_forward
|
||||
end
|
||||
if "backward" == direction then
|
||||
return give_way.direction_reverse
|
||||
end
|
||||
end
|
||||
-- return give_way.direction_all
|
||||
return true
|
||||
end
|
||||
-- return give_way.none
|
||||
return false
|
||||
end
|
||||
|
||||
return GiveWay
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
local StopSign = {}
|
||||
|
||||
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 stop_sign.direction_forward
|
||||
end
|
||||
if "backward" == direction then
|
||||
return stop_sign.direction_reverse
|
||||
end
|
||||
end
|
||||
return stop_sign.direction_all
|
||||
end
|
||||
return stop_sign.none
|
||||
end
|
||||
|
||||
return StopSign
|
||||
|
||||
Reference in New Issue
Block a user