first round of handlers

This commit is contained in:
Emil Tin
2017-02-04 23:50:00 +01:00
committed by Patrick Niklaus
parent 3abab16bf3
commit d81ef3f4db
2 changed files with 92 additions and 56 deletions
+15 -3
View File
@@ -65,9 +65,15 @@ end
-- determine if this way can be used as a start/end point for routing
function Handlers.handle_startpoint(way,result,data,profile)
-- only allow this road as start point if it not a ferry
result.is_startpoint = result.forward_mode == profile.default_mode or
result.backward_mode == profile.default_mode
-- if profile specifies set of allowed start modes, then check for that
-- otherwise require default mode
if profile.allowed_start_modes then
result.is_startpoint = profile.allowed_start_modes[result.forward_mode] == true or
profile.allowed_start_modes[result.backward_mode] == true
else
result.is_startpoint = result.forward_mode == profile.default_mode or
result.backward_mode == profile.default_mode
end
end
-- handle turn lanes
@@ -431,6 +437,12 @@ function Handlers.handle_blocked_ways(way,result,data,profile)
return false
end
-- construction
-- TODO if highway is valid then we shouldn't check railway, and vica versa
if profile.avoid.construction and (data.highway == 'construction' or way:get_value_by_key('railway') == 'construction') then
return false
end
-- Reversible oneways change direction with low frequency (think twice a day):
-- do not route over these at all at the moment because of time dependence.
-- Note: alternating (high frequency) oneways are handled below with penalty.