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
72aad392
You need to sign in or sign up before continuing.
Commit
72aad392
authored
Nov 17, 2021
by
Muharemi
Browse files
added descriptions to TODOs
parent
b1a534a8
Changes
1
Show whitespace changes
Inline
Side-by-side
public/js/connectToAPI.js
View file @
72aad392
var
coordinatesBB
=
[]
//var url = "https://simstadt-api.iaf-ex.hft-stuttgart.de:8080/workflow/execute" //old link
var
url
=
"
http://vm24.fkc.hft-stuttgart.de:8080/workflow/execute
"
var
url
=
"
http://vm24.fkc.hft-stuttgart.de:8080/workflow/execute
"
// URL to API
var
buildingFunctionSort
...
...
@@ -55,8 +55,8 @@ async function fetchDataJSON() {
}
document
.
getElementById
(
"
loader
"
).
style
.
visibility
=
"
hidden
"
/*TODO
: -us
e local test data
-
no
connection handeling
/*TODO
#1: -get current data from the api and creat
e local test data
(apiData foler)
-
add
connection handeling
(error messages when there isnt a connection and then using the local test data)
*/
function
processData
()
{
console
.
log
(
coordinatesBB
)
...
...
@@ -289,15 +289,16 @@ window.onclick = function (event) {
}
//-------------------------------------------------------------------------------
var
tileData
=
null
var
tileset
=
null
var
tileData
=
null
;
var
tileset
=
null
;
var
tilesetURL
=
'
http://vm24.fkc.hft-stuttgart.de:8081/CampusLOD2/CityModel/tileset.json
'
;
var
localTestTileset
=
'
/3dclient4simstadtapi/public/test/tileset/gmlTileset_v1.json
'
;
//fetching the tileset and handling the connection
// TODO
: cancel
timemout when there isnt a connection
// TODO
#2: add a
timemout when there isnt a connection
(1sec) -> so the user doesnt have to wait 10sec for the failed fetch
async
function
fetchTileset
(){
fetch
(
tilesetURL
).
then
((
response
)
=>
{
if
(
response
.
status
>=
200
&&
response
.
status
<=
299
){
//successful connection
//const tilesetJSON = response.json();
...
...
@@ -313,32 +314,35 @@ async function fetchTileset(){
swal
(
"
Could not connect to Server
"
,
errorString
,
"
error
"
);
console
.
log
(
"
Using local test data
"
);
loadAndZoomTime
(
localTestTileset
);
//TODO: fix loading local data
});
swal
({
text
:
"
Connecting to Server ... Please wait !
"
,
icon
:
"
info
"
,
buttons
:
false
});
//displays waiting alert
loadAndZoomTime
(
localTestTileset
);
//TODO#3: fix the link so the local tileset can be loaded
})
//swal({text:"Connecting to Server ... Please wait !",icon:"info" ,buttons: false}); //displays waiting alert
}
//loads tileset after submit button is clicked
/*
FIXME:
-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
-surfaces are also broken
-->this fixme is the problem of the backendteam !
? maybe add old menu back and the option to also load the new ones
*/
function
loadTileset
()
{
viewer
.
scene
.
primitives
.
remove
(
tileset
)
tileContent
=
[]
viewer
.
scene
.
primitives
.
remove
(
tileset
)
;
tileContent
=
[]
;
modal
.
style
.
display
=
"
block
"
;
fetchTileset
();
//var userurl = document.getElementById("3Durl").value; //returns the chosen area from the dropdown
}
//loads the tileset from the url into the cesium viewer and zooms to it
function
loadAndZoomTime
(
url
){
tileset
=
viewer
.
scene
.
primitives
.
add
(
new
Cesium
.
Cesium3DTileset
({
url
:
url
...
...
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