Ejemplo n.º 1
0
 /**
  * Calculate distance
  */
 private function setDistanceFromGPSdata()
 {
     if (!empty($this->gps['latitude']) && !empty($this->gps['longitude']) && empty($this->gps['km'])) {
         $num = count($this->gps['latitude']);
         $this->gps['km'] = array(0);
         $lastDistance = 0;
         for ($i = 1; $i < $num; ++$i) {
             $step = round(Runalyze\Model\Route\Object::gpsDistance($this->gps['latitude'][$i - 1], $this->gps['longitude'][$i - 1], $this->gps['latitude'][$i], $this->gps['longitude'][$i]), ParserAbstract::DISTANCE_PRECISION);
             $this->gps['km'][] = $lastDistance + $step;
             $lastDistance += $step;
         }
         $this->TrainingObject->setArrayDistance($this->gps['km']);
         $this->TrainingObject->setDistance(end($this->gps['km']));
     }
 }
Ejemplo n.º 2
0
 /**
  * Set GPS data
  */
 protected function setGPSarrays()
 {
     $this->removeInvalidEntriesFromGPSarrays();
     if (empty($this->gps['pace']) && !empty($this->gps['time_in_s']) && !empty($this->gps['km'])) {
         $this->setPaceFromDistanceAndTime();
     }
     $this->TrainingObject->setArrayTime($this->gps['time_in_s']);
     $this->TrainingObject->setArrayDistance($this->gps['km']);
     $this->TrainingObject->setArrayLatitude($this->gps['latitude']);
     $this->TrainingObject->setArrayLongitude($this->gps['longitude']);
     $this->TrainingObject->setArrayAltitude($this->gps['altitude']);
     $this->TrainingObject->setArrayHeartrate($this->gps['heartrate']);
     $this->TrainingObject->setArrayPace($this->gps['pace']);
     $this->TrainingObject->setArrayCadence($this->gps['rpm']);
     $this->TrainingObject->setArrayPower($this->gps['power']);
     $this->TrainingObject->setArrayTemperature($this->gps['temp']);
     $this->TrainingObject->setArrayGroundContact($this->gps['groundcontact']);
     $this->TrainingObject->setArrayVerticalOscillation($this->gps['oscillation']);
     $this->TrainingObject->setArrayHRV($this->gps['hrv']);
     $this->setValuesFromArraysIfEmpty();
 }