コード例 #1
0
ファイル: Editor_distanation.cs プロジェクト: Bushin/Poezd
 void Add_distanation()
 {
     string name = textBox4.Text;
     Distanation dist;
     dist = new Distanation(name, ostanovki[0].Name, ostanovki[ostanovki.Count - 1].Name, ostanovki);
     Glades.marshruti.Add(dist);
 }
コード例 #2
0
        void Add_distanation()
        {
            string      name = textBox4.Text;
            Distanation dist;

            dist = new Distanation(name, ostanovki[0].Name, ostanovki[ostanovki.Count - 1].Name, ostanovki);
            Glades.marshruti.Add(dist);
        }
コード例 #3
0
ファイル: Train.cs プロジェクト: Samatov/Poezda
        public void last_ostanovka(Distanation marshrut, DateTime time)
        {
            int count = 0, i = 0;
            int hour, min;
            Boolean flag = true;
            DateTime dt1 = new DateTime();
            DateTime dt2 = new DateTime();
            DateTime realtime = new DateTime();
            hour = int.Parse(time.ToString("HH"));
            min = int.Parse(time.ToString("mm"));
            realtime = realtime.AddHours(hour);
            realtime = realtime.AddMinutes(min);

            if (realtime <= Time[0])//поезl не выехал
            {
                motion = false;
                last_stops = marshrut.Start;
                flag = false;
                count = 0;
                S = 0;
                X_din = 0;
                Y_din = 0;

            }
            if (realtime >= Time[Time.Count - 1])//поезд приехал
            {
                last_stops = marshrut.End;
                flag = false;
                count = marshrut.Ostanovki.Count - 1;
                motion = false;
                S = 100;
                X_din = 0;
                Y_din = 0;
            }
            while (flag)
            {
                dt1 = Time[i];
                dt2 = Time[i + 1];
                if ((realtime > dt1) & (realtime >= dt2))
                {
                    i++;
                    count++;
                }
                if ((realtime >= dt1) & (realtime < dt2))
                {
                    if (realtime == dt1)
                        motion = false;
                    else
                        motion = true;

                    last_stops = marshrut.Ostanovki[count].Name;
                    flag = false;
                    rachet_S(marshrut.Ostanovki[count], marshrut.Ostanovki[count + 1], dt1, dt2, time);
                }

            }
        }
コード例 #4
0
        public void last_ostanovka(Distanation marshrut)
        {
            int      count = 0, i = 0;
            int      hour, min;
            Boolean  flag     = true;
            DateTime dt1      = new DateTime();
            DateTime dt2      = new DateTime();
            DateTime realtime = new DateTime();

            hour     = int.Parse(DateTime.Now.ToString("HH"));
            min      = int.Parse(DateTime.Now.ToString("mm"));
            realtime = realtime.AddHours(hour);
            realtime = realtime.AddMinutes(min);

            if (realtime <= Time[0])//поезl не выехал
            {
                motion     = false;
                last_stops = marshrut.Start;
                flag       = false;
                count      = 0;
            }
            if (realtime >= Time[Time.Count - 1])//поезд приехал
            {
                last_stops = marshrut.End;
                flag       = false;
                count      = marshrut.Ostanovki.Count - 1;
                motion     = false;
            }


            //for (int i = 0; i < Time.Count; i++)
            while (flag)
            {
                dt1 = Time[i];
                dt2 = Time[i + 1];
                if ((realtime > dt1) & (realtime >= dt2))
                {
                    i++;
                    count++;
                }
                if ((realtime >= dt1) & (realtime < dt2))
                {
                    if (realtime == dt1)
                    {
                        motion = false;
                    }
                    else
                    {
                        motion = true;
                    }

                    last_stops = marshrut.Ostanovki[count].Name;
                    flag       = false;
                }
            }
        }
コード例 #5
0
ファイル: Glades.cs プロジェクト: Bushin/Poezd
        public void PoiskVsexmarshrutov()
        {
            XmlDocument Doc = new XmlDocument();

            Doc.Load("Distanation.xml");
            XmlElement Root = Doc.DocumentElement;
            string     start = "", end = "", id = "";

            foreach (XmlNode node in Root)
            {
                List <Stops> ostanovki = new List <Stops>();
                if (node.Attributes.Count > 0)
                {
                    XmlNode attr = node.Attributes.GetNamedItem("id");
                    if (attr != null)
                    {
                        id = attr.Value;
                    }
                }
                foreach (XmlNode childnode in node.ChildNodes)
                {
                    if (childnode.Name == "Start")
                    {
                        start = childnode.InnerText;
                    }
                    if (childnode.Name == "End")
                    {
                        end = childnode.InnerText;
                    }
                    if (childnode.Name == "stops")
                    {
                        string[] info = childnode.InnerText.Split(' ');
                        for (int i = 0; i < info.Length; i++)
                        {
                            ostanovki.Add(Poiskostanovoki(info[i]));
                        }
                    }
                }
                dist = new Distanation(id, start, end, ostanovki);
                marshruti.Add(dist);
                ostanovki = null;
            }
        }
コード例 #6
0
ファイル: Glades.cs プロジェクト: Samatov/Poezda
 public void PoiskVsexmarshrutov()
 {
     XmlDocument Doc = new XmlDocument();
     Doc.Load("Distanation.xml");
     XmlElement Root = Doc.DocumentElement;
     string start = "", end = "", id = "";
     foreach (XmlNode node in Root)
     {
         List<Stops> ostanovki = new List<Stops>();
         if (node.Attributes.Count > 0)
         {
             XmlNode attr = node.Attributes.GetNamedItem("id");
             if (attr != null)
                 id = attr.Value;
         }
         foreach (XmlNode childnode in node.ChildNodes)
         {
             if (childnode.Name == "Start")
             {
                 start = childnode.InnerText;
             }
             if (childnode.Name == "End")
             {
                 end = childnode.InnerText;
             }
             if (childnode.Name == "stops")
             {
                 string[] info = childnode.InnerText.Split(' ');
                 for (int i = 0; i < info.Length; i++)
                 {
                     ostanovki.Add(Poiskostanovoki(info[i]));
                 }
             }
         }
         dist = new Distanation(id, start, end, ostanovki);
         marshruti.Add(dist);
         ostanovki = null;
     }
 }