Commit cecb9f7d authored by Pithon Kabiro's avatar Pithon Kabiro
Browse files

Add documentation to functions / Cesium app

parent 8be8f752
Showing with 25 additions and 6 deletions
+25 -6
...@@ -15,6 +15,11 @@ const viewer = new Cesium.Viewer("cesiumGlobeContainer", { ...@@ -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 loadTiles = function (urlTiles) {
const tileset = new Cesium.Cesium3DTileset({ const tileset = new Cesium.Cesium3DTileset({
url: urlTiles, url: urlTiles,
...@@ -37,7 +42,11 @@ const loadTiles = function (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 () { 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";
...@@ -46,7 +55,13 @@ const loadNonDetailed = function () { ...@@ -46,7 +55,13 @@ const loadNonDetailed = function () {
loadTiles(URL_3DTILES); 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( const modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(
Cesium.Cartesian3.fromDegrees(9.083385, 48.881342, 0) Cesium.Cartesian3.fromDegrees(9.083385, 48.881342, 0)
); );
...@@ -61,7 +76,11 @@ const gltfLoad = function (gltfId, gltfUrl) { ...@@ -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 () { 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";
...@@ -71,7 +90,7 @@ const loadDetailed = function () { ...@@ -71,7 +90,7 @@ const loadDetailed = function () {
loadTiles(URL_3DTILES); loadTiles(URL_3DTILES);
// Load Building 225 // Load Building 225
gltfLoad("bosch_si225_3", URL_GLTF); gltfLoad(URL_GLTF, "bosch_si225_3");
// Load sensors in Building 225 // Load sensors in Building 225
const gltfArray = [ const gltfArray = [
...@@ -111,7 +130,7 @@ const loadDetailed = function () { ...@@ -111,7 +130,7 @@ const loadDetailed = function () {
"sensor_383_v2", "sensor_383_v2",
]; ];
gltfArray.forEach((sensor) => gltfLoad(sensor, URL_GLTF)); gltfArray.forEach((sensor) => gltfLoad(URL_GLTF, sensor));
}; };
if (!LOAD_DETAILED_BLDG225) { if (!LOAD_DETAILED_BLDG225) {
...@@ -125,7 +144,7 @@ if (!LOAD_DETAILED_BLDG225) { ...@@ -125,7 +144,7 @@ if (!LOAD_DETAILED_BLDG225) {
/** /**
* Activate feature picking for the displayed 3DTiles * Activate feature picking for the displayed 3DTiles
* @param {*} * @param {*}
* @returns {void} * @returns {undefined}
*/ */
const activate3DTileFeaturePicking = function () { const activate3DTileFeaturePicking = function () {
// HTML overlay for showing feature name on mouseover // HTML overlay for showing feature name on mouseover
......
Supports Markdown
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