/// <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); }
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); }
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; } }
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); }
public GpsTrack(GpsDataTimeLocation data) { VerifyInitialInput(data); this.points = new List <GpsPoint>(); }