示例#1
0
 public static IEnumerable <GpxTrackPoint> ToGPX(this SensorLog sensorLog)
 {
     return(sensorLog.Data
            .Where(d => d.HasCoordinates)
            .Select(d => new GpxTrackPoint()
     {
         Bearing = d.LocationTrueHeading
         ,
         Elevation = d.AltimeterRelativeAltitude
         ,
         Latitude = d.LocationLatitude.Value
         ,
         Longitude = d.LocationLongitude.Value
         ,
         Time = d.LoggingTime
     }));
 }
示例#2
0
        public static SensorLog FromJson(string filePath)
        {
            SensorLog sensorLog = new SensorLog();

            sensorLog.Data = SensorLogData.FromJson(File.ReadAllText(filePath, Encoding.UTF8));

            sensorLog.Count = sensorLog.Data.Count;
            foreach (var data in sensorLog.Data)
            {
                sensorLog.LocationCount += (data.LocationLongitude != 0 && data.LocationLatitude.HasValue) ? 1 : 0;
                sensorLog.AltitudeCount += (data.LocationAltitude.HasValue) ? 1 : 0;
            }
            sensorLog.AltitudeMin = sensorLog.Data.Where(s => s.LocationAltitude.HasValue).Min(s => s.LocationAltitude.Value);
            sensorLog.AltitudeMax = sensorLog.Data.Where(s => s.LocationAltitude.HasValue).Max(s => s.LocationAltitude.Value);

            return(sensorLog);
        }
示例#3
0
 public static IEnumerable <GeoPoint> ToGeoPoints(this SensorLog sensorLog)
 {
     return(sensorLog.Data.Where(d => d.HasCoordinates)
            .Select(d => new GeoPoint(d.LocationLatitude.Value, d.LocationLongitude.Value, d.AltimeterRelativeAltitude)));
 }