maxspeed:forward and :backward get parsed and tests pass. Implements
#569 partially.
This commit is contained in:
parent
2707001a3a
commit
54cdf6d6f2
@ -32,13 +32,12 @@ Feature: Bike - Max speed restrictions
|
|||||||
| a | b | ab | 20s ~5% |
|
| a | b | ab | 20s ~5% |
|
||||||
| b | c | bc | 20s ~5% |
|
| b | c | bc | 20s ~5% |
|
||||||
|
|
||||||
@todo
|
|
||||||
Scenario: Bike - Forward/backward maxspeed
|
Scenario: Bike - Forward/backward maxspeed
|
||||||
Given the shortcuts
|
Given the shortcuts
|
||||||
| key | value |
|
| key | value |
|
||||||
| bike | 43s ~10% |
|
| bike | 43s ~10% |
|
||||||
| run | 73s ~10% |
|
| run | 73s ~10% |
|
||||||
| walk | 170s ~10% |
|
| walk | 145s ~10% |
|
||||||
| snail | 720s ~10% |
|
| snail | 720s ~10% |
|
||||||
|
|
||||||
Then routability should be
|
Then routability should be
|
||||||
|
@ -33,13 +33,12 @@ Feature: Car - Max speed restrictions
|
|||||||
| a | b | ab | 144s ~10% |
|
| a | b | ab | 144s ~10% |
|
||||||
| b | c | bc | 144s ~10% |
|
| b | c | bc | 144s ~10% |
|
||||||
|
|
||||||
@todo
|
|
||||||
Scenario: Car - Forward/backward maxspeed
|
Scenario: Car - Forward/backward maxspeed
|
||||||
Given the shortcuts
|
Given the shortcuts
|
||||||
| key | value |
|
| key | value |
|
||||||
| car | 12s ~10% |
|
| car | 12s ~10% |
|
||||||
| run | 73s ~10% |
|
| run | 73s ~10% |
|
||||||
| walk | 170s ~10% |
|
| walk | 146s ~10% |
|
||||||
| snail | 720s ~10% |
|
| snail | 720s ~10% |
|
||||||
|
|
||||||
And a grid size of 100 meters
|
And a grid size of 100 meters
|
||||||
|
@ -143,6 +143,8 @@ function way_function (way, numberOfNodesInWay)
|
|||||||
local ref = way.tags:Find("ref")
|
local ref = way.tags:Find("ref")
|
||||||
local junction = way.tags:Find("junction")
|
local junction = way.tags:Find("junction")
|
||||||
local maxspeed = parseMaxspeed(way.tags:Find ( "maxspeed") )
|
local maxspeed = parseMaxspeed(way.tags:Find ( "maxspeed") )
|
||||||
|
local maxspeed_forward = tonumber(way.tags:Find( "maxspeed:forward"))
|
||||||
|
local maxspeed_backward = tonumber(way.tags:Find( "maxspeed:backward"))
|
||||||
local barrier = way.tags:Find("barrier")
|
local barrier = way.tags:Find("barrier")
|
||||||
local oneway = way.tags:Find("oneway")
|
local oneway = way.tags:Find("oneway")
|
||||||
local onewayClass = way.tags:Find("oneway:bicycle")
|
local onewayClass = way.tags:Find("oneway:bicycle")
|
||||||
@ -287,6 +289,19 @@ function way_function (way, numberOfNodesInWay)
|
|||||||
way.speed = math.min(way.speed, maxspeed)
|
way.speed = math.min(way.speed, maxspeed)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Override speed settings if explicit forward/backward maxspeeds are given
|
||||||
|
if maxspeed_forward ~= nil and maxspeed_forward > 0 then
|
||||||
|
if Way.bidirectional == way.direction then
|
||||||
|
way.backward_speed = way.speed
|
||||||
|
end
|
||||||
|
way.speed = maxspeed_forward
|
||||||
|
end
|
||||||
|
if maxspeed_backward ~= nil and maxspeed_backward > 0 then
|
||||||
|
way.backward_speed = maxspeed_backward
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
way.type = 1
|
way.type = 1
|
||||||
return 1
|
return 1
|
||||||
|
@ -102,6 +102,8 @@ function way_function (way, numberOfNodesInWay)
|
|||||||
local junction = way.tags:Find("junction")
|
local junction = way.tags:Find("junction")
|
||||||
local route = way.tags:Find("route")
|
local route = way.tags:Find("route")
|
||||||
local maxspeed = parse_maxspeed(way.tags:Find ( "maxspeed") )
|
local maxspeed = parse_maxspeed(way.tags:Find ( "maxspeed") )
|
||||||
|
local maxspeed_forward = tonumber(way.tags:Find( "maxspeed:forward"))
|
||||||
|
local maxspeed_backward = tonumber(way.tags:Find( "maxspeed:backward"))
|
||||||
local barrier = way.tags:Find("barrier")
|
local barrier = way.tags:Find("barrier")
|
||||||
local oneway = way.tags:Find("oneway")
|
local oneway = way.tags:Find("oneway")
|
||||||
local cycleway = way.tags:Find("cycleway")
|
local cycleway = way.tags:Find("cycleway")
|
||||||
@ -157,7 +159,7 @@ function way_function (way, numberOfNodesInWay)
|
|||||||
end
|
end
|
||||||
way.speed = math.min(speed_profile[highway], maxspeed)
|
way.speed = math.min(speed_profile[highway], maxspeed)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Set the avg speed on ways that are marked accessible
|
-- Set the avg speed on ways that are marked accessible
|
||||||
if "" ~= highway and access_tag_whitelist[access] and way.speed == -1 then
|
if "" ~= highway and access_tag_whitelist[access] and way.speed == -1 then
|
||||||
if 0 == maxspeed then
|
if 0 == maxspeed then
|
||||||
@ -190,7 +192,18 @@ function way_function (way, numberOfNodesInWay)
|
|||||||
else
|
else
|
||||||
way.direction = Way.bidirectional
|
way.direction = Way.bidirectional
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Override speed settings if explicit forward/backward maxspeeds are given
|
||||||
|
if maxspeed_forward ~= nil and maxspeed_forward > 0 then
|
||||||
|
if Way.bidirectional == way.direction then
|
||||||
|
way.backward_speed = way.speed
|
||||||
|
end
|
||||||
|
way.speed = maxspeed_forward
|
||||||
|
end
|
||||||
|
if maxspeed_backward ~= nil and maxspeed_backward > 0 then
|
||||||
|
way.backward_speed = maxspeed_backward
|
||||||
|
end
|
||||||
|
|
||||||
-- Override general direction settings of there is a specific one for our mode of travel
|
-- 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
|
if ignore_in_grid[highway] ~= nil and ignore_in_grid[highway] then
|
||||||
|
Loading…
Reference in New Issue
Block a user