/**
  * 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();
     }
 }
Example #3
0
$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);
    $Map->addRoute($Path);
}
if (!isset($Route)) {
    echo HTML::error(__('There are no routes matching the criterias.'));
}
$Map->setBounds(array('lat.min' => $minLat, 'lat.max' => $maxLat, 'lng.min' => $minLng, 'lng.max' => $maxLng));
$Map->display();
?>

<p class="info">
	<?php 
echo sprintf(__('The map contains your %s most recent routes matching the criterias.'), RunalyzePluginStat_Strecken::MAX_ROUTES_ON_NET);
?>
	<?php 
_e('More routes are not possible at the moment due to performance issues.');
?>