| | | 1 | | using Itinero.Routes; |
| | | 2 | | |
| | | 3 | | namespace Itinero.Geo.Elevation; |
| | | 4 | | |
| | | 5 | | /// <summary> |
| | | 6 | | /// Extensions for the route object related to elevation. |
| | | 7 | | /// </summary> |
| | | 8 | | public static class RouteExtensions |
| | | 9 | | { |
| | | 10 | | /// <summary> |
| | | 11 | | /// Adds elevation to the route. |
| | | 12 | | /// </summary> |
| | | 13 | | /// <param name="route">The route.</param> |
| | | 14 | | /// <param name="elevationHandler">The elevation handler, if null, the default will be used.</param> |
| | | 15 | | /// <remarks> |
| | | 16 | | /// This only adds elevation if an elevation handler was registered. It doesn't overwrite any elevation data already |
| | | 17 | | /// </remarks> |
| | | 18 | | public static void AddElevation(this Route route, IElevationHandler? elevationHandler = null) |
| | 2 | 19 | | { |
| | 8 | 20 | | for (var s = 0; s < route.Shape.Count; s++) |
| | 2 | 21 | | { |
| | 2 | 22 | | route.Shape[s] = route.Shape[s].AddElevation(elevationHandler: elevationHandler); |
| | 2 | 23 | | } |
| | | 24 | | |
| | | 25 | | // TODO: add branches when implemented. |
| | 2 | 26 | | } |
| | | 27 | | } |