Beispiel #1
0
        public void validKFTGPS(string _lat, string _lon,string speed,string number, string TimeDate, bool Clear)
        {
            if (!string.IsNullOrEmpty(_lat))
            {
                if (Clear)
                    frmSatelliteMap.satelliteMap.Invoke(new ClearMapDelegate(ClearMap), null);

                double lat = Convert_To_Decimal(_lat);
                double lon = Convert_To_Decimal(_lon);

                smartrack pp = searchDevice(number);

                //*************************************************************
                //*** CONTROLLARE SE IL MEZZO HA ASSOCIATO UN'OBIETTIVO
                //*** E IN TAL CASO CONTROLLARE SE E' ALL'INTERNO
                //*************************************************************
                if (pp.Bersaglio != null)               //esiste un bersaglio
                {
                    MapUtils mu = new MapUtils(pp, this);
                    Location bers = null;
                    string[] hh = pp.Bersaglio.Split('|');
                    if (!string.IsNullOrEmpty(hh[1]) && !string.IsNullOrEmpty(hh[2]))
                        bers = frmMapPoint.Map.ActiveMap.GetLocation(double.Parse(hh[1]), double.Parse(hh[2]), frmMapPoint.Map.ActiveMap.Altitude);
                    mu.radiusSearch(frmMapPoint.Map.ActiveMap, bers.Latitude, bers.Longitude, lat, lon);
                }

                if (frmSatelliteMap.Visible == true)
                {
                    object[] ob = new object[6];
                    ob[0] = lat;
                    ob[1] = lon;
                    ob[2] = pp.Description + " (" + number + ")";
                    ob[3] = TimeDate;
                    ob[4] = pp.image;
                    ob[5] = true;
                    frmSatelliteMap.satelliteMap.Invoke(new SetPushpinDelegate(SetPushpin), new object[] { ob });
                }

                if (frmMapPoint.Visible == true)
                {
                    SetVehiclePosition(lat, lon, frmMapPoint.Map.ActiveMap, pp.Description, pp.Targa + " (" + number + ")\r\nVel:"+speed+" Km/h", "", pp.image,Clear);
                }

                pp.Lat = lat;
                pp.Lon = lon;
                pp.lastDate = TimeDate;

                saveDevices(sm_array);
            }
        }
Beispiel #2
0
        public void validGPSTablet(string ret, string UNIT, string TimeDate, bool Clear)
        {
            if (!string.IsNullOrEmpty(ret))
            {
                if (Clear)
                    frmSatelliteMap.satelliteMap.Invoke(new ClearMapDelegate(ClearMap), null);

                string[] Coord = ret.Split(',');
                string _latitude = Coord[0];
                string _longitude = Coord[1];
                string KmH = Coord[2];
                double lat = Double.Parse(_latitude.Replace('.',','));// getLatitude(_latitude);
                double lon = Double.Parse(_longitude.Replace('.', ','));// getLongitude(_longitude);

                smartrack pp = searchDevice(UNIT);

                if (frmSatelliteMap.Visible == true)
                {
                    object[] ob = new object[5];
                    ob[0] = lat;// TrasformLatitude(_latitude);
                    ob[1] = lon;// TrasformLongitude(_longitude);
                    ob[2] = pp.Description + " (" + UNIT + ")";
                    ob[3] = TimeDate;
                    ob[4] = pp.image;
                    frmSatelliteMap.satelliteMap.Invoke(new SetPushpinDelegate(SetPushpin), new object[] { ob });
                }
                if (frmMapPoint.Visible == true)
                {
                    SetVehiclePosition(lat, lon, frmMapPoint.Map.ActiveMap, pp.Description, pp.Targa + " (" + UNIT + ")", "", pp.image, Clear);
                    //*************************************************************
                    //*** CONTROLLARE SE IL MEZZO HA ASSOCIATO UN'OBIETTIVO
                    //*** E IN TAL CASO CONTROLLARE SE E' ALL'INTERNO
                    //*************************************************************
                    if (pp.Bersaglio != null)               //esiste un bersaglio
                    {
                        MapUtils mu = new MapUtils(pp, this);
                        Location bers = null;
                        string[] hh = pp.Bersaglio.Split('|');
                        if (!string.IsNullOrEmpty(hh[1]) && !string.IsNullOrEmpty(hh[2]))
                            bers = frmMapPoint.Map.ActiveMap.GetLocation(double.Parse(hh[1]), double.Parse(hh[2]), frmMapPoint.Map.ActiveMap.Altitude);
                        //else
                        //   bers = frmMapPoint.Map.ActiveMap.

                        mu.radiusSearch(frmMapPoint.Map.ActiveMap, bers.Latitude, bers.Longitude, lat, lon);
                    }

                    /*if (pp.Bersaglio != null)               //esiste un bersaglio
                    {
                        MapUtils mu = new MapUtils(pp, this);
                        mu.radiusSearch(frmMapPoint.Map.ActiveMap, pp.Bersaglio.Latitude, pp.Bersaglio.Longitude, lat, lon);
                    }*/
                }

                //smartrack pp = searchDevice(number);
                pp.Lat = lat;
                pp.Lon = lon;
                pp.lastDate = TimeDate;

                saveDevices(sm_array);
            }
        }