From 25ab51f4f0b10d25d71cf30551041e03aa8eeaf7 Mon Sep 17 00:00:00 2001 From: karenzshea Date: Fri, 3 Feb 2017 13:46:28 +0100 Subject: [PATCH] remove calls to handlers now in handle_penalties --- features/car/traffic_turn_penalties.feature | 16 ++++++++-------- profiles/car.lua | 8 +++----- profiles/lib/handlers.lua | 10 +++++----- 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/features/car/traffic_turn_penalties.feature b/features/car/traffic_turn_penalties.feature index 1f21f42b5..8fca9aa1f 100644 --- a/features/car/traffic_turn_penalties.feature +++ b/features/car/traffic_turn_penalties.feature @@ -53,21 +53,21 @@ Feature: Traffic - turn penalties Scenario: Weighting not based on turn penalty file When I route I should get | from | to | route | speed | time | - | a | h | ad,dhk,dhk | 52 km/h | 14s +-1 | + | a | h | ad,dhk,dhk | 65 km/h | 11s +-1 | # straight - | i | g | fim,fg,fg | 45 km/h | 16s +-1 | + | i | g | fim,fg,fg | 55 km/h | 13s +-1 | # right - | a | e | ad,def,def | 38 km/h | 19s +-1 | + | a | e | ad,def,def | 44 km/h | 16.3s +-1 | # left - | c | g | cd,def,fg,fg | 52 km/h | 27s +-1 | + | c | g | cd,def,fg,fg | 65 km/h | 22s +-1 | # double straight - | p | g | mp,fim,fg,fg | 48 km/h | 29s +-1 | + | p | g | mp,fim,fg,fg | 60 km/h | 24s +-1 | # straight-right - | a | l | ad,dhk,klm,klm | 44 km/h | 33s +-1 | + | a | l | ad,dhk,klm,klm | 53 km/h | 27s +-1 | # straight-left - | l | e | klm,dhk,def,def | 45 km/h | 32s +-1 | + | l | e | klm,dhk,def,def | 55 km/h | 26s +-1 | # double right - | g | n | fg,fim,mn,mn | 38 km/h | 38s +-1 | + | g | n | fg,fim,mn,mn | 44 km/h | 32s +-1 | # double left Scenario: Weighting based on turn penalty file diff --git a/profiles/car.lua b/profiles/car.lua index 14439b48f..4aa839380 100644 --- a/profiles/car.lua +++ b/profiles/car.lua @@ -17,7 +17,7 @@ properties.max_speed_for_map_matching = 180/3.6 -- 180kmph -> m/s properties.use_turn_restrictions = true properties.continue_straight_at_waypoint = true properties.left_hand_driving = false --- For routing based on duration, but weighted for prefering certain roads +-- For routing based on duration, but weighted for preferring certain roads properties.weight_name = 'routability' -- For shortest duration without penalties for accessibility --properties.weight_name = 'duration' @@ -316,10 +316,10 @@ function way_function(way, result) -- access tags, e.g: motorcar, motor_vehicle, vehicle 'handle_access', - -- check whether forward/backward directons are routable + -- check whether forward/backward directions are routable 'handle_oneway', - -- check whether forward/backward directons are routable + -- check whether forward/backward directions are routable 'handle_destinations', -- check whether we're using a special transport mode @@ -334,11 +334,9 @@ function way_function(way, result) -- compute speed taking into account way type, maxspeed tags, etc. 'handle_speed', - 'handle_side_roads', 'handle_surface', 'handle_maxspeed', 'handle_penalties', - 'handle_alternating_speed', -- handle turn lanes and road classification, used for guidance 'handle_turn_lanes', diff --git a/profiles/lib/handlers.lua b/profiles/lib/handlers.lua index 607880a89..4d53e6973 100644 --- a/profiles/lib/handlers.lua +++ b/profiles/lib/handlers.lua @@ -305,17 +305,17 @@ function Handlers.handle_penalties(way,result,data,profile) local sideroad_penalty = 1.0 data.sideroad = way:get_value_by_key("side_road") if "yes" == data.sideroad or "rotary" == data.sideroad then - sideroad_penalty = side_road_multipler; + sideroad_penalty = side_road_multiplier; end local penalty = service_penalty * width_penalty * alternating_penalty * sideroad_penalty if properties.weight_name == 'routability' then if result.forward_speed > 0 then - result.forward_rate = result.forward_speed * penalty + result.forward_rate = result.forward_speed * profile.speed_reduction end if result.backward_speed > 0 then - result.backward_rate = result.backward_speed * penalty + result.backward_rate = result.backward_speed * profile.speed_reduction end if result.duration > 0 then result.weight = result.duration / penalty @@ -331,11 +331,11 @@ function Handlers.handle_maxspeed(way,result,data,profile) backward = Handlers.parse_maxspeed(backward,profile) if forward and forward > 0 then - result.forward_speed = forward * speed_scaling + result.forward_speed = forward * profile.speed_reduction end if backward and backward > 0 then - result.backward_speed = backward * speed_scaling + result.backward_speed = backward * profile.speed_reduction end end