Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
iCity
EnergyDashboard
Commits
57149df7
Commit
57149df7
authored
3 years ago
by
Sven Schneider
Browse files
Options
Download
Email Patches
Plain Diff
made an array that contains data of all bld for vorlauf
parent
e50e245c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
public/js/appCesium.js
+67
-43
public/js/appCesium.js
with
67 additions
and
43 deletions
+67
-43
public/js/appCesium.js
+
67
-
43
View file @
57149df7
...
@@ -26,6 +26,8 @@ import {
...
@@ -26,6 +26,8 @@ import {
PARAM_SELECT
,
PARAM_SELECT
,
}
from
"
./appChart.js
"
;
}
from
"
./appChart.js
"
;
var
ALLDATA
=
[];
Cesium
.
Ion
.
defaultAccessToken
=
Cesium
.
Ion
.
defaultAccessToken
=
"
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiIyODgxYzJlNi1kNDZiLTQ3ZmQtYmUxYy0yMWI0OGM3NDA5MzAiLCJpZCI6NDczOSwic2NvcGVzIjpbImFzciIsImdjIl0sImlhdCI6MTU0MTUyMzU0MX0.shj2hM3pvsvcmE_wMb2aBDuk_cKWmFmbolltInGImwU
"
;
"
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiIyODgxYzJlNi1kNDZiLTQ3ZmQtYmUxYy0yMWI0OGM3NDA5MzAiLCJpZCI6NDczOSwic2NvcGVzIjpbImFzciIsImdjIl0sImlhdCI6MTU0MTUyMzU0MX0.shj2hM3pvsvcmE_wMb2aBDuk_cKWmFmbolltInGImwU
"
;
...
@@ -46,13 +48,13 @@ const viewer = new Cesium.Viewer("cesiumGlobeContainer", {
...
@@ -46,13 +48,13 @@ const viewer = new Cesium.Viewer("cesiumGlobeContainer", {
* @param {String} urlTiles URL to the 3DTiles to be loaded
* @param {String} urlTiles URL to the 3DTiles to be loaded
* @returns {undefined} undefined
* @returns {undefined} undefined
*/
*/
const
loadTiles
=
function
(
urlTiles
)
{
const
loadTiles
=
function
(
urlTiles
)
{
const
tileset
=
new
Cesium
.
Cesium3DTileset
({
const
tileset
=
new
Cesium
.
Cesium3DTileset
({
url
:
urlTiles
,
url
:
urlTiles
,
});
});
viewer
.
scene
.
primitives
.
add
(
tileset
);
viewer
.
scene
.
primitives
.
add
(
tileset
);
tileset
.
readyPromise
.
then
(
function
()
{
tileset
.
readyPromise
.
then
(
function
()
{
viewer
viewer
.
zoomTo
(
.
zoomTo
(
tileset
,
tileset
,
...
@@ -61,7 +63,7 @@ const loadTiles = function(urlTiles) {
...
@@ -61,7 +63,7 @@ const loadTiles = function(urlTiles) {
tileset
.
boundingSphere
.
radius
/
0.5
tileset
.
boundingSphere
.
radius
/
0.5
)
)
)
)
.
otherwise
(
function
(
err
)
{
.
otherwise
(
function
(
err
)
{
throw
err
;
throw
err
;
});
});
});
});
...
@@ -72,7 +74,7 @@ const loadTiles = function(urlTiles) {
...
@@ -72,7 +74,7 @@ const loadTiles = function(urlTiles) {
* @param{*}
* @param{*}
* @returns {undefined} undefined
* @returns {undefined} undefined
*/
*/
const
loadNonDetailed
=
function
()
{
const
loadNonDetailed
=
function
()
{
// Paths to data sources
// Paths to data sources
const
URL_3DTILES
=
"
data_3d/3dtiles/1_full/tileset.json
"
;
const
URL_3DTILES
=
"
data_3d/3dtiles/1_full/tileset.json
"
;
...
@@ -86,7 +88,7 @@ const loadNonDetailed = function() {
...
@@ -86,7 +88,7 @@ const loadNonDetailed = function() {
* @param {String} gltfId Name of the glTF model file without the extension i.e. exclude the `.gltf` suffix
* @param {String} gltfId Name of the glTF model file without the extension i.e. exclude the `.gltf` suffix
* @returns {undefined} undefined
* @returns {undefined} undefined
*/
*/
const
gltfLoad
=
function
(
gltfUrl
,
gltfId
)
{
const
gltfLoad
=
function
(
gltfUrl
,
gltfId
)
{
const
modelMatrix
=
Cesium
.
Transforms
.
eastNorthUpToFixedFrame
(
const
modelMatrix
=
Cesium
.
Transforms
.
eastNorthUpToFixedFrame
(
Cesium
.
Cartesian3
.
fromDegrees
(
9.083385
,
48.881342
,
0
)
Cesium
.
Cartesian3
.
fromDegrees
(
9.083385
,
48.881342
,
0
)
);
);
...
@@ -106,7 +108,7 @@ const gltfLoad = function(gltfUrl, gltfId) {
...
@@ -106,7 +108,7 @@ const gltfLoad = function(gltfUrl, gltfId) {
* @param{*}
* @param{*}
* @returns {undefined} undefined
* @returns {undefined} undefined
*/
*/
const
loadDetailed
=
function
()
{
const
loadDetailed
=
function
()
{
// Paths to data sources
// Paths to data sources
const
URL_3DTILES
=
"
data_3d/3dtiles/2_partial/tileset.json
"
;
const
URL_3DTILES
=
"
data_3d/3dtiles/2_partial/tileset.json
"
;
const
URL_GLTF
=
"
data_3d/gltf
"
;
const
URL_GLTF
=
"
data_3d/gltf
"
;
...
@@ -171,7 +173,7 @@ if (!LOAD_DETAILED_BLDG225) {
...
@@ -171,7 +173,7 @@ if (!LOAD_DETAILED_BLDG225) {
* @param {*}
* @param {*}
* @returns {undefined}
* @returns {undefined}
*/
*/
const
activate3DTileFeaturePicking
=
function
()
{
const
activate3DTileFeaturePicking
=
function
()
{
// HTML overlay for showing feature name on mouseover
// HTML overlay for showing feature name on mouseover
const
nameOverlay
=
document
.
createElement
(
"
div
"
);
const
nameOverlay
=
document
.
createElement
(
"
div
"
);
viewer
.
container
.
appendChild
(
nameOverlay
);
viewer
.
container
.
appendChild
(
nameOverlay
);
...
@@ -308,46 +310,68 @@ const activate3DTileFeaturePicking = function() {
...
@@ -308,46 +310,68 @@ const activate3DTileFeaturePicking = function() {
);
);
const
PARAM_FILTER
=
createTemporalFilterString
(
"
2020-01-01
"
,
"
2021-01-01
"
);
const
PARAM_FILTER
=
createTemporalFilterString
(
"
2020-01-01
"
,
"
2021-01-01
"
);
const
axiosGetRequest
=
axios
.
get
(
BASE_URL_OBSERVATIONS
,
{
// const axiosGetRequest = axios.get(BASE_URL_OBSERVATIONS, {
params
:
{
// params: {
"
$resultFormat
"
:
PARAM_RESULT_FORMAT
,
// "$resultFormat": PARAM_RESULT_FORMAT,
"
$orderBy
"
:
PARAM_ORDER_BY
,
// "$orderBy": PARAM_ORDER_BY,
"
$filter
"
:
PARAM_FILTER
,
// "$filter": PARAM_FILTER,
"
$select
"
:
PARAM_SELECT
,
// "$select": PARAM_SELECT,
},
// },
});
// });
const
buildingIDs
=
[
75
,
76
,
77
,
78
,
79
,
80
];
// var ALLDATA = [];
for
(
var
bld
=
0
;
bld
<
buildingIDs
.
length
;
bld
++
)
{
var
baseUrlBld
=
getObservationsUrl
(
BASE_URL
,
buildingIDs
[
bld
]);
const
axiosGetRequest
=
axios
.
get
(
baseUrlBld
,
{
params
:
{
"
$resultFormat
"
:
PARAM_RESULT_FORMAT
,
"
$orderBy
"
:
PARAM_ORDER_BY
,
"
$filter
"
:
PARAM_FILTER
,
"
$select
"
:
PARAM_SELECT
,
},
});
// Get "ALL" the Observations that satisfy our query
// Get "ALL" the Observations that satisfy our query
followNextLink
(
axiosGetRequest
)
followNextLink
(
axiosGetRequest
)
.
then
((
success
)
=>
{
.
then
((
success
)
=>
{
const
successValue
=
success
.
data
.
value
;
const
successValue
=
success
.
data
.
value
;
// Array that will hold the combined observations
const
combinedObservations
=
[];
successValue
.
forEach
((
dataObj
)
=>
{
// Each page of results will have a dataArray that holds the observations
const
dataArrays
=
dataObj
.
dataArray
;
combinedObservations
.
push
(...
dataArrays
);
});
// DEBUG: Check total number of observations
console
.
log
(
combinedObservations
.
length
);
// DEBUG: Print the array of observations
console
.
log
(
combinedObservations
);
return
combinedObservations
;
})
.
catch
((
err
)
=>
{
console
.
log
(
"
ERROR:
"
)
console
.
log
(
err
);
})
.
then
((
observationArr
)
=>
{
var
agg
=
aggregateResponse
(
observationArr
,
0
,
'
mean
'
);
ALLDATA
.
push
(
agg
);
// console.log(agg);
drawHeatMapHC
(
formatSTAResponseForHeatMap
(
agg
));
drawLineChartHC
(
formatSTAResponseForLineChart
(
agg
));
console
.
log
(
ALLDATA
.
length
);
// alert('waiting...');
});
// Array that will hold the combined observations
const
combinedObservations
=
[];
successValue
.
forEach
((
dataObj
)
=>
{
// Each page of results will have a dataArray that holds the observations
const
dataArrays
=
dataObj
.
dataArray
;
combinedObservations
.
push
(...
dataArrays
);
}
});
// DEBUG: Check total number of observations
console
.
log
(
combinedObservations
.
length
);
// DEBUG: Print the array of observations
console
.
log
(
combinedObservations
);
return
combinedObservations
;
})
.
catch
((
err
)
=>
{
console
.
log
(
err
);
})
.
then
((
observationArr
)
=>
{
var
agg
=
aggregateResponse
(
observationArr
,
0
,
'
mean
'
);
// console.log(agg);
drawHeatMapHC
(
formatSTAResponseForHeatMap
(
agg
));
drawLineChartHC
(
formatSTAResponseForLineChart
(
agg
));
});
},
Cesium
.
ScreenSpaceEventType
.
LEFT_CLICK
);
},
Cesium
.
ScreenSpaceEventType
.
LEFT_CLICK
);
...
...
This diff is collapsed.
Click to expand it.
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