Ejemplo n.º 1
0
 public SessionGraphInfo(
     IReadOnlyList <ISessionDisplayablePoint> sessionPoints,
     ValueBounds heartRate,
     ValueBounds speed,
     ValueBounds altitude,
     int totalDurationInSeconds)
 {
     SessionPoints          = sessionPoints;
     HeartRate              = heartRate;
     Speed                  = speed;
     Altitude               = altitude;
     TotalDurationInSeconds = totalDurationInSeconds;
 }
Ejemplo n.º 2
0
        public static SessionGraphInfo CreateSessionGraphInfo(IReadOnlyList <ISessionDisplayablePoint> points)
        {
            if (points == null || points.Count < 2)
            {
                throw new ArgumentException();
            }

            var heartRateBounds = new ValueBounds(points.Min(p => p.HeartRate ?? int.MaxValue), points.Max(p => p.HeartRate ?? 0));
            var speedBounds     = new ValueBounds(points.Min(p => p.Speed ?? int.MaxValue), points.Max(p => p.Speed ?? 0));
            var altitudeBounds  = new ValueBounds(points.Min(p => p.Altitude ?? int.MaxValue), points.Max(p => p.Altitude ?? 0));

            int totalDuration = (int)points.Last().Time.TotalSeconds;

            return(new SessionGraphInfo(points, heartRateBounds, speedBounds, altitudeBounds, totalDuration));
        }