Esempio n. 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);
        }
Esempio n. 2
0
        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);
        }