/// <summary> /// Create a new LatLng object to represent a latitude/longitude pair using the /// specified datum. /// </summary> /// <param name="latitudeDegrees">The degrees part of the latitude. Must be 0 <= latitudeDegrees <= /// 90.0.</param> /// <param name="latitudeMinutes">The minutes part of the latitude. Must be 0 <= latitudeMinutes < /// 60.0.</param> /// <param name="latitudeSeconds">The seconds part of the latitude. Must be 0 <= latitudeSeconds < /// 60.0.</param> /// <param name="northSouth">Whether the latitude is north or south of the equator.</param> /// <param name="longitudeDegrees">The degrees part of the longitude. Must be 0 <= longitudeDegrees <= /// 180.0.</param> /// <param name="longitudeMinutes">The minutes part of the longitude. Must be 0 <= longitudeMinutes < /// 60.0.</param> /// <param name="longitudeSeconds">The seconds part of the longitude. Must be 0 <= longitudeSeconds < /// 60.0.</param> /// <param name="eastWest">Whether the longitude is east or west of the prime meridian.</param> /// <param name="height">The perpendicular height above the reference ellipsoid.</param> /// <param name="datum">The datum that this reference is based on.</param> /// <exception cref="ArgumentException">if any of the parameters are invalid.</exception> public LatLng(int latitudeDegrees, int latitudeMinutes, double latitudeSeconds, NorthSouth northSouth, int longitudeDegrees, int longitudeMinutes, double longitudeSeconds, EastWest eastWest, double height, Datum.Datum datum) { if (latitudeDegrees < 0.0 || latitudeDegrees > 90.0 || latitudeMinutes < 0.0 || latitudeMinutes >= 60.0 || latitudeSeconds < 0.0 || latitudeSeconds >= 60.0) { throw new ArgumentException("Invalid latitude"); } if (longitudeDegrees < 0.0 || longitudeDegrees > 180.0 || longitudeMinutes < 0.0 || longitudeMinutes >= 60.0 || longitudeSeconds < 0.0 || longitudeSeconds >= 60.0) { throw new ArgumentException("Invalid longitude"); } Latitude = (int)northSouth * (latitudeDegrees + (latitudeMinutes / 60.0) + (latitudeSeconds / 3600.0)); Longitude = (int)eastWest * (longitudeDegrees + (longitudeMinutes / 60.0) + (longitudeSeconds / 3600.0)); Height = height; Datum = datum; }
/// <summary> /// Create a new LatLng object to represent a latitude/longitude pair using the /// WGS84 datum. /// </summary> /// <param name="latitudeDegrees">The degrees part of the latitude. Must be 0 <= latitudeDegrees <= /// 90.0.</param> /// <param name="latitudeMinutes">The minutes part of the latitude. Must be 0 <= latitudeMinutes < /// 60.0.</param> /// <param name="latitudeSeconds">The seconds part of the latitude. Must be 0 <= latitudeSeconds < /// 60.0.</param> /// <param name="northSouth">Whether the latitude is north or south of the equator.</param> /// <param name="longitudeDegrees">The degrees part of the longitude. Must be 0 <= longitudeDegrees <= /// 180.0.</param> /// <param name="longitudeMinutes">The minutes part of the longitude. Must be 0 <= longitudeMinutes < /// 60.0.</param> /// <param name="longitudeSeconds">The seconds part of the longitude. Must be 0 <= longitudeSeconds < /// 60.0.</param> /// <param name="eastWest">Whether the longitude is east or west of the prime meridian.</param> /// <param name="height">The perpendicular height above the reference ellipsoid.</param> /// <exception cref="ArgumentException">if any of the parameters are invalid.</exception> public LatLng(int latitudeDegrees, int latitudeMinutes, double latitudeSeconds, NorthSouth northSouth, int longitudeDegrees, int longitudeMinutes, double longitudeSeconds, EastWest eastWest, double height) : this(latitudeDegrees, latitudeMinutes, latitudeSeconds, northSouth, longitudeDegrees, longitudeMinutes, longitudeSeconds, eastWest, height, WGS84Datum.Instance) { }
public static string ToStr(this NorthSouth e) { switch (e) { case NorthSouth.North: return("N"); default: return("S"); } }
public static String ToStringAbv(this NorthSouth northSouth) { switch (northSouth) { case NorthSouth.North: return("N"); case NorthSouth.South: return("S"); } throw new ArgumentException(); }
/// <inheritdoc /> protected override void SetIndexValue(int idx, ReadOnlySpan <char> val) { switch (idx) { case 0: UTCTime = GetTimeSpanFromHHMMSS(val); break; case 1: ActiveStatus = GetActiveStatus(val); break; case 2: Latitude = GetDecimalDegrees(val); break; case 3: NorthSouth = GetNorthSouth(val); break; case 4: Longitude = GetDecimalDegrees(val); break; case 5: EastWest = GetEastWest(val); break; case 6: Knots = GetDecimal(val); break; case 7: TrackAngle = GetDecimal(val); break; case 8: Date = GetDateTimeDDMMYY(val); break; case 9: MagneticVariation = GetDecimal(val); break; } }
public static Latitude fromDecimalDMS(double dms, NorthSouth hemisphere) { return(new Latitude(DMS.FromDecimalDMS(dms), hemisphere)); }
public Latitude(int degrees, int minutes, double seconds, NorthSouth hemisphere) : base(degrees, minutes, seconds) { this.Hemisphere = hemisphere; }
public Latitude(double dms, NorthSouth hemisphere) : base(dms) { this.Hemisphere = hemisphere; }
public Latitude(double dms) : base(dms) { this.Hemisphere = (dms < 0) ? NorthSouth.South : NorthSouth.North; }
public Latitude(DMS coord, NorthSouth hemisphere) : base(coord) { this.Hemisphere = hemisphere; }
public Latitude(Latitude latitude) : base(latitude) { this.Hemisphere = latitude.Hemisphere; }
/// <summary> /// Based on index value which is the position in the nmea sentence, extract the value to the create type /// and set the correct member value /// </summary> /// <param name="idx">index</param> /// <param name="val">raw value</param> protected override void SetIndexValue(int idx, ReadOnlySpan <char> val) { switch (idx) { case 0: UTCTime = GetTimeSpanFromHHMMSS(val); break; case 1: Latitude = GetDecimalDegrees(val); break; case 2: NorthSouth = GetNorthSouth(val); break; case 3: Longitude = GetDecimalDegrees(val); break; case 4: EastWest = GetEastWest(val); break; case 5: FixQuality = GetGPSFix(val); break; case 6: SatsInView = GetInteger(val); break; case 7: HDOP = GetDecimal(val); break; case 8: Altitude = GetDecimal(val); break; case 9: AltitudeUnits = GetUnits(val); break; case 10: GeoidalSeperation = GetDecimal(val); break; case 11: GeoidSeperationUnits = GetUnits(val); break; case 12: AgeOfDGPSData = GetTimeSpanFromHHMMSS(val); break; case 13: DGPStationID = GetString(val); break; } }
public void Complete() { string[] fixedPRNs = _fixed_PRNs.Split('_'); foreach (string prn in fixedPRNs) { foreach (Satellite sat in SatellitesUsed) { if (sat.ID == prn) SatellitesUsed.Add(sat); } } _Z = _altitude; if (_RMC_longitude > -1) _longitude = _RMC_longitude; else _longitude = _GGA_longitude; if (_RMC_latitude > -1) _latitude = _RMC_latitude; else _latitude = _GGA_latitude; _latDir = _RMC_latDir; _longDir = _RMC_longDir; if (_latitude > -1 && _longitude > -1) { double lat = -1, lon = -1; TtUtils.LatLonDegreeMinDecimalToDegreeDecimal(_latitude, _longitude, out lat, out lon); _latitude = lat; _longitude = lon; //TtUtils.LatLontoUTM(lat, (_longDir == EastWest.West) ? (lon * -1) : (lon), out _Y, out _X, out _utm_zone); //_X = (_longDir == EastWest.West) ? (_X * -1) : (_X); _Z = this._altitude; } else { drop = true; } _datetime = DateTime.Parse(string.Format("{0}/{1}/{2,4} {3}:{4}:{5}", _date.Month, _date.Day, _date.Year, _time.Hour, _time.Minute, _time.Second)); complete = true; }
/// <summary> /// Create a new LatLng object to represent a latitude/longitude pair using the /// WGS84 datum. /// </summary> /// <param name="latitudeDegrees">The degrees part of the latitude. Must be 0 <= latitudeDegrees <= /// 90.0.</param> /// <param name="latitudeMinutes">The minutes part of the latitude. Must be 0 <= latitudeMinutes < /// 60.0.</param> /// <param name="latitudeSeconds">The seconds part of the latitude. Must be 0 <= latitudeSeconds < /// 60.0.</param> /// <param name="northSouth">Whether the latitude is north or south of the equator.</param> /// <param name="longitudeDegrees">The degrees part of the longitude. Must be 0 <= longitudeDegrees <= /// 180.0.</param> /// <param name="longitudeMinutes">The minutes part of the longitude. Must be 0 <= longitudeMinutes < /// 60.0.</param> /// <param name="longitudeSeconds">The seconds part of the longitude. Must be 0 <= longitudeSeconds < /// 60.0.</param> /// <param name="eastWest">Whether the longitude is east or west of the prime meridian.</param> /// <param name="height">The perpendicular height above the reference ellipsoid.</param> /// <exception cref="ArgumentException">if any of the parameters are invalid.</exception> public LatLng(int latitudeDegrees, int latitudeMinutes, double latitudeSeconds, NorthSouth northSouth, int longitudeDegrees, int longitudeMinutes, double longitudeSeconds, EastWest eastWest, double height) : this(latitudeDegrees, latitudeMinutes, latitudeSeconds, northSouth, longitudeDegrees, longitudeMinutes, longitudeSeconds, eastWest, height, WGS84Datum.Instance) { }
public Position(double latitude, NorthSouth latDir, double longitude, EastWest lonDir) { SetPosition(latitude, latDir, longitude, lonDir); }
public GeoPosition(double latitude, NorthSouth latDir, double longitude, EastWest lonDir) : base(latitude, latDir, longitude, lonDir) { }
public GeoPosition(double latitude, NorthSouth latDir, double longitude, EastWest lonDir, double elevation, UomElevation uomElevation) : base(latitude, latDir, longitude, lonDir) { this.Elevation = elevation; this.UomElevation = uomElevation; }
/// <summary> /// Create a new LatLng object to represent a latitude/longitude pair using the /// specified datum. /// </summary> /// <param name="latitudeDegrees">The degrees part of the latitude. Must be 0 <= latitudeDegrees <= /// 90.0.</param> /// <param name="latitudeMinutes">The minutes part of the latitude. Must be 0 <= latitudeMinutes < /// 60.0.</param> /// <param name="latitudeSeconds">The seconds part of the latitude. Must be 0 <= latitudeSeconds < /// 60.0.</param> /// <param name="northSouth">Whether the latitude is north or south of the equator.</param> /// <param name="longitudeDegrees">The degrees part of the longitude. Must be 0 <= longitudeDegrees <= /// 180.0.</param> /// <param name="longitudeMinutes">The minutes part of the longitude. Must be 0 <= longitudeMinutes < /// 60.0.</param> /// <param name="longitudeSeconds">The seconds part of the longitude. Must be 0 <= longitudeSeconds < /// 60.0.</param> /// <param name="eastWest">Whether the longitude is east or west of the prime meridian.</param> /// <param name="height">The perpendicular height above the reference ellipsoid.</param> /// <param name="datum">The datum that this reference is based on.</param> /// <exception cref="ArgumentException">if any of the parameters are invalid.</exception> public LatLng(int latitudeDegrees, int latitudeMinutes, double latitudeSeconds, NorthSouth northSouth, int longitudeDegrees, int longitudeMinutes, double longitudeSeconds, EastWest eastWest, double height, DotNetCoords.Datum.Datum datum) { if (latitudeDegrees < 0.0 || latitudeDegrees > 90.0 || latitudeMinutes < 0.0 || latitudeMinutes >= 60.0 || latitudeSeconds < 0.0 || latitudeSeconds >= 60.0) { throw new ArgumentException("Invalid latitude"); } if (longitudeDegrees < 0.0 || longitudeDegrees > 180.0 || longitudeMinutes < 0.0 || longitudeMinutes >= 60.0 || longitudeSeconds < 0.0 || longitudeSeconds >= 60.0) { throw new ArgumentException("Invalid longitude"); } this.latitude = (int)northSouth * (latitudeDegrees + (latitudeMinutes / 60.0) + (latitudeSeconds / 3600.0)); this.longitude = (int)eastWest * (longitudeDegrees + (longitudeMinutes / 60.0) + (longitudeSeconds / 3600.0)); this.height = height; this.datum = datum; }
protected internal NmeaBurst() { _Used = false; _PointCN = null; _CN = null; SatellitesSeen = new List<Satellite>(); SatellitesUsed = new List<Satellite>(); _time = DateTime.Now; _date = DateTime.Now; _datetime = DateTime.Now; _longitude = -1; _latitude = -1; _RMC_latitude = -1; _RMC_longitude = -1; _GGA_latitude = -1; _GGA_longitude = -1; _latDir = NorthSouth.North; _longDir = EastWest.West; countGSV = 0; totalGSV = 0; badData = 0; bRMC = false; bGGA = false; bGSA = false; bGSV = false; complete = false; drop = false; }