コード例 #1
0
        /// <summary>
        /// Verifies the data being added and adjusts the start and/or end end times for the entire track accordingly
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        private bool VerifyInitialInput(GpsDataTimeLocation data)
        {
            if (data.Time == 0)
            {
                throw new Exception("Bogus data to GpsPoint./n" + data.ToString());
            }

            if (data.Time < this.startTime)
            {
                this.startTime = data.Time;
            }
            if (data.Time > this.endTime)
            {
                this.endTime = data.Time;
            }
            if (typeof(GpsDataDate).IsAssignableFrom(data.GetType()))
            {
                GpsDataDate d = (GpsDataDate)data;
                if (d.Date < this.startDate)
                {
                    this.startDate = d.Date;
                }
                if (d.Date > this.endDate)
                {
                    this.endDate = d.Date;
                }
            }
            return(true);
        }
コード例 #2
0
ファイル: GpsPoint.cs プロジェクト: hnjm/GPS-Application
        private bool VerifyInitialInput(GpsDataTimeLocation data)
        {
            if (data.Time == 0)
            {
                throw new Exception("Bogus data to GpsPoint./n" + data.ToString());
            }
            else if (this.time != 0 && data.Time != this.time)
            {
                throw new Exception("Bogus data to GpsPoint./n" + data.ToString());
            }

            return(true);
        }
コード例 #3
0
ファイル: GpsPoint.cs プロジェクト: hnjm/GPS-Application
        public GpsPoint(GpsDataTimeLocation data)
        {
            VerifyInitialInput(data);

            this.time      = data.Time;
            this.latitude  = data.Latitude;
            this.longitude = data.Longitude;

            if (typeof(GpsDataDate).IsAssignableFrom(data.GetType()))
            {
                this.date = ((GpsDataDate)data).Date;
            }
        }
コード例 #4
0
ファイル: GpsPoint.cs プロジェクト: hnjm/GPS-Application
        private bool VerifyInput(GpsData data)
        {
            if (typeof(GpsDataTimeLocation).IsAssignableFrom(data.GetType()))
            {
                GpsDataTimeLocation d1 = (GpsDataTimeLocation)data;
                if (!d1.Latitude.Equals(latitude) || !d1.Longitude.Equals(this.longitude) || d1.Time != this.time)
                {
                    throw new Exception("Bogus data to GpsPoint./n" + data.ToString());
                }

                if (typeof(GpsDataDate).IsAssignableFrom(data.GetType()))
                {
                    GpsDataDate d2 = (GpsDataDate)data;
                    if (this.date != 0 && d2.Date != this.date)
                    {
                        throw new Exception("Bogus data for date to GpsPoint./n" + data.ToString());
                    }
                }
            }
            return(true);
        }
コード例 #5
0
 public GpsTrack(GpsDataTimeLocation data)
 {
     VerifyInitialInput(data);
     this.points = new List <GpsPoint>();
 }