Example #1
0
 /// <summary>
 /// Serializes the position record into a string suitable for logging or transmitting.
 /// </summary>
 /// <returns>The serialized record.</returns>
 public override string ToString()
 {
     return(string.Format("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9}",
                          TimeUtc.HasValue ? Serialize.ToString(TimeUtc.Value) : string.Empty,
                          !double.IsNaN(Latitude) ? Latitude.ToString() : string.Empty,
                          !double.IsNaN(Longitude) ? Longitude.ToString() : string.Empty,
                          !double.IsNaN(Altitude) ? Altitude.ToString() : string.Empty,
                          !double.IsNaN(Course) ? Course.ToString() : string.Empty,
                          !double.IsNaN(Speed) ? Speed.ToString() : string.Empty,
                          !double.IsNaN(HorizontalAccuracy) ? HorizontalAccuracy.ToString() : string.Empty,
                          !double.IsNaN(VerticalAccurancy) ? VerticalAccurancy.ToString() : string.Empty,
                          Technology != GeoFixTechnology.Unknown ? Technology.ToString() : string.Empty,
                          NetworkStatus != NetworkStatus.Unknown ? NetworkStatus.ToString() : string.Empty));
 }
Example #2
0
 /// <summary>
 /// Serializes the specified fields of the position record into a string suitable for logging or transmitting.
 /// </summary>
 /// <param name="fields">A <see cref="GeoFixField" /> bitmap describing the fields to be written.</param>
 /// <returns>The serialized record.</returns>
 public string ToString(GeoFixField fields)
 {
     return(string.Format("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9}",
                          (fields & GeoFixField.TimeUtc) != 0 && TimeUtc.HasValue ? Serialize.ToString(TimeUtc.Value) : string.Empty,
                          (fields & GeoFixField.Latitude) != 0 && !double.IsNaN(Latitude) ? Latitude.ToString() : string.Empty,
                          (fields & GeoFixField.Longitude) != 0 && !double.IsNaN(Longitude) ? Longitude.ToString() : string.Empty,
                          (fields & GeoFixField.Altitude) != 0 && !double.IsNaN(Altitude) ? Altitude.ToString() : string.Empty,
                          (fields & GeoFixField.Course) != 0 && !double.IsNaN(Course) ? Course.ToString() : string.Empty,
                          (fields & GeoFixField.Speed) != 0 && !double.IsNaN(Speed) ? Speed.ToString() : string.Empty,
                          (fields & GeoFixField.HorizontalAccuracy) != 0 && !double.IsNaN(HorizontalAccuracy) ? HorizontalAccuracy.ToString() : string.Empty,
                          (fields & GeoFixField.VerticalAccurancy) != 0 && !double.IsNaN(VerticalAccurancy) ? VerticalAccurancy.ToString() : string.Empty,
                          (fields & GeoFixField.Technology) != 0 && Technology != GeoFixTechnology.Unknown ? Technology.ToString() : string.Empty,
                          (fields & GeoFixField.NetworkStatus) != 0 && NetworkStatus != NetworkStatus.Unknown ? NetworkStatus.ToString() : string.Empty));
 }