Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
iCity
EnergyDashboard
Commits
cecb9f7d
Commit
cecb9f7d
authored
Jun 24, 2021
by
Pithon Kabiro
Browse files
Add documentation to functions / Cesium app
parent
8be8f752
Changes
1
Hide whitespace changes
Inline
Side-by-side
public/js/appCesium.js
View file @
cecb9f7d
...
...
@@ -15,6 +15,11 @@ const viewer = new Cesium.Viewer("cesiumGlobeContainer", {
}),
});
/**
* Load and zoom to the extents of 3DTiles
* @param {String} urlTiles URL to the 3DTiles to be loaded
* @returns {undefined} undefined
*/
const
loadTiles
=
function
(
urlTiles
)
{
const
tileset
=
new
Cesium
.
Cesium3DTileset
({
url
:
urlTiles
,
...
...
@@ -37,7 +42,11 @@ const loadTiles = function (urlTiles) {
});
};
// Function for loading 3DTiles only
/**
* Load 3DTiles for all the buildings; ignore any glTF models
* @param{*}
* @returns {undefined} undefined
*/
const
loadNonDetailed
=
function
()
{
// Paths to data sources
const
URL_3DTILES
=
"
data_3d/3dtiles/1_full/tileset.json
"
;
...
...
@@ -46,7 +55,13 @@ const loadNonDetailed = function () {
loadTiles
(
URL_3DTILES
);
};
const
gltfLoad
=
function
(
gltfId
,
gltfUrl
)
{
/**
* Load glTF models
* @param {String} gltfUrl Path to the folder containing the glTF models
* @param {String} gltfId Name of the glTF model file without the extension i.e. exclude the `.gltf` suffix
* @returns {undefined} undefined
*/
const
gltfLoad
=
function
(
gltfUrl
,
gltfId
)
{
const
modelMatrix
=
Cesium
.
Transforms
.
eastNorthUpToFixedFrame
(
Cesium
.
Cartesian3
.
fromDegrees
(
9.083385
,
48.881342
,
0
)
);
...
...
@@ -61,7 +76,11 @@ const gltfLoad = function (gltfId, gltfUrl) {
);
};
// Function for loading 3DTiles + glTF models
/**
* Load detailed glTF models for Building 225 and 3DTiles for the rest of the buildings
* @param{*}
* @returns {undefined} undefined
*/
const
loadDetailed
=
function
()
{
// Paths to data sources
const
URL_3DTILES
=
"
data_3d/3dtiles/2_partial/tileset.json
"
;
...
...
@@ -71,7 +90,7 @@ const loadDetailed = function () {
loadTiles
(
URL_3DTILES
);
// Load Building 225
gltfLoad
(
"
bosch_si225_3
"
,
URL_GLTF
);
gltfLoad
(
URL_GLTF
,
"
bosch_si225_3
"
);
// Load sensors in Building 225
const
gltfArray
=
[
...
...
@@ -111,7 +130,7 @@ const loadDetailed = function () {
"
sensor_383_v2
"
,
];
gltfArray
.
forEach
((
sensor
)
=>
gltfLoad
(
sensor
,
URL_GLTF
));
gltfArray
.
forEach
((
sensor
)
=>
gltfLoad
(
URL_GLTF
,
sensor
));
};
if
(
!
LOAD_DETAILED_BLDG225
)
{
...
...
@@ -125,7 +144,7 @@ if (!LOAD_DETAILED_BLDG225) {
/**
* Activate feature picking for the displayed 3DTiles
* @param {*}
* @returns {
voi
d}
* @returns {
undefine
d}
*/
const
activate3DTileFeaturePicking
=
function
()
{
// HTML overlay for showing feature name on mouseover
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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