| | | 1 | | using System; |
| | | 2 | | using System.Collections; |
| | | 3 | | using System.Collections.Generic; |
| | | 4 | | using Itinero.Network; |
| | | 5 | | using NetTopologySuite.Features; |
| | | 6 | | |
| | | 7 | | namespace Itinero.Geo; |
| | | 8 | | |
| | | 9 | | /// <summary> |
| | | 10 | | /// Converts a routerDB into a stream of geofeatures |
| | | 11 | | /// </summary> |
| | | 12 | | internal class RoutingNetworkStream : IEnumerable<IFeature> |
| | | 13 | | { |
| | | 14 | | private readonly RoutingNetwork _network; |
| | | 15 | | |
| | | 16 | | private readonly Func<IEnumerable<(string key, string value)>, IEnumerable<(string key, string value)>> |
| | | 17 | | _preprocessEdgeAttributes; |
| | | 18 | | |
| | 4 | 19 | | public RoutingNetworkStream(RoutingNetwork network, |
| | 4 | 20 | | Func<IEnumerable<(string key, string value)>, IEnumerable<(string key, string value)>> |
| | 4 | 21 | | preprocessEdgeAttributes) |
| | 4 | 22 | | { |
| | 4 | 23 | | _network = network; |
| | 4 | 24 | | _preprocessEdgeAttributes = preprocessEdgeAttributes; |
| | 4 | 25 | | } |
| | | 26 | | |
| | | 27 | | public IEnumerator<IFeature> GetEnumerator() |
| | 4 | 28 | | { |
| | 4 | 29 | | return new RoutingNetworkEnumerator(_network, _preprocessEdgeAttributes); |
| | 4 | 30 | | } |
| | | 31 | | |
| | | 32 | | IEnumerator IEnumerable.GetEnumerator() |
| | 0 | 33 | | { |
| | 0 | 34 | | return this.GetEnumerator(); |
| | 0 | 35 | | } |
| | | 36 | | } |