From b095944b957bea4b25e60b4c371102fd0b579cc5 Mon Sep 17 00:00:00 2001 From: tebben Date: Fri, 6 Sep 2024 07:57:54 +0200 Subject: [PATCH] updated cesium preview to latest version --- ctod/templates/preview/index.html | 10 +++++----- ctod/templates/preview/scripts/index.js | 26 +++++++++++++------------ 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/ctod/templates/preview/index.html b/ctod/templates/preview/index.html index a779d81..c0268ab 100644 --- a/ctod/templates/preview/index.html +++ b/ctod/templates/preview/index.html @@ -5,13 +5,13 @@ - + @@ -42,7 +42,8 @@ } #attribution { - font-family: "Courier New", Courier, "Lucida Console", "Monaco", monospace; + font-family: "Courier New", Courier, "Lucida Console", "Monaco", + monospace; position: absolute; bottom: 0; right: 0; @@ -57,7 +58,6 @@
-
-
+
diff --git a/ctod/templates/preview/scripts/index.js b/ctod/templates/preview/scripts/index.js index 7189fed..c42f2e7 100644 --- a/ctod/templates/preview/scripts/index.js +++ b/ctod/templates/preview/scripts/index.js @@ -7,11 +7,11 @@ var viewer, currentCog, dataset; -function loadCesium() { +async function loadCesium() { Cesium.Ion.defaultAccessToken = undefined; viewer = new Cesium.Viewer("cesiumContainer", { - imageryProvider: false, + baseLayer: false, requestRenderMode: true, timeline: false, animation: false, @@ -26,13 +26,13 @@ function loadCesium() { msaaSamples: 1, }); - initializeLayers(); - initTerrainProvider(); + await initializeLayers(); + await initTerrainProvider(); configureViewer(); setShading(); } -function initializeLayers() { +async function initializeLayers() { streetsLayer = new Cesium.ImageryLayer( new Cesium.OpenStreetMapImageryProvider({ url: "https://tile.openstreetmap.org/", @@ -68,7 +68,7 @@ function initializeLayers() { useStreetLayer(); } -function initTerrainProvider() { +async function initTerrainProvider() { dataset = getUrlParamIgnoreCase("dataset") || undefined; const minZoom = getUrlParamIgnoreCase("minZoom") || 1; const maxZoom = getUrlParamIgnoreCase("maxZoom") || 18; @@ -76,7 +76,7 @@ function initTerrainProvider() { const cog = getUrlParamIgnoreCase("cog") || "./ctod/files/test_cog.tif"; const skipCache = getUrlParamIgnoreCase("skipCache") || false; const meshingMethod = getUrlParamIgnoreCase("meshingMethod") || "grid"; - setTerrainProvider( + await setTerrainProvider( minZoom, maxZoom, noData, @@ -124,7 +124,7 @@ function configureViewer() { }); } -function setTerrainProvider( +async function setTerrainProvider( minZoom, maxZoom, noData, @@ -145,10 +145,12 @@ function setTerrainProvider( } } - terrainProvider = new Cesium.CesiumTerrainProvider({ - url: terrainProviderUrl, - requestVertexNormals: true, - }); + terrainProvider = await Cesium.CesiumTerrainProvider.fromUrl( + terrainProviderUrl, + { + requestVertexNormals: true, + } + ); viewer.terrainProvider = terrainProvider; if (currentCog !== cog) {