public GPSPoint(DateTime date, float lat, float lon, float speed, SourceProviders source, float ha) { if (IsValidLat(lat)) { throw new ArgumentOutOfRangeException("lat"); } if (IsValidLon(lon)) { throw new ArgumentOutOfRangeException("lon"); } Date = date; Lat = lat; Lon = lon; Speed = new Speed(speed); Course = new Course(0); Height = new Altitude(0); IgnitionStatus = Utils.IgnitionStatus.Unknown; SourceProvider = source; HorizontalAccuracy = ha; }
public static GPSPoint Factory(DateTime date, float lat, float lon, float speed, float course, float altitude, float hdop, SourceProviders source, float ha) { try { return(new GPSPoint(date, lat, lon, speed, source, ha) { Course = new Course(course), Height = new Altitude(altitude), HDOP = hdop, }); } catch { return(new GPSPoint { Date = date, Lat = lat, Lon = lon, Speed = new Speed(speed), Course = new Course(course), Height = new Altitude(altitude), HDOP = hdop, SourceProvider = source, HorizontalAccuracy = ha }); } }