/// <summary> /// Get all TransportNode objects currently streamed in for the given transport network and cell. /// </summary> /// <param name="transportApi">TransportApi instance.</param> /// <param name="transportNetwork">The returned results are filtered to contain only objects belonging to this transport network.</param> /// <param name="cellKey">The returned results are filtered to contain only objects belonging to this cell.</param> /// <returns>The list of TransportNode objects for the given network and cell.</returns> static public IList <TransportNode> GetNodesForNetworkAndCell(this TransportApi transportApi, TransportNetworkType transportNetwork, TransportCellKey cellKey) { var nodeIds = transportApi.GetNodeIdsForNetworkInCell(transportNetwork, cellKey); var nodes = new List <TransportNode>(); foreach (var nodeId in nodeIds) { TransportNode node; if (!transportApi.TryGetNode(nodeId, out node)) { throw new System.ArgumentOutOfRangeException("unable to fetch TransportWay"); } nodes.Add(node); } return(nodes); }
private void AddForCell( TransportCellKey cellKey, IList <TransportNodeId> nodeIds, IList <TransportDirectedEdgeId> directedEdgeIds, IList <TransportWayId> wayIds ) { foreach (var nodeId in nodeIds) { TransportNode node; if (m_transportApi.TryGetNode(nodeId, out node)) { m_nodes.Add(node.Id, node); } } foreach (var directedEdgeId in directedEdgeIds) { TransportDirectedEdge directedEdge; if (m_transportApi.TryGetDirectedEdge(directedEdgeId, out directedEdge)) { m_directedEdges.Add(directedEdge.Id, directedEdge); } } foreach (var wayId in wayIds) { TransportWay way; if (m_transportApi.TryGetWay(wayId, out way)) { m_ways.Add(way.Id, way); } } if (OnTransportGraphChanged != null) { OnTransportGraphChanged(this, cellKey); } }