Ejemplo n.º 1
0
        private static void ReadStopFacility(XElement stopFacilitySetElement)
        {
            EntityData.StopFacilityList = new Dictionary <string, PassengerPlot.StopFacility>();

            foreach (XElement element in stopFacilitySetElement.Elements("StopFacility"))
            {
                StopFacility sf = new PassengerPlot.StopFacility()
                {
                    ID            = element.Attribute("ID").Value,
                    LinkedStation = EntityData.StationList[element.Attribute("LinkedStationID").Value],
                    Name          = element.Attribute("Name").Value,
                    Location      = System.Windows.Point.Parse(element.Attribute("Location").Value),
                    IsDisplayName = bool.Parse(element.Attribute("IsDisplayName").Value)
                };
                EntityData.StopFacilityList.Add(sf.ID, sf);
            }
        }
Ejemplo n.º 2
0
        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();
        }