Commit 513f1072 authored by Sven Schneider's avatar Sven Schneider
Browse files

added a switch to activete lod3 model of HFt delivered via Geovolume apo from Steinbeis server

parent 3f9f0e68
Pipeline #5268 passed with stages
in 24 seconds
......@@ -84,6 +84,15 @@
</label>
</td>
</tr>
</tr>
<tr>
<td style=" padding-bottom: 10px;"><strong>Pretty Buildings </strong> </td>
<td style=" padding-bottom: 10px; padding-left: 15px;"><label class="switch">
<input type="checkbox" onclick="togglePrettyBuildingTiles()" checked>
<span class="slider round"></span>
</label>
</td>
</tr>
</tbody>
</table>
</div>
......
......@@ -22,11 +22,15 @@ var extent = Cesium.Rectangle.fromDegrees(9.162794728779428, 48.78605872069245,
Cesium.Camera.DEFAULT_VIEW_RECTANGLE = extent;
Cesium.Camera.DEFAULT_VIEW_FACTOR = 0;
viewer.scene.globe.enableLighting = true; // set lighting to true
// load 3d Tile set of HFT from Cesium ION.
var tileset = viewer.scene.primitives.add(
new Cesium.Cesium3DTileset({
url: Cesium.IonResource.fromAssetId(656401),
})
);
// define a function to zoom to the tileset (invoke later)
var zoomAll = function (tileset) {
return new Promise(function (resolve, reject) {
......@@ -42,23 +46,16 @@ var zoomAll = function (tileset) {
});
};
//////////////////////////// load 3d building tiles or OSM 3d Buildings ///////////////////////
// here is the switch to switch between different 3d buildings
// load 3d Tile set of SToeckach.
// var tileset = viewer.scene.primitives.add(
// new Cesium.Cesium3DTileset({
// url: "https://steinbeis-3dps.eu/3DGeoVolumes/collections/Stuttgart/HFTBuildings_3DModel_noTexture/3dtiles/tileset.json"//Cesium.IonResource.fromAssetId(656401),
// })
// );
var load3DTiles = function () {
tilesetLOD1 = viewer.scene.primitives.add(new Cesium.Cesium3DTileset({
url: "https://steinbeis-3dps.eu/3DGeoVolumes/collections/Stuttgart/HFTBuildings_3DModel_noTexture/3dtiles/tileset.json" //Cesium.IonResource.fromAssetId(656401),
}));
//
Cesium.when(tilesetLOD1.readyPromise).then(function (tilesetLOD1) {
viewer.flyTo(tilesetLOD1)
......@@ -93,7 +90,6 @@ var zoomAll = function (tileset) {
//////// important value. to find the correct value trail and error is needed for a perfect fit
const BUILDIG_TILESET_HEIGHT_OFFSET = 54;
var tileset = tilesetLOD1
tileset.readyPromise.then(function (tileset) {
var height = BUILDIG_TILESET_HEIGHT_OFFSET;
......@@ -118,7 +114,7 @@ var zoomAll = function (tileset) {
// now shift / translate the tileset by the translation vector defined above
tileset.modelMatrix = Cesium.Matrix4.fromTranslation(translation);
//return zoomAll(tileset); // zoom or rather go to the translated tileset
return zoomAll(tileset); // zoom or rather go to the translated tileset
});
......@@ -206,5 +202,9 @@ var toggleBuildingTiles = function () {
tileset.show = tileset.show ? false : true;
}
var togglePrettyBuildingTiles = function () {
tilesetLOD1.show = tilesetLOD1.show ? false : true;
}
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