From bb156b4f77053e00322628ff06d1c01fda909109 Mon Sep 17 00:00:00 2001 From: Daria Kolokolnikova <72koda1bif@hft-stuttgart.de> Date: Thu, 13 Jan 2022 13:17:55 +0100 Subject: [PATCH] pvPotentialRadioButtons triggers now pvPotentialNormalization --- public/js/globe.js | 37 +++++++++++++++++---------- public/js/pvPotentialNormalization.js | 1 + public/main.html | 2 +- 3 files changed, 25 insertions(+), 15 deletions(-) diff --git a/public/js/globe.js b/public/js/globe.js index f85d779..8b0740e 100644 --- a/public/js/globe.js +++ b/public/js/globe.js @@ -20,8 +20,8 @@ var roofViewActivated = false; var chosenAttributeRadioBtnFlag = "shadowValue"; -function chosenAttributeHandler(radioBtnValue){ - chosenAttributeRadioBtnFlag=radioBtnValue.value; +function chosenAttributeHandler(radioBtnValue) { + chosenAttributeRadioBtnFlag = radioBtnValue.value; } //load address @@ -315,7 +315,7 @@ viewer.screenSpaceEventHandler.setInputAction(function onLeftClick(movement) { //fill variables for Single Building Properties fillTableProperties(gmlID, surID) - + //Surface View @onLeftClick if (document.getElementById("surface").checked) { resetRoofColors(); @@ -341,25 +341,34 @@ viewer.screenSpaceEventHandler.setInputAction(function onLeftClick(movement) { if (key === t.getProperty("gml_id")) { //checking if the ids of the current surface match the id in the shadowdata array //console.log("hour:",chosenDate.hour); shadowHourValue = value[chosenDate.hour - 1] //getting the current chosen hour from the timeline - - if(chosenAttributeRadioBtnFlag==="shadowValue"){ - t.color = Cesium.Color.fromCssColorString(getColorFromPalette(shadowHourValue,"shadowValue")); //coloring the surface - }else if(chosenAttributeRadioBtnFlag==="pvPotential"){ - t.color = Cesium.Color.fromCssColorString(getColorFromPalette(shadowHourValue,"pvPotential")); //coloring the surface + + if (chosenAttributeRadioBtnFlag === "shadowValue") { + t.color = Cesium.Color.fromCssColorString(getColorFromPalette(shadowHourValue, "shadowValue")); //coloring the surface } + //t.color = Cesium.Color.fromCssColorString(getShadowPalette(shadowHourValue)); //coloring the surface - + } } console.log(pvPotentialSurfaces); //coloring surfaces on pv potential - for (const [key, value] of Object.entries(pvPotentialSurfaces)) { //looping threw the shadowdata array - if (value["id"] === t.getProperty("gml_id")) { //checking if the ids of the current surface match the id in the shadowdata array - //console.log("hour:",chosenDate.hour); - SurfacePvPotential = value["attributes"]["pvPotential"]["totalInvestment"]; + setMinAndMax(chosenAttributeRadioBtnFlag); + console.log("minie maus", minAndMaxPvPotentials); + for (const [key, value] of Object.entries(pvPotentialSurfaces)) { + if (value["id"] === t.getProperty("gml_id")) { //checking if the ids of the current surface match the id in the shadowdata array + //console.log("hour:",chosenDate.hour); + var normalizedPvValue; + chosenPvPotentialValue = value["attributes"]["pvPotential"][chosenAttributeRadioBtnFlag]; + //console.log("normalisierter",chosenPvPotentialValue); + console.log("klick"); + normalizedPvValue = getNormalizedValue(chosenPvPotentialValue); + console.log("normalisierter", normalizedPvValue); + t.color = Cesium.Color.fromCssColorString(getColorFromPalette(normalizedPvValue, "pvPotential")); //coloring the surface + + // SurfacePvPotential = value["attributes"]["pvPotential"][chosenAttributeRadioBtnFlag]; SurfacePvPotentialObject = value["attributes"]["pvPotential"]; - //console.log(SurfacePvPotentialObject); + console.log(SurfacePvPotentialObject); } } } diff --git a/public/js/pvPotentialNormalization.js b/public/js/pvPotentialNormalization.js index 8c1702d..80d462f 100644 --- a/public/js/pvPotentialNormalization.js +++ b/public/js/pvPotentialNormalization.js @@ -15,6 +15,7 @@ function setMinAndMax(pvPotentialValue) { } }); pvPotentials = pvPotentials.sort(function(a, b) { return a - b; }); + minAndMaxPvPotentials=[]; minAndMaxPvPotentials.push(pvPotentials[0]); minAndMaxPvPotentials.push(pvPotentials[pvPotentials.length - 1]); } diff --git a/public/main.html b/public/main.html index da26835..2755f62 100644 --- a/public/main.html +++ b/public/main.html @@ -302,7 +302,7 @@ <label for="discountedPaybackPeriod">Discounted Payback Period <input id="discountedPaybackPeriod" type="radio" key="discountedPaybackPeriod" name="dropp" value="discountedPaybackPeriod" onclick="chosenAttributeHandler(this);"> </label> - <label><input id="shadowValue" type="radio" name="dropp" value="shadowValue" checked onclick="chosenAttributeHandler(this);"> Shadow-Value</label> + <label><input id="shadowValue" type="radio" name="dropp" value="shadowValue" onclick="chosenAttributeHandler(this);"> Shadow-Value</label> </div> </div> <div id="chartButton" class="button"> -- GitLab