Commit 39b61e30 authored by Izairi's avatar Izairi
Browse files

add fetch function and print output console

parent f971529d
var coordinatesBB = [] var coordinatesBB = []
//var url = "https://simstadt-api.iaf-ex.hft-stuttgart.de:8080/workflow/execute" //old link //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" // URL to API var url = "http://vm24.fkc.hft-stuttgart.de:8082/workflow/execute" // URL to API
var url2 = "http://vm24.fkc.hft-stuttgart.de:8082/workflow/timedShadowValueByDay/"
/*TODO#1: -get current data from the api and create local test data (apiData foler) /*TODO#1: -get current data from the api and create local test data (apiData foler)
-add connection handeling (error messages when there isnt a connection and then using the local test data) -add connection handeling (error messages when there isnt a connection and then using the local test data)
*/ */
...@@ -15,13 +15,41 @@ var totalSurfaceAreaSortPick ...@@ -15,13 +15,41 @@ var totalSurfaceAreaSortPick
var roofTypeSortPick var roofTypeSortPick
var uValueSortPick var uValueSortPick
async function fetchshadowDataJSON() {
var bottomLat = coordinatesBB[1]
var leftLng = coordinatesBB[0]
var rightLng = coordinatesBB[2]
var topLat = coordinatesBB[3]//
var day = 5;
const response = await fetch(url2 + day, {
method: "POST",
body: JSON.stringify({
"boundingBox": {
"bottomLat": bottomLat, //48.779004965,
"leftLng": leftLng, //9.1686843081,
"lodType": "LOD2",
"rightLng": rightLng, //9.175336684,
"topLat": topLat //48.7822869656
},
"cityGMLRef": "campusLOD2"
}),
headers: {
"Content-Type": "application/json",
"Authorization": "Basic YWRtaW46YWRtaW4xMjM="
}
})
const data = await response.json()
return data
}
async function fetchDataJSON() { async function fetchDataJSON() {
var bottomLat = coordinatesBB[1] var bottomLat = coordinatesBB[1]
var leftLng = coordinatesBB[0] var leftLng = coordinatesBB[0]
var rightLng = coordinatesBB[2] var rightLng = coordinatesBB[2]
var topLat = coordinatesBB[3]// var topLat = coordinatesBB[3]//
const response = await fetch(url, { const response = await fetch(url, {
method: "POST", method: "POST",
body: JSON.stringify({ body: JSON.stringify({
"boundingBox": { "boundingBox": {
...@@ -39,8 +67,8 @@ async function fetchDataJSON() { ...@@ -39,8 +67,8 @@ async function fetchDataJSON() {
"heatedVolume", "heatedVolume",
"yearOfConstruction", "yearOfConstruction",
"buildingFunction", "buildingFunction",
"monthlyHeating", // "monthlyHeating",
"monthlyCooling", //"monthlyCooling",
"pvPotential", "pvPotential",
"roofType", "roofType",
"totalSurfaceArea" "totalSurfaceArea"
...@@ -57,6 +85,7 @@ async function fetchDataJSON() { ...@@ -57,6 +85,7 @@ async function fetchDataJSON() {
const data = await response.json() const data = await response.json()
return data return data
} }
document.getElementById("loader").style.visibility = "hidden" document.getElementById("loader").style.visibility = "hidden"
...@@ -64,7 +93,9 @@ function processData() { ...@@ -64,7 +93,9 @@ function processData() {
console.log(coordinatesBB) console.log(coordinatesBB)
console.log("Waiting for data....") console.log("Waiting for data....")
fetchshadowDataJSON().then(data=> {
console.log(data)
})
fetchDataJSON().then(data => { fetchDataJSON().then(data => {
console.log(data); console.log(data);
document.getElementById("cesiumContainer").style.opacity = "1"; document.getElementById("cesiumContainer").style.opacity = "1";
...@@ -293,7 +324,7 @@ window.onclick = function (event) { ...@@ -293,7 +324,7 @@ window.onclick = function (event) {
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
var tileData = null; var tileData = null;
var tileset = null; var tileset = null;
var tilesetURL = 'http://vm24.fkc.hft-stuttgart.de:8081/CampusLOD2/CityModel/tileset.json'; var tilesetURL = 'http://vm24.fkc.hft-stuttgart.de:8081/CampusLOD2Old/tileset.json';
var localTestTileset = '/3dclient4simstadtapi/public/test/gmlTileset_v1.json'; var localTestTileset = '/3dclient4simstadtapi/public/test/gmlTileset_v1.json';
......
Markdown is supported
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