/** * Constructor * @param \Runalyze\View\Activity\Context $context */ public function __construct(Context $context) { $this->Context = $context; if ($this->Context->trackdata()->has(Runalyze\Model\Trackdata\Entity::TIME)) { $this->initData(); $this->convertData(); } }
/** * Create series * @var \Runalyze\View\Activity\Context $context */ public function __construct(Activity\Context $context) { $this->initOptions(); $this->initData($context->trackdata(), Trackdata::GROUNDCONTACT_BALANCE); $this->setManualAverage($context->activity()->groundContactBalance() / 100); $this->manipulateData(); }
/** * Create series * @var \Runalyze\View\Activity\Context $context */ public function __construct(Activity\Context $context) { $this->setManipulationFactor(); $this->initOptions(); $this->initData($context->trackdata(), Trackdata::HEARTRATE, true); $this->manipulateData(); }
/** * Create series * @var \Runalyze\View\Activity\Context $context */ public function __construct(Activity\Context $context) { $this->initOptions(); $this->initData($context->trackdata()); $this->manipulateData(); $this->setManualAverage($context->activity()->strideLength()); }
/** * Create series * @var \Runalyze\View\Activity\Context $context */ public function __construct(Activity\Context $context) { $this->initOptions(); $this->initData($context->trackdata(), Trackdata::VERTICAL_OSCILLATION); $this->manipulateData(); $this->setManualAverage($context->activity()->verticalOscillation() * 0.1); }
/** * Construct plot data * @param enum $algorithm * @param int $treshold * @return array */ protected function constructPlotDataFor($algorithm, $treshold = false) { $Method = new ElevationMethod(); $Method->set($algorithm); if ($treshold === false) { $treshold = Configuration::ActivityView()->elevationMinDiff(); } $Calculator = new Data\Elevation\Calculation\Calculator($this->Context->route()->elevations()); $Calculator->setMethod($Method); $Calculator->setThreshold($treshold); $Calculator->calculate(); $i = 0; $Data = array(); $Points = $Calculator->strategy()->smoothedData(); $Indices = $Calculator->strategy()->smoothingIndices(); $hasDistances = $this->Context->trackdata()->get(Trackdata\Entity::DISTANCE); $Distances = $this->Context->trackdata()->get(Trackdata\Entity::DISTANCE); $Times = $this->Context->trackdata()->get(Trackdata\Entity::TIME); $num = $this->Context->trackdata()->num(); foreach ($Indices as $i => $index) { if ($index >= $num) { $index = $num - 1; } if ($hasDistances) { $Data[(string) $Distances[$index]] = $Points[$i]; } else { $Data[(string) $Times[$index] . '000'] = $Points[$i]; } } $this->manipulateData($Data); return $Data; }
/** * Create series * @var \Runalyze\View\Activity\Context $context */ public function __construct(Activity\Context $context) { $this->setManipulationFactor(); $this->initOptions(); $this->initData($context->trackdata(), Trackdata::HEARTRATE, true); $this->manipulateData(); $this->setManualAverage(round(100 * $context->activity()->hrAvg() / $this->HRmax)); }
/** * Create series * @var \Runalyze\View\Activity\Context $context */ public function __construct(Activity\Context $context) { $this->paceUnit = $context->sport()->paceUnit(); $this->paceUnitEnum = $context->sport()->paceUnitEnum(); $this->isRunning = $context->sport()->id() == Configuration::General()->runningSport(); $this->initOptions(); $this->initData($context->trackdata(), Trackdata::PACE); $this->manipulateData(); }
/** * Create series * @var \Runalyze\View\Activity\Context $context */ public function __construct(Activity\Context $context) { $this->paceUnit = $context->sport()->paceUnit(); $this->paceInTime = $this->paceUnit == \Runalyze\Activity\Pace::MIN_PER_KM || $this->paceUnit == \Runalyze\Activity\Pace::MIN_PER_100M || $this->paceUnit == \Runalyze\Activity\Pace::MIN_PER_500M; $this->isRunning = $context->sport()->id() == Configuration::General()->runningSport(); $this->initOptions(); $this->initData($context->trackdata(), Trackdata::PACE); $this->manipulateData(); }
/** * Create series * @var \Runalyze\View\Activity\Context $context */ public function __construct(Activity\Context $context) { $this->isRunning = $context->activity()->sportid() == Configuration::General()->runningSport(); $cadence = $this->isRunning ? new CadenceUnitRunning(0) : new CadenceUnit(0); $this->initOptions(); $this->initData($context->trackdata(), Trackdata::CADENCE); $this->initStrings($cadence); $this->manipulateData($cadence); }
/** * @param \Runalyze\View\Activity\Context $context * @return array */ protected function computeRounds(Activity\Context $context) { $Loop = new Trackdata\Loop($context->trackdata()); $Rounds = array(); do { $Loop->nextDistance(); $Rounds[] = array('km' => $Loop->difference(Trackdata\Object::DISTANCE), 's' => $Loop->difference(Trackdata\Object::TIME)); } while (!$Loop->isAtEnd()); return $Rounds; }
/** * Create series * @var \Runalyze\View\Activity\Context $context */ public function __construct(Activity\Context $context) { $this->isRunning = $context->activity()->sportid() == Configuration::General()->runningSport(); $cadence = $this->isRunning ? new Data\Cadence\Running() : new Data\Cadence\General(0); $this->initOptions(); $this->initData($context->trackdata(), Trackdata::CADENCE); $this->initStrings($cadence); $this->manipulateData($cadence); $this->setManualAverage($cadence->useFactor($context->activity()->cadence())); }
/** * Display rounds */ protected function displayTable() { $this->DemandedPace->setUnit($this->Context->sport()->paceUnit()); $Table = new Table($this->Laps, $this->DemandedTime, $this->DemandedPace, $this->Context->sport()->id() == Configuration::General()->runningSport()); if ($this->LapDistance > 0) { $Table->setAverage($this->Context->dataview()->pace(), new Duration($this->Context->trackdata()->totalTime() / $this->Context->trackdata()->totalDistance() * $this->LapDistance)); } else { $Table->setAverage($this->Context->dataview()->pace()); } $Table->display(); }
/** * Determine correct x axis * @param \Runalyze\View\Activity\Context $context */ protected function determineXAxis(Activity\Context $context) { if ($context->hasTrackdata()) { $totalTime = 1000 * $context->trackdata()->totalTime(); if ($context->hrv()->num() == $context->trackdata()->num()) { $this->XAxisData = array_map(function ($value) { return 1000 * $value; }, $context->trackdata()->time()); } else { $correctTime = abs(array_sum($context->hrv()->data()) - $totalTime) > 0.005 * $totalTime; $time = 0; foreach ($context->hrv()->data() as $ms) { $time += $correctTime && $ms < 1000 ? 1000 : $ms; $this->XAxisData[] = $time; } if ($correctTime && abs($time - $totalTime) > 0.01 * $totalTime) { $this->XAxisData = array(); } } } }
/** * Init sections */ protected function initSections() { if (Configuration::ActivityView()->mapFirst() && Configuration::ActivityView()->plotMode()->showCollection()) { $this->Sections[] = new SectionComposite($this->Context); $this->Sections[] = new SectionLaps($this->Context); } else { $this->Sections[] = new SectionOverview($this->Context); if (Configuration::ActivityView()->mapFirst()) { $this->Sections[] = new SectionRouteOnlyMap($this->Context); } else { $this->Sections[] = new SectionLaps($this->Context); } $this->Sections[] = new SectionSwimLane($this->Context); if (Configuration::ActivityView()->plotMode()->showSeperated()) { $this->Sections[] = new SectionHeartrate($this->Context); $this->Sections[] = new SectionPace($this->Context); if (Configuration::ActivityView()->mapFirst()) { $this->Sections[] = new SectionRouteOnlyElevation($this->Context); } else { $this->Sections[] = new SectionRoute($this->Context); } } else { $this->Sections[] = new SectionComposite($this->Context); if (Configuration::ActivityView()->plotMode()->showPaceAndHR()) { if (Configuration::ActivityView()->mapFirst()) { $this->Sections[] = new SectionRouteOnlyElevation($this->Context); } else { $this->Sections[] = new SectionRoute($this->Context); } } else { if (!Configuration::ActivityView()->mapFirst()) { $this->Sections[] = new SectionRouteOnlyMap($this->Context); } } } if (Configuration::ActivityView()->mapFirst()) { $this->Sections[] = new SectionLaps($this->Context); } } if ($this->Context->trackdata()->has(\Runalyze\Model\Trackdata\Object::CADENCE) && $this->Context->sport()->id() == Configuration::General()->runningSport() || $this->Context->trackdata()->has(\Runalyze\Model\Trackdata\Object::GROUNDCONTACT) || $this->Context->trackdata()->has(\Runalyze\Model\Trackdata\Object::VERTICAL_OSCILLATION)) { $this->Sections[] = new SectionRunningDynamics($this->Context); $this->Sections[] = new SectionMiscellaneous($this->Context, false); } else { $this->Sections[] = new SectionMiscellaneous($this->Context, true); } if ($this->Context->hasHRV()) { $this->Sections[] = new SectionHRV($this->Context); } }
/** * Init data * @var \Runalyze\View\Activity\Context $context * @var boolean $forceOriginal */ protected function initDataWithSwimdata(Activity\Context $context) { if (!$context->hasSwimdata()) { $this->Data = array(); return; } $key = Swimdata::SWOLFCYCLES; if (!$context->swimdata()->has($key)) { $this->Data = array(); return; } $Collector = new DataCollectorWithSwimdata($context->trackdata(), $key, $context->swimdata()); $this->Data = $Collector->data(); $this->XAxis = $Collector->xAxis(); }
/** * 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()); }
/** * Create series * @var \Runalyze\View\Activity\Context $context */ public function __construct(Activity\Context $context) { $this->initOptions(); $this->initData($context->trackdata(), Trackdata::GROUNDCONTACT); $this->setManualAverage($context->activity()->groundcontact()); }
/** * Create series * @var \Runalyze\View\Activity\Context $context */ public function __construct(Activity\Context $context) { $this->initOptions(); $this->initData($context->trackdata(), Trackdata::TIME); }
/** * Create series * @var \Runalyze\View\Activity\Context $context */ public function __construct(Activity\Context $context) { $this->initOptions(); $this->initData($context->trackdata(), Trackdata::POWER); $this->setManualAverage($context->activity()->power()); }
/** * Create series * @var \Runalyze\View\Activity\Context $context */ public function __construct(Activity\Context $context) { $this->initOptions(); $this->initData($context->trackdata()); $this->manipulateData(); }
/** * Create series * @var \Runalyze\View\Activity\Context $context */ public function __construct(Activity\Context $context) { $this->initOptions(); $this->initData($context->trackdata(), Trackdata::VERTICAL_OSCILLATION); $this->manipulateData(); }