/** * Set track */ protected function setTrack() { $this->prepareLoop(); while ($this->RouteLoop->nextStep()) { $this->TrackdataLoop->nextStep(); if ($this->thereWasAPause()) { $this->setPauseToXml(); } $this->addCoordinateToCurrentPath($this->RouteLoop->coordinate()); } $this->addCurrentPathToXml(); }
/** * Next step * @return boolean */ protected function nextStep() { if ($this->hasTrackdataLoop()) { $this->TrackdataLoop->nextStep(); } return $this->RouteLoop->nextStep(); }
/** * Display course */ public function displayCourse() { $this->Context = new Context(Request::sendId(), Request::param('account')); if (!$this->activityIsValid() || !$this->Context->hasRoute() || !$this->Context->route()->hasPositionData()) { die('Don\'t do that!'); } $Linker = new Linker($this->Context->activity()); echo '<meta property="og:type" content="metadata">' . NL; echo '<link rel="origin" href="' . $Linker->publicUrl() . '">' . NL; $this->RouteLoop = new Model\Route\Loop($this->Context->route()); $this->RouteLoop->setStepSize(self::STEP_SIZE); $this->TrackdataLoop = new Model\Trackdata\Loop($this->Context->trackdata()); $this->TrackdataLoop->setStepSize(self::STEP_SIZE); do { $this->displayActivityDataPoint(); } while ($this->RouteLoop->nextStep() && $this->TrackdataLoop->nextStep()); }
/** * Add track to xml */ protected function setTrack() { $Starttime = $this->Context->activity()->timestamp(); $Trackdata = new Trackdata\Loop($this->Context->trackdata()); $Route = new Route\Loop($this->Context->route()); $hasElevation = $this->Context->route()->hasOriginalElevations(); $hasHeartrate = $this->Context->trackdata()->has(Trackdata\Object::HEARTRATE); while ($Trackdata->nextStep()) { $Route->nextStep(); $Trackpoint = $this->Track->addChild('trkpt'); $Trackpoint->addAttribute('lat', $Route->latitude()); $Trackpoint->addAttribute('lon', $Route->longitude()); $Trackpoint->addChild('time', $this->timeToString($Starttime + $Trackdata->time())); if ($hasElevation) { $Trackpoint->addChild('ele', $Route->current(Route\Object::ELEVATIONS_ORIGINAL)); } if ($hasHeartrate) { $ext = $Trackpoint->addChild('extensions'); $tpe = $ext->addChild('gpxtpx:TrackPointExtension', '', 'http://www.garmin.com/xmlschemas/TrackPointExtension/v1'); $tpe->addChild('gpxtpx:hr', $Trackdata->current(Trackdata\Object::HEARTRATE)); } } }
/** * Add track to all laps to xml */ protected function setTrack() { $Starttime = $this->Context->activity()->timestamp(); $Trackdata = new Trackdata\Loop($this->Context->trackdata()); if ($this->HasRoute) { $Route = new Route\Loop($this->Context->route()); } while ($Trackdata->nextStep()) { if ($this->HasRoute) { $Route->nextStep(); } if ($this->Activity->Lap[(int) floor($Trackdata->distance())]) { $Trackpoint = $this->Activity->Lap[(int) floor($Trackdata->distance())]->Track->addChild('Trackpoint'); $Trackpoint->addChild('Time', $this->timeToString($Starttime + $Trackdata->time())); if ($this->HasRoute) { $this->addRouteDetailsTo($Trackpoint, $Route); } $this->addTrackdataDetailsTo($Trackpoint, $Trackdata); } } }
/** * Add track to all laps to xml */ protected function setTrack() { $Starttime = $this->Context->activity()->timestamp(); $Trackdata = new Trackdata\Loop($this->Context->trackdata()); $Route = new Route\Loop($this->Context->route()); $hasElevation = $this->Context->route()->hasOriginalElevations(); $hasHeartrate = $this->Context->trackdata()->has(Trackdata\Object::HEARTRATE); while ($Trackdata->nextStep()) { $Route->nextStep(); if ($this->Activity->Lap[(int) floor($Trackdata->distance())]) { $Trackpoint = $this->Activity->Lap[(int) floor($Trackdata->distance())]->Track->addChild('Trackpoint'); $Trackpoint->addChild('Time', $this->timeToString($Starttime + $Trackdata->time())); $Position = $Trackpoint->addChild('Position'); $Position->addChild('LatitudeDegrees', $Route->latitude()); $Position->addChild('LongitudeDegrees', $Route->longitude()); if ($hasElevation) { $Trackpoint->addChild('AltitudeMeters', $Route->current(Route\Object::ELEVATIONS_ORIGINAL)); } $Trackpoint->addChild('DistanceMeters', 1000 * $Trackdata->distance()); if ($hasHeartrate) { $Heartrate = $Trackpoint->addChild('HeartRateBpm'); $Heartrate->addChild('Value', $Trackdata->current(Trackdata\Object::HEARTRATE)); } } } }