| | | 1 | | using System.Runtime.CompilerServices; |
| | | 2 | | using Itinero.Instructions.Generators; |
| | | 3 | | using Itinero.Routes; |
| | | 4 | | [assembly: InternalsVisibleTo("Itinero.Tests.Instructions")] |
| | | 5 | | |
| | | 6 | | namespace Itinero.Instructions; |
| | | 7 | | |
| | | 8 | | /// <summary> |
| | | 9 | | /// A route which has the capabilities to generate instructions. |
| | | 10 | | /// </summary> |
| | | 11 | | internal class RouteInstructionGenerator |
| | | 12 | | { |
| | | 13 | | private readonly RouteInstructionGeneratorSettings _settings; |
| | | 14 | | private readonly Route _route; |
| | | 15 | | private readonly IInstructionListGenerator _generator; |
| | | 16 | | |
| | 0 | 17 | | internal RouteInstructionGenerator(Route route, RouteInstructionGeneratorSettings settings) |
| | 0 | 18 | | { |
| | 0 | 19 | | _route = route; |
| | 0 | 20 | | _settings = settings; |
| | | 21 | | |
| | 0 | 22 | | _generator = new LinearInstructionListGenerator(_settings.Generators); |
| | 0 | 23 | | } |
| | | 24 | | |
| | | 25 | | /// <summary> |
| | | 26 | | /// Generates turn-by-turn instructions. |
| | | 27 | | /// </summary> |
| | | 28 | | /// <returns>The route and the instructions.</returns> |
| | | 29 | | public IRouteAndBaseInstructions Generate() |
| | 0 | 30 | | { |
| | 0 | 31 | | return new RouteAndBaseInstructions(_route, |
| | 0 | 32 | | _generator.GenerateInstructions(_route), _settings.Languages); |
| | 0 | 33 | | } |
| | | 34 | | } |