From 12718c4c474ffe5226020917db9ae9e662b46660 Mon Sep 17 00:00:00 2001 From: Kowalski Date: Sat, 8 Mar 2025 08:44:35 +0100 Subject: [PATCH] =?UTF-8?q?Menu=20a=20zobrazen=C3=AD=20jednoho=20obvodu.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Presentation/Home/default.latte | 3 ++- app/Presentation/Obvody/ObvodyPresenter.php | 2 +- app/Presentation/Obvody/default.latte | 3 +++ www/js/mapa.js | 2 +- www/js/obvody.js | 13 ++++++++++++- 5 files changed, 19 insertions(+), 4 deletions(-) diff --git a/app/Presentation/Home/default.latte b/app/Presentation/Home/default.latte index 6dd309f..3942ff7 100644 --- a/app/Presentation/Home/default.latte +++ b/app/Presentation/Home/default.latte @@ -4,7 +4,8 @@

Seznam obvodů

+Všechny obvody {foreach $obvody as $obvod} - {$obvod} + {$obvod} {/foreach}
\ No newline at end of file diff --git a/app/Presentation/Obvody/ObvodyPresenter.php b/app/Presentation/Obvody/ObvodyPresenter.php index 5938f44..c724062 100644 --- a/app/Presentation/Obvody/ObvodyPresenter.php +++ b/app/Presentation/Obvody/ObvodyPresenter.php @@ -15,6 +15,6 @@ final class ObvodyPresenter extends Nette\Application\UI\Presenter public function renderDefault(int $obvod = null): void { - + $this->template->obvod_id = $obvod; } } diff --git a/app/Presentation/Obvody/default.latte b/app/Presentation/Obvody/default.latte index 493322f..029a1c5 100644 --- a/app/Presentation/Obvody/default.latte +++ b/app/Presentation/Obvody/default.latte @@ -3,6 +3,9 @@ {block content}
+ diff --git a/www/js/mapa.js b/www/js/mapa.js index 7bdbf8b..5a2dbeb 100644 --- a/www/js/mapa.js +++ b/www/js/mapa.js @@ -36,7 +36,7 @@ var osm = L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', { // Výchozí bod: var map = L.map('map', { - center: [50.853501146, 14.8425], + center: [50.853501146, 14.8425], // Hrádek zoom: 16, layers: [mapyCZ, osm] }); diff --git a/www/js/obvody.js b/www/js/obvody.js index 0035110..cd59fb1 100644 --- a/www/js/obvody.js +++ b/www/js/obvody.js @@ -12,11 +12,22 @@ $.ajax({ var geojson; geojson = L.geoJSON(geojsonFeature, { style: style, + filter: picnicFilter, onEachFeature: onEachFeature }).addTo(map); +function picnicFilter(feature) { + // obvod ID je z latte obvod_id + if (obvod_id == null) return true; + if (feature.properties.number == obvod_id) return true +} + +// center na vybraný obvod: +map.flyToBounds(geojson.getBounds()); + + // geolokace: -map.locate({ setView: true, maxZoom: 16 }); +map.locate({ setView: false, maxZoom: 16 }); function onLocationFound(e) { var radius = e.accuracy;