Exemplo n.º 1
0
 /**
  * Find limit for pauses
  */
 protected function findLimitForPauses()
 {
     if (!is_null($this->Trackdata) && $this->Trackdata->has(Trackdata\Entity::DISTANCE)) {
         $SecondsForDist = (int) Configuration::ActivityView()->routeBreak()->value();
         $AveragePace = $this->Trackdata->totalDistance() > 0 ? $this->Trackdata->totalTime() / $this->Trackdata->totalDistance() : 0;
         if ($AveragePace > 0) {
             $this->PauseLimit = max($this->PauseLimit, $SecondsForDist / $AveragePace);
         }
     }
     $this->PauseLimit *= (int) Configuration::ActivityView()->routePrecision()->value();
 }
Exemplo n.º 2
0
 /**
  * Calculate swim values
  */
 protected function calculateSwimValues()
 {
     if (null !== $this->Trackdata && null !== $this->Swimdata) {
         if ($this->Swimdata->stroke()) {
             $this->Object->set(Entity::TOTAL_STROKES, array_sum($this->Swimdata->stroke()));
         }
         if ($this->Object->totalStrokes() && $this->Trackdata->totalTime()) {
             $num = $this->Trackdata->num();
             $totaltime = $this->Trackdata->totalTime();
             $totalstrokes = $this->Object->totalStrokes();
             if (!empty($totalstrokes) && !empty($totaltime) & !empty($num) && $totalstrokes != 0) {
                 $this->Object->set(Entity::SWOLF, round(($totalstrokes + $totaltime) / $num));
             }
         }
     }
 }
Exemplo n.º 3
0
 /**
  * Define x-axis
  * @param \Runalyze\Model\Trackdata\Entity $trackdata
  */
 protected function defineXAxis(Trackdata $trackdata)
 {
     if (Configuration::ActivityView()->usesTimeAsXAxis() && $trackdata->has(Trackdata::TIME) && $trackdata->totalTime() > 0) {
         $this->XAxis = self::X_AXIS_TIME;
     } elseif ($trackdata->has(Trackdata::DISTANCE) && $trackdata->totalDistance() > 0) {
         $this->XAxis = self::X_AXIS_DISTANCE;
     } elseif ($trackdata->has(Trackdata::TIME) && $trackdata->totalTime() > 0) {
         $this->XAxis = self::X_AXIS_TIME;
     } else {
         $this->XAxis = self::X_AXIS_INDEX;
     }
 }