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
a0a1c873
Commit
a0a1c873
authored
3 years ago
by
BujarMuharemi
Browse files
Options
Download
Email Patches
Plain Diff
getting surface and their pvPotential in one array
parent
e6b8e7a9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
public/js/connectToAPI.js
+31
-23
public/js/connectToAPI.js
public/js/globe.js
+1
-1
public/js/globe.js
with
32 additions
and
24 deletions
+32
-24
public/js/connectToAPI.js
+
31
-
23
View file @
a0a1c873
...
@@ -134,7 +134,7 @@ async function getLocalShadowdata() {
...
@@ -134,7 +134,7 @@ async function getLocalShadowdata() {
async
function
processData
()
{
async
function
processData
()
{
console
.
log
(
coordinatesBB
)
console
.
log
(
coordinatesBB
)
console
.
log
(
"
Waiting for data....
"
)
console
.
log
(
"
Waiting for data....
"
)
shadowdata
=
await
getLocalShadowdata
()
shadowdata
=
await
getLocalShadowdata
()
timeout
(
25000
,
getLocalShadowdata
()).
then
((
response
)
=>
{
timeout
(
25000
,
getLocalShadowdata
()).
then
((
response
)
=>
{
console
.
log
(
response
)
console
.
log
(
response
)
...
@@ -145,30 +145,25 @@ async function processData() {
...
@@ -145,30 +145,25 @@ async function processData() {
})
})
timeout
(
10000
,
fetchPvPotentialJSON
()).
then
((
response
)
=>
{
timeout
(
10000
,
fetchPvPotentialJSON
()).
then
((
response
)
=>
{
console
.
log
(
response
)
//console.log("fetchPvPotentialJSON:", response);
getPvPotentialOfSurfaces
(
response
[
"
buildings
"
]);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
log
(
error
)
console
.
log
(
error
)
})
})
timeout
(
10000
,
fetchDataJSON
()).
then
((
response
)
=>
{
timeout
(
10000
,
fetchDataJSON
()).
then
((
response
)
=>
{
calculateData
(
response
);
calculateData
(
response
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
log
(
error
)
console
.
log
(
error
)
fetch
(
localPvpotentialData
)
fetch
(
localPvpotentialData
)
.
then
(
response
=>
response
.
text
())
.
then
(
response
=>
response
.
text
())
.
then
(
text
=>
calculateData
(
JSON
.
parse
(
text
)))
.
then
(
text
=>
calculateData
(
JSON
.
parse
(
text
)))
})
})
}
}
function
calculateData
(
data
)
{
function
calculateData
(
data
)
{
console
.
log
(
data
);
console
.
log
(
data
);
document
.
getElementById
(
"
cesiumContainer
"
).
style
.
opacity
=
"
1
"
;
document
.
getElementById
(
"
cesiumContainer
"
).
style
.
opacity
=
"
1
"
;
...
@@ -409,9 +404,23 @@ function timeout(ms, promise) {
...
@@ -409,9 +404,23 @@ function timeout(ms, promise) {
})
})
}
}
function
getPvPotentialOfSurfaces
(
pvPotentialarray
){
var
pvPotentialArray
=
[];
pvPotentialarray
.
forEach
(
building
=>
building
[
"
parts
"
].
forEach
(
parts
=>
parts
[
"
surfaces
"
].
forEach
(
surface
=>
pvPotentialArray
.
push
(
surface
)
//console.log(surface)
)
)
);
console
.
log
(
pvPotentialArray
);
}
//fetching the tileset and handling the connection
//fetching the tileset and handling the connection
async
function
fetchTileset
()
{
function
fetchTileset
()
{
timeout
(
1000
,
fetch
(
tilesetURL
)).
then
((
response
)
=>
{
timeout
(
1000
,
fetch
(
tilesetURL
)).
then
((
response
)
=>
{
loadAndZoomToTileset
(
tilesetURL
);
loadAndZoomToTileset
(
tilesetURL
);
}).
catch
((
error
)
=>
{
//catching the error(no connection)/ timeout and displaying an alert for the user
}).
catch
((
error
)
=>
{
//catching the error(no connection)/ timeout and displaying an alert for the user
...
@@ -422,8 +431,6 @@ async function fetchTileset() {
...
@@ -422,8 +431,6 @@ async function fetchTileset() {
})
})
}
}
/*
/*
NOTE #1: -load the models but the are in the too high in the "air"
NOTE #1: -load the models but the are in the too high in the "air"
-building view doesn´t work because all buildings are grouped together
-building view doesn´t work because all buildings are grouped together
...
@@ -432,7 +439,6 @@ async function fetchTileset() {
...
@@ -432,7 +439,6 @@ async function fetchTileset() {
-->this fixme is the problem of the backendteam !
-->this fixme is the problem of the backendteam !
? maybe add old menu back and the option to also load the new ones
? maybe add old menu back and the option to also load the new ones
*/
*/
...
@@ -508,15 +514,17 @@ function deleteTilesetButtons() {
...
@@ -508,15 +514,17 @@ function deleteTilesetButtons() {
//expects path to test data, from the 'public' folder as origin
//expects path to test data, from the 'public' folder as origin
// for example: getAbsoulteTestPath("/test/gmlTileset_v1.json")
// for example: getAbsoulteTestPath("/test/gmlTileset_v1.json")
function
getAbsoulteTestPath
(
path
){
function
getAbsoulteTestPath
(
testdataPath
)
{
var
a
=
window
.
location
.
pathname
.
split
(
"
/
"
)
var
a
=
window
.
location
.
pathname
.
split
(
"
/
"
)
a
.
pop
();
a
.
reverse
();
a
.
pop
();
a
.
pop
();
a
.
reverse
();
a
.
pop
();
a
.
reverse
()
var
path
=
""
;
a
.
forEach
(
element
=>
path
+=
"
/
"
+
element
);
var
path
;
var
path
=
window
.
location
.
origin
+
"
/
"
+
path
+
testdataPath
;
a
.
forEach
(
element
=>
path
+
"
/
"
+
element
);
var
path
=
window
.
location
.
origin
+
"
/
"
+
a
[
0
]
+
path
;
console
.
log
(
path
);
return
path
;
return
path
;
}
}
This diff is collapsed.
Click to expand it.
public/js/globe.js
+
1
-
1
View file @
a0a1c873
...
@@ -16,7 +16,7 @@ viewer.scene.globe.depthTestAgainstTerrain = true;
...
@@ -16,7 +16,7 @@ viewer.scene.globe.depthTestAgainstTerrain = true;
//--------------------hover over surfaces--------------------
//--------------------hover over surfaces--------------------
var
singleChart
=
document
.
getElementById
(
'
singleChartContainer
'
);
var
singleChart
=
document
.
getElementById
(
'
singleChartContainer
'
);
console
.
log
(
viewer
.
ShadowMap
);
//
console.log(viewer.ShadowMap);
// HTML overlay for showing feature name on mouseover
// HTML overlay for showing feature name on mouseover
var
nameOverlay
=
document
.
createElement
(
"
div
"
);
var
nameOverlay
=
document
.
createElement
(
"
div
"
);
...
...
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