示例#1
0
 /**
  * @param \Runalyze\Model\Activity\Splits\Object $splits
  * @param boolean $showInactive
  */
 protected function readDataFromSplits(Splits\Object $splits, $showInactive)
 {
     foreach ($splits->asArray() as $split) {
         if (($showInactive || $split->isActive()) && $split->distance() > 0) {
             $this->Labels[] = $split->distance();
             $this->Data[] = $split->time() / $split->distance();
         }
     }
 }
示例#2
0
 /**
  * @param \Runalyze\Model\Activity\Splits\Object $splits
  * @param boolean $showInactive
  */
 protected function readDataFromSplits(Splits\Object $splits, $showInactive)
 {
     foreach ($splits->asArray() as $split) {
         if (($showInactive || $split->isActive()) && $split->distance() > 0) {
             $this->Labels[] = round((new Distance($split->distance()))->valueInPreferredUnit(), 2);
             $this->Data[] = $split->time() / $split->distance();
         }
     }
 }
示例#3
0
文件: Table.php 项目: 9x/Runalyze
 /**
  * Set splits
  */
 private function setSplits()
 {
     $i = 0;
     $seperated = false;
     $showOnlyActive = $this->Splits->hasActiveAndInactiveLaps() && $this->Splits->hasActiveLaps(2);
     foreach ($this->Splits->asArray() as $Split) {
         $PaceObj = $Split->pace($this->PaceUnit);
         if ($showOnlyActive && !$Split->isActive()) {
             if (!$seperated && $i > 0) {
                 // && ($i < $num_active)) {
                 $this->Code .= '<tr class="space-line"><td colspan="5"></td></tr>';
                 $this->Code .= '<tr class="space-line zebra-corrector"><td colspan="5"></td></tr>';
                 $seperated = true;
             }
             continue;
         } else {
             $seperated = false;
         }
         $this->Code .= '<tr class="r">';
         $this->Code .= '<td class="c">' . ++$i . '.</td>';
         $this->Code .= '<td>' . Distance::format($Split->distance(), true, 2) . '</td>';
         $this->Code .= '<td>' . Duration::format($Split->time()) . '</td>';
         $this->Code .= '<td>' . $PaceObj->value() . '<small>' . $PaceObj->appendix() . '</small></td>';
         $this->Code .= '<td>' . $this->tdForPaceDifference($PaceObj) . '</td>';
         $this->Code .= '</tr>';
     }
     $this->Code .= '</tbody><tbody class="top-spacer">';
 }
示例#4
0
 public function testSimpleExample()
 {
     $Splits = new Splits\Object();
     $Splits->add(new Splits\Split(3.0, 1000, false));
     $Splits->add(new Splits\Split(0.4, 72, true));
     $Splits->add(new Splits\Split(0.2, 62, false));
     $Splits->add(new Splits\Split(0.4, 69, true));
     $Splits->add(new Splits\Split(0.2, 63, false));
     $Splits->add(new Splits\Split(2.0, 600, false));
     $this->object->readFrom($Splits);
     $this->assertEquals(6, $this->Laps->num());
     $this->checkAgainst(array(array(1000, 3.0, false), array(72, 0.4, true), array(62, 0.2, false), array(69, 0.4, true), array(63, 0.2, false), array(600, 2.0, false)));
 }
示例#5
0
 /**
  * Complete splits
  */
 public function completeSplits()
 {
     $totalDistance = 0;
     $totalTime = 0;
     $size = min(count($this->Time), count($this->Distance));
     $i = 0;
     foreach ($this->Splits->asArray() as $split) {
         if ($this->mode() == self::MODE_DISTANCE) {
             $s = $split->time();
             while ($i < $size - 1 && $s > $this->Time[$i] - $totalTime) {
                 $i++;
             }
             $split->setDistance($this->Distance[$i] - $totalDistance);
         } else {
             $dist = $split->distance();
             while ($i < $size - 1 && $dist > $this->Distance[$i] - $totalDistance) {
                 $i++;
             }
             $split->setTime($this->Time[$i] - $totalTime);
         }
         $totalTime = $this->Time[$i];
         $totalDistance = $this->Distance[$i];
     }
 }
示例#6
0
 /**
  * @param \Runalyze\Model\Activity\Splits\Object $Splits
  */
 public function readFrom(Splits\Object $Splits)
 {
     foreach ($Splits->asArray() as $Split) {
         $this->Laps->add(new Lap($Split->time(), $Split->distance(), $Split->isActive() ? Lap::MODE_ACTIVE : Lap::MODE_RESTING));
     }
 }