From 87f6184fad292cd3446616654dcbe1bd78c08bb0 Mon Sep 17 00:00:00 2001
From: patri <patri@MININT-HAK9ISR.local>
Date: Fri, 19 Aug 2022 14:13:54 +0200
Subject: [PATCH] update

---
 vcm/index.html         |  7 +++++-
 vcm/js/cityplanning.js | 55 ++++++++++++++++++++++++++++++++++++++----
 2 files changed, 56 insertions(+), 6 deletions(-)

diff --git a/vcm/index.html b/vcm/index.html
index 430feeefd..06abce050 100644
--- a/vcm/index.html
+++ b/vcm/index.html
@@ -405,7 +405,12 @@
                     <br>
                     <p>Wachstum kann über einen Slider gezeigt werden: </p><br>
                     <div id = "slider-step"></div><br>
-                    <div id="slider-step-value"></div><br>
+                    <div id="slider-step-value"></div>
+                    <div class="contain-buttons">
+                        <button id='startButton0001' onclick="sliderautoMove()">Start</button>
+                        <button id='stopButton' onclick="sliderautoMoveStop()">Stop</button>
+                        <button id='resetButton0001' onclick="sliderautoMoveReset()">Reset</button>
+                    </div>
 
                 </div>
                 <button id="men_acoustic" onclick="akkustikview()" type="button" class="collapsible">Akustik</button>
diff --git a/vcm/js/cityplanning.js b/vcm/js/cityplanning.js
index 899457696..d52257807 100644
--- a/vcm/js/cityplanning.js
+++ b/vcm/js/cityplanning.js
@@ -31,7 +31,7 @@ function BuildingAGE() {
     }
   
   
-    layer2 = layers[layerIndexRosenstein];
+    var layer2 = layers[layerIndexRosenstein];
     var tileset = layer2.cesium3DTileset;
     if (tileset) {
       tileset.style = new Cesium.Cesium3DTileStyle({
@@ -108,6 +108,9 @@ stepSlider.noUiSlider.on('update', function (values, handle) {
 });
 
 
+
+
+
 function BuildingAGEdynamic(age) {
     screenspaceErr(true)
     var Framework = vcs.vcm.Framework.getInstance();
@@ -125,7 +128,7 @@ function BuildingAGEdynamic(age) {
     }
   
   
-    layer2 = layers[layerIndexRosenstein];
+    var layer2 = layers[layerIndexRosenstein];
     var tileset = layer2.cesium3DTileset;
     if (tileset) {
       tileset.style = new Cesium.Cesium3DTileStyle({
@@ -169,15 +172,57 @@ function screenspaceErr(tf) {
     }
   
   
-    layer2 = layers[layerIndexRosenstein];
-    if(tf == true){
+    var layer2 = layers[layerIndexRosenstein];
+    if (layer2 == undefined){
+
+    } else {
+        if(tf == true){
         layer2.screenSpaceErrorMobile = 1
         layer2.screenSpaceError = 1
     } else {
         layer2.screenSpaceErrorMobile = 32
         layer2.screenSpaceError = 16
     }
+    }
+    
     
 
 
-}
\ No newline at end of file
+}
+var stopvar = false
+function sliderautoMoveStop(){
+        stopvar = true
+     }
+
+
+let stoptheAuto = document.getElementById('stopButton');
+function sliderautoMove() {
+    stopvar = false
+    const interval = setInterval(function() {
+        var valueold = parseInt(stepSlider.noUiSlider.get());
+        stepSlider.noUiSlider.set(valueold + 1);
+        console.log(valueold)
+        stepSliderValueElement.innerHTML = "Gebäude gebaut vor: " + parseInt(stepSlider.noUiSlider.get());
+        if(valueold >=2019) {
+            clearInterval(interval);
+        } 
+        if (stopvar == true){
+        clearInterval(interval);
+      }
+      }, 100);
+     
+		
+	
+     
+    //  clearInterval(interval);
+}
+function sliderautoMoveReset() {
+        stopvar = true
+        stepSlider.noUiSlider.set(1900);
+        
+        stepSliderValueElement.innerHTML = "Gebäude gebaut vor: " + parseInt(stepSlider.noUiSlider.get());
+        removebuildings();
+     
+    //  clearInterval(interval);
+}
+
-- 
GitLab