fix collapsing of roundabout instructions
This commit is contained in:
		
							parent
							
								
									3e18e31bc9
								
							
						
					
					
						commit
						3eeb3cb6c6
					
				| @ -24,6 +24,11 @@ | ||||
|     - Debug Tiles | ||||
|       - Added support for turn penalties | ||||
| 
 | ||||
| # 5.4.3 | ||||
|   - Changes from 5.4.1 | ||||
|     - Bugfixes | ||||
|       - #3254 Fixed a bug that could end up hiding roundabout instructions | ||||
| 
 | ||||
| # 5.4.2 | ||||
|   - Changes from 5.4.1 | ||||
|     - Bugfixes | ||||
|  | ||||
| @ -418,3 +418,53 @@ Feature: Basic Roundabout | ||||
|         When I route I should get | ||||
|             | waypoints | route                                  | turns                           | | ||||
|             | 1,h       | roundabout,right-bot-out,right-bot-out | depart,roundabout-exit-1,arrive | | ||||
| 
 | ||||
|     @3254 | ||||
|     Scenario: Driving up to and through a roundabout | ||||
|         Given the node map | ||||
|             """ | ||||
|               g            a | ||||
|               |          /   \ | ||||
|             e-f- - - - b      d - - - h | ||||
|               |          \   / | ||||
|               i            c | ||||
|                            | | ||||
|                            k | ||||
|             """ | ||||
| 
 | ||||
|         And the ways | ||||
|             | nodes | junction   | name       | highway     | | ||||
|             | abcda | roundabout | roundabout | residential | | ||||
|             | gfi   |            | side       | residential | | ||||
|             | efb   |            | left       | residential | | ||||
|             | dh    |            | right      | residential | | ||||
|             | ck    |            | bottom     | residential | | ||||
| 
 | ||||
|         When I route I should get | ||||
|             | waypoints | route            | turns                           | | ||||
|             | e,h       | left,right,right | depart,roundabout-exit-2,arrive | | ||||
| 
 | ||||
|     @3254 | ||||
|     Scenario: Driving up to and through a roundabout | ||||
|         Given the node map | ||||
|             """ | ||||
|               g       a | ||||
|               |     /   \ | ||||
|             e-f - b      d - - - h | ||||
|               |     \   / | ||||
|               i       c | ||||
|                       | | ||||
|                       k | ||||
|             """ | ||||
| 
 | ||||
|         And the ways | ||||
|             | nodes | junction   | name       | highway     | | ||||
|             | abcda | roundabout | roundabout | residential | | ||||
|             | gfi   |            | side       | residential | | ||||
|             | efb   |            | left       | residential | | ||||
|             | dh    |            | right      | residential | | ||||
|             | ck    |            | bottom     | residential | | ||||
| 
 | ||||
|         When I route I should get | ||||
|             | waypoints | route            | turns                           | | ||||
|             | e,h       | left,right,right | depart,roundabout-exit-2,arrive | | ||||
|  | ||||
| @ -498,6 +498,10 @@ void collapseTurnAt(std::vector<RouteStep> &steps, | ||||
|     BOOST_ASSERT(one_back_index < steps.size()); | ||||
|     const auto ¤t_step = steps[step_index]; | ||||
|     const auto &one_back_step = steps[one_back_index]; | ||||
|     // Don't collapse roundabouts
 | ||||
|     if (entersRoundabout(current_step.maneuver.instruction) || | ||||
|         entersRoundabout(one_back_step.maneuver.instruction)) | ||||
|         return; | ||||
| 
 | ||||
|     // This function assumes driving on the right hand side of the streat
 | ||||
|     BOOST_ASSERT(!one_back_step.intersections.empty() && !current_step.intersections.empty()); | ||||
| @ -812,6 +816,11 @@ void collapseTurnAt(std::vector<RouteStep> &steps, | ||||
| //
 | ||||
| bool isStaggeredIntersection(const RouteStep &previous, const RouteStep ¤t) | ||||
| { | ||||
|     //don't touch roundabouts
 | ||||
|     if (entersRoundabout(previous.maneuver.instruction) || | ||||
|         entersRoundabout(current.maneuver.instruction)) | ||||
|         return false; | ||||
| 
 | ||||
|     // Base decision on distance since the zig-zag is a visual clue.
 | ||||
|     // If adjusted, make sure to check validity of the is_right/is_left classification below
 | ||||
|     const constexpr auto MAX_STAGGERED_DISTANCE = 3; // debatable, but keep short to be on safe side
 | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user