From 8e43c8cbced2724f52ae1b68a843bc252f719673 Mon Sep 17 00:00:00 2001 From: karenzshea Date: Wed, 1 Mar 2017 13:50:53 -0500 Subject: [PATCH] add restricted penalty on NoTurn turns --- features/car/destination.feature | 29 +++++++++++++++++++++++++++++ profiles/car.lua | 12 ++++++------ 2 files changed, 35 insertions(+), 6 deletions(-) diff --git a/features/car/destination.feature b/features/car/destination.feature index 745ecb079..f52058106 100644 --- a/features/car/destination.feature +++ b/features/car/destination.feature @@ -81,3 +81,32 @@ Feature: Car - Destination only, no passing through | e | a | de,cd,bc,ab,ab | | b | d | bc,cd,cd | | d | b | cd,bc,bc | + + Scenario: Car - Routing around a way that becomes destination only + Given the node map + """ + b + \ + e + / + + / d+++++++c--i + | \ + | h--a + f | + \________________g + """ + + And the ways + | nodes | access | oneway | + | ah | | no | + | ihg | | no | + | gfe | | no | + | icde | | no | + | cde | destination | no | + | eb | | no | + + When I route I should get + | from | to | route | # | + | i | b | ihg,ihg,gfe,eb,eb | # goes around access=destination, though restricted way starts at two node intersection| + | b | d | eb,cde,cde | # ends in restricted way correctly | + | b | i | eb,gfe,ihg,ihg | # goes around restricted way correctly | diff --git a/profiles/car.lua b/profiles/car.lua index 07c85dc9d..000c57d2e 100644 --- a/profiles/car.lua +++ b/profiles/car.lua @@ -393,11 +393,11 @@ function turn_function (turn) else turn.weight = turn.duration end - if properties.weight_name == 'routability' then - -- penalize turns from non-local access only segments onto local access only tags - if not turn.source_restricted and turn.target_restricted then - turn.weight = turn.weight + profile.restricted_penalty - end - end + end + if properties.weight_name == 'routability' then + -- penalize turns from non-local access only segments onto local access only tags + if not turn.source_restricted and turn.target_restricted then + turn.weight = turn.weight + profile.restricted_penalty + end end end