示例#1
0
 /**
  * @param \Runalyze\Model\Activity\Entity $activity
  * @param \Runalyze\Model\Route\Entity $route
  * @param int $offset
  * @return \Runalyze\Calculation\NightDetector $this-reference
  */
 public function setFromEntities(Activity\Entity $activity, Route\Entity $route, $offset = 0)
 {
     if ($route->hasGeohashes() && $route->get(Route\Entity::STARTPOINT) != '') {
         $timestamp = $activity->timestamp() + 0.5 * $activity->duration();
         $coordinate = (new Geohash())->decode($route->get(Route\Entity::STARTPOINT))->getCoordinate();
         $this->setFrom($timestamp, $coordinate, $offset);
     } else {
         $this->Value = null;
     }
     return $this;
 }