From 09e4592f1c9f7d9982dea0284f9792da5049697a Mon Sep 17 00:00:00 2001
From: Sven Schneider <sven.schneider@hft-stuttgart.de>
Date: Fri, 29 Oct 2021 21:28:22 +0200
Subject: [PATCH] only allowed one building model to show at a time, either
 Lod1 or Lod3. If one is selected, the other will be deselected and not be
 visible anymore

---
 public/HFT.html | 25 +++++++++++++++++++------
 public/HFT.js   | 26 ++++++++++++++++++++++++--
 2 files changed, 43 insertions(+), 8 deletions(-)

diff --git a/public/HFT.html b/public/HFT.html
index ae3427e..1d28297 100644
--- a/public/HFT.html
+++ b/public/HFT.html
@@ -58,6 +58,8 @@
 
   <div class="backdrop mainbackdrop" id="DCMO" style="display:show">    
     <h2>  Layer selection </h2>
+    <div class="backdrop mainbackdrop"> 
+      <h3> Pointclouds </h3>
     <table>
       <tbody>
         <tr>
@@ -76,25 +78,36 @@
           </label>
         </td>
         </tr>
+      </tbody>
+    </table>  
+  </div>
+
+    <div class="backdrop mainbackdrop">   
+      <h3>Building models </h3>
+<table>  
+<tbody>
+        
         <tr>
-          <td style=" padding-bottom: 10px;"><strong>Buildings </strong> </td>
+          <td style=" padding-bottom: 10px;"><strong>LOD1 Buildings </strong> </td>
           <td style=" padding-bottom: 10px; padding-left: 15px;"><label class="switch">
-            <input type="checkbox" onclick="toggleBuildingTiles()" checked>
+            <input id="simpleBuildingsCheckbox" type="checkbox" onclick="toggleBuildingTiles()" unchecked>
             <span class="slider round"></span>
           </label>
         </td>
         </tr>
       </tr>
       <tr>
-        <td style=" padding-bottom: 10px;"><strong>Pretty Buildings </strong> </td>
+        <td style=" padding-bottom: 10px;"><strong>LOD3 Buildings </strong> </td>
         <td style=" padding-bottom: 10px; padding-left: 15px;"><label class="switch">
-          <input type="checkbox" onclick="togglePrettyBuildingTiles()" checked>
+          <input id="prettyBuildingsCheckbox" type="checkbox" onclick="togglePrettyBuildingTiles()" checked>
           <span class="slider round"></span>
         </label>
       </td>
       </tr>
-      </tbody>
-      </table>     
+    </tbody>
+  </table>  
+         
+      </div>
 </div>
             
       
diff --git a/public/HFT.js b/public/HFT.js
index 2ac13d9..01ed0b5 100644
--- a/public/HFT.js
+++ b/public/HFT.js
@@ -117,6 +117,7 @@ var zoomAll = function (tileset) {
 		return zoomAll(tileset); // zoom or rather go to the translated tileset
 	});
 
+	tileset.show = false;
 
 
 ////////////////////////////////////////////////////////////////////////////////////
@@ -199,11 +200,32 @@ var toggleRGBPC = function () {
 }
 
 var toggleBuildingTiles = function () {
-	tileset.show = tileset.show ? false : true;
+	if (tileset.show === true) {
+		tileset.show = false
+	}
+	else {
+		tileset.show = true	
+		if (tilesetLOD1.show === true){
+			$('#prettyBuildingsCheckbox').prop('checked', false);
+			tilesetLOD1.show = false
+		}						
+	}
 }
 
 var togglePrettyBuildingTiles = function () {
-	tilesetLOD1.show = tilesetLOD1.show ? false : true;
+	// tilesetLOD1.show = tilesetLOD1.show ? false : true;
+	if (tilesetLOD1.show === true) {
+		tilesetLOD1.show = false		
+	}
+	else {
+		tilesetLOD1.show = true				
+		if (tileset.show === true){
+			$('#simpleBuildingsCheckbox').prop('checked', false);
+			tileset.show = false
+		}
+	}
+	// $('#prettyBuildingsCheckbox').prop('checked', true); // Checks it
+//$('#myCheckbox').prop('checked', false); // Unchecks it
 }
 
 
-- 
GitLab