From e6b8e7a95ad99abcc7b7deb8a5131b7ce3b2910a Mon Sep 17 00:00:00 2001 From: BujarMuharemi <bujar.muharemi.28@gmail.com> Date: Thu, 23 Dec 2021 19:24:25 +0100 Subject: [PATCH] fixed paths to all local test data --- public/js/connectToAPI.js | 23 ++++++++++++++++++++--- public/test/gmlTileset_v1.json | 22 +++++++++++----------- 2 files changed, 31 insertions(+), 14 deletions(-) diff --git a/public/js/connectToAPI.js b/public/js/connectToAPI.js index 28d88cb..9fce792 100644 --- a/public/js/connectToAPI.js +++ b/public/js/connectToAPI.js @@ -7,7 +7,8 @@ var pvURL = "http://vm24.fkc.hft-stuttgart.de:8082/workflow/readPVPotential" /*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) */ -var localShadowData = "/3dclient4simstadtapi/public/test/APIdata/shadowData.json" +var localShadowData = "/public/test/APIdata/shadowData.json" +var localPvpotentialData = "/public/test/APIdata/buildingInformation.json" var buildingFunctionSort var constructionYearSortPick @@ -155,7 +156,7 @@ async function processData() { }).catch((error) => { console.log(error) - fetch("/3dclient4simstadtapi/public/test/APIdata/buildingInformation.json") + fetch(localPvpotentialData) .then(response => response.text()) .then(text => calculateData( JSON.parse(text))) @@ -395,7 +396,8 @@ var tileset = null; //var tilesetURL = 'http://vm24.fkc.hft-stuttgart.de:8081/CampusLOD2Old/tileset.json'; var tilesetURL = 'http://vm24.fkc.hft-stuttgart.de:8081/CampusLOD2/tileset.json'; -var localTestTileset = '/3dclient4simstadtapi/public/test/gmlTileset_v1.json'; +//var localTestTileset = '/3dclient4simstadtapi/public/test/gmlTileset_v1.json'; +var localTestTileset = getAbsoulteTestPath("/test/gmlTileset_v1.json"); function timeout(ms, promise) { @@ -503,3 +505,18 @@ function deleteTilesetButtons() { } } + +//expects path to test data, from the 'public' folder as origin +// for example: getAbsoulteTestPath("/test/gmlTileset_v1.json") +function getAbsoulteTestPath(path){ + var a = window.location.pathname.split("/") + a.pop();a.reverse();a.pop(); + + var path; + a.forEach(element => path+"/"+element); + var path = window.location.origin+"/"+a[0]+path; + console.log(path); + + return path; +} + diff --git a/public/test/gmlTileset_v1.json b/public/test/gmlTileset_v1.json index 236b24b..4befd74 100644 --- a/public/test/gmlTileset_v1.json +++ b/public/test/gmlTileset_v1.json @@ -19,7 +19,7 @@ "boundingVolume" : { "box" : [ 4157183.0913853333, 671276.9167505095, 4774688.139831596, 208.88327595870942, 0, 0, 0, 198.420072172652, 0, 0, 0, 159.76538479700685 ] }, - "url" : "/3dclient4simstadtapi/public/test/tileset/data/data0.b3dm" + "url" : "/public/test/tileset/data/data0.b3dm" }, "children" : [ { @@ -31,7 +31,7 @@ "boundingVolume" : { "box" : [ 4157228.114850776, 671251.5544893676, 4774660.327885907, 43.80110447667539, 0, 0, 0, 12.856712591368705, 0, 0, 0, 53.52015439514071 ] }, - "url" : "/3dclient4simstadtapi/public/test/tileset/data/data1.b3dm" + "url" : "/public/test/tileset/data/data1.b3dm" } }, { @@ -43,7 +43,7 @@ "boundingVolume" : { "box" : [ 4157259.0075245854, 671237.0161895596, 4774633.671508187, 58.36289628734812, 0, 0, 0, 60.476301041897386, 0, 0, 0, 50.82873797882348 ] }, - "url" : "/3dclient4simstadtapi/public/test/tileset/data/data2.b3dm" + "url" : "/public/test/tileset/data/data2.b3dm" } }, { @@ -55,7 +55,7 @@ "boundingVolume" : { "box" : [ 4157260.196087419, 671251.9858865617, 4774636.8328062985, 25.79576786607504, 0, 0, 0, 29.950261512654833, 0, 0, 0, 44.506141755729914 ] }, - "url" : "/3dclient4simstadtapi/public/test/tileset/data/data3.b3dm" + "url" : "/public/test/tileset/data/data3.b3dm" } }, { @@ -67,7 +67,7 @@ "boundingVolume" : { "box" : [ 4157223.877246985, 671278.8423610204, 4774660.5079447515, 20.377759689930826, 0, 0, 0, 193.8928428903455, 0, 0, 0, 22.34141970332712 ] }, - "url" : "/3dclient4simstadtapi/public/test/tileset/data/data4.b3dm" + "url" : "/public/test/tileset/data/data4.b3dm" } }, { @@ -79,7 +79,7 @@ "boundingVolume" : { "box" : [ 4157211.0689755557, 671179.0722945668, 4774667.161378037, 61.64202992897481, 0, 0, 0, 58.29674572101794, 0, 0, 0, 57.427568226121366 ] }, - "url" : "/3dclient4simstadtapi/public/test/tileset/data/data5.b3dm" + "url" : "/public/test/tileset/data/data5.b3dm" } }, { @@ -91,7 +91,7 @@ "boundingVolume" : { "box" : [ 4157225.063591961, 671175.3949235276, 4774673.084528787, 21.286791074555367, 0, 0, 0, 20.521639954065904, 0, 0, 0, 20.94711357820779 ] }, - "url" : "/3dclient4simstadtapi/public/test/tileset/data/data6.b3dm" + "url" : "/public/test/tileset/data/data6.b3dm" } }, { @@ -103,7 +103,7 @@ "boundingVolume" : { "box" : [ 4157172.530755615, 671226.8655617537, 4774696.573534641, 138.71846981020644, 0, 0, 0, 106.83504467795137, 0, 0, 0, 116.25188143644482 ] }, - "url" : "/3dclient4simstadtapi/public/test/tileset/data/data7.b3dm" + "url" : "/public/test/tileset/data/data7.b3dm" } }, { @@ -115,7 +115,7 @@ "boundingVolume" : { "box" : [ 4157234.735237984, 671184.0981509301, 4774663.504809576, 1.9434990277513862, 0, 0, 0, 3.1151851491304114, 0, 0, 0, 1.7876751571893692 ] }, - "url" : "/3dclient4simstadtapi/public/test/tileset/data/data8.b3dm" + "url" : "/public/test/tileset/data/data8.b3dm" } }, { @@ -127,7 +127,7 @@ "boundingVolume" : { "box" : [ 4157192.6996459886, 671343.1874950464, 4774673.3595239995, 76.89431473286822, 0, 0, 0, 65.87858309876174, 0, 0, 0, 87.54443842731416 ] }, - "url" : "/3dclient4simstadtapi/public/test/tileset/data/data9.b3dm" + "url" : "/public/test/tileset/data/data9.b3dm" } }, { @@ -139,7 +139,7 @@ "boundingVolume" : { "box" : [ 4157146.0018855724, 671293.6001087409, 4774719.744891234, 134.70427643693984, 0, 0, 0, 99.23852986039128, 0, 0, 0, 96.55526552256197 ] }, - "url" : "/3dclient4simstadtapi/public/test/tileset/data/data10.b3dm" + "url" : "/public/test/tileset/data/data10.b3dm" } } ] -- GitLab