diff --git a/public/js/globe.js b/public/js/globe.js index f85d77959955168b134b8222cdfd3dad0316c7ec..8b0740e8ea4c463ca78da5c9527cf848839146b9 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 8c1702d04794541a2bc8e2c277e72fd5e420fb7f..80d462f54f17cd261e788e432d6ee351c1797233 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 da268352eb2ae908541f04ae53d023350801d69a..2755f6257b4bf5f3bcd75230822d78cc81f66b88 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">