add support for movable bridges in the biking profile, cf #1399

This commit is contained in:
Dennis Luxen 2015-02-26 16:28:04 +01:00
parent dd5f926077
commit 6b88856c16
2 changed files with 59 additions and 1 deletions

View File

@ -0,0 +1,47 @@
@routing @bicycle @bridge
Feature: Bicycle - Handle movable bridge
Background:
Given the profile "bicycle"
Scenario: Car - Use a ferry route
Given the node map
| a | b | c | | |
| | | d | | |
| | | e | f | g |
And the ways
| nodes | highway | bridge | bicycle |
| abc | primary | | |
| cde | | movable | yes |
| efg | primary | | |
When I route I should get
| from | to | route | modes |
| a | g | abc,cde,efg | 1,3,1 |
| b | f | abc,cde,efg | 1,3,1 |
| e | c | cde | 3 |
| e | b | cde,abc | 3,1 |
| e | a | cde,abc | 3,1 |
| c | e | cde | 3 |
| c | f | cde,efg | 3,1 |
| c | g | cde,efg | 3,1 |
Scenario: Car - Properly handle durations
Given the node map
| a | b | c | | |
| | | d | | |
| | | e | f | g |
And the ways
| nodes | highway | bridge | duration |
| abc | primary | | |
| cde | | movable | 00:05:00 |
| efg | primary | | |
When I route I should get
| from | to | route | modes | speed |
| a | g | abc,cde,efg | 1,3,1 | 6 km/h |
| b | f | abc,cde,efg | 1,3,1 | 4 km/h |
| c | e | cde | 3 | 2 km/h |
| e | c | cde | 3 | 2 km/h |

View File

@ -219,7 +219,18 @@ function way_function (way, result)
end
-- speed
if route_speeds[route] then
local bridge_speed = speed_profile[bridge]
if (bridge_speed and bridge_speed > 0) then
highway = bridge;
local duration = way:get_value_by_key("duration")
if duration and durationIsValid(duration) then
result.duration = max( parseDuration(duration), 1 );
end
result.forward_mode = mode_movable_bridge
result.backward_mode = mode_movable_bridge
result.forward_speed = bridge_speed
result.backward_speed = bridge_speed
elseif route_speeds[route] then
-- ferries (doesn't cover routes tagged using relations)
result.forward_mode = mode_ferry
result.backward_mode = mode_ferry