public void moverUnBus(MIO bus) { ParameterizedThreadStart delegado = new ParameterizedThreadStart(moverBus); Thread hilo = new Thread(delegado); hilo.Start(bus); }
public void moverBus(object bus) { Bitmap markerMio = (Bitmap)Image.FromFile(@"iconoMio.png"); MIO buss = (MIO)bus; //Console.WriteLine(buss.BUSID); double latitude = ordenarDecimal(buss.LATITUDE); double longitude = ordenarDecimal(buss.LONGITUDE); marker = new GMarkerGoogle(new PointLatLng(latitude, longitude), markerMio); markerOverlayMIO.Markers.Add(marker); marker.ToolTipText = buss.LINEID; gControl.Overlays.Add(markerOverlayMIO); for (int j = 1; j < buss.LIST_LATITUDE.Count - 1; j++) { while (!buss.LATITUDE.Equals(buss.LIST_LATITUDE[j]) && !buss.LONGITUDE.Equals(buss.LIST_LONGITUDE[j])) { //Buses[i].moveBus(ordenarDecimal(Buses[i].LIST_LATITUDE[j]), ordenarDecimal(Buses[i].LIST_LONGITUDE[j])); buss.moveBus2(buss.LIST_LATITUDE[j], buss.LIST_LONGITUDE[j]); marker.Position = new GMap.NET.PointLatLng(ordenarDecimal(buss.LATITUDE), ordenarDecimal(buss.LONGITUDE)); //Thread.Sleep(1000); } } }
public Hilo(MIO mio, Form1 forma, String x, String y) { mios = mio; ventana = forma; this.x = x; this.y = y; continuar = true; }
//metodo de prueba public void lecturaDatagramas2() { StreamReader lector = new StreamReader(@"DATAGRAMS4.txt"); String line = lector.ReadLine(); line = lector.ReadLine(); while (line != null) { MIO bus = new MIO("", "", "", "", "", "", "", "", "", "", ""); String[] arregloDatagramas = line.Split(','); bus.EVENTTYPE = arregloDatagramas[0]; bus.STOPID = arregloDatagramas[2]; bus.ODOMETER = arregloDatagramas[3]; bus.LATITUDE = arregloDatagramas[4]; bus.LONGITUDE = arregloDatagramas[5]; bus.LIST_LATITUDE.Add(arregloDatagramas[4]); bus.LIST_LONGITUDE.Add(arregloDatagramas[5]); bus.TASKID = arregloDatagramas[6]; bus.LINEID = arregloDatagramas[7]; bus.TRIPID = arregloDatagramas[8]; bus.DATAGRAMID = arregloDatagramas[9]; bus.DATAGRAMDATE = arregloDatagramas[10]; bus.BUSID = arregloDatagramas[11]; line = lector.ReadLine(); arregloDatagramas = line.Split(','); while (line != null && arregloDatagramas[11].Equals(bus.BUSID)) { arregloDatagramas = line.Split(','); bus.LIST_LATITUDE.Add(arregloDatagramas[4]); bus.LIST_LONGITUDE.Add(arregloDatagramas[5]); line = lector.ReadLine(); if (line != null) { arregloDatagramas = line.Split(','); } } Buses.Add(bus); Console.WriteLine(bus.BUSID); busDict.Add(Int32.Parse(bus.BUSID), bus); } lector.Close(); }
public Boolean busExist(MIO idBus) { for (int i = 0; i < Buses.Count(); i++) { if (Buses[i].BUSID.Equals(idBus.BUSID)) { indexBus = i; return(true); } } return(false); }
//Aquí se guarda la información de los buses, en la lista de buses. public void lecturaDatagramas() { StreamReader lector = new StreamReader(@"DATAGRAMS4.txt"); String line = lector.ReadLine(); line = lector.ReadLine(); int i = 0; while (line != null) { String[] arregloDatagramas = line.Split(','); String EVENTTYPE = arregloDatagramas[0]; String STOPID = arregloDatagramas[2]; String ODOMETER = arregloDatagramas[3]; String LATITUDE = arregloDatagramas[4]; String LONGITUDE = arregloDatagramas[5]; String TASKID = arregloDatagramas[6]; String LINEID = arregloDatagramas[7]; String TRIPID = arregloDatagramas[8]; String DATAGRAMID = arregloDatagramas[9]; String DATAGRAMDATE = arregloDatagramas[10]; String BUSID = arregloDatagramas[11]; MIO bus = new MIO(EVENTTYPE, STOPID, ODOMETER, LATITUDE, LONGITUDE, TASKID, LINEID, TRIPID, DATAGRAMID, DATAGRAMDATE, BUSID); Buses.Add(bus); i++; line = lector.ReadLine(); } lector.Close(); }