| | | 1 | | using System; |
| | | 2 | | using System.Collections.Generic; |
| | | 3 | | using Itinero.Network; |
| | | 4 | | using NetTopologySuite.Features; |
| | | 5 | | |
| | | 6 | | namespace Itinero.Geo; |
| | | 7 | | |
| | | 8 | | public static class RoutingNetworkExtensions |
| | | 9 | | { |
| | | 10 | | /// <summary> |
| | | 11 | | /// Converts the RoutingNetwork into a stream of GeoFeatures |
| | | 12 | | /// </summary> |
| | | 13 | | /// <param name="routerDb">The network to convert</param> |
| | | 14 | | public static IEnumerable<IFeature> AsStream(this RouterDb routerDb) |
| | 4 | 15 | | { |
| | 4 | 16 | | return routerDb.Latest.AsStream(); |
| | 4 | 17 | | } |
| | | 18 | | |
| | | 19 | | /// <summary> |
| | | 20 | | /// Converts the RoutingNetwork into a stream of GeoFeatures |
| | | 21 | | /// </summary> |
| | | 22 | | /// <param name="network">The network to convert</param> |
| | | 23 | | public static IEnumerable<IFeature> AsStream(this RoutingNetwork network) |
| | 4 | 24 | | { |
| | 4 | 25 | | return new RoutingNetworkStream(network, null); |
| | 4 | 26 | | } |
| | | 27 | | |
| | | 28 | | |
| | | 29 | | /// <summary> |
| | | 30 | | /// Converts the RoutingNetwork into a stream of GeoFeatures |
| | | 31 | | /// </summary> |
| | | 32 | | /// <param name="routerDb">The network to convert</param> |
| | | 33 | | /// <param name="preprocessAttributes">The function which preprocesses the attributes on the edges</param> |
| | | 34 | | public static IEnumerable<IFeature> AsStream(this RouterDb routerDb, |
| | | 35 | | Func<IEnumerable<(string key, string value)>, IEnumerable<(string key, string value)>> preprocessAttributes) |
| | 0 | 36 | | { |
| | 0 | 37 | | return routerDb.Latest.AsStream(preprocessAttributes); |
| | 0 | 38 | | } |
| | | 39 | | |
| | | 40 | | /// <summary> |
| | | 41 | | /// Converts the RoutingNetwork into a stream of GeoFeatures |
| | | 42 | | /// </summary> |
| | | 43 | | /// <param name="network">The network to convert</param> |
| | | 44 | | /// <param name="preprocessAttributes">The function which preprocesses the attributes on the edges</param> |
| | | 45 | | public static IEnumerable<IFeature> AsStream(this RoutingNetwork network, |
| | | 46 | | Func<IEnumerable<(string key, string value)>, IEnumerable<(string key, string value)>> preprocessAttributes) |
| | 0 | 47 | | { |
| | 0 | 48 | | return new RoutingNetworkStream(network, preprocessAttributes); |
| | 0 | 49 | | } |
| | | 50 | | } |