| | 1 | | using System.Collections.Generic; |
| | 2 | |
|
| | 3 | | namespace Itinero.Instructions.Types; |
| | 4 | |
|
| | 5 | | /// <summary> |
| | 6 | | /// The crossroad-instructions is an instruction that helps travellers cross intersections. |
| | 7 | | /// When multiple streets are coming together on nearly the same point (e.g. only a few meters apart), then the |
| | 8 | | /// traveller can get confused. |
| | 9 | | /// And lets be honest, 'turn right' isn't all that clear when there is a road slightly right, right and sharp right |
| | 10 | | /// </summary> |
| | 11 | | public class IntersectionInstruction : BaseInstruction |
| | 12 | | { |
| | 13 | | public readonly uint ActualIndex; |
| | 14 | |
|
| | 15 | | /// <summary> |
| | 16 | | /// The list with all the branches and properties of all the roads at this crossroads, *except* the one we just |
| | 17 | | /// from. |
| | 18 | | /// They are sorted by their relativeDegrees (where 0° is straight on the direction we came from) |
| | 19 | | /// </summary> |
| | 20 | | public readonly List<(int relativeDegrees, IEnumerable<(string, string)> tags)> AllRoads; |
| | 21 | |
|
| | 22 | |
|
| | 23 | | public IntersectionInstruction(IndexedRoute route, int shapeIndex, int shapeIndexEnd, int turnDegrees, |
| 4 | 24 | | List<(int relativeDegrees, IEnumerable<(string, string)> tags)> allRoads, uint actualIndex) : base( |
| 4 | 25 | | route, shapeIndex, shapeIndexEnd, turnDegrees) |
| 4 | 26 | | { |
| 4 | 27 | | AllRoads = allRoads; |
| 4 | 28 | | ActualIndex = actualIndex; |
| 4 | 29 | | } |
| | 30 | |
|
| | 31 | |
|
| | 32 | | public override string ToString() |
| 0 | 33 | | { |
| 0 | 34 | | return |
| 0 | 35 | | $"On the crossing: turn {this.TurnDegrees}° (road {ActualIndex + 1}/{AllRoads.Count} if left to right indexe |
| 0 | 36 | | } |
| | 37 | | } |