Exemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Wind"/> class.
 /// </summary>
 /// <param name="coords">The coordinates of the request.</param>
 /// <param name="altitude">The altitude of the request.</param>
 /// <param name="unit">The unit for the altitude (Imperial/Metric Flight Level/Altitude).</param>
 /// <param name="epoch">The time to request data for.</param>
 private Wind(LatLon coords, int altitude, AltitudeUnit unit, DateTime epoch)
 {
     Coordinates = coords;
     Altitude = altitude;
     Unit = unit;
     Epoch = epoch;
 }
Exemplo n.º 2
0
 /// <summary>
 /// Create a wind request for a specified set of coordinates, altitude and time.
 /// </summary>
 /// <param name="coords">The coordinates of the request.</param>
 /// <param name="altitude">The altitude of the request.</param>
 /// <param name="unit">The unit for the altitude (Imperial/Metric Flight Level/Altitude).</param>
 /// <param name="epoch">The time to request data for.</param>
 /// <returns></returns>
 public static Wind For(string coords, int altitude, AltitudeUnit unit, DateTime epoch)
 {
     return new Wind(new LatLon(coords), altitude, unit, epoch);
 }
Exemplo n.º 3
0
        /// <summary>
        /// Called when the message is being loaded.
        /// </summary>
        /// <param name="message">The NMEA message values.</param>
        protected override void OnLoadMessage(string[] message)
        {
            if (message == null || message.Length < 3)
                throw new ArgumentException("Invalid PGRMZ", "message");

            if (message[0].Length > 0)
                Altitude = double.Parse(message[0], CultureInfo.InvariantCulture);
            else
                Altitude = double.NaN;
            Unit = message[1] == "f" ? AltitudeUnit.Feet : AltitudeUnit.Unknown;
            int dim = -1;
            if (message[2].Length == 1 && int.TryParse(message[2], out dim))
            {
                if (dim >= (int)PositionFixType.NoFix && dim <= (int)PositionFixType.Fix3D)
                    FixType = (PositionFixType)dim;
            }
        }