/** * Add map */ protected function addMap() { if ($this->Context->hasRoute() && $this->Context->route()->hasPositionData() && !$this->Context->hideMap()) { $Map = new Leaflet\Map('map-' . $this->Context->activity()->id()); $Map->addRoute(new Leaflet\Activity('route-' . $this->Context->activity()->id(), $this->Context->route(), $this->Context->trackdata())); $this->TopContent = '<div id="training-map"">' . $Map->code() . '</div>'; $this->big = true; } }
/** * Set content */ protected function setContent() { $this->id = 'training-map'; if ($this->Context->hasRoute() && $this->Context->route()->hasPositionData() && !$this->Context->hideMap()) { $Map = new Leaflet\Map('map-' . $this->Context->activity()->id()); $Map->addRoute(new Leaflet\Activity('route-' . $this->Context->activity()->id(), $this->Context->route(), $this->Context->trackdata())); $this->Content = $Map->code(); } }
ORDER BY `id` DESC LIMIT ' . RunalyzePluginStat_Strecken::MAX_ROUTES_ON_NET); } else { $Routes = DB::getInstance()->query(' SELECT `' . PREFIX . 'route`.`id`, `' . PREFIX . 'route`.`geohashes`, `' . PREFIX . 'route`.`min`, `' . PREFIX . 'route`.`max` FROM `' . PREFIX . 'training` LEFT JOIN `' . PREFIX . 'route` ON `' . PREFIX . 'training`.`routeid`=`' . PREFIX . 'route`.`id` WHERE `' . PREFIX . 'training`.`accountid`=' . SessionAccountHandler::getId() . ' AND`' . PREFIX . 'route`.`geohashes`!="" ' . $Conditions . ' ORDER BY `id` DESC LIMIT ' . RunalyzePluginStat_Strecken::MAX_ROUTES_ON_NET); } $Map = new Leaflet\Map('map-routenet', 600); $minLat = 90; $maxLat = -90; $minLng = 180; $maxLng = -180; while ($RouteData = $Routes->fetch()) { $Route = new Model\Route\Entity($RouteData); $MinCoordinate = (new League\Geotools\Geohash\Geohash())->decode($RouteData['min'])->getCoordinate(); $MaxCoordinate = (new League\Geotools\Geohash\Geohash())->decode($RouteData['max'])->getCoordinate(); $minLat = $MinCoordinate->getLatitude() != 0 ? min($minLat, $MinCoordinate->getLatitude()) : $minLat; $minLng = $MinCoordinate->getLongitude() != 0 ? min($minLng, $MinCoordinate->getLongitude()) : $minLng; $maxLat = $MaxCoordinate->getLatitude() != 0 ? max($maxLat, $MaxCoordinate->getLatitude()) : $maxLat; $maxLng = $MaxCoordinate->getLongitude() != 0 ? max($maxLng, $MaxCoordinate->getLongitude()) : $maxLng; $Path = new Leaflet\Activity('route-' . $RouteData['id'], $Route, null, false); $Path->addOption('hoverable', false); $Path->addOption('autofit', false);