Example #1
0
        private GpxWaypoint ToGpxWaypoint(LatLngTime latLng)
        {
            var gpxWaypoint = new GpxWaypoint(new GpxLongitude(latLng.Lng), new GpxLatitude(latLng.Lat), latLng.Alt);

            return(latLng.Timestamp.HasValue
                ? gpxWaypoint.WithTimestampUtc(latLng.Timestamp.Value.ToUniversalTime())
                : gpxWaypoint);
        }
        private static IEnumerable <LatLngTime> GetPointsInBetween(LatLngTime start, LatLngTime end)
        {
            var result = new List <LatLngTime>();

            var totalTimeMinutes = (end.AddedAt - start.AddedAt).TotalMinutes;
            var segmentLength    = (decimal)(1 / totalTimeMinutes);

            var startPoint = start;

            for (var index = 0; index < totalTimeMinutes; index++)
            {
                var addedAt  = startPoint.AddedAt.AddMinutes(1);
                var newPoint = (start.Point - end.Point) * segmentLength + startPoint.Point;
                startPoint = new LatLngTime(newPoint, addedAt);
                result.Add(startPoint);
            }

            result.Insert(0, start);
            result.Add(end);

            return(result);
        }