Commit 0468704c authored by BujarMuharemi's avatar BujarMuharemi
Browse files

painting shadows on roof works correctly

parent 363df370
......@@ -398,12 +398,11 @@ viewer.screenSpaceEventHandler.setInputAction(function onLeftClick(movement) {
//looping threw all surfaces
tileContent.forEach(t => {
if(t.getProperty("description").includes("Roof")){ //HACK: checking if the are a roof surface (should come from feature_type)
for (const [key, value] of Object.entries(shadowdata)) { //looping threw the shadowdata array
for (const [key, value] of Object.entries(shadowdata)) { //looping threw the shadowdata array
if(key === t.getProperty("gml_id")){ //checking the id
console.log(value);
shadowHourValue = value[chosenDate.hour-1]; //getting the current chosen hour from the timeline
t.color = Cesium.Color.fromCssColorString(getShadowPalette(shadowHourValue)); //coloring the surface
t.color = Cesium.Color.fromCssColorString(getShadowPalette(shadowHourValue)); //coloring the surface
}
}
......
//Shadow palette for coloring the roofs
//color pallet white->black
var shadowPalette = ['#ffffff','#f0f0f0','#d9d9d9','#bdbdbd','#969696','#737373','#525252','#252525'];
//const shadowPalette = colorPalette.reverse();
var colorPalette = ['#ffffff','#f0f0f0','#d9d9d9','#bdbdbd','#969696','#737373','#525252','#252525'];
const shadowPalette = colorPalette.reverse();
//returns the responding color from the shadowPalette, depending on the inputShadowValue(0 to 1 in float)
function getShadowPalette(inputShadowValue){
//TODO: add check for wrong inputShadowValues
function getShadowPalette(inputShadowValue){
//checking for the float values
var index = Math.ceil((shadowPalette.length-1)*inputShadowValue);
//console.log(inputShadowValue,"---",shadowPalette[index]);
return shadowPalette[index];
/* Can be ignored for now
if(!Number.isInteger(inputShadowValue)){
var index = Math.ceil((shadowPalette.length-1)*inputShadowValue);
//console.log(shadowPalette[index]);
......@@ -15,9 +19,16 @@ function getShadowPalette(inputShadowValue){
}
//edge case for 0 and 1
else{
//console.log(inputShadowValue);
if(inputShadowValue===0){
//console.log(inputShadowValue);
return shadowPalette[shadowPalette.length-1];
}else{
return shadowPalette[0];
}
//console.log("black",shadowPalette[shadowPalette.length-1]);
return shadowPalette[shadowPalette.length-1];
}
}*/
}
Supports Markdown
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