Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
SimStadt
3DClient4SimStadtAPI
Commits
cf8c7a82
Commit
cf8c7a82
authored
Jan 11, 2022
by
BujarMuharemi
Browse files
removed roofview
parent
ccc82897
Changes
2
Hide whitespace changes
Inline
Side-by-side
public/js/globe.js
View file @
cf8c7a82
...
...
@@ -9,43 +9,45 @@ var viewer = new Cesium.Viewer('cesiumContainer', {
animation
:
false
,
sceneModePicker
:
false
,
geocoder
:
false
,
sceneMode
:
Cesium
.
SceneMode
.
SCENE3D
sceneMode
:
Cesium
.
SceneMode
.
SCENE3D
});
viewer
.
scene
.
globe
.
depthTestAgainstTerrain
=
true
;
//--------------------hover over surfaces--------------------
var
singleChart
=
document
.
getElementById
(
'
singleChartContainer
'
);
var
roofViewActivated
=
false
;
//load address
var
request
=
new
XMLHttpRequest
();
request
.
onreadystatechange
=
function
(){
if
(
this
.
readyState
==
4
&&
this
.
status
==
200
){
var
coordinate
=
JSON
.
parse
(
request
.
responseText
);
var
lat
=
coordinate
.
results
[
0
].
geometry
.
lat
;
var
lng
=
coordinate
.
results
[
0
].
geometry
.
lng
;
console
.
log
(
lat
+
"
"
+
lng
);
fly
(
lat
,
lng
);
request
.
onreadystatechange
=
function
()
{
if
(
this
.
readyState
==
4
&&
this
.
status
==
200
)
{
var
coordinate
=
JSON
.
parse
(
request
.
responseText
);
var
lat
=
coordinate
.
results
[
0
].
geometry
.
lat
;
var
lng
=
coordinate
.
results
[
0
].
geometry
.
lng
;
console
.
log
(
lat
+
"
"
+
lng
);
fly
(
lat
,
lng
);
}
}
function
searchaddress
(){
function
searchaddress
()
{
var
query
=
document
.
getElementById
(
'
SearchAddress
'
).
value
;
request
.
open
(
"
GET
"
,
'
https://api.opencagedata.com/geocode/v1/json?key=c73da14969e6408ab4535b3ad6dc43ea&pretty=1&no_annotations=1&q=
'
+
query
,
true
);
request
.
send
();
request
.
open
(
"
GET
"
,
'
https://api.opencagedata.com/geocode/v1/json?key=c73da14969e6408ab4535b3ad6dc43ea&pretty=1&no_annotations=1&q=
'
+
query
,
true
);
request
.
send
();
}
function
fly
(
lat
,
lng
){
function
fly
(
lat
,
lng
)
{
var
pinBuilder
=
new
Cesium
.
PinBuilder
();
var
bluePin
=
viewer
.
entities
.
add
({
name
:
"
Blank blue pin
"
,
position
:
Cesium
.
Cartesian3
.
fromDegrees
(
lng
,
lat
),
billboard
:
{
image
:
pinBuilder
.
fromColor
(
Cesium
.
Color
.
ROYALBLUE
,
48
).
toDataURL
(),
verticalOrigin
:
Cesium
.
VerticalOrigin
.
BOTTOM
,
},
});
var
bluePin
=
viewer
.
entities
.
add
({
name
:
"
Blank blue pin
"
,
position
:
Cesium
.
Cartesian3
.
fromDegrees
(
lng
,
lat
),
billboard
:
{
image
:
pinBuilder
.
fromColor
(
Cesium
.
Color
.
ROYALBLUE
,
48
).
toDataURL
(),
verticalOrigin
:
Cesium
.
VerticalOrigin
.
BOTTOM
,
},
});
viewer
.
zoomTo
(
bluePin
);
viewer
.
flyTo
(
bluePin
);
...
...
@@ -235,7 +237,7 @@ var pickRoofType
var
pickUValue
var
shadowHourValue
=
0
;
var
SurfacePvPotential
=
[];
var
SurfacePvPotential
=
[];
//Color a feature on selection and show metadata in the InfoBox
...
...
@@ -338,13 +340,13 @@ viewer.screenSpaceEventHandler.setInputAction(function onLeftClick(movement) {
}
}
//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);
console
.
log
(
value
);
SurfacePvPotential
=
value
[
"
attributes
"
][
"
pvPotential
"
][
"
totalInvestment
"
];
//
console.log(value);
SurfacePvPotential
=
value
[
"
attributes
"
][
"
pvPotential
"
][
"
totalInvestment
"
];
}
}
}
...
...
@@ -376,7 +378,7 @@ viewer.screenSpaceEventHandler.setInputAction(function onLeftClick(movement) {
"
<tr><th>description</th><td>
"
+
pickedFeature
.
getProperty
(
"
description
"
)
+
"
</td></tr>
"
+
"
<tr><th>feature_type</th><td>
"
+
pickedFeature
.
getProperty
(
"
feature_type
"
)
+
"
</td></tr>
"
+
"
<tr><th>shadow value</th><td>
"
+
shadowhourvaluepercent
.
toFixed
(
1
)
+
"
%
"
+
"
</td></tr>
"
+
"
<tr><th>totalInvestment</th><td>
"
+
SurfacePvPotential
+
"
</td></tr>
"
+
"
<tr><th>totalInvestment</th><td>
"
+
SurfacePvPotential
+
"
</td></tr>
"
+
"
</tbody></table>
"
;
...
...
@@ -439,7 +441,7 @@ viewer.screenSpaceEventHandler.setInputAction(function onLeftClick(movement) {
//Roof View
//BUG: shows random attributes ui element ??
else
if
(
document
.
getElementById
(
"
roof
"
).
checked
)
{
else
if
(
document
.
getElementById
(
"
roof
"
).
checked
&&
roofViewActivated
)
{
console
.
log
(
"
clicked when in roof view and on click
"
);
//looping threw all surfaces
...
...
public/main.html
View file @
cf8c7a82
...
...
@@ -254,9 +254,10 @@
<div
class=
"lang"
key=
"surfaceview"
>
Surface-View
</div>
<label
class=
"drinkcard-cc surface"
for=
"surface"
></label>
<!-- deprecated: Used for roof-view
<input id="roof" type="radio" name="credit-card" value="roof">
<div class="lang" key="roofview">Roof-View</div>
<label
class=
"drinkcard-cc surface"
for=
"roof"
></label>
<label class="drinkcard-cc surface" for="roof"></label>
-->
</div>
</div>
...
...
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