Commit 8b532b40 authored by BujarMuharemi's avatar BujarMuharemi
Browse files

fixed pvPotential radio btn controller; works now

parent bb156b4f
//Shadow palette for coloring the roofs
// color pallet from https://colorbrewer2.org/#type=sequential&scheme=BuGn&n=3
var pvPotentialPallet = ['#fff7fb', '#ece7f2', '#d0d1e6', '#a6bddb', '#74a9cf', '#3690c0', '#0570b0', '#034e7b']
var pvPotentialPallet = ['#d0d1e6', '#a6bddb', '#74a9cf', '#3690c0', '#0570b0', '#034e7b']
pvPotentialPallet = pvPotentialPallet.reverse();
//color pallet white->black
......
......@@ -20,6 +20,7 @@ var roofViewActivated = false;
var chosenAttributeRadioBtnFlag = "shadowValue";
function chosenAttributeHandler(radioBtnValue) {
chosenAttributeRadioBtnFlag = radioBtnValue.value;
}
......@@ -319,6 +320,7 @@ viewer.screenSpaceEventHandler.setInputAction(function onLeftClick(movement) {
//Surface View @onLeftClick
if (document.getElementById("surface").checked) {
resetRoofColors();
setMinAndMax(chosenAttributeRadioBtnFlag);
//save the selected feature's original color
if (pickedhigh) {
highlightedFeatures.forEach(h => {
......@@ -334,7 +336,7 @@ viewer.screenSpaceEventHandler.setInputAction(function onLeftClick(movement) {
//used for debugging, when clicking on a surface
//console.log(t.getProperty("description") + "\n" + t.getProperty("feature_type") + "\n" + t.getProperty("gml_id") + "\n" + t.getProperty("gml_parent_id"));
t.color = Cesium.Color.LIME;
//t.color = Cesium.Color.LIME;
//color surfaces depending on their shadow value
for (const [key, value] of Object.entries(shadowdata)) { //looping threw the shadowdata array
......@@ -353,15 +355,15 @@ viewer.screenSpaceEventHandler.setInputAction(function onLeftClick(movement) {
console.log(pvPotentialSurfaces);
//coloring surfaces on pv potential
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");
console.log("chosenPvPotentialValue",chosenPvPotentialValue);
normalizedPvValue = getNormalizedValue(chosenPvPotentialValue);
console.log("normalisierter", normalizedPvValue);
t.color = Cesium.Color.fromCssColorString(getColorFromPalette(normalizedPvValue, "pvPotential")); //coloring the surface
......
......@@ -18,6 +18,7 @@ function setMinAndMax(pvPotentialValue) {
minAndMaxPvPotentials=[];
minAndMaxPvPotentials.push(pvPotentials[0]);
minAndMaxPvPotentials.push(pvPotentials[pvPotentials.length - 1]);
console.log("setMinAndMax calculated");
}
function getNormalizedValue(selectedPvPotentialValue) {
......
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment