Fixes issue #461 and cucumber tests
This commit is contained in:
parent
77c9f96f44
commit
2798c5a48d
@ -1,6 +1,6 @@
|
|||||||
-- Begin of globals
|
-- Begin of globals
|
||||||
|
|
||||||
bollards_whitelist = { [""] = true, ["cattle_grid"] = true, ["border_control"] = true, ["toll_booth"] = true, ["no"] = true, ["sally_port"] = true, ["gate"] = true}
|
barrier_whitelist = { ["cattle_grid"] = true, ["border_control"] = true, ["toll_booth"] = true, ["no"] = true, ["sally_port"] = true, ["gate"] = true}
|
||||||
access_tag_whitelist = { ["yes"] = true, ["motorcar"] = true, ["motor_vehicle"] = true, ["vehicle"] = true, ["permissive"] = true, ["designated"] = true }
|
access_tag_whitelist = { ["yes"] = true, ["motorcar"] = true, ["motor_vehicle"] = true, ["vehicle"] = true, ["permissive"] = true, ["designated"] = true }
|
||||||
access_tag_blacklist = { ["no"] = true, ["private"] = true, ["agricultural"] = true, ["forestery"] = true }
|
access_tag_blacklist = { ["no"] = true, ["private"] = true, ["agricultural"] = true, ["forestery"] = true }
|
||||||
access_tag_restricted = { ["destination"] = true, ["delivery"] = true }
|
access_tag_restricted = { ["destination"] = true, ["delivery"] = true }
|
||||||
@ -50,39 +50,20 @@ function node_function (node)
|
|||||||
node.traffic_light = true;
|
node.traffic_light = true;
|
||||||
end
|
end
|
||||||
|
|
||||||
if access_tag_blacklist[barrier] then
|
if "" ~= barrier and obey_bollards then
|
||||||
node.bollard = true;
|
node.bollard = true; -- flag as unpassable and then check
|
||||||
|
|
||||||
|
if "yes" == access then
|
||||||
|
node.bollard = false;
|
||||||
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if "" ~= barrier then
|
|
||||||
if obey_bollards then
|
|
||||||
--flag node as unpassable if it black listed as unpassable
|
|
||||||
node.bollard = true;
|
|
||||||
end
|
|
||||||
--reverse the previous flag if there is an access tag specifying entrance
|
--reverse the previous flag if there is an access tag specifying entrance
|
||||||
if node.bollard and bollards_whitelist[barrier] and access_tag_whitelist[barrier] then
|
if node.bollard and (barrier_whitelist[barrier] or access_tag_whitelist[access]) then
|
||||||
node.bollard = false;
|
node.bollard = false;
|
||||||
return 1
|
|
||||||
end
|
|
||||||
-- Check if our vehicle types are allowd to pass the barrier
|
|
||||||
for i,v in ipairs(access_tags) do
|
|
||||||
local mode_value = node.tags:Find(v)
|
|
||||||
if nil ~= mode_value and "yes" == mode_value then
|
|
||||||
node.bollard = false
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
|
||||||
-- Check if our vehicle types are forbidden to pass the node
|
|
||||||
for i,v in ipairs(access_tags) do
|
|
||||||
local mode_value = node.tags:Find(v)
|
|
||||||
if nil ~= mode_value and "no" == mode_value then
|
|
||||||
node.bollard = true
|
|
||||||
return 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return 1
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function way_function (way, numberOfNodesInWay)
|
function way_function (way, numberOfNodesInWay)
|
||||||
|
Loading…
Reference in New Issue
Block a user