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; }
private function createPoints(array $speeds) { $points = array(); foreach ($speeds as $index => $speed) { $point = new Point(); $point->setTime(new \DateTime('+' . $index * 5 . ' seconds')); $point->setSpeed($speed); $points[] = $point; } return $points; }
private function createPoints(array $elevations) { $points = array(); foreach ($elevations as $index => $elevation) { $point = new Point(); $point->setTime(new \DateTime('+' . $index * 5 . ' seconds')); $point->setElevation($elevation); $points[] = $point; } return $points; }
private function createPoints($numPoints) { $points = array(); for ($index = 0; $index < $numPoints; $index++) { $time = new \DateTime(); $time->setTimestamp($index * 5); $point = new Point(); $point->setTime($time); $points[] = $point; } return $points; }
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; }