Exemple #1
0
        /// <summary>
        /// Presents this message as output
        /// </summary>
        public override string ToNmeaParameterList()
        {
            if (Valid)
            {
                StringBuilder b = new StringBuilder();
                b.AppendFormat(CultureInfo.InvariantCulture, "{0:F1},", HeadingTrue.Normalize(true).Degrees);
                if (Deviation.HasValue)
                {
                    b.AppendFormat(CultureInfo.InvariantCulture, "{0:F1},{1},", Math.Abs(Deviation.Value.Degrees),
                                   Deviation.Value.Degrees >= 0 ? "E" : "W");
                }
                else
                {
                    b.AppendFormat(",,");
                }

                if (Declination.HasValue)
                {
                    b.AppendFormat(CultureInfo.InvariantCulture, "{0:F1},{1}", Math.Abs(Declination.Value.Degrees),
                                   Declination.Value.Degrees >= 0 ? "E" : "W");
                }
                else
                {
                    b.AppendFormat(",");
                }

                return(b.ToString());
            }

            return(string.Empty);
        }
Exemple #2
0
        /// <inheritdoc />
        public override string ToReadableContent()
        {
            if (Valid)
            {
                return($"True heading: {HeadingTrue.GetValueOrDefault(Angle.Zero).Degrees:F1}° Magnetic heading: {HeadingMagnetic.GetValueOrDefault(Angle.Zero).Degrees:F1}° Speed: {Speed.Knots:F1}kts");
            }

            return("Speed/Direction trough water unknown");
        }