orchidmap-front/osrm/lib/maxspeed.lua
2018-08-27 15:51:26 +07:00

19 lines
459 B
Lua

local math = math
local MaxSpeed = {}
function MaxSpeed.limit(way,max,maxf,maxb)
if maxf and maxf>0 then
way.forward_speed = math.min(way.forward_speed, maxf)
elseif max and max>0 then
way.forward_speed = math.min(way.forward_speed, max)
end
if maxb and maxb>0 then
way.backward_speed = math.min(way.backward_speed, maxb)
elseif max and max>0 then
way.backward_speed = math.min(way.backward_speed, max)
end
end
return MaxSpeed