| | 1 | | using System; |
| | 2 | | using System.Collections.Generic; |
| | 3 | | using Itinero.Geo; |
| | 4 | | using Itinero.Network.Enumerators.Vertices; |
| | 5 | | using Itinero.Network.Tiles; |
| | 6 | |
|
| | 7 | | namespace Itinero.Network.Search; |
| | 8 | |
|
| | 9 | | /// <summary> |
| | 10 | | /// Implements vertex searches. |
| | 11 | | /// </summary> |
| | 12 | | internal static class VertexSearch |
| | 13 | | { |
| | 14 | | /// <summary> |
| | 15 | | /// Enumerates all vertices in the given bounding box. |
| | 16 | | /// </summary> |
| | 17 | | /// <param name="network">The network.</param> |
| | 18 | | /// <param name="box">The box to enumerate in.</param> |
| | 19 | | /// <returns>An enumerator with all the vertices and their location.</returns> |
| | 20 | | internal static IEnumerable<(VertexId vertex, (double longitude, double latitude, float? e) location)> |
| | 21 | | SearchVerticesInBox(this RoutingNetwork network, |
| | 22 | | ((double longitude, double latitude, float? e) topLeft, (double longitude, double latitude, float? e) |
| | 23 | | bottomRight) box) |
| 30 | 24 | | { |
| 30 | 25 | | var rangeVertices = new TilesVertexEnumerator(network, box.TileRange(network.Zoom)); |
| | 26 | |
|
| 80 | 27 | | while (rangeVertices.MoveNext()) |
| 70 | 28 | | { |
| 70 | 29 | | var location = rangeVertices.Location; |
| 70 | 30 | | if (!box.Overlaps(location)) |
| 7 | 31 | | { |
| 7 | 32 | | continue; |
| | 33 | | } |
| | 34 | |
|
| 63 | 35 | | yield return (rangeVertices.Current, location); |
| 43 | 36 | | } |
| 10 | 37 | | } |
| | 38 | | } |