Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
SimStadt
3DClient4SimStadtAPI
Commits
0468704c
Commit
0468704c
authored
3 years ago
by
BujarMuharemi
Browse files
Options
Download
Email Patches
Plain Diff
painting shadows on roof works correctly
parent
363df370
master
dev
1 merge request
!1
Finale Merge of the dev branch into master
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
public/js/globe.js
+3
-4
public/js/globe.js
public/js/shadowPalette.js
+16
-5
public/js/shadowPalette.js
with
19 additions
and
9 deletions
+19
-9
public/js/globe.js
+
3
-
4
View file @
0468704c
...
@@ -398,12 +398,11 @@ viewer.screenSpaceEventHandler.setInputAction(function onLeftClick(movement) {
...
@@ -398,12 +398,11 @@ viewer.screenSpaceEventHandler.setInputAction(function onLeftClick(movement) {
//looping threw all surfaces
//looping threw all surfaces
tileContent
.
forEach
(
t
=>
{
tileContent
.
forEach
(
t
=>
{
if
(
t
.
getProperty
(
"
description
"
).
includes
(
"
Roof
"
)){
//HACK: checking if the are a roof surface (should come from feature_type)
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
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
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
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
public/js/shadowPalette.js
+
16
-
5
View file @
0468704c
//Shadow palette for coloring the roofs
//Shadow palette for coloring the roofs
//color pallet white->black
//color pallet white->black
var
shadow
Palette
=
[
'
#ffffff
'
,
'
#f0f0f0
'
,
'
#d9d9d9
'
,
'
#bdbdbd
'
,
'
#969696
'
,
'
#737373
'
,
'
#525252
'
,
'
#252525
'
];
var
color
Palette
=
[
'
#ffffff
'
,
'
#f0f0f0
'
,
'
#d9d9d9
'
,
'
#bdbdbd
'
,
'
#969696
'
,
'
#737373
'
,
'
#525252
'
,
'
#252525
'
];
//
const shadowPalette = colorPalette.reverse();
const
shadowPalette
=
colorPalette
.
reverse
();
//returns the responding color from the shadowPalette, depending on the inputShadowValue(0 to 1 in float)
//returns the responding color from the shadowPalette, depending on the inputShadowValue(0 to 1 in float)
function
getShadowPalette
(
inputShadowValue
){
function
getShadowPalette
(
inputShadowValue
){
//TODO: add check for wrong inputShadowValues
//checking for the float values
//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)){
if(!Number.isInteger(inputShadowValue)){
var index = Math.ceil((shadowPalette.length-1)*inputShadowValue);
var index = Math.ceil((shadowPalette.length-1)*inputShadowValue);
//console.log(shadowPalette[index]);
//console.log(shadowPalette[index]);
...
@@ -15,9 +19,16 @@ function getShadowPalette(inputShadowValue){
...
@@ -15,9 +19,16 @@ function getShadowPalette(inputShadowValue){
}
}
//edge case for 0 and 1
//edge case for 0 and 1
else{
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]);
//console.log("black",shadowPalette[shadowPalette.length-1]);
return shadowPalette[shadowPalette.length-1];
return shadowPalette[shadowPalette.length-1];
}
}
*/
}
}
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Snippets