Commit a0a1c873 authored by BujarMuharemi's avatar BujarMuharemi
Browse files

getting surface and their pvPotential in one array

parent e6b8e7a9
......@@ -134,7 +134,7 @@ async function getLocalShadowdata() {
async function processData() {
console.log(coordinatesBB)
console.log("Waiting for data....")
shadowdata= await getLocalShadowdata()
shadowdata = await getLocalShadowdata()
timeout(25000, getLocalShadowdata()).then((response) => {
console.log(response)
......@@ -145,30 +145,25 @@ async function processData() {
})
timeout(10000, fetchPvPotentialJSON()).then((response) => {
console.log(response)
//console.log("fetchPvPotentialJSON:", response);
getPvPotentialOfSurfaces(response["buildings"]);
}).catch((error) => {
console.log(error)
})
timeout(10000, fetchDataJSON()).then((response) => {
calculateData(response);
}).catch((error) => {
console.log(error)
fetch(localPvpotentialData)
.then(response => response.text())
.then(text => calculateData( JSON.parse(text)))
.then(response => response.text())
.then(text => calculateData(JSON.parse(text)))
})
}
function calculateData(data) {
console.log(data);
document.getElementById("cesiumContainer").style.opacity = "1";
......@@ -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
async function fetchTileset() {
function fetchTileset() {
timeout(1000, fetch(tilesetURL)).then((response) => {
loadAndZoomToTileset(tilesetURL);
}).catch((error) => { //catching the error(no connection)/ timeout and displaying an alert for the user
......@@ -422,8 +431,6 @@ async function fetchTileset() {
})
}
/*
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
......@@ -432,7 +439,6 @@ async function fetchTileset() {
-->this fixme is the problem of the backendteam !
? maybe add old menu back and the option to also load the new ones
*/
......@@ -508,15 +514,17 @@ function deleteTilesetButtons() {
//expects path to test data, from the 'public' folder as origin
// for example: getAbsoulteTestPath("/test/gmlTileset_v1.json")
function getAbsoulteTestPath(path){
function getAbsoulteTestPath(testdataPath) {
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;
a.forEach(element => path+"/"+element);
var path = window.location.origin+"/"+a[0]+path;
console.log(path);
var path = window.location.origin + "/" + path + testdataPath;
return path;
}
......@@ -16,7 +16,7 @@ viewer.scene.globe.depthTestAgainstTerrain = true;
//--------------------hover over surfaces--------------------
var singleChart = document.getElementById('singleChartContainer');
console.log(viewer.ShadowMap);
//console.log(viewer.ShadowMap);
// HTML overlay for showing feature name on mouseover
var nameOverlay = document.createElement("div");
......
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