| | | 1 | | using System; |
| | | 2 | | using System.Collections.Generic; |
| | | 3 | | using System.Linq; |
| | | 4 | | using Itinero.IO.Osm.Restrictions.Barriers; |
| | | 5 | | using Itinero.IO.Osm.Restrictions.Turns; |
| | | 6 | | using Itinero.IO.Osm.Streams; |
| | | 7 | | using Itinero.Network; |
| | | 8 | | using Itinero.Network.Tiles.Standalone; |
| | | 9 | | using Itinero.Network.Tiles.Standalone.Global; |
| | | 10 | | using Itinero.Network.Tiles.Standalone.Writer; |
| | | 11 | | using OsmSharp; |
| | | 12 | | using OsmSharp.Streams; |
| | | 13 | | |
| | | 14 | | namespace Itinero.IO.Osm.Tiles; |
| | | 15 | | |
| | | 16 | | /// <summary> |
| | | 17 | | /// Contains extensions methods for the standalone tile writer. |
| | | 18 | | /// </summary> |
| | | 19 | | public static class StandaloneNetworkTileWriterExtensions |
| | | 20 | | { |
| | | 21 | | /// <summary> |
| | | 22 | | /// Adds tile data using the writer and the given tile data. |
| | | 23 | | /// </summary> |
| | | 24 | | /// <param name="writer">The writer.</param> |
| | | 25 | | /// <param name="tileData">The OSM data in the tile.</param> |
| | | 26 | | /// <param name="configure">The configure function.</param> |
| | | 27 | | /// <exception cref="Exception"></exception> |
| | | 28 | | public static void AddTileData(this StandaloneNetworkTileWriter writer, IEnumerable<OsmGeo> tileData, |
| | | 29 | | Action<DataProviderSettings>? configure = null) |
| | 0 | 30 | | { |
| | | 31 | | static uint ToLocalId(uint x, uint y, int zoom) |
| | 0 | 32 | | { |
| | 0 | 33 | | var xMax = 1 << zoom; |
| | 0 | 34 | | return (uint)((y * xMax) + x); |
| | 0 | 35 | | } |
| | | 36 | | |
| | | 37 | | // create settings. |
| | 0 | 38 | | var settings = new DataProviderSettings(); |
| | 0 | 39 | | configure?.Invoke(settings); |
| | | 40 | | |
| | | 41 | | // do filtering. |
| | | 42 | | // ReSharper disable once PossibleMultipleEnumeration |
| | 0 | 43 | | OsmStreamSource data = new OsmEnumerableStreamSource(tileData); |
| | | 44 | | |
| | | 45 | | // 1: complete objects. |
| | 0 | 46 | | if (settings.TagsFilter.CompleteFilter != null) |
| | 0 | 47 | | { |
| | 0 | 48 | | data = data.ApplyCompleteFilter(settings.TagsFilter.CompleteFilter); |
| | 0 | 49 | | } |
| | | 50 | | |
| | | 51 | | // 2: filter relations. |
| | 0 | 52 | | if (settings.TagsFilter.MemberFilter != null) |
| | 0 | 53 | | { |
| | 0 | 54 | | data = data.ApplyRelationMemberFilter(settings.TagsFilter.MemberFilter); |
| | 0 | 55 | | } |
| | | 56 | | |
| | | 57 | | // 3: filter tags on ways and relations. |
| | 0 | 58 | | if (settings.TagsFilter.Filter != null) |
| | 0 | 59 | | { |
| | 0 | 60 | | data = data.ApplyFilter(settings.TagsFilter.Filter); |
| | 0 | 61 | | } |
| | | 62 | | |
| | | 63 | | // setup the edge type map. |
| | 0 | 64 | | var edgeTypeMap = writer.EdgeTypeMap.func; |
| | 0 | 65 | | var emptyEdgeType = edgeTypeMap(ArraySegment<(string key, string value)>.Empty); |
| | | 66 | | |
| | | 67 | | // keep all node locations. |
| | 0 | 68 | | var nodeLocations = new Dictionary<long, (double longitude, double latitude, bool inside)>(); |
| | | 69 | | // keep a set of used nodes, all nodes inside the tile. |
| | 0 | 70 | | var usedNodes = new HashSet<long>(); |
| | | 71 | | // keep a set of core nodes, all nodes inside the tile that should be a vertex |
| | 0 | 72 | | var coreNodes = new HashSet<long>(); |
| | | 73 | | // keep a set of boundary nodes, all boundary nodes (first node outside the tile). |
| | 0 | 74 | | var boundaryNodes = new HashSet<long>(); |
| | | 75 | | // keep a set of boundary vertices. |
| | 0 | 76 | | var boundaryVertices = new HashSet<VertexId>(); |
| | | 77 | | |
| | | 78 | | // first pass to: |
| | | 79 | | // - mark nodes are core, they are to be become vertices later. |
| | | 80 | | // - parse restrictions and keep restricted edges and mark nodes as core. |
| | 0 | 81 | | using var enumerator = data.GetEnumerator(); |
| | | 82 | | |
| | 0 | 83 | | var globalRestrictions = new List<GlobalRestriction>(); |
| | 0 | 84 | | var globalRestrictionEdges = new Dictionary<GlobalEdgeId, EdgeId?>(); |
| | | 85 | | |
| | 0 | 86 | | var restrictionMembers = new Dictionary<long, Way?>(); |
| | 0 | 87 | | var restrictionParser = new OsmTurnRestrictionParser(); |
| | 0 | 88 | | var barrierNodes = new Dictionary<long, List<Way>>(); |
| | | 89 | | |
| | 0 | 90 | | var wayEdgeTypes = new Dictionary<long, (uint edgeTypeId, (string key, string value)[] attributes)>(); |
| | | 91 | | |
| | 0 | 92 | | var barrierParser = new OsmBarrierParser(); |
| | 0 | 93 | | while (enumerator.MoveNext()) |
| | 0 | 94 | | { |
| | 0 | 95 | | var current = enumerator.Current; |
| | | 96 | | |
| | 0 | 97 | | switch (current) |
| | | 98 | | { |
| | | 99 | | case Node node: |
| | 0 | 100 | | if (node.Id == null) throw new Exception("Id cannot be null"); |
| | 0 | 101 | | if (node.Longitude == null) throw new Exception("Longitude cannot be null"); |
| | 0 | 102 | | if (node.Latitude == null) throw new Exception("Latitude cannot be null"); |
| | | 103 | | |
| | 0 | 104 | | var nodeInTile = writer.IsInTile(node.Longitude.Value, node.Latitude.Value); |
| | 0 | 105 | | nodeLocations[node.Id.Value] = (node.Longitude.Value, node.Latitude.Value, |
| | 0 | 106 | | nodeInTile); |
| | | 107 | | |
| | 0 | 108 | | if (barrierParser.IsBarrier(node)) |
| | 0 | 109 | | { |
| | | 110 | | // make sure the barriers are core nodes, they need a turn cost. |
| | | 111 | | // log nodes are barriers to be able to detect their ways, |
| | | 112 | | // only take nodes in the tile to mark as barrier. |
| | 0 | 113 | | coreNodes.Add(node.Id.Value); |
| | 0 | 114 | | barrierNodes.Add(node.Id.Value, []); |
| | 0 | 115 | | } |
| | | 116 | | |
| | 0 | 117 | | break; |
| | 0 | 118 | | case Way way when way.Nodes.Length == 0: |
| | 0 | 119 | | break; |
| | | 120 | | case Way way: |
| | 0 | 121 | | { |
| | | 122 | | // calculate edge type and determine if there is relevant data. |
| | 0 | 123 | | var attributes = way.Tags?.Select(tag => (tag.Key, tag.Value)).ToArray() ?? |
| | 0 | 124 | | Array.Empty<(string key, string value)>(); |
| | 0 | 125 | | var edgeTypeId = edgeTypeMap(attributes); |
| | 0 | 126 | | if (edgeTypeId == emptyEdgeType) continue; |
| | | 127 | | |
| | | 128 | | // cache for pass 2 to avoid recomputing. |
| | 0 | 129 | | wayEdgeTypes[way.Id!.Value] = (edgeTypeId, attributes); |
| | | 130 | | |
| | | 131 | | // mark as core nodes used twice or nodes representing a boundary crossing. |
| | 0 | 132 | | bool? previousInTile = null; |
| | 0 | 133 | | for (var n = 0; n < way.Nodes.Length; n++) |
| | 0 | 134 | | { |
| | 0 | 135 | | var wayNode = way.Nodes[n]; |
| | | 136 | | |
| | | 137 | | // if the node is a barrier, at this way to the barrier nodes. |
| | 0 | 138 | | if (barrierNodes.TryGetValue(wayNode, out var barrierNodeWays)) |
| | 0 | 139 | | { |
| | 0 | 140 | | restrictionMembers[way.Id!.Value] = null; |
| | 0 | 141 | | barrierNodeWays.Add(way); |
| | 0 | 142 | | } |
| | | 143 | | |
| | | 144 | | // check if the node is in the tile or not. |
| | 0 | 145 | | if (!nodeLocations.TryGetValue(wayNode, out var value)) |
| | 0 | 146 | | { |
| | 0 | 147 | | throw new Exception( |
| | 0 | 148 | | $"Node {wayNode} as part of way {way.Id} not found in source data."); |
| | | 149 | | } |
| | 0 | 150 | | var (_, _, inTile) = value; |
| | | 151 | | |
| | | 152 | | // mark as core if used before and mark as used. |
| | 0 | 153 | | if (inTile) |
| | 0 | 154 | | { |
| | | 155 | | // only mark nodes used when in the tile. |
| | 0 | 156 | | if (usedNodes.Contains(wayNode)) coreNodes.Add(wayNode); |
| | 0 | 157 | | usedNodes.Add(wayNode); |
| | | 158 | | |
| | | 159 | | // if first or last node and inside always core. |
| | 0 | 160 | | if (n == 0 || n == way.Nodes.Length - 1) |
| | 0 | 161 | | { |
| | 0 | 162 | | coreNodes.Add(wayNode); |
| | 0 | 163 | | } |
| | 0 | 164 | | } |
| | | 165 | | |
| | | 166 | | // boundary crossing, from outside to in. |
| | 0 | 167 | | if (previousInTile is false && inTile) |
| | 0 | 168 | | { |
| | 0 | 169 | | boundaryNodes.Add(way.Nodes[n - 1]); |
| | 0 | 170 | | coreNodes.Add(way.Nodes[n]); |
| | 0 | 171 | | } |
| | | 172 | | |
| | | 173 | | // boundary crossing, from inside to out. |
| | 0 | 174 | | if (previousInTile is true && inTile == false) |
| | 0 | 175 | | { |
| | 0 | 176 | | coreNodes.Add(way.Nodes[n - 1]); |
| | 0 | 177 | | boundaryNodes.Add(way.Nodes[n]); |
| | 0 | 178 | | } |
| | | 179 | | |
| | 0 | 180 | | previousInTile = inTile; |
| | 0 | 181 | | } |
| | | 182 | | |
| | 0 | 183 | | break; |
| | | 184 | | } |
| | | 185 | | case Relation relation: |
| | 0 | 186 | | if (!restrictionParser.IsRestriction(relation, out _)) continue; |
| | 0 | 187 | | if (relation.Members == null) continue; |
| | | 188 | | |
| | | 189 | | // log ways that are members, we need to keep their edge ids ready |
| | | 190 | | // or store their global ids when the restriction crosses tile boundaries. |
| | 0 | 191 | | foreach (var relationMember in relation.Members) |
| | 0 | 192 | | { |
| | 0 | 193 | | if (relationMember.Type != OsmGeoType.Way) continue; |
| | | 194 | | |
| | 0 | 195 | | restrictionMembers[relationMember.Id] = null; |
| | 0 | 196 | | } |
| | | 197 | | |
| | 0 | 198 | | break; |
| | | 199 | | } |
| | 0 | 200 | | } |
| | | 201 | | |
| | | 202 | | // a second pass where we add all vertices, core nodes and edges. |
| | | 203 | | // we also keep an index of edges that were added and are part of a restriction. |
| | 0 | 204 | | var vertices = new Dictionary<long, VertexId>(); |
| | 0 | 205 | | enumerator.Reset(); |
| | 0 | 206 | | while (enumerator.MoveNext()) |
| | 0 | 207 | | { |
| | 0 | 208 | | var current = enumerator.Current; |
| | | 209 | | |
| | 0 | 210 | | switch (current) |
| | | 211 | | { |
| | | 212 | | case Node node: |
| | 0 | 213 | | if (node.Id == null) throw new Exception("Id cannot be null"); |
| | 0 | 214 | | if (node.Longitude == null) throw new Exception("Longitude cannot be null"); |
| | 0 | 215 | | if (node.Latitude == null) throw new Exception("Latitude cannot be null"); |
| | | 216 | | |
| | | 217 | | // add all core nodes as vertices. |
| | 0 | 218 | | if (coreNodes.Contains(node.Id.Value)) |
| | 0 | 219 | | { |
| | 0 | 220 | | if (!writer.IsInTile(node.Longitude.Value, node.Latitude.Value)) continue; |
| | 0 | 221 | | vertices[node.Id.Value] = writer.AddVertex(node.Longitude.Value, node.Latitude.Value); |
| | | 222 | | |
| | | 223 | | // a core node can be a barrier, check here. |
| | 0 | 224 | | if (barrierNodes.TryGetValue(node.Id.Value, out var barrierWays)) |
| | 0 | 225 | | { |
| | 0 | 226 | | if (!barrierParser.TryParse(node, barrierWays, out var barrier)) |
| | 0 | 227 | | throw new Exception("node in the barriers list is not a barrier"); |
| | 0 | 228 | | globalRestrictions.AddRange(barrier.ToGlobalNetworkRestrictions()); |
| | 0 | 229 | | } |
| | 0 | 230 | | } |
| | | 231 | | |
| | 0 | 232 | | break; |
| | 0 | 233 | | case Way way when way.Nodes.Length == 0: |
| | 0 | 234 | | continue; |
| | | 235 | | case Way way: |
| | 0 | 236 | | { |
| | 0 | 237 | | if (restrictionMembers.ContainsKey(way.Id.Value)) restrictionMembers[way.Id.Value] = way; |
| | | 238 | | |
| | | 239 | | // use cached values from pass 1. |
| | 0 | 240 | | if (!wayEdgeTypes.TryGetValue(way.Id!.Value, out var cached)) continue; |
| | 0 | 241 | | var (edgeTypeId, attributes) = cached; |
| | | 242 | | |
| | | 243 | | // add all boundaries, if any. |
| | 0 | 244 | | for (var n = 1; n < way.Nodes.Length; n++) |
| | 0 | 245 | | { |
| | 0 | 246 | | var tail = way.Nodes[n - 1]; |
| | 0 | 247 | | var head = way.Nodes[n]; |
| | 0 | 248 | | var globalEdgeId = way.CreateGlobalEdgeId(n - 1, n); |
| | | 249 | | |
| | 0 | 250 | | if (boundaryNodes.Contains(tail) && |
| | 0 | 251 | | vertices.TryGetValue(head, out var headVertex)) |
| | 0 | 252 | | { |
| | | 253 | | // outgoing. |
| | 0 | 254 | | writer.AddOutgoingBoundaryCrossing(globalEdgeId, headVertex, |
| | 0 | 255 | | edgeTypeId, attributes); |
| | | 256 | | |
| | 0 | 257 | | boundaryVertices.Add(headVertex); |
| | 0 | 258 | | } |
| | 0 | 259 | | else if (boundaryNodes.Contains(head) && |
| | 0 | 260 | | vertices.TryGetValue(tail, out var tailVertex)) |
| | 0 | 261 | | { |
| | | 262 | | // incoming. |
| | 0 | 263 | | writer.AddIncomingBoundaryCrossing(globalEdgeId, tailVertex, |
| | 0 | 264 | | edgeTypeId, attributes); |
| | | 265 | | |
| | 0 | 266 | | boundaryVertices.Add(tailVertex); |
| | 0 | 267 | | } |
| | 0 | 268 | | } |
| | | 269 | | |
| | | 270 | | // add regular edges, if any. |
| | 0 | 271 | | var shape = new List<(double longitude, double latitude, float? e)>(); |
| | 0 | 272 | | VertexId? previousVertex = null; |
| | | 273 | | |
| | 0 | 274 | | for (var n = 0; n < way.Nodes.Length; n++) |
| | 0 | 275 | | { |
| | 0 | 276 | | var wayNode = way.Nodes[n]; |
| | | 277 | | |
| | 0 | 278 | | if (boundaryNodes.Contains(wayNode)) |
| | 0 | 279 | | { |
| | 0 | 280 | | previousVertex = null; |
| | 0 | 281 | | shape.Clear(); |
| | 0 | 282 | | continue; |
| | | 283 | | } |
| | | 284 | | |
| | 0 | 285 | | if (!vertices.TryGetValue(wayNode, out var vertexId)) |
| | 0 | 286 | | { |
| | 0 | 287 | | var (longitude, latitude, _) = nodeLocations[wayNode]; |
| | | 288 | | |
| | 0 | 289 | | shape.Add((longitude, latitude, null)); |
| | 0 | 290 | | continue; |
| | | 291 | | } |
| | | 292 | | |
| | 0 | 293 | | if (previousVertex != null) |
| | 0 | 294 | | { |
| | 0 | 295 | | var globalEdgeId = way.CreateGlobalEdgeId(n - 1, n); |
| | 0 | 296 | | var edgeId = writer.AddEdge(previousVertex.Value, vertexId, edgeTypeId, shape, |
| | 0 | 297 | | attributes, globalEdgeId); |
| | 0 | 298 | | shape.Clear(); |
| | | 299 | | |
| | 0 | 300 | | if (restrictionMembers.ContainsKey(way.Id.Value)) |
| | 0 | 301 | | globalRestrictionEdges[globalEdgeId] = edgeId; |
| | 0 | 302 | | } |
| | | 303 | | |
| | 0 | 304 | | previousVertex = vertexId; |
| | 0 | 305 | | } |
| | | 306 | | |
| | 0 | 307 | | break; |
| | | 308 | | } |
| | | 309 | | case Relation relation: |
| | 0 | 310 | | var result = restrictionParser.TryParse(relation, (wayId) => |
| | 0 | 311 | | restrictionMembers.GetValueOrDefault(wayId), |
| | 0 | 312 | | out var osmTurnRestriction); |
| | | 313 | | |
| | 0 | 314 | | if (result.IsError) continue; |
| | 0 | 315 | | if (!result.Value) continue; |
| | 0 | 316 | | if (osmTurnRestriction == null) |
| | 0 | 317 | | throw new Exception("Parsing restriction was successful but not returned"); |
| | | 318 | | |
| | 0 | 319 | | globalRestrictions.AddRange(osmTurnRestriction.ToGlobalNetworkRestrictions()); |
| | 0 | 320 | | break; |
| | | 321 | | } |
| | 0 | 322 | | } |
| | | 323 | | |
| | 0 | 324 | | var tileEnumerator = writer.GetEnumerator(); |
| | 0 | 325 | | var r = 0; |
| | 0 | 326 | | while (r < globalRestrictions.Count) |
| | 0 | 327 | | { |
| | 0 | 328 | | var globalNetworkRestriction = globalRestrictions[r]; |
| | | 329 | | |
| | | 330 | | // try to convert first, and see if all edges are there |
| | 0 | 331 | | if (!globalNetworkRestriction.TryBuildNetworkRestriction(GetEdgeForGlobalEdge, out var networkRestriction)) |
| | 0 | 332 | | { |
| | | 333 | | // the restriction could not be converted, |
| | | 334 | | |
| | | 335 | | // one of it's edge is a boundary edge and we are working on a single tile right now. |
| | 0 | 336 | | r++; |
| | 0 | 337 | | continue; |
| | | 338 | | } |
| | | 339 | | |
| | | 340 | | // TODO: log something? |
| | | 341 | | // all the edges in the restriction are inside this tile. |
| | 0 | 342 | | if (networkRestriction!.Count < 2) |
| | 0 | 343 | | { |
| | 0 | 344 | | globalRestrictions.RemoveAt(r); |
| | 0 | 345 | | continue; |
| | | 346 | | } |
| | | 347 | | |
| | | 348 | | // get last edge and turn cost vertex. |
| | 0 | 349 | | var last = networkRestriction[^1]; |
| | 0 | 350 | | var lastEdge = writer.GetEdge(last.edge, last.forward); |
| | 0 | 351 | | var turnCostVertex = lastEdge.Tail; |
| | | 352 | | |
| | | 353 | | // only add turn costs around vertices that are in the current tile. |
| | 0 | 354 | | if (turnCostVertex.TileId != writer.TileId) |
| | 0 | 355 | | { |
| | 0 | 356 | | r++; |
| | 0 | 357 | | continue; |
| | | 358 | | } |
| | | 359 | | |
| | 0 | 360 | | var secondToLast = networkRestriction[^2]; |
| | 0 | 361 | | if (networkRestriction.IsProhibitory) |
| | 0 | 362 | | { |
| | | 363 | | // easy, we only add a single cost. |
| | 0 | 364 | | var costs = new uint[,] { { 0, 1 }, { 0, 0 } }; |
| | 0 | 365 | | writer.AddTurnCosts(turnCostVertex, networkRestriction.Attributes, |
| | 0 | 366 | | [secondToLast.edge, last.edge], costs, |
| | 0 | 367 | | networkRestriction.Take(networkRestriction.Count - 2).Select(x => x.edge)); |
| | | 368 | | |
| | | 369 | | // best case, the restriction was converted and can be removed. |
| | 0 | 370 | | globalRestrictions.RemoveAt(r); |
| | 0 | 371 | | } |
| | | 372 | | else |
| | 0 | 373 | | { |
| | | 374 | | // hard, we need to add a cost for every *other* edge than then one in the restriction. |
| | 0 | 375 | | tileEnumerator.MoveTo(secondToLast.edge, secondToLast.forward); |
| | 0 | 376 | | var to = tileEnumerator.Head; |
| | | 377 | | |
| | | 378 | | // check if the vertex of the restriction is a boundary vertex. |
| | 0 | 379 | | if (boundaryVertices.Contains(to)) |
| | 0 | 380 | | { |
| | 0 | 381 | | r++; |
| | 0 | 382 | | continue; |
| | | 383 | | } |
| | | 384 | | |
| | | 385 | | // add all the edge other than the one that is in the restriction as restricted turns. |
| | 0 | 386 | | tileEnumerator.MoveTo(to); |
| | 0 | 387 | | while (tileEnumerator.MoveNext()) |
| | 0 | 388 | | { |
| | 0 | 389 | | if (tileEnumerator.EdgeId == secondToLast.edge || |
| | 0 | 390 | | tileEnumerator.EdgeId == lastEdge.EdgeId) continue; |
| | | 391 | | |
| | | 392 | | // easy, we only add a single cost. |
| | 0 | 393 | | var costs = new uint[,] { { 0, 1 }, { 0, 0 } }; |
| | 0 | 394 | | writer.AddTurnCosts(turnCostVertex, networkRestriction.Attributes, |
| | 0 | 395 | | [secondToLast.edge, tileEnumerator.EdgeId], costs, |
| | 0 | 396 | | networkRestriction.Take(networkRestriction.Count - 2).Select(x => x.edge)); |
| | 0 | 397 | | } |
| | | 398 | | |
| | 0 | 399 | | globalRestrictions.RemoveAt(r); |
| | 0 | 400 | | } |
| | 0 | 401 | | } |
| | | 402 | | |
| | | 403 | | // add global restrictions. |
| | | 404 | | // also add all edge ids that are already known as an index to use during processing of the tile. |
| | 0 | 405 | | foreach (var globalNetworkRestriction in globalRestrictions) |
| | 0 | 406 | | { |
| | 0 | 407 | | var edges = globalNetworkRestriction.Select(x => |
| | 0 | 408 | | { |
| | 0 | 409 | | var localEdge = GetEdgeForGlobalEdge(x); |
| | 0 | 410 | | if (localEdge == null) return (x, (EdgeId?)null); |
| | 0 | 411 | | |
| | 0 | 412 | | return (x, localEdge.Value.edge); |
| | 0 | 413 | | }); |
| | | 414 | | |
| | 0 | 415 | | writer.AddGlobalRestriction(edges, globalNetworkRestriction.IsProhibitory, |
| | 0 | 416 | | globalNetworkRestriction.Attributes); |
| | 0 | 417 | | } |
| | | 418 | | |
| | 0 | 419 | | return; |
| | | 420 | | |
| | | 421 | | // convert network restrictions to turn costs. |
| | | 422 | | (EdgeId edge, bool forward)? GetEdgeForGlobalEdge(GlobalEdgeId globalEdgeId) |
| | | 423 | | { |
| | | 424 | | if (globalRestrictionEdges.TryGetValue(globalEdgeId, out var edgeId) && edgeId.HasValue) |
| | | 425 | | { |
| | | 426 | | return (edgeId.Value, true); |
| | | 427 | | } |
| | | 428 | | |
| | | 429 | | if (globalRestrictionEdges.TryGetValue(globalEdgeId.GetInverted(), out edgeId) && edgeId.HasValue) |
| | | 430 | | { |
| | | 431 | | return (edgeId.Value, false); |
| | | 432 | | } |
| | | 433 | | |
| | | 434 | | return null; |
| | | 435 | | } |
| | 0 | 436 | | } |
| | | 437 | | |
| | | 438 | | internal static IStandaloneNetworkTileEnumerator GetEnumerator(this StandaloneNetworkTileWriter writer) |
| | 0 | 439 | | { |
| | 0 | 440 | | return writer.GetResultingTile().GetEnumerator(); |
| | 0 | 441 | | } |
| | | 442 | | } |