Skip to content

Commit 2c7c18f

Browse files
committed
Fix bug in snapping=any when bearings or radiuses are supplied.
1 parent 5ddbb25 commit 2c7c18f

File tree

2 files changed

+65
-4
lines changed

2 files changed

+65
-4
lines changed

features/car/startpoint.feature

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,66 @@ Feature: Car - Allowed start/end modes
6060
| from | to | route |
6161
| 1 | 2 | ab,bc,cd |
6262
| 2 | 1 | cd,bc,ab |
63+
64+
Scenario: Car - URL override of non-startpoints
65+
Given the node map
66+
"""
67+
a 1 b c 2 d
68+
"""
69+
70+
Given the query options
71+
| snapping | any |
72+
| bearings | 90,180; |
73+
74+
And the ways
75+
| nodes | highway | access |
76+
| ab | service | private |
77+
| bc | primary | |
78+
| cd | service | private |
79+
80+
When I route I should get
81+
| from | to | route |
82+
| 1 | 2 | ab,bc,cd |
83+
| 2 | 1 | cd,bc,ab |
84+
85+
Scenario: Car - URL override of non-startpoints
86+
Given the node map
87+
"""
88+
a 1 b c 2 d
89+
"""
90+
91+
Given the query options
92+
| snapping | any |
93+
| radiuses | 100;unlimited |
94+
95+
And the ways
96+
| nodes | highway | access |
97+
| ab | service | private |
98+
| bc | primary | |
99+
| cd | service | private |
100+
101+
When I route I should get
102+
| from | to | route |
103+
| 1 | 2 | ab,bc,cd |
104+
| 2 | 1 | cd,bc,ab |
105+
106+
Scenario: Car - URL override of non-startpoints
107+
Given the node map
108+
"""
109+
a 1 b c 2 d
110+
"""
111+
112+
Given the query options
113+
| snapping | any |
114+
| bearings | 90,180;0,180;; |
115+
116+
And the ways
117+
| nodes | highway | access |
118+
| ab | service | private |
119+
| bc | primary | |
120+
| cd | service | private |
121+
122+
When I request a travel time matrix I should get
123+
| | 2 | c |
124+
| 1 | 59.1 | 35.1 |
125+
| b | 35.1 | 11.1 |

include/engine/geospatial_query.hpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -327,13 +327,12 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
327327
(!has_small_component || (!has_big_component && !IsTinyComponent(segment)));
328328
auto use_directions = std::make_pair(use_segment, use_segment);
329329
const auto admissible_segments = CheckSegmentExclude(segment);
330-
use_directions = boolPairAnd(use_directions, HasValidEdge(segment, use_all_edges));
331330

332331
if (use_segment)
333332
{
334333
use_directions =
335334
boolPairAnd(CheckSegmentBearing(segment, bearing, bearing_range),
336-
HasValidEdge(segment));
335+
HasValidEdge(segment, use_all_edges));
337336
use_directions = boolPairAnd(use_directions, admissible_segments);
338337
use_directions = boolPairAnd(
339338
use_directions, CheckApproach(input_coordinate, segment, approach));
@@ -387,13 +386,12 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
387386
(!has_small_component || (!has_big_component && !IsTinyComponent(segment)));
388387
auto use_directions = std::make_pair(use_segment, use_segment);
389388
const auto admissible_segments = CheckSegmentExclude(segment);
390-
use_directions = boolPairAnd(use_directions, HasValidEdge(segment, use_all_edges));
391389

392390
if (use_segment)
393391
{
394392
use_directions =
395393
boolPairAnd(CheckSegmentBearing(segment, bearing, bearing_range),
396-
HasValidEdge(segment));
394+
HasValidEdge(segment, use_all_edges));
397395
use_directions = boolPairAnd(use_directions, admissible_segments);
398396
use_directions = boolPairAnd(
399397
use_directions, CheckApproach(input_coordinate, segment, approach));

0 commit comments

Comments
 (0)