Emit a notification when turning on a ferry and don't merge step
This commit is contained in:
		
							parent
							
								
									e0593c7ca2
								
							
						
					
					
						commit
						4e9e2ed5bd
					
				| @ -687,21 +687,23 @@ Feature: Basic Roundabout | |||||||
|     Scenario: Only Enter |     Scenario: Only Enter | ||||||
|         Given the node map |         Given the node map | ||||||
|             """ |             """ | ||||||
|                 a |                   a | ||||||
|                 b |                   b | ||||||
|               c   e ~ ~ ~ f - h |            i   c     e ~ ~ ~ f - h | ||||||
|                 d |                 j d | ||||||
|                 g |               k   g | ||||||
|             """ |             """ | ||||||
| 
 | 
 | ||||||
|         And the ways |         And the ways | ||||||
|             | nodes | junction   | route | |             | nodes  | junction   | route | | ||||||
|             | ab    |            |       | |             | ab     |            |       | | ||||||
|             | ef    |            | ferry | |             | ef     |            | ferry | | ||||||
|             | fh    |            |       | |             | fh     |            |       | | ||||||
|             | dg    |            |       | |             | dg     |            |       | | ||||||
|             | bcdeb | roundabout |       | |             | ic     |            |       | | ||||||
|  |             | jk     |            |       | | ||||||
|  |             | bcjdeb | roundabout |       | | ||||||
| 
 | 
 | ||||||
|         When I route I should get |         When I route I should get | ||||||
|             | waypoints | route    | turns                           | |             | waypoints | route          | turns                                                                           | | ||||||
|             | a,h       | ab,ef,fh | depart,roundabout-exit-2,arrive | |             | a,h       | ab,ef,ef,fh,fh | depart,roundabout-exit-4,notification slight right,notification straight,arrive | | ||||||
|  | |||||||
| @ -118,12 +118,14 @@ bool setUpRoundabout(RouteStep &step) | |||||||
| 
 | 
 | ||||||
| void closeOffRoundabout(const bool on_roundabout, | void closeOffRoundabout(const bool on_roundabout, | ||||||
|                         std::vector<RouteStep> &steps, |                         std::vector<RouteStep> &steps, | ||||||
|                         const std::size_t step_index) |                         std::size_t step_index) | ||||||
| { | { | ||||||
|     auto &step = steps[step_index]; |     auto &step = steps[step_index]; | ||||||
|     step.maneuver.exit += 1; |     step.maneuver.exit += 1; | ||||||
|     if (!on_roundabout) |     if (!on_roundabout) | ||||||
|     { |     { | ||||||
|  |         BOOST_ASSERT(steps.size() >= 2); | ||||||
|  | 
 | ||||||
|         // We reached a special case that requires the addition of a special route step in the
 |         // We reached a special case that requires the addition of a special route step in the
 | ||||||
|         // beginning. We started in a roundabout, so to announce the exit, we move use the exit
 |         // beginning. We started in a roundabout, so to announce the exit, we move use the exit
 | ||||||
|         // instruction and move it right to the beginning to make sure to immediately announce the
 |         // instruction and move it right to the beginning to make sure to immediately announce the
 | ||||||
| @ -160,6 +162,23 @@ void closeOffRoundabout(const bool on_roundabout, | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     if (step_index > 1) | ||||||
|  |     { | ||||||
|  |         auto &exit_step = steps[step_index]; | ||||||
|  |         auto &prev_step = steps[step_index - 1]; | ||||||
|  |         // In case the step with the roundabout exit instruction cannot be merged with the
 | ||||||
|  |         // previous step we change the instruction to a normal turn
 | ||||||
|  |         if (!guidance::haveSameMode(exit_step, prev_step)) | ||||||
|  |         { | ||||||
|  |             BOOST_ASSERT(leavesRoundabout(exit_step.maneuver.instruction)); | ||||||
|  |             prev_step.maneuver.instruction = exit_step.maneuver.instruction; | ||||||
|  |             if (!entersRoundabout(prev_step.maneuver.instruction)) | ||||||
|  |                 prev_step.maneuver.exit = exit_step.maneuver.exit; | ||||||
|  |             exit_step.maneuver.instruction.type = TurnType::Notification; | ||||||
|  |             step_index--; | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     // Normal exit from the roundabout, or exit from a previously fixed roundabout. Propagate the
 |     // Normal exit from the roundabout, or exit from a previously fixed roundabout. Propagate the
 | ||||||
|     // index back to the entering location and prepare the current silent set of instructions for
 |     // index back to the entering location and prepare the current silent set of instructions for
 | ||||||
|     // removal.
 |     // removal.
 | ||||||
| @ -170,6 +189,7 @@ void closeOffRoundabout(const bool on_roundabout, | |||||||
|     const auto exit_intersection = steps[step_index].intersections.front(); |     const auto exit_intersection = steps[step_index].intersections.front(); | ||||||
|     const auto exit_bearing = exit_intersection.bearings[exit_intersection.out]; |     const auto exit_bearing = exit_intersection.bearings[exit_intersection.out]; | ||||||
|     const auto destination_copy = step; |     const auto destination_copy = step; | ||||||
|  | 
 | ||||||
|     if (step_index > 1) |     if (step_index > 1) | ||||||
|     { |     { | ||||||
|         // The very first route-step is head, so we cannot iterate past that one
 |         // The very first route-step is head, so we cannot iterate past that one
 | ||||||
| @ -177,8 +197,11 @@ void closeOffRoundabout(const bool on_roundabout, | |||||||
|              --propagation_index) |              --propagation_index) | ||||||
|         { |         { | ||||||
|             auto &propagation_step = steps[propagation_index]; |             auto &propagation_step = steps[propagation_index]; | ||||||
|             propagation_step.ElongateBy(steps[propagation_index + 1]); |             auto &next_step = steps[propagation_index + 1]; | ||||||
|             propagation_step.maneuver.exit = steps[propagation_index + 1].maneuver.exit; |             propagation_step.ElongateBy(next_step); | ||||||
|  |             propagation_step.maneuver.exit = next_step.maneuver.exit; | ||||||
|  |             next_step.Invalidate(); | ||||||
|  | 
 | ||||||
|             if (entersRoundabout(propagation_step.maneuver.instruction)) |             if (entersRoundabout(propagation_step.maneuver.instruction)) | ||||||
|             { |             { | ||||||
|                 const auto entry_intersection = propagation_step.intersections.front(); |                 const auto entry_intersection = propagation_step.intersections.front(); | ||||||
| @ -206,13 +229,8 @@ void closeOffRoundabout(const bool on_roundabout, | |||||||
|                 } |                 } | ||||||
| 
 | 
 | ||||||
|                 propagation_step.AdaptStepSignage(destination_copy); |                 propagation_step.AdaptStepSignage(destination_copy); | ||||||
|                 steps[propagation_index + 1].Invalidate(); |  | ||||||
|                 break; |                 break; | ||||||
|             } |             } | ||||||
|             else |  | ||||||
|             { |  | ||||||
|                 steps[propagation_index + 1].Invalidate(); |  | ||||||
|             } |  | ||||||
|         } |         } | ||||||
|         // remove exit
 |         // remove exit
 | ||||||
|     } |     } | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user