private void AddPrivateTrip(Passenger passenger, PassengerEvent lastEvent, string lastStationName, PassengerEvent currentEvent, string currentStationName) { Point lastLocation; if (lastStationName == "-") { lastLocation = (lastEvent as PassengerActivityEvent).Location; } else { StopFacility lastF = StopFacilityNameDic[lastStationName]; lastLocation = lastF.LinkedStation.Location; } Point currentLocation; if (currentStationName == "-") { currentLocation = (currentEvent as PassengerActivityEvent).Location; } else { StopFacility currentF = StopFacilityNameDic[currentStationName]; currentLocation = currentF.LinkedStation.Location; } PassengerPrivateTripEvent e = new PassengerPrivateTripEvent() { Type = PassengerEventTypes.TripStart, Time = lastEvent.Time, Location = lastLocation }; passenger.EventList.Add(e); e = new PassengerPlot.PassengerPrivateTripEvent() { Type = PassengerEventTypes.TripEnd, Time = currentEvent.Time, Location = currentLocation }; passenger.EventList.Add(e); }
private void LoadStopFacility(string directory) { EntityData.StopFacilityList = new Dictionary <string, PassengerPlot.StopFacility>(); XDocument xmlDoc = XDocument.Load(directory + "input/abmt_pt_schedule.xml"); XElement transitStopsElements = xmlDoc.Element("transitSchedule").Element("transitStops"); foreach (XElement stopElement in transitStopsElements.Elements("stopFacility")) { StopFacility sf = new PassengerPlot.StopFacility() { Name = stopElement.Attribute("name").Value, ID = stopElement.Attribute("id").Value, Location = new Point(Convert.ToDouble(stopElement.Attribute("x").Value), Convert.ToDouble(stopElement.Attribute("y").Value)), LinkedStation = GetStationIDByFacilityRefID(stopElement.Attribute("id").Value) }; EntityData.StopFacilityList.Add(sf.ID, sf); if (!StopFacilityNameDic.ContainsKey(sf.Name)) { StopFacilityNameDic.Add(sf.Name, sf); } } System.IO.FileStream fs = new System.IO.FileStream(directory + "input/NameDisplayFacilities.txt", System.IO.FileMode.Open); System.IO.StreamReader sr = new System.IO.StreamReader(fs); string facilityID = sr.ReadLine(); while (facilityID != null && facilityID.Trim() != "") { if (EntityData.StopFacilityList.ContainsKey(facilityID)) { StopFacility sf = EntityData.StopFacilityList[facilityID]; sf.IsDisplayName = true; } facilityID = sr.ReadLine(); } sr.Close(); fs.Close(); }
public VStopFacility(StopFacility entity) { Entity = entity; }