Esempio n. 1
0
        private void TraziRuteOdM(podaci marker)
        {
            podaci TimeSpeed = new podaci();

            TimeSpeed.id_markera = marker.id_markera;
            TimeSpeed.imena      = marker.imena;
            for (int i = 0; i < rutes.Count; i++)
            {
                if (int.Parse(rutes[i].ime_markera) == marker.id_markera)
                {
                    TimeSpeed.korX += duzinaRute(rutes[i].tstart_X, rutes[i].tstart_Y, rutes[i].finish_X, rutes[i].finish_Y);
                    for (int j = 0; j <= 1; j++)
                    {
                        if (j == 0)
                        {
                            Tocka tockica = new Tocka();
                            tockica.koord_x    = rutes[i].tstart_X;
                            tockica.koord_y    = rutes[i].tstart_Y;
                            tockica.id_Tocka   = i;
                            tockica.marker     = "no";
                            tockica.postrojba  = marker.prezimena;
                            tockica.zavrsna    = 2;
                            tockica.pripadnost = marker.vrsta;
                            tocke.Add(tockica);
                        }

                        else
                        {
                            Tocka tockica = new Tocka();
                            tockica.koord_x    = rutes[i].finish_X;
                            tockica.koord_y    = rutes[i].finish_Y;
                            tockica.id_Tocka   = i;
                            tockica.marker     = "no";
                            tockica.postrojba  = marker.prezimena;
                            tockica.pripadnost = marker.vrsta;
                            tockica.zavrsna    = 0;
                            tocke.Add(tockica);
                        }
                    }
                }
            }

            ListaTimeSpeed.Add(TimeSpeed);
        }
Esempio n. 2
0
        private void load_Click(object sender, EventArgs e)
        {
            int pamtiMarkerPrije = 0;

            for (int i = 0; i < tocke.Count; i++)
            {
                if (tocke[i].marker == "yes")
                {
                    podaci m = new podaci();
                    m.id_markera     = tocke[i].id_Tocka;
                    m.korX           = tocke[i].koord_x;
                    m.korY           = tocke[i].koord_y;
                    m.imena          = tocke[i].postrojba;
                    m.prezimena      = tocke[i].postrojba;
                    m.vrsta          = tocke[i].pripadnost;
                    pamtiMarkerPrije = m.id_markera;
                    staviMarker(m.korX, m.korY, m.vrsta, m.prezimena, m.id_markera);
                }


                else
                {
                    rute ruta = new rute();
                    if (tocke[i].zavrsna == 2)
                    {
                        ruta.id_rute     = tocke[i].id_Tocka;
                        ruta.ime_markera = pamtiMarkerPrije.ToString();


                        ruta.start_X  = tocke[i].koord_x;
                        ruta.start_Y  = tocke[i].koord_y;
                        ruta.tstart_X = tocke[i].koord_x;
                        ruta.tstart_Y = tocke[i].koord_y;
                        ruta.finish_X = tocke[i + 1].koord_x;
                        ruta.finish_Y = tocke[i + 1].koord_y;
                        ruta.gotovo   = 0;

                        Stavirutu(ruta.start_X, ruta.start_Y, ruta.finish_X, ruta.finish_Y, ruta.ime_markera);
                    }
                }
            }
        }
Esempio n. 3
0
        private void staviMarker(double X, double Y, string r2, string postrojba, int mId)
        {
            gMapControl1.Position = new PointLatLng(Y, X);
            GMarkerGoogle marker;

            if (r2 == "enemy")
            {
                marker = new GMarkerGoogle(gMapControl1.Position, GMarkerGoogleType.pink);
            }
            else
            {
                marker = new GMarkerGoogle(gMapControl1.Position, GMarkerGoogleType.blue);
            }


            TheChosenOne       = comboBox1.Text;
            marker.ToolTipText = marker_Id.ToString();

            overlayOne.Markers.Add(marker);
            gMapControl1.Overlays.Add(overlayOne);
            podaci m = new podaci();

            m.imena      = postrojba;
            m.prezimena  = postrojba;
            m.id_markera = mId;
            marker_Id++;
            m.korX = X;
            m.korY = Y;
            if (r2 == "enemy")
            {
                m.vrsta = "enemy";
            }
            else
            {
                m.vrsta = "our_team";
            }
            markeri.Add(m);
        }
Esempio n. 4
0
        private void gMapControl1_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            double X = gMapControl1.FromLocalToLatLng(e.X, e.Y).Lng;
            double Y = gMapControl1.FromLocalToLatLng(e.X, e.Y).Lat;

            if (r3.Checked == true)
            {
                gMapControl1.Position = new PointLatLng(Y, X);
                GMarkerGoogle marker;
                if (r2.Checked == true)
                {
                    marker = new GMarkerGoogle(gMapControl1.Position, GMarkerGoogleType.pink);
                }
                else
                {
                    marker = new GMarkerGoogle(gMapControl1.Position, GMarkerGoogleType.blue);
                }

                int indexOdabranePostrojbe = comboBox1.SelectedIndex + 41;
                TheChosenOne = indexOdabranePostrojbe.ToString();

                marker.ToolTipText = marker_Id.ToString();

                overlayOne.Markers.Add(marker);
                gMapControl1.Overlays.Add(overlayOne);
                podaci m = new podaci();
                m.imena      = TheChosenOne;
                m.prezimena  = TheChosenOne;
                m.id_markera = marker_Id;
                marker_Id    = marker_Id + 1;
                m.korX       = X;
                m.korY       = Y;
                if (r1.Checked == false)
                {
                    m.vrsta = "enemy";
                }
                else
                {
                    m.vrsta = "our_team";
                }
                markeri.Add(m);
            }

            else if (r4.Checked == true)
            {
                if (marker_ruta == null)
                {
                    MessageBox.Show("Moraš prvo kreirati barem jedan marker da bi mu mogao dodijeliti rutu...");
                }
                else
                {
                    rute nova_rute = new rute();
                    nova_rute.start_X  = temporary.korX;
                    nova_rute.tstart_X = temporary.korX;
                    nova_rute.start_Y  = temporary.korY;
                    nova_rute.tstart_Y = temporary.korY;
                    nova_rute.finish_X = Y;
                    nova_rute.finish_Y = X;
                    idRute_povecaj++;
                    nova_rute.id_rute     = idRute_povecaj;
                    nova_rute.ime_markera = marker_ruta;
                    rutes.Add(nova_rute);
                    List <PointLatLng> rutice = new List <PointLatLng>();
                    PointLatLng        start  = new PointLatLng(temporary.korX, temporary.korY);
                    PointLatLng        end    = new PointLatLng(Y, X);
                    rutice.Add(start);
                    rutice.Add(end);
                    var r = new GMap.NET.WindowsForms.GMapRoute(rutice, "MyRoute");
                    r.Name             = Convert.ToString(marker_ruta);
                    r.Stroke.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
                    r.IsHitTestVisible = true;
                    GMapOverlay routesOverlay = new GMapOverlay("routes");
                    routesOverlay.Routes.Add(r);
                    gMapControl1.Overlays.Add(routesOverlay);
                    gMapControl1.Zoom += 0.1;
                    gMapControl1.Zoom -= 0.1;
                }
            }
        }