fix incomplete implementation of movable bridges in bike profiles, plenty of regressions
This commit is contained in:
parent
023dd3e880
commit
878c49e4e1
@ -18,14 +18,14 @@ Feature: Bicycle - Handle movable bridge
|
|||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route | modes |
|
| from | to | route | modes |
|
||||||
| a | g | abc,cde,efg | 1,3,1 |
|
| a | g | abc,cde,efg | 1,5,1 |
|
||||||
| b | f | abc,cde,efg | 1,3,1 |
|
| b | f | abc,cde,efg | 1,5,1 |
|
||||||
| e | c | cde | 3 |
|
| e | c | cde | 5 |
|
||||||
| e | b | cde,abc | 3,1 |
|
| e | b | cde,abc | 5,1 |
|
||||||
| e | a | cde,abc | 3,1 |
|
| e | a | cde,abc | 5,1 |
|
||||||
| c | e | cde | 3 |
|
| c | e | cde | 5 |
|
||||||
| c | f | cde,efg | 3,1 |
|
| c | f | cde,efg | 5,1 |
|
||||||
| c | g | cde,efg | 3,1 |
|
| c | g | cde,efg | 5,1 |
|
||||||
|
|
||||||
Scenario: Car - Properly handle durations
|
Scenario: Car - Properly handle durations
|
||||||
Given the node map
|
Given the node map
|
||||||
@ -41,7 +41,7 @@ Feature: Bicycle - Handle movable bridge
|
|||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route | modes | speed |
|
| from | to | route | modes | speed |
|
||||||
| a | g | abc,cde,efg | 1,3,1 | 6 km/h |
|
| a | g | abc,cde,efg | 1,5,1 | 5 km/h |
|
||||||
| b | f | abc,cde,efg | 1,3,1 | 4 km/h |
|
| b | f | abc,cde,efg | 1,5,1 | 3 km/h |
|
||||||
| c | e | cde | 3 | 2 km/h |
|
| c | e | cde | 5 | 2 km/h |
|
||||||
| e | c | cde | 3 | 2 km/h |
|
| e | c | cde | 5 | 2 km/h |
|
||||||
|
@ -66,6 +66,10 @@ route_speeds = {
|
|||||||
["ferry"] = 5
|
["ferry"] = 5
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bridge_speeds = {
|
||||||
|
["movable"] = 5
|
||||||
|
}
|
||||||
|
|
||||||
surface_speeds = {
|
surface_speeds = {
|
||||||
["asphalt"] = default_speed,
|
["asphalt"] = default_speed,
|
||||||
["cobblestone:flattened"] = 10,
|
["cobblestone:flattened"] = 10,
|
||||||
@ -102,7 +106,7 @@ mode_normal = 1
|
|||||||
mode_pushing = 2
|
mode_pushing = 2
|
||||||
mode_ferry = 3
|
mode_ferry = 3
|
||||||
mode_train = 4
|
mode_train = 4
|
||||||
|
mode_movable_bridge = 5
|
||||||
|
|
||||||
local function parse_maxspeed(source)
|
local function parse_maxspeed(source)
|
||||||
if not source then
|
if not source then
|
||||||
@ -159,12 +163,14 @@ function way_function (way, result)
|
|||||||
local railway = way:get_value_by_key("railway")
|
local railway = way:get_value_by_key("railway")
|
||||||
local amenity = way:get_value_by_key("amenity")
|
local amenity = way:get_value_by_key("amenity")
|
||||||
local public_transport = way:get_value_by_key("public_transport")
|
local public_transport = way:get_value_by_key("public_transport")
|
||||||
|
local bridge = way:get_value_by_key("bridge")
|
||||||
if (not highway or highway == '') and
|
if (not highway or highway == '') and
|
||||||
(not route or route == '') and
|
(not route or route == '') and
|
||||||
(not railway or railway=='') and
|
(not railway or railway=='') and
|
||||||
(not amenity or amenity=='') and
|
(not amenity or amenity=='') and
|
||||||
(not man_made or man_made=='') and
|
(not man_made or man_made=='') and
|
||||||
(not public_transport or public_transport=='')
|
(not public_transport or public_transport=='') and
|
||||||
|
(not bridge or bridge=='')
|
||||||
then
|
then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -219,12 +225,11 @@ function way_function (way, result)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- speed
|
-- speed
|
||||||
local bridge_speed = bicycle_speeds[bridge]
|
local bridge_speed = bridge_speeds[bridge]
|
||||||
if (bridge_speed and bridge_speed > 0) then
|
if (bridge_speed and bridge_speed > 0) then
|
||||||
highway = bridge;
|
highway = bridge;
|
||||||
local duration = way:get_value_by_key("duration")
|
|
||||||
if duration and durationIsValid(duration) then
|
if duration and durationIsValid(duration) then
|
||||||
result.duration = max( parseDuration(duration), 1 );
|
result.duration = math.max( parseDuration(duration), 1 );
|
||||||
end
|
end
|
||||||
result.forward_mode = mode_movable_bridge
|
result.forward_mode = mode_movable_bridge
|
||||||
result.backward_mode = mode_movable_bridge
|
result.backward_mode = mode_movable_bridge
|
||||||
|
Loading…
Reference in New Issue
Block a user