handle throughabouts -- do not announce going through
This commit is contained in:
		
							parent
							
								
									8c9ae4d3b4
								
							
						
					
					
						commit
						0affec8f17
					
				| @ -14,6 +14,7 @@ | |||||||
|       - Pass functions instead of strings to `WayHandlers.run()`, so it's possible to mix in your own functions. |       - Pass functions instead of strings to `WayHandlers.run()`, so it's possible to mix in your own functions. | ||||||
|       - Reorders arguments to `WayHandlers` functions to match `process_way()`. |       - Reorders arguments to `WayHandlers` functions to match `process_way()`. | ||||||
|       - Profiles must return a hash of profile functions. This makes it easier for profiles to include each other. |       - Profiles must return a hash of profile functions. This makes it easier for profiles to include each other. | ||||||
|  |       - Guidance: add support for throughabouts | ||||||
| 
 | 
 | ||||||
| # 5.9.2 | # 5.9.2 | ||||||
|     - API: |     - API: | ||||||
|  | |||||||
| @ -567,5 +567,5 @@ Feature: Basic Roundabout | |||||||
|             | ab    | residential   | in      |            |        | |             | ab    | residential   | in      |            |        | | ||||||
| 
 | 
 | ||||||
|         When I route I should get |         When I route I should get | ||||||
|             | waypoints | turns                                                    | route                      | |             | waypoints | turns                    | route              | | ||||||
|             | a,f       | depart,turn right,roundabout turn straight exit-1,arrive | in,through,through,through | |             | a,f       | depart,turn right,arrive | in,through,through | | ||||||
|  | |||||||
| @ -763,7 +763,7 @@ Feature: Basic Roundabout | |||||||
| 
 | 
 | ||||||
|         When I route I should get |         When I route I should get | ||||||
|            | waypoints | bearings | route       | turns                           | |            | waypoints | bearings | route       | turns                           | | ||||||
|            | e,f       | 90 90    | edf,edf,edf | depart,roundabout-exit-1,arrive | |            | e,f       | 90 90    | edf,edf     | depart,arrive                   | | ||||||
|            | e,h       | 90 135   | edf,gch,gch | depart,roundabout-exit-2,arrive | |            | e,h       | 90 135   | edf,gch,gch | depart,roundabout-exit-2,arrive | | ||||||
|            | g,f       | 45 90    | gch,edf,edf | depart,roundabout-exit-2,arrive | |            | g,f       | 45 90    | gch,edf,edf | depart,roundabout-exit-2,arrive | | ||||||
|            | g,h       | 45 135   | gch,gch,gch | depart,roundabout-exit-1,arrive | |            | g,h       | 45 135   | gch,gch,gch | depart,roundabout-exit-1,arrive | | ||||||
| @ -843,6 +843,6 @@ Feature: Basic Roundabout | |||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|         When I route I should get |         When I route I should get | ||||||
|             | from | to | route                        | turns                                                             | distance | |             | from | to | route                | turns                                 | distance | | ||||||
|             | e    | k  | ebds,ebds,ds,ufghl,jhik,jhik | depart,rotary-exit-1,rotary-exit-1,rstur-exit-2,turn right,arrive | 189.1m   | |             | e    | k  | ebds,ufghl,jhik,jhik | depart,rstur-exit-2,turn right,arrive | 189.1m   | | ||||||
|             | 1    | k  | ebds,ds,ufghl,jhik,jhik      | depart,rotary-exit-1,rstur-exit-2,turn right,arrive               | 159.1m   | |             | 1    | k  | ebds,ufghl,jhik,jhik | depart,rstur-exit-2,turn right,arrive | 159.1m   | | ||||||
|  | |||||||
| @ -504,15 +504,23 @@ Intersection RoundaboutHandler::handleRoundabouts(const RoundaboutType roundabou | |||||||
|     } |     } | ||||||
|     else |     else | ||||||
|     { |     { | ||||||
|  |         bool crossing_roundabout = false; | ||||||
|         for (std::size_t cnt = 0, idx = lhs ? intersection.size() - 1 : 0; |         for (std::size_t cnt = 0, idx = lhs ? intersection.size() - 1 : 0; | ||||||
|              cnt < intersection.size(); |              cnt < intersection.size(); | ||||||
|              ++cnt, idx += step) |              ++cnt, idx += step) | ||||||
|         { |         { | ||||||
|             auto &road = intersection[idx]; |             auto &turn = intersection[idx]; | ||||||
|             if (!road.entry_allowed) |  | ||||||
|                 continue; |  | ||||||
|             auto &turn = road; |  | ||||||
|             const auto &out_data = node_based_graph.GetEdgeData(turn.eid); |             const auto &out_data = node_based_graph.GetEdgeData(turn.eid); | ||||||
|  | 
 | ||||||
|  |             // A roundabout consists of exactly two roads at an intersection. by toggeling this
 | ||||||
|  |             // flag, we can switch between roads crossing the roundabout and roads that are on the
 | ||||||
|  |             // same side as via_eid.
 | ||||||
|  |             if (out_data.roundabout || out_data.circular) | ||||||
|  |                 crossing_roundabout = !crossing_roundabout; | ||||||
|  | 
 | ||||||
|  |             if (!turn.entry_allowed) | ||||||
|  |                 continue; | ||||||
|  | 
 | ||||||
|             if (out_data.roundabout || out_data.circular) |             if (out_data.roundabout || out_data.circular) | ||||||
|             { |             { | ||||||
|                 if (can_exit_roundabout_separately) |                 if (can_exit_roundabout_separately) | ||||||
| @ -524,8 +532,21 @@ Intersection RoundaboutHandler::handleRoundabouts(const RoundaboutType roundabou | |||||||
|             } |             } | ||||||
|             else |             else | ||||||
|             { |             { | ||||||
|                 turn.instruction = TurnInstruction::ENTER_AND_EXIT_ROUNDABOUT( |                 // Distinguish between throughabouts and entering a roundabout to directly exit: In
 | ||||||
|                     roundabout_type, getTurnDirection(turn.angle)); |                 // case of a throughabout, both enter and exit do not show roundabout tags (as we
 | ||||||
|  |                 // already have checked, when arriving here) and the enter/exit are nearly straight
 | ||||||
|  |                 // and on different sides of the roundabouts
 | ||||||
|  |                 if (util::angularDeviation(turn.angle, STRAIGHT_ANGLE) < FUZZY_ANGLE_DIFFERENCE && | ||||||
|  |                     crossing_roundabout) | ||||||
|  |                 { | ||||||
|  |                     turn.instruction = getInstructionForObvious( | ||||||
|  |                         intersection.size(), via_eid, isThroughStreet(idx, intersection), turn); | ||||||
|  |                 } | ||||||
|  |                 else | ||||||
|  |                 { | ||||||
|  |                     turn.instruction = TurnInstruction::ENTER_AND_EXIT_ROUNDABOUT( | ||||||
|  |                         roundabout_type, getTurnDirection(turn.angle)); | ||||||
|  |                 } | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user