update foot profile, add ferry mode

This commit is contained in:
Emil Tin 2014-08-19 11:32:56 +02:00
parent 3d94638d86
commit 6ee7a81f10
2 changed files with 18 additions and 15 deletions

View File

@ -17,15 +17,15 @@ Feature: Foot - Handle ferry routes
| efg | primary | | | | efg | primary | | |
When I route I should get When I route I should get
| from | to | route | | from | to | route | modes |
| a | g | abc,cde,efg | | a | g | abc,cde,efg | 1,2,1 |
| b | f | abc,cde,efg | | b | f | abc,cde,efg | 1,2,1 |
| e | c | cde | | e | c | cde | 2 |
| e | b | cde,abc | | e | b | cde,abc | 2,1 |
| e | a | cde,abc | | e | a | cde,abc | 2,1 |
| c | e | cde | | c | e | cde | 2 |
| c | f | cde,efg | | c | f | cde,efg | 2,1 |
| c | g | cde,efg | | c | g | cde,efg | 2,1 |
Scenario: Foot - Ferry duration, single node Scenario: Foot - Ferry duration, single node
Given the node map Given the node map

View File

@ -63,6 +63,10 @@ traffic_signal_penalty = 2
u_turn_penalty = 2 u_turn_penalty = 2
use_turn_restrictions = false use_turn_restrictions = false
--modes
local mode_normal = 1
local mode_ferry = 2
function get_exceptions(vector) function get_exceptions(vector)
for i,v in ipairs(restriction_exception_tags) do for i,v in ipairs(restriction_exception_tags) do
vector:Add(v) vector:Add(v)
@ -156,13 +160,14 @@ function way_function (way)
-- speed -- speed
if route_speeds[route] then if route_speeds[route] then
-- ferries (doesn't cover routes tagged using relations) -- ferries (doesn't cover routes tagged using relations)
way.direction = Way.bidirectional
way.ignore_in_grid = true way.ignore_in_grid = true
if durationIsValid(duration) then if durationIsValid(duration) then
way.duration = math.max( 1, parseDuration(duration) ) way.duration = math.max( 1, parseDuration(duration) )
else else
way.forward_speed = route_speeds[route] way.forward_speed = route_speeds[route]
end end
way.forward_mode = mode_ferry
way.backward_mode = mode_ferry
elseif railway and platform_speeds[railway] then elseif railway and platform_speeds[railway] then
-- railway platforms (old tagging scheme) -- railway platforms (old tagging scheme)
way.forward_speed = platform_speeds[railway] way.forward_speed = platform_speeds[railway]
@ -182,13 +187,11 @@ function way_function (way)
-- oneway -- oneway
if onewayClass == "yes" or onewayClass == "1" or onewayClass == "true" then if onewayClass == "yes" or onewayClass == "1" or onewayClass == "true" then
way.direction = Way.oneway way.backward_mode = 0
elseif onewayClass == "no" or onewayClass == "0" or onewayClass == "false" then elseif onewayClass == "no" or onewayClass == "0" or onewayClass == "false" then
way.direction = Way.bidirectional -- nothing to do
elseif onewayClass == "-1" then elseif onewayClass == "-1" then
way.direction = Way.opposite way.forward_mode = 0
else
way.direction = Way.bidirectional
end end
-- surfaces -- surfaces