| | 1 | | using System; |
| | 2 | | using Itinero.Profiles; |
| | 3 | |
|
| | 4 | | namespace Itinero.Network.Mutation; |
| | 5 | |
|
| | 6 | | public static class RoutingNetworkMutatorExtensions |
| | 7 | | { |
| | 8 | | /// <summary> |
| | 9 | | /// Gets the location of the given vertex. |
| | 10 | | /// </summary> |
| | 11 | | /// <param name="routingNetwork">The network</param> |
| | 12 | | /// <param name="vertex">The vertex.</param> |
| | 13 | | /// <returns>The location.</returns> |
| | 14 | | /// <exception cref="ArgumentOutOfRangeException">When the vertex doesn't exist.</exception> |
| | 15 | | public static (double longitude, double latitude, float? e) GetVertex(this RoutingNetworkMutator routingNetwork, |
| | 16 | | VertexId vertex) |
| 0 | 17 | | { |
| 0 | 18 | | if (!routingNetwork.TryGetVertex(vertex, out var longitude, out var latitude, out var e)) |
| 0 | 19 | | { |
| 0 | 20 | | throw new ArgumentOutOfRangeException(nameof(vertex)); |
| | 21 | | } |
| | 22 | |
|
| 0 | 23 | | return (longitude, latitude, e); |
| 0 | 24 | | } |
| | 25 | |
|
| | 26 | | /// <summary> |
| | 27 | | /// Adds a new vertex. |
| | 28 | | /// </summary> |
| | 29 | | /// <param name="routingNetwork">The mutable network.</param> |
| | 30 | | /// <param name="location">The location.</param> |
| | 31 | | /// <returns>The vertex id.</returns> |
| | 32 | | public static VertexId AddVertex(this RoutingNetworkMutator routingNetwork, |
| | 33 | | (double longitude, double latitude, float? e) location) |
| 6 | 34 | | { |
| 6 | 35 | | return routingNetwork.AddVertex(location.longitude, location.latitude, location.e); |
| 6 | 36 | | } |
| | 37 | | } |