refactored some parameter setting
This commit is contained in:
parent
9d6bd91279
commit
48cb374d94
@ -90,7 +90,25 @@ end
|
||||
|
||||
|
||||
function way_function (way)
|
||||
-- First, get the properties of each way that we come across
|
||||
-- we dont route over areas
|
||||
local area = way.tags:Find("area")
|
||||
if ignore_areas and ("yes" == area) then
|
||||
return 0
|
||||
end
|
||||
|
||||
-- check if oneway tag is unsupported
|
||||
local oneway = way.tags:Find("oneway")
|
||||
if "reversible" == oneway then
|
||||
return 0
|
||||
end
|
||||
|
||||
-- Check if we are allowed to access the way
|
||||
local access = Access.find_access_tag(way, access_tags_hierachy)
|
||||
if access_tag_blacklist[access] then
|
||||
return 0
|
||||
end
|
||||
|
||||
-- Second, parse the way according to these properties
|
||||
local highway = way.tags:Find("highway")
|
||||
local name = way.tags:Find("name")
|
||||
local ref = way.tags:Find("ref")
|
||||
@ -100,23 +118,10 @@ function way_function (way)
|
||||
local maxspeed_forward = parse_maxspeed(way.tags:Find( "maxspeed:forward"))
|
||||
local maxspeed_backward = parse_maxspeed(way.tags:Find( "maxspeed:backward"))
|
||||
local barrier = way.tags:Find("barrier")
|
||||
local oneway = way.tags:Find("oneway")
|
||||
local cycleway = way.tags:Find("cycleway")
|
||||
local duration = way.tags:Find("duration")
|
||||
local service = way.tags:Find("service")
|
||||
local area = way.tags:Find("area")
|
||||
local access = Access.find_access_tag(way, access_tags_hierachy)
|
||||
|
||||
-- Second, parse the way according to these properties
|
||||
|
||||
if ignore_areas and ("yes" == area) then
|
||||
return 0
|
||||
end
|
||||
|
||||
-- Check if we are allowed to access the way
|
||||
if access_tag_blacklist[access] then
|
||||
return 0
|
||||
end
|
||||
|
||||
-- Set the name that will be used for instructions
|
||||
if "" ~= ref then
|
||||
@ -176,18 +181,13 @@ function way_function (way)
|
||||
end
|
||||
|
||||
-- Set direction according to tags on way
|
||||
if obey_oneway then
|
||||
if oneway == "no" or oneway == "0" or oneway == "false" then
|
||||
way.direction = Way.bidirectional
|
||||
elseif oneway == "-1" then
|
||||
if obey_oneway then
|
||||
if oneway == "-1" then
|
||||
way.direction = Way.opposite
|
||||
elseif oneway == "yes" or oneway == "1" or oneway == "true" or junction == "roundabout" or highway == "motorway_link" or highway == "motorway" then
|
||||
way.direction = Way.oneway
|
||||
else
|
||||
way.direction = Way.bidirectional
|
||||
end
|
||||
else
|
||||
way.direction = Way.bidirectional
|
||||
end
|
||||
|
||||
-- Override speed settings if explicit forward/backward maxspeeds are given
|
||||
@ -202,10 +202,10 @@ function way_function (way)
|
||||
end
|
||||
|
||||
-- Override general direction settings of there is a specific one for our mode of travel
|
||||
|
||||
if ignore_in_grid[highway] ~= nil and ignore_in_grid[highway] then
|
||||
way.ignore_in_grid = true
|
||||
end
|
||||
|
||||
way.type = 1
|
||||
return 1
|
||||
end
|
||||
|
@ -4,8 +4,7 @@ module "Access"
|
||||
|
||||
function find_access_tag(source,access_tags_hierachy)
|
||||
for i,v in ipairs(access_tags_hierachy) do
|
||||
local tag = source.tags:Find(v)
|
||||
if tag ~= '' then
|
||||
if source.tags:Find(v) ~= '' then
|
||||
return tag
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user