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); }
private void srediListe() { for (int i = 0; i < markeri.Count; i++) { Tocka tockica = new Tocka(); tockica.id_Tocka = markeri[i].id_markera;//ovo je autoincrement u bazi tockica.koord_x = markeri[i].korX; tockica.koord_y = markeri[i].korY; tockica.postrojba = markeri[i].prezimena; tockica.pripadnost = markeri[i].vrsta; tockica.marker = "yes"; if (rutes.Count != 0) { TraziRuteOdM(markeri[i]); } else { tockica.zavrsna = 0; } ;//tu staviš null u bazu ako je marker tocke.Add(tockica); } }
private void pretvarajUlistuTocke() { for (int i = 0; i < LoadaneTocke.Count; i++) { Tocka t = new Tocka(); t.id_Tocka = LoadaneTocke[i].id_tocka; t.koord_x = (double)LoadaneTocke[i].koord_x; t.koord_y = (double)LoadaneTocke[i].koord_y; if (LoadaneTocke[i].marker == "Da") { t.marker = "yes"; } else { t.marker = "no"; } t.postrojba = LoadaneTocke[i].id_postrojba.ToString(); if (LoadaneTocke[i].id_pripadnost == 2) { t.pripadnost = "enemy"; } else { t.pripadnost = "our_team"; } if (LoadaneTocke[i].zavrsna != null) { t.zavrsna = 2; } else { t.zavrsna = 0; } tocke.Add(t); } }