private function createPoints(array $heartRates)
 {
     $points = array();
     foreach ($heartRates as $index => $heartRate) {
         $point = new Point();
         $point->setTime(new \DateTime('+' . $index * 5 . ' seconds'));
         $point->setHeartRate($heartRate);
         $points[] = $point;
     }
     return $points;
 }
Beispiel #2
0
 protected function parseTrackpoint(\SimpleXMLElement $trackpointNode)
 {
     // Skip the point if lat/lng not found
     if (!isset($trackpointNode->Position->LatitudeDegrees) || !isset($trackpointNode->Position->LongitudeDegrees)) {
         return;
     }
     $point = new Point();
     $point->setElevation((double) $trackpointNode->AltitudeMeters);
     $point->setDistance((double) $trackpointNode->DistanceMeters);
     $point->setLatitude((double) $trackpointNode->Position->LatitudeDegrees);
     $point->setLongitude((double) $trackpointNode->Position->LongitudeDegrees);
     $point->getTime()->modify((string) $trackpointNode->Time);
     if (isset($trackpointNode->HeartRateBpm->Value)) {
         $point->setHeartRate((int) $trackpointNode->HeartRateBpm->Value);
     }
     if (isset($trackpointNode->Extensions->TPX->Speed)) {
         $point->setSpeed($this->convertSpeed((double) $trackpointNode->Extensions->TPX->Speed));
     }
     return $point;
 }