update car profile, add ferry mode
This commit is contained in:
parent
418ff95543
commit
3d94638d86
@ -17,12 +17,12 @@ Feature: Car - 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 |
|
||||||
|
@ -48,6 +48,11 @@ local max = math.max
|
|||||||
|
|
||||||
local speed_reduction = 0.8
|
local speed_reduction = 0.8
|
||||||
|
|
||||||
|
--modes
|
||||||
|
local mode_normal = 1
|
||||||
|
local mode_ferry = 2
|
||||||
|
|
||||||
|
|
||||||
local function find_access_tag(source,access_tags_hierachy)
|
local function find_access_tag(source,access_tags_hierachy)
|
||||||
for i,v in ipairs(access_tags_hierachy) do
|
for i,v in ipairs(access_tags_hierachy) do
|
||||||
local has_tag = source.tags:Holds(v)
|
local has_tag = source.tags:Holds(v)
|
||||||
@ -169,8 +174,10 @@ function way_function (way)
|
|||||||
if durationIsValid(duration) then
|
if durationIsValid(duration) then
|
||||||
way.duration = max( parseDuration(duration), 1 );
|
way.duration = max( parseDuration(duration), 1 );
|
||||||
end
|
end
|
||||||
way.direction = Way.bidirectional
|
way.forward_mode = mode_ferry
|
||||||
|
way.backward_mode = mode_ferry
|
||||||
way.forward_speed = route_speed
|
way.forward_speed = route_speed
|
||||||
|
way.backward_speed = route_speed
|
||||||
end
|
end
|
||||||
|
|
||||||
-- leave early of this way is not accessible
|
-- leave early of this way is not accessible
|
||||||
@ -237,17 +244,16 @@ function way_function (way)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Set direction according to tags on way
|
-- Set direction according to tags on way
|
||||||
way.direction = Way.bidirectional
|
|
||||||
if obey_oneway then
|
if obey_oneway then
|
||||||
if oneway == "-1" then
|
if oneway == "-1" then
|
||||||
way.direction = Way.opposite
|
way.forward_mode = 0
|
||||||
elseif oneway == "yes" or
|
elseif oneway == "yes" or
|
||||||
oneway == "1" or
|
oneway == "1" or
|
||||||
oneway == "true" or
|
oneway == "true" or
|
||||||
junction == "roundabout" or
|
junction == "roundabout" or
|
||||||
(highway == "motorway_link" and oneway ~="no") or
|
(highway == "motorway_link" and oneway ~="no") or
|
||||||
(highway == "motorway" and oneway ~= "no") then
|
(highway == "motorway" and oneway ~= "no") then
|
||||||
way.direction = Way.oneway
|
way.backward_mode = 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -255,7 +261,7 @@ function way_function (way)
|
|||||||
local maxspeed_forward = parse_maxspeed(way.tags:Find( "maxspeed:forward"))
|
local maxspeed_forward = parse_maxspeed(way.tags:Find( "maxspeed:forward"))
|
||||||
local maxspeed_backward = parse_maxspeed(way.tags:Find( "maxspeed:backward"))
|
local maxspeed_backward = parse_maxspeed(way.tags:Find( "maxspeed:backward"))
|
||||||
if maxspeed_forward > 0 then
|
if maxspeed_forward > 0 then
|
||||||
if Way.bidirectional == way.direction then
|
if 0 ~= way.forward_mode and 0 ~= way.backward_mode then
|
||||||
way.backward_speed = way.forward_speed
|
way.backward_speed = way.forward_speed
|
||||||
end
|
end
|
||||||
way.forward_speed = maxspeed_forward
|
way.forward_speed = maxspeed_forward
|
||||||
|
Loading…
Reference in New Issue
Block a user