예제 #1
0
        /*private void UpdateTexts(String s)
         * {
         *  String[] coln = s.Split('\t');
         *
         *  locationManager curr_loc = new locationManager(double.Parse(coln[(int)gpslogger.lat]), double.Parse(coln[(int)gpslogger.lng]), 0);
         *
         *  if (strt_loc.lat > 0 && strt_loc.lng > 0)
         *  {
         *      curr_loc.dst = GetDistance(strt_loc.lat, strt_loc.lng, curr_loc.lat, curr_loc.lng);
         *
         *      if (curr_loc.dst >= dist_100)
         *      {
         *          //Console.WriteLine("Id:" + a[0] + " strLat:" + start_lat + " strLng:" + start_lng + " curLat:" + currn_lat + " curLng:" + currn_lng + " curDis:" + currn_dst + " preDis:" + prevs_dst);
         *
         *          String[] time = coln[(int)gpslogger.tim].Split('.');     // Separate the timestamp in GPS logger into second and milli
         *
         *          double euclidean = Math.Abs(curr_loc.dst - dist_100) - Math.Abs(prev_loc.dst - dist_100);
         *          if (euclidean > 0)
         *          {
         *              timeStamp info = new timeStamp(listGPS.Count, int.Parse(time[0]), int.Parse(time[1]), prev_loc, new inclinoMeter(double.Parse(coln[(int)gpslogger.acx]), double.Parse(coln[(int)gpslogger.acy])), true);
         *              listGPS.Add(info);
         *
         *              strt_loc = prev_loc;
         *              strt20m_loc = prev_loc;
         *
         *              dist_100 = 100 + (dist_100 - prev_loc.dst);
         *
         *              Console.WriteLine(">> Save Previous GPS Record. distance:" + prev_loc.dst + " next interval:" + dist_100);
         *          }
         *          else
         *          {
         *              timeStamp info = new timeStamp(listGPS.Count, int.Parse(time[0]), int.Parse(time[1]), curr_loc, new inclinoMeter(double.Parse(coln[(int)gpslogger.acx]), double.Parse(coln[(int)gpslogger.acy])), true);
         *              listGPS.Add(info);
         *
         *              strt_loc = curr_loc;
         *              strt20m_loc = curr_loc;
         *
         *              dist_100 = 100 + (dist_100 - curr_loc.dst);
         *
         *              Console.WriteLine(">> Save Current  GPS Record. distance:" + curr_loc.dst + " next interval:" + dist_100);
         *          }
         *
         *          curr_loc.dst = GetDistance(strt_loc.lat, strt_loc.lng, curr_loc.lat, curr_loc.lng);
         *      }
         *      else
         *      {
         *          double currn20m_dst = GetDistance(strt20m_loc.lat, strt20m_loc.lng, curr_loc.lat, curr_loc.lng);
         *
         *          if ((currn20m_dst >= dist_020) && (curr_loc.dst < 90.0))
         *          {
         *              String[] time = coln[(int)gpslogger.tim].Split('.');     // Separate the timestamp in GPS logger into second and milli
         *
         *              double euclidean = Math.Abs(currn20m_dst - dist_020) - Math.Abs(prev20m_loc.dst - dist_020);
         *
         *              if (euclidean > 0)
         *              {
         *                  timeStamp info = new timeStamp(listGPS.Count, int.Parse(time[0]), int.Parse(time[1]), prev_loc, 0, 0, false);
         *                  listGPS.Add(info);
         *
         *                  strt20m_loc = prev_loc;
         *
         *                  dist_020 = 20 + (dist_020 - prev20m_loc.dst);
         *                  Console.WriteLine(" - Save Previous GPS Record. distance:" + prev20m_loc.dst + " next interval:" + dist_020);
         *              }
         *              else
         *              {
         *                  timeStamp info = new timeStamp(listGPS.Count, int.Parse(time[0]), int.Parse(time[1]), curr_loc, 0, 0, false);
         *                  listGPS.Add(info);
         *
         *                  strt20m_loc = curr_loc;
         *
         *                  dist_020 = 20 + (dist_020 - currn20m_dst);
         *                  Console.WriteLine(" - Save Current  GPS Record. distance:" + currn20m_dst + " next interval:" + dist_020);
         *              }
         *              //Console.WriteLine(" - Id:" + coln[0] + " strLat:" + start20m_lat + " strLng:" + start20m_lng + " curLat:" + currn_lat + " curLng:" + currn_lng + " curDis:" + currn20m_dst + " preDis:" + prevs20m_dst);
         *              currn20m_dst = GetDistance(strt20m_loc.lat, strt20m_loc.lng, curr_loc.lat, curr_loc.lng);
         *          }
         *
         *          prev20m_loc.dst = currn20m_dst;
         *      }
         *      prev_loc = curr_loc;
         *  }
         *  else
         *  {
         *      String[] time = coln[(int)gpslogger.tim].Split('.');     // Separate the timestamp in GPS logger into second and milli
         *      dateSurvey = FromUnixTime(long.Parse(time[0]));
         *
         *      strt_loc = curr_loc;
         *      prev_loc = curr_loc;
         *      strt_loc.dst = 0;
         *      prev_loc.dst = 0;
         *
         *      strt20m_loc = curr_loc;
         *      prev20m_loc = curr_loc;
         *      strt20m_loc.dst = 0;
         *      prev20m_loc.dst = 0;
         *  }
         * }*/

        private void UpdateTexts(String s)
        {
            String[] coln = s.Split('\t');

            locationManager curr_loc = new locationManager(double.Parse(coln[(int)gpslogger.lat]), double.Parse(coln[(int)gpslogger.lng]), double.Parse(coln[(int)gpslogger.bea]), double.Parse(coln[(int)gpslogger.acx]), double.Parse(coln[(int)gpslogger.acy]));

            if (strt_loc.lat > 0 && strt_loc.lng > 0)
            {
                curr_loc.dst = GetDistance(strt_loc.lat, strt_loc.lng, curr_loc.lat, curr_loc.lng);

                if (curr_loc.dst >= dist_50m)
                {
                    String[] time = coln[(int)gpslogger.tim].Split('.');     // Separate the timestamp in GPS logger into second and milli

                    double euclidean = Math.Abs(curr_loc.dst - dist_50m) - Math.Abs(prev_loc.dst - dist_50m);

                    if (euclidean > 0)
                    {
                        timeStamp info = new timeStamp(listGPS.Count, int.Parse(time[0]), int.Parse(time[1]), prev_loc, !Convert.ToBoolean(listGPS.Count % 2));
                        listGPS.Add(info);

                        strt_loc = prev_loc;

                        dist_50m = 50.0 + (dist_50m - prev_loc.dst);

                        Console.WriteLine(">> Save Previous GPS Record. distance:" + prev_loc.dst + " next interval:" + dist_50m + " is100m:" + Convert.ToBoolean(0 % 2) + " is100m:" + Convert.ToBoolean(1 % 2) + " is100m:" + Convert.ToBoolean(2 % 2));
                    }
                    else
                    {
                        timeStamp info = new timeStamp(listGPS.Count, int.Parse(time[0]), int.Parse(time[1]), curr_loc, !Convert.ToBoolean(listGPS.Count % 2));
                        listGPS.Add(info);

                        strt_loc = curr_loc;

                        dist_50m = 50.0 + (dist_50m - curr_loc.dst);

                        Console.WriteLine(">> Save Current  GPS Record. distance:" + curr_loc.dst + " next interval:" + dist_50m + " is100m:" + Convert.ToBoolean(listGPS.Count % 2));
                    }

                    curr_loc.dst = GetDistance(strt_loc.lat, strt_loc.lng, curr_loc.lat, curr_loc.lng);
                }

                prev_loc = curr_loc;
            }
            else
            {
                String[] time = coln[(int)gpslogger.tim].Split('.');     // Separate the timestamp in GPS logger into second and milli

                dateSurvey = FromUnixTime(long.Parse(time[0]));

                strt_loc = curr_loc;
                prev_loc = curr_loc;

                strt_loc.dst = 0;
                prev_loc.dst = 0;
            }
        }
예제 #2
0
            public timeStamp(int tag, int sec, int mil, locationManager loc, Boolean is100m)
            {
                this.tag = tag;
                this.sec = sec;
                this.mil = mil;

                this.location = loc;

                this.is100m = is100m;
            }
예제 #3
0
 // Use this for initialization
 void Awake()
 {
     Instance = this;
     initialize = true;
 }