commit 64bc29346b7f59b24054d3b7ffe608cf12180031
Author: vastja <vastja@gmail.com>
Date:   Thu Apr 30 22:53:59 2020 +0200

    + funkcionalita zobrazení jednotlivých datasetů - zatím bez animace

diff --git a/website/public/js/zcu-heatmap.js b/website/public/js/zcu-heatmap.js
index d89a3f1..ba7abcc 100644
--- a/website/public/js/zcu-heatmap.js
+++ b/website/public/js/zcu-heatmap.js
@@ -1,4 +1,4 @@
-var map;
+var mymap;
 var heatmapLayer = null;
 
 var startX = 49.7248;
@@ -9,17 +9,17 @@ var currentTime = 0;
 
 
 function initMap() {
-  map = L.map('heatmap').setView([startX, startY], startZoom);
+  mymap = L.map('heatmap').setView([startX, startY], startZoom);
 
   L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
     attribution: '',
     maxZoom: 19
-  }).addTo(map);
+  }).addTo(mymap);
 }
 
 
 function setMapView(latitude = startX, longitude = startY, zoom = startZoom) {
-  map.setView([latitude, longitude], zoom);
+  mymap.setView([latitude, longitude], zoom);
 }
 
 
@@ -59,11 +59,16 @@ function animateTimeline() {
     }, 400);
 }
 
-function showHeatmap(route, date) {
+function showHeatmap(route) {
+
+  var name = $('#type').children("option:selected").text();
+  var parts = $('#date').val().split('-');
+  var date = parts[2] + parts[1] + parts[0];
+  var time = $('#time').children("option:selected").val();
 
   $.ajax({
     type: "POST",
-    url: route + date,
+    url: route + '/' +  name + '/' + date + '/' + time,
     success: function(result) {
       drawHeatmap(result);
     }
@@ -78,9 +83,11 @@ function drawHeatmap(points) {
   if (heatmapLayer != null) {
     mymap.removeLayer(heatmapLayer);
   }
-  heatmapLayer = L.heatLayer(points).addTo(map), draw = true; 
+  heatmapLayer = L.heatLayer(points, {opacity: 0.5}).addTo(mymap);
+  heatmapLayer.options = {opacity: 1};
   // var heat_01 = ...
   // on background map.addLayer(heat_01) -> map.removeLayer(heat_01);
+  // $(.leaflet-heatmap-layer).css('opacity', 'value');
 }
 
 function checkDataSetsAvailability(route) {
@@ -105,6 +112,6 @@ function updateAvailableDataSets(available) {
     options += '<option value="' + value + '">' + key + '</option>\n'; 
   });
 
-  $('#types').empty().append(options);
+  $('#type').empty().append(options);
   
 }
diff --git a/website/src/Controller/HeatmapController.php b/website/src/Controller/HeatmapController.php
index a3ca911..ab86103 100644
--- a/website/src/Controller/HeatmapController.php
+++ b/website/src/Controller/HeatmapController.php
@@ -24,22 +24,22 @@ class HeatmapController extends AbstractController {
         $dataSet = $form->getData();
         if ($form->isSubmitted()) {
             $dataSet = $form->getData();
-            // Todo do something
         }
 
         return $this->render(
             'heatmap.html.twig',
             [
                 'form' => $form->createView(),
+                'data_to_display' => $dataSet,
             ]
         );
     }
 
     /**
-     * @Route("heatmap/opendata/{collectionName}", name="opendata")
+     * @Route("heatmap/opendata/{name}/{date}/{time}", name="opendata")
      */
-    public function opendata(IOpenDataManager $manager, $collectionName) {
-        return $this->json($manager->getCollectionDataByName($collectionName));
+    public function opendata(IOpenDataManager $manager, $name = 'NONE', $date = '01012020', $time = '1') {
+        return $this->json($manager->getCollectionDataByName($name, $date, $time));
     }
 
     /**
diff --git a/website/src/IOpenDataManager.php b/website/src/IOpenDataManager.php
index 02faf82..feb89c3 100644
--- a/website/src/IOpenDataManager.php
+++ b/website/src/IOpenDataManager.php
@@ -3,7 +3,7 @@
 namespace App\OpenData;
 
 interface IOpenDataManager {
-    public function getCollectionDataByName($name);
+    public function getCollectionDataByName($name, $date, $hour);
 
     public function getAvailableCollections();
 
diff --git a/website/src/OpenDataManager.php b/website/src/OpenDataManager.php
index 621ba26..b0f87a3 100644
--- a/website/src/OpenDataManager.php
+++ b/website/src/OpenDataManager.php
@@ -14,8 +14,8 @@ class OpenDataManager implements IOpenDataManager {
         );
     }
 
-    public function getCollectionDataByName($name) {
-        $openData = $this->manager->executeQuery($name, new Query([], []));
+    public function getCollectionDataByName($name, $date, $hour) {
+        $openData = $this->manager->executeQuery('open-data-db.'.$name.$date, new Query(['date' => $date.$hour], []));
 
         $openData->setTypeMap([
             'array' => 'array',
diff --git a/website/templates/heatmap.html.twig b/website/templates/heatmap.html.twig
index 0662b24..2065e68 100644
--- a/website/templates/heatmap.html.twig
+++ b/website/templates/heatmap.html.twig
@@ -44,6 +44,7 @@
               {{ form_label(form.date, 'Vyberte čas') }}
               {{
                 form_widget(form.time, {
+                  'id' : 'time',
                   'attr' : {
                     'class' : "custom-select"
                   }
@@ -55,7 +56,7 @@
               {{ form_label(form.date, 'Vybrané datové sady') }}
               {{
                 form_widget(form.type, {
-                  'id' : 'types',
+                  'id' : 'type',
                   'attr' : {
                     'class' : "custom-select"                 
                   }
@@ -164,7 +165,9 @@
     <script src="{{ asset('js/zcu-heatmap.js') }}"></script>
     <script>
        initMap();
-       showHeatmap("{{ path('opendata', {'collectionName':'open-data-db.'}) }}", 'KOLOBEZKY31102018');
+        {% if data_to_display is defined %}
+          showHeatmap("{{ path('opendata') }}");
+        {% endif %}
     </script>
 
 
