| | 1 | | using System.Collections.Generic; |
| | 2 | | using System.Runtime.CompilerServices; |
| | 3 | | using System.Threading; |
| | 4 | | using Itinero.Network; |
| | 5 | | using Itinero.Network.Search; |
| | 6 | |
|
| | 7 | | namespace Itinero.Search; |
| | 8 | |
|
| | 9 | | internal class RoutingNetworkQuery : IRoutingNetworkQuery |
| | 10 | | { |
| | 11 | | private readonly RoutingNetwork _network; |
| | 12 | |
|
| 0 | 13 | | public RoutingNetworkQuery(RoutingNetwork network) |
| 0 | 14 | | { |
| 0 | 15 | | _network = network; |
| 0 | 16 | | } |
| | 17 | | public async IAsyncEnumerable<VertexId> Vertices( |
| | 18 | | ((double longitude, double latitude, float? e) topLeft, (double longitude, double latitude, float? e) bottomRigh |
| | 19 | | box, [EnumeratorCancellation] CancellationToken cancellationToken = default) |
| 0 | 20 | | { |
| 0 | 21 | | await _network.UsageNotifier.NotifyBox(_network, box, cancellationToken); |
| 0 | 22 | | if (cancellationToken.IsCancellationRequested) yield break; |
| | 23 | |
|
| 0 | 24 | | var vertices = _network.SearchVerticesInBox(box); |
| 0 | 25 | | foreach (var (vertex, _) in vertices) |
| 0 | 26 | | { |
| 0 | 27 | | if (cancellationToken.IsCancellationRequested) yield break; |
| 0 | 28 | | yield return vertex; |
| 0 | 29 | | } |
| 0 | 30 | | } |
| | 31 | | } |