public PublicTransport(PublicTransport obj)
 {
     ID            = obj.ID;
     transportId   = obj.transportId;
     transportType = obj.transportType;
     last_stop     = obj.last_stop;
     next_stop     = obj.next_stop;
     progress      = obj.progress;
 }
        private void MainWindow_Load(object sender, EventArgs e)
        {
            command1 = new MenuItem("Your command name 1", new EventHandler(Method1));
            command2 = new MenuItem("Your command name 2", new EventHandler(Method2));
            markerMenu.MenuItems.Add(command1);
            markerMenu.MenuItems.Add(command2);
            gMapControl1.MapProvider    = GMapProviders.YandexMap;
            gMapControl1.Zoom           = 5;
            gMapControl1.MaxZoom        = 15;
            gMapControl1.MinZoom        = 3;
            gMapControl1.MarkersEnabled = true;
            label4.Text = gMapControl1.Zoom.ToString();
            gMapControl1.OnMarkerClick += new MarkerClick(gMap_OnMarkerClick);
            using (StreamReader sR = new StreamReader("stops.txt", Encoding.GetEncoding(1251)))
            {
                int     score = 0;
                BusStop tmp   = new BusStop();
                while (true)
                {
                    string temp = sR.ReadLine();
                    if (temp == null)
                    {
                        break;
                    }
                    switch (score)
                    {
                    case 0:
                        tmp.ID = int.Parse(temp);
                        break;

                    case 1:
                        tmp.weight = int.Parse(temp);
                        break;

                    case 2:
                        tmp.name = temp;
                        break;

                    case 3:
                        tmp.adjacentIdList = space_Parsing(temp);
                        break;

                    case 4:
                        tmp.adjacentRoadsList = space_Parsing(temp);
                        break;

                    case 5:
                        tmp.routeList = space_Parsing(temp);
                        break;

                    case 6:
                        tmp.coord_X = double.Parse(temp, CultureInfo.InvariantCulture);
                        break;

                    case 7:
                        tmp.coord_Y = double.Parse(temp, CultureInfo.InvariantCulture);
                        break;
                    }
                    score += 1;
                    if (score == 8)
                    {
                        score = 0;
                        BusStop newPoint = new BusStop(tmp);
                        map_stops.Add(newPoint);
                    }
                }
            }
            List <int> lines = new List <int>();

            for (int i = 0; i < map_stops.Count; i++)
            {
                AddPoint(map_stops[i].coord_X, map_stops[i].coord_Y, map_stops[i].name);
                for (int j = 0; j < map_stops[i].adjacentIdList.Count; j++)
                {
                    bool flag = false;
                    for (int k = 0; k < lines.Count; k += 2)
                    {
                        if (lines[k] == map_stops[i].ID && lines[k + 1] == map_stops[i].adjacentIdList[j])
                        {
                            flag = true;
                        }
                        if (lines[k + 1] == map_stops[i].ID && lines[k] == map_stops[i].adjacentIdList[j])
                        {
                            flag = true;
                        }
                    }
                    if (flag == false)
                    {
                        lines.Add(map_stops[i].ID);
                        lines.Add(map_stops[i].adjacentIdList[j]);
                    }
                }
            }

            /*for (int i = 0; i < lines.Count; i += 2)
             * {
             *  AddRoute(map_stops[lines[i] - 1].coord_X, map_stops[lines[i] - 1].coord_Y, map_stops[lines[i + 1] - 1].coord_X, map_stops[lines[i + 1] - 1].coord_Y);
             * }*/
            using (StreamReader sR = new StreamReader("routes.txt"))
            {
                int   score = 0;
                Route tmp   = new Route();
                while (true)
                {
                    string temp = sR.ReadLine();
                    if (temp == null)
                    {
                        break;
                    }
                    switch (score)
                    {
                    case 0:
                        tmp.ID = int.Parse(temp);
                        break;

                    case 1:
                        tmp.way = space_Parsing(temp);
                        break;
                    }
                    score += 1;
                    if (score == 2)
                    {
                        score = 0;
                        Route newRoute = new Route(tmp);
                        map_routes.Add(newRoute);
                    }
                }
            }
            using (StreamReader sR = new StreamReader("transports.txt"))
            {
                int             score = 0;
                PublicTransport tmp   = new PublicTransport();
                while (true)
                {
                    string temp = sR.ReadLine();
                    if (temp == null)
                    {
                        break;
                    }
                    switch (score)
                    {
                    case 0:
                        tmp.ID = int.Parse(temp);
                        break;

                    case 1:
                        tmp.transportId = temp;
                        break;

                    case 2:
                        tmp.transportType = temp;
                        break;

                    case 3:
                        tmp.last_stop = int.Parse(temp);
                        break;

                    case 4:
                        tmp.next_stop = int.Parse(temp);
                        break;

                    case 5:
                        tmp.progress = double.Parse(temp, CultureInfo.InvariantCulture);
                        break;
                    }
                    score += 1;
                    if (score == 6)
                    {
                        score = 0;
                        PublicTransport newTransport = new PublicTransport(tmp);
                        map_transport.Add(newTransport);
                    }
                }
            }
            for (int i = 0; i < map_transport.Count; i++)
            {
                AddTrans(map_stops[map_transport[i].last_stop - 1].coord_X, map_stops[map_transport[i].last_stop - 1].coord_Y, map_stops[map_transport[i].next_stop - 1].coord_X, map_stops[map_transport[i].next_stop - 1].coord_Y, map_transport[i].progress, map_transport[i].ID.ToString());
            }

            List <Color> clrList = new List <Color>();

            clrList.Add(Color.FromArgb(4, 255, 0, 0));
            clrList.Add(Color.FromArgb(4, 0, 255, 0));
            clrList.Add(Color.FromArgb(4, 255, 255, 0));
            clrList.Add(Color.FromArgb(4, 0, 0, 255));
            int h = 0;

            foreach (var route in map_routes)
            {
                for (int i = 0; i < route.way.Count - 1; i++)
                {
                    AddRoute(
                        map_stops[route.way[i] - 1].coord_X,
                        map_stops[route.way[i] - 1].coord_Y,
                        map_stops[route.way[i + 1] - 1].coord_X,
                        map_stops[route.way[i + 1] - 1].coord_Y,
                        clrList[h]
                        );
                }
                h++;
            }
        }