public static void createOsmNodes(MapReader mapReader, Dispatcher dispatcher, Connection connection) { List <ulong> createdRoadNodeIds = new List <ulong>(); foreach (OsmWay way in mapReader.ways.Values.ToList()) { if (way.IsRoad) { foreach (ulong nodeId in way.NodeIDs) { OsmNode thisNode; if (mapReader.nodes.TryGetValue(nodeId, out thisNode)) { if (thisNode.Id != nodeId) { Startup.StaticConnection.SendLogMessage(LogLevel.Info, Startup.StaticLogName, "Node ids don't match!"); } if (!createdRoadNodeIds.Contains(nodeId)) { createdRoadNodeIds.Add(nodeId); RequestId <CreateEntityRequest> roadNodeRequestId = CreationRequests.CreateOsmNodeEntity(dispatcher, connection, "Road Node", thisNode.coords); } } else { Startup.StaticConnection.SendLogMessage(LogLevel.Info, Startup.StaticLogName, "Couldn't find road node by id"); } } } if (way.IsBuilding) { } } }
private static void CreateCars(WorkerView dispatcher, Connection connection) { for (int i = 0; i < numberOfCars; i++) { RequestId <CreateEntityRequest> creationRequestId = CreationRequests.CreateCarEntity(dispatcher, connection); dispatcher.carCreationRequestIds.Add(creationRequestId); } }
private static void CreateNewBusesInList(WorkerView dispatcher, Connection connection, System.Collections.Generic.HashSet <string> newBusVehicleIds) { foreach (string busVehicleId in newBusVehicleIds) { if (!busVehicleIds.Contains(busVehicleId)) { if (BusOnMap(busVehicleId)) { RequestId <CreateEntityRequest> creationRequestId = CreationRequests.CreateBusEntity(dispatcher, connection, busVehicleId); dispatcher.carCreationRequestIds.Add(creationRequestId); requestIdToBusVehicleIdDict.Add(creationRequestId, busVehicleId); } } } }
public static void createBusStops(MapReader mapReader, Dispatcher dispatcher, Connection connection) { foreach (ulong busStopId in mapReader.busStops.Values) { OsmNode thisNode; if (mapReader.nodes.TryGetValue(busStopId, out thisNode)) { RequestId <CreateEntityRequest> busStopRequestId = CreationRequests.CreateBusStopEntity(dispatcher, connection, "Bus stop", thisNode.coords, thisNode.actoCode); } else { Startup.StaticConnection.SendLogMessage(LogLevel.Info, Startup.StaticLogName, "Couldn't find bus stop node by id"); } } }