From 2c7c18fd24f9a46de04c935126fc29992f57113f Mon Sep 17 00:00:00 2001 From: Daniel Patterson Date: Fri, 15 Feb 2019 19:23:03 -0800 Subject: [PATCH] Fix bug in snapping=any when bearings or radiuses are supplied. --- features/car/startpoint.feature | 63 +++++++++++++++++++++++++++++ include/engine/geospatial_query.hpp | 6 +-- 2 files changed, 65 insertions(+), 4 deletions(-) diff --git a/features/car/startpoint.feature b/features/car/startpoint.feature index 44cc696ab..9e753843b 100644 --- a/features/car/startpoint.feature +++ b/features/car/startpoint.feature @@ -60,3 +60,66 @@ Feature: Car - Allowed start/end modes | from | to | route | | 1 | 2 | ab,bc,cd | | 2 | 1 | cd,bc,ab | + + Scenario: Car - URL override of non-startpoints + Given the node map + """ + a 1 b c 2 d + """ + + Given the query options + | snapping | any | + | bearings | 90,180; | + + And the ways + | nodes | highway | access | + | ab | service | private | + | bc | primary | | + | cd | service | private | + + When I route I should get + | from | to | route | + | 1 | 2 | ab,bc,cd | + | 2 | 1 | cd,bc,ab | + + Scenario: Car - URL override of non-startpoints + Given the node map + """ + a 1 b c 2 d + """ + + Given the query options + | snapping | any | + | radiuses | 100;unlimited | + + And the ways + | nodes | highway | access | + | ab | service | private | + | bc | primary | | + | cd | service | private | + + When I route I should get + | from | to | route | + | 1 | 2 | ab,bc,cd | + | 2 | 1 | cd,bc,ab | + + Scenario: Car - URL override of non-startpoints + Given the node map + """ + a 1 b c 2 d + """ + + Given the query options + | snapping | any | + | bearings | 90,180;0,180;; | + + And the ways + | nodes | highway | access | + | ab | service | private | + | bc | primary | | + | cd | service | private | + + When I request a travel time matrix I should get + | | 2 | c | + | 1 | 59.1 | 35.1 | + | b | 35.1 | 11.1 | \ No newline at end of file diff --git a/include/engine/geospatial_query.hpp b/include/engine/geospatial_query.hpp index 67e2b3b69..b4a05b18d 100644 --- a/include/engine/geospatial_query.hpp +++ b/include/engine/geospatial_query.hpp @@ -327,13 +327,12 @@ template class GeospatialQuery (!has_small_component || (!has_big_component && !IsTinyComponent(segment))); auto use_directions = std::make_pair(use_segment, use_segment); const auto admissible_segments = CheckSegmentExclude(segment); - use_directions = boolPairAnd(use_directions, HasValidEdge(segment, use_all_edges)); if (use_segment) { use_directions = boolPairAnd(CheckSegmentBearing(segment, bearing, bearing_range), - HasValidEdge(segment)); + HasValidEdge(segment, use_all_edges)); use_directions = boolPairAnd(use_directions, admissible_segments); use_directions = boolPairAnd( use_directions, CheckApproach(input_coordinate, segment, approach)); @@ -387,13 +386,12 @@ template class GeospatialQuery (!has_small_component || (!has_big_component && !IsTinyComponent(segment))); auto use_directions = std::make_pair(use_segment, use_segment); const auto admissible_segments = CheckSegmentExclude(segment); - use_directions = boolPairAnd(use_directions, HasValidEdge(segment, use_all_edges)); if (use_segment) { use_directions = boolPairAnd(CheckSegmentBearing(segment, bearing, bearing_range), - HasValidEdge(segment)); + HasValidEdge(segment, use_all_edges)); use_directions = boolPairAnd(use_directions, admissible_segments); use_directions = boolPairAnd( use_directions, CheckApproach(input_coordinate, segment, approach));