Commit 5f7d44be authored by BujarMuharemi's avatar BujarMuharemi
Browse files

added attributes to surfaceview

parent 9b02ecb7
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" // URL to API
var url2 = "http://vm24.fkc.hft-stuttgart.de:8083/workflow/timedShadowValueByDay/"
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)
-add connection handeling (error messages when there isnt a connection and then using the local test data)
*/
......@@ -21,7 +21,7 @@ async function fetchshadowDataJSON() {
var leftLng = coordinatesBB[0]
var rightLng = coordinatesBB[2]
var topLat = coordinatesBB[3]//
var day = 5;
var day = "1";
const response = await fetch(url2 + day, {
method: "POST",
body: JSON.stringify({
......@@ -38,15 +38,14 @@ async function fetchshadowDataJSON() {
"Content-Type": "application/json",
"Authorization": "Basic YWRtaW46YWRtaW4xMjM="
}
}).then(function() {
console.log("ok");
}).catch(function() {
alert("Connetion error to server, use local data")
})
const data = await response.json()
const data = await response.json();
return data
}
async function fetchDataJSON() {
var bottomLat = coordinatesBB[1]
var leftLng = coordinatesBB[0]
......@@ -71,8 +70,8 @@ const response = await fetch(url, {
"heatedVolume",
"yearOfConstruction",
"buildingFunction",
// "monthlyHeating",
//"monthlyCooling",
"monthlyHeating",
"monthlyCooling",
"pvPotential",
"roofType",
"totalSurfaceArea"
......@@ -97,9 +96,18 @@ function processData() {
console.log(coordinatesBB)
console.log("Waiting for data....")
fetchshadowDataJSON().then(data=> {
console.log(data)
})
timeout(25000, fetchshadowDataJSON()).then((response)=>{
console.log(response)
}).catch((error)=>{ //catching the error(no connection)/ timeout and displaying an alert for the user
swal({text:"Could not connect to Server. Using now: local data",icon:"info" } );
console.log("Using local test data");
//loadLocalAPIshadowData here...
})
fetchDataJSON().then(data => {
console.log(data);
document.getElementById("cesiumContainer").style.opacity = "1";
......
......@@ -286,7 +286,6 @@ viewer.screenSpaceEventHandler.setInputAction(function onLeftClick(movement) {
}
//set feature infobox description
var featureName = pickedFeature.getProperty("name");
selectedEntity.name = featureName;
......@@ -296,7 +295,10 @@ viewer.screenSpaceEventHandler.setInputAction(function onLeftClick(movement) {
'<table class="cesium-infoBox-defaultTable"><tbody>' +
"<tr><th>Surface_ID</th><td>" + pickedFeature.getProperty("gml_id") + "</td></tr>" +
"<tr><th>u_Value</th><td>" + pickUValue + "</td></tr>" +
"<tr><th>description</th><td>" + pickedFeature.getProperty("description") + "</td></tr>" +
"<tr><th>feature_type</th><td>" + pickedFeature.getProperty("feature_type") + "</td></tr>" +
"</tbody></table>";
}
else {
......
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