/** * Display with corrector */ protected function displayWithElevation() { if ($this->Context->hasRoute() && ($this->Context->route()->elevationUp() > 0 || $this->Context->route()->elevationDown())) { $up = $this->Context->route()->elevationUp(); $down = $this->Context->route()->elevationDown(); } else { $up = $this->Context->activity()->elevation(); $down = $up; } $Modifier = new Elevation\DistanceModifier($this->Context->activity()->distance(), $up, $down, Configuration::Vdot()); $VDOT = new JD\VDOT(0, new JD\VDOTCorrector(Configuration::Data()->vdotFactor())); $VDOT->fromPaceAndHR($Modifier->correctedDistance(), $this->Context->activity()->duration(), $this->Context->activity()->hrAvg() / Configuration::Data()->HRmax()); $Fieldset = new FormularFieldset(__('Correction: considering elevation')); $Fieldset->setHtmlCode(' <p class="warning small ' . (Configuration::Vdot()->useElevationCorrection() ? 'hide' : '') . '"> ' . __('This correction method is currently unused.') . ' </p> <div class="w50"> <label>' . __('Up/Down') . '</label> <span class="as-input">+' . $up . '/-' . $down . ' m</span> </div> <div class="w50 double-height-right"> <label>⇒ ' . __('VDOT') . '</label> <span class="as-input ' . (!Configuration::Vdot()->useElevationCorrection() ? '' : 'highlight') . '">' . $VDOT->value() . '</span> </div> <div class="w50"> <label>' . __('Influence') . '</label> <span class="as-input">' . sprintf("%+d", 1000 * $Modifier->additionalDistance()) . 'm = ' . Distance::format($Modifier->correctedDistance(), false, 3) . '</span> </div> '); $Fieldset->display(); }
/** * @param \Runalyze\View\Activity\Context $context * @param int $offset * @return \Runalyze\Calculation\NightDetector $this-reference */ public function setFromContext(Context $context, $offset = 0) { if (!$context->hasRoute()) { $this->Value = null; return $this; } return $this->setFromEntities($context->activity(), $context->route(), $offset); }
/** * Constructor * @param \Runalyze\View\Activity\Context $Context */ public function __construct(\Runalyze\View\Activity\Context $Context) { if ($Context->hasRoute()) { $upDown = '+' . ElevationBase::format($Context->route()->elevationUp(), false) . '/-' . ElevationBase::format($Context->route()->elevationDown(), false); } else { $upDown = '+' . ElevationBase::format($Context->activity()->elevation(), false) . '/-' . ElevationBase::format($Context->activity()->elevation(), false); } parent::__construct($upDown, Configuration::General()->distanceUnitSystem()->elevationUnit(), __('Elevation up/down')); }
/** * Init data * @var \Runalyze\View\Activity\Context $context * @var boolean $forceOriginal */ protected function initDataWithRoute(Activity\Context $context, $forceOriginal) { if (!$context->hasRoute()) { $this->Data = array(); return; } $key = $context->route()->hasCorrectedElevations() && !$forceOriginal ? Route::ELEVATIONS_CORRECTED : Route::ELEVATIONS_ORIGINAL; if (!$context->route()->has($key)) { $this->Data = array(); return; } $Collector = new DataCollectorWithRoute($context->trackdata(), $key, $context->route()); $this->Data = $Collector->data(); $this->XAxis = $Collector->xAxis(); }
/** * 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()); }