Beispiel #1
0
 /**
  * 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();
 }
Beispiel #2
0
 /**
  * Go to end and read last lap
  */
 protected function finish()
 {
     $this->TrackdataLoop->goToEnd();
     if (!is_null($this->RouteLoop)) {
         $this->RouteLoop->goToEnd();
     }
     $this->readLap();
 }
Beispiel #3
0
 /**
  * Add icon for current pause
  */
 protected function addCurrentPauseIcon()
 {
     $Pause = $this->Trackdata->pauses()->at($this->PauseIndex);
     $Index = $this->RouteLoop->index();
     $Tooltip = sprintf(__('<strong>Pause</strong> of %s'), Duration::format($Pause->duration()));
     $Tooltip .= '<br>' . sprintf(__('<strong>Distance:</strong> %s'), Distance::format($this->Trackdata->at($Index, Trackdata\Entity::DISTANCE)));
     $Tooltip .= '<br>' . sprintf(__('<strong>Time:</strong> %s'), Duration::format($this->Trackdata->at($Index, Trackdata\Entity::TIME)));
     if ($Pause->hasHeartRateInfo()) {
         $Tooltip .= '<br>' . sprintf(__('<strong>Heart rate:</strong>') . ' ' . __('%s to %s'), $Pause->hrStart(), $Pause->hrEnd() . ' bpm');
     }
     $this->addMarkerGeohash($this->Route->at($Index, Route\Entity::GEOHASHES), $this->pauseIcon(), $Tooltip);
 }
Beispiel #4
0
 /**
  * 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\Entity::HEARTRATE);
     do {
         $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\Entity::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\Entity::HEARTRATE));
         }
     } while ($Trackdata->nextStep() && $Route->nextStep());
 }
    /**
     * Display activity data point
     */
    protected function displayActivityDataPoint()
    {
        // TODO: Elevation?
        //$elevation = ...
        $pace = $this->TrackdataLoop->average(Model\Trackdata\Entity::PACE);
        echo '
<meta property="fitness:metrics:location:latitude"  content="' . $this->RouteLoop->latitude() . '">
<meta property="fitness:metrics:location:longitude" content="' . $this->RouteLoop->longitude() . '">
<meta property="fitness:metrics:timestamp" content="' . date('Y-m-d\\TH:i', $this->Context->activity()->timestamp() + $this->TrackdataLoop->time()) . '">
<meta property="fitness:metrics:distance:value" content="' . $this->TrackdataLoop->distance() . '">
<meta property="fitness:metrics:distance:units" content="km">
<meta property="fitness:metrics:pace:value" content="' . $pace / 1000 . '">
<meta property="fitness:metrics:pace:units" content="s/m">
<meta property="fitness:metrics:speed:value" content="' . ($pace > 0 ? 1000 / $pace : 0) . '">
<meta property="fitness:metrics:speed:units" content="m/s">';
    }
Beispiel #6
0
 /**
  * @param \SimpleXMLElement $trackpoint
  * @param \Runalyze\Model\Route\Loop $routeLoop
  */
 protected function addRouteDetailsTo(\SimpleXMLElement $trackpoint, Route\Loop $routeLoop)
 {
     if ($this->RouteHas[Route\Entity::GEOHASHES]) {
         $Position = $trackpoint->addChild('Position');
         $Position->addChild('LatitudeDegrees', $routeLoop->latitude());
         $Position->addChild('LongitudeDegrees', $routeLoop->longitude());
     }
     if ($this->RouteHas[Route\Entity::ELEVATIONS_ORIGINAL]) {
         $trackpoint->addChild('AltitudeMeters', $routeLoop->current(Route\Entity::ELEVATIONS_ORIGINAL));
     }
 }
 /**
  * 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));
             }
         }
     }
 }