| | 1 | | using System; |
| | 2 | |
|
| | 3 | | namespace Itinero.Instructions.Types; |
| | 4 | |
|
| | 5 | | /*** |
| | 6 | | * The 'startInstruction' represents the projection from the actual startpoint (e.g. an adress) to the snapped point on |
| | 7 | | * It doesn't really have an associated segment. |
| | 8 | | */ |
| | 9 | | public class StartInstruction : BaseInstruction |
| | 10 | | { |
| | 11 | | public StartInstruction(IndexedRoute route, int turnDegrees, int absoluteStartingDegrees, |
| | 12 | | uint projectionDistance, BaseInstruction? contained = null) : |
| 19 | 13 | | base(route, 0, Math.Max(0, contained?.ShapeIndexEnd ?? 0), turnDegrees) |
| 19 | 14 | | { |
| 19 | 15 | | this.StartDegrees = absoluteStartingDegrees; |
| 19 | 16 | | this.ProjectionDistance = projectionDistance; |
| 19 | 17 | | this.Then = contained; |
| 19 | 18 | | } |
| | 19 | |
|
| | 20 | |
|
| 4 | 21 | | public StartInstruction(IndexedRoute route, BaseInstruction? contained = null) : this(route, |
| 4 | 22 | | 0, |
| 4 | 23 | | route.DepartingDirectionAt(0).NormalizeDegrees(), |
| 4 | 24 | | 0, contained) |
| 8 | 25 | | { } |
| | 26 | |
|
| | 27 | | /// <summary> |
| | 28 | | /// The compass degrees to start the trip, with 0° being 'go to the north' |
| | 29 | | /// </summary> |
| | 30 | | /// <remarks> |
| | 31 | | /// The 'turnDegrees' is relative to the actual startpoint, thus if walking from the startpoint to the |
| | 32 | | /// snappedpoint, the amount of degrees to turn then |
| | 33 | | /// </remarks> |
| | 34 | |
|
| 102 | 35 | | public int StartDegrees { get; } |
| | 36 | |
|
| | 37 | | /// <summary> |
| | 38 | | /// The distance between the actual start point and the snapped start point on the road |
| | 39 | | /// </summary> |
| 102 | 40 | | public uint ProjectionDistance { get; } |
| | 41 | |
|
| | 42 | | /// <summary> |
| | 43 | | /// The instruction following the start instruction |
| | 44 | | /// </summary> |
| | 45 | | // ReSharper disable once UnusedAutoPropertyAccessor.Global |
| 102 | 46 | | public BaseInstruction Then { get; } |
| | 47 | |
|
| | 48 | | public override string ToString() |
| 0 | 49 | | { |
| 0 | 50 | | return |
| 0 | 51 | | $"Start by going {this.ProjectionDistance}m towards the road, then turn {this.TurnDegrees}° to start a {this |
| 0 | 52 | | } |
| | 53 | | } |