Fixes issue #461 and cucumber tests

This commit is contained in:
DennisOSRM 2012-10-01 10:52:56 +02:00
parent 77c9f96f44
commit 2798c5a48d

View File

@ -1,6 +1,6 @@
-- 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_blacklist = { ["no"] = true, ["private"] = true, ["agricultural"] = true, ["forestery"] = true }
access_tag_restricted = { ["destination"] = true, ["delivery"] = true }
@ -50,39 +50,20 @@ function node_function (node)
node.traffic_light = true;
end
if access_tag_blacklist[barrier] then
node.bollard = true;
if "" ~= barrier and obey_bollards then
node.bollard = true; -- flag as unpassable and then check
if "yes" == access then
node.bollard = false;
return
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
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;
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
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
function way_function (way, numberOfNodesInWay)