From 314e2940be2c97e5254e1f5d6aced6c74444e553 Mon Sep 17 00:00:00 2001
From: zdenevuk <zdenko.vuk@ijs.si>
Date: Wed, 14 Dec 2022 15:37:02 +0100
Subject: [PATCH] joined dailyInternalBikeTravels and pedestrianTravelTime into
 a single if statement

---
 .../results-map/results-map.component.ts      | 77 +++++++------------
 1 file changed, 28 insertions(+), 49 deletions(-)

diff --git a/src/app/pages/simulation-wizard/results-map/results-map.component.ts b/src/app/pages/simulation-wizard/results-map/results-map.component.ts
index fc5556ea..3ddac4d1 100644
--- a/src/app/pages/simulation-wizard/results-map/results-map.component.ts
+++ b/src/app/pages/simulation-wizard/results-map/results-map.component.ts
@@ -78,28 +78,28 @@ export class ResultsMapComponent implements OnChanges {
         this.setMapPositionAndZoom(res);
       });
     }, 50);
-    // setTimeout(() => {
-    //   console.log(
-    //     "%cTemporary",
-    //     "background: peru; font-weight: bold; color: black; font-family: serif; padding: 0 10px;"
-    //   );
-    //   const celkomplet: HTMLElement = document.querySelectorAll(
-    //     ".buttons"
-    //   )[0] as HTMLElement;
-    //   celkomplet.style.display = "none";
-    // }, 825);
-    // setTimeout(() => {
-    //   const celkomplet1: HTMLElement = document.querySelectorAll(
-    //     ".appearance-filled.size-medium.shape-rectangle.status-primary.ng-star-inserted.nb-transition"
-    //   )[1] as HTMLElement;
-    //   celkomplet1.click();
-    // }, 1000);
-    // setTimeout(() => {
-    //   const celkomplet2: HTMLElement = document.querySelectorAll(
-    //     "#loadGeojsonButtonsContainer button"
-    //   )[3] as HTMLElement;
-    //   celkomplet2.click();
-    // }, 1050);
+    setTimeout(() => {
+      console.log(
+        "%cTemporary",
+        "background: peru; font-weight: bold; color: black; font-family: serif; padding: 0 10px;"
+      );
+      const celkomplet: HTMLElement = document.querySelectorAll(
+        ".buttons"
+      )[0] as HTMLElement;
+      celkomplet.style.display = "none";
+    }, 825);
+    setTimeout(() => {
+      const celkomplet1: HTMLElement = document.querySelectorAll(
+        ".appearance-filled.size-medium.shape-rectangle.status-primary.ng-star-inserted.nb-transition"
+      )[1] as HTMLElement;
+      celkomplet1.click();
+    }, 1000);
+    setTimeout(() => {
+      const celkomplet2: HTMLElement = document.querySelectorAll(
+        "#loadGeojsonButtonsContainer button"
+      )[3] as HTMLElement;
+      celkomplet2.click();
+    }, 1050);
     // setTimeout(() => {
     //   const celkomplet3: HTMLElement = document.querySelectorAll(
     //     ".leaflet-control-layers-selector"
@@ -481,37 +481,16 @@ export class ResultsMapComponent implements OnChanges {
                 mouseout: (e) => this.resetFeature(e, feature.properties),
               }),
           });
-        } else if (keys[f] == "dailyInternalBikeTravels") {
+        } else if (
+          keys[f] == "dailyInternalBikeTravels" ||
+          keys[f] == "pedestrianTravelTime"
+        ) {
           tmp = L.geoJSON(<any>jsonFile, {
             style: (feature) => ({
               weight: this.geoJsonStyleWeight,
               color: MapColors.getColorHighToLow(
-                feature["properties"]["cityWide"]["traffic"]
-                  .dailyInternalBikeTravels ||
-                  feature["properties"].dailyInternalBikeTravels,
-                keys[f],
-                this.maxKeyValues[`maxValue_${keys[f]}`],
-                ratiosBetweenGrades,
-                parseInt(feature["properties"]["capacity"]) == 9999
-                  ? true
-                  : false
-              ),
-              opacity: this.geoJsonStyleOpacity,
-            }),
-            onEachFeature: (feature, layer) =>
-              layer.on({
-                mouseover: (e) => this.highlightFeature(e, feature.properties),
-                mouseout: (e) => this.resetFeature(e, feature.properties),
-              }),
-          });
-        } else if (keys[f] == "pedestrianTravelTime") {
-          tmp = L.geoJSON(<any>jsonFile, {
-            style: (feature) => ({
-              weight: this.geoJsonStyleWeight,
-              color: MapColors.getColor(
-                feature["properties"]["cityWide"]["traffic"]
-                  .pedestrianTravelTime ||
-                  feature["properties"].pedestrianTravelTime,
+                feature["properties"]["cityWide"]["traffic"][keys[f]] ||
+                  feature["properties"][keys[f]],
                 keys[f],
                 this.maxKeyValues[`maxValue_${keys[f]}`],
                 ratiosBetweenGrades,
-- 
GitLab