From 93d1d37c15366c4cf73938a5775ffc469b0d8a1e Mon Sep 17 00:00:00 2001 From: hpinkos Date: Thu, 8 Feb 2018 17:26:17 -0500 Subject: [PATCH 1/3] Fixes #6192 --- Apps/CesiumViewer/CesiumViewer.js | 8 ++++++++ Source/Widgets/Viewer/viewerDragDropMixin.js | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Apps/CesiumViewer/CesiumViewer.js b/Apps/CesiumViewer/CesiumViewer.js index 73edd88034f6..576dbdcc950c 100644 --- a/Apps/CesiumViewer/CesiumViewer.js +++ b/Apps/CesiumViewer/CesiumViewer.js @@ -1,5 +1,6 @@ define([ 'Cesium/Core/Cartesian3', + 'Cesium/Core/CesiumTerrainProvider', 'Cesium/Core/defined', 'Cesium/Core/formatError', 'Cesium/Core/Math', @@ -15,6 +16,7 @@ define([ 'domReady!' ], function( Cartesian3, + CesiumTerrainProvider, defined, formatError, CesiumMath, @@ -58,6 +60,12 @@ define([ scene3DOnly : endUserOptions.scene3DOnly, requestRenderMode : true }); + + viewer.terrainProvider = new CesiumTerrainProvider({ + url : 'https://assets.agi.com/stk-terrain/v1/tilesets/world/tiles', + requestWaterMask : true, + requestVertexNormals : true + }); } catch (exception) { loadingIndicator.style.display = 'none'; var message = formatError(exception); diff --git a/Source/Widgets/Viewer/viewerDragDropMixin.js b/Source/Widgets/Viewer/viewerDragDropMixin.js index e3c6d3f443c2..81f6acf00525 100644 --- a/Source/Widgets/Viewer/viewerDragDropMixin.js +++ b/Source/Widgets/Viewer/viewerDragDropMixin.js @@ -272,7 +272,8 @@ define([ sourceUri : fileName, proxy : proxy, camera : scene.camera, - canvas : scene.canvas + canvas : scene.canvas, + clampToGround: clampToGround }); } else { viewer.dropError.raiseEvent(viewer, fileName, 'Unrecognized file: ' + fileName); From 5c3e88d54052b3d9b004317e1c12bc3158903508 Mon Sep 17 00:00:00 2001 From: Hannah Date: Fri, 9 Feb 2018 18:14:58 -0500 Subject: [PATCH 2/3] Update CHANGES.md --- CHANGES.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 0dcfd8ed5311..350d82317c9d 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -6,6 +6,9 @@ Change Log ##### Fixes :wrench: * Fixed bug where AxisAlignedBoundingBox did not copy over center value when cloning an undefined result. [#6183](https://github.com/AnalyticalGraphicsInc/cesium/pull/6183) +##### Additions :tada: +* Enable terrain in the `CesiumViewer` demo application [#6198](https://github.com/AnalyticalGraphicsInc/cesium/pull/6198) + ### 1.42.1 - 2018-02-01 _This is an npm-only release to fix an issue with using Cesium in Node.js.__ * Fixed a bug where Cesium would fail to load under Node.js. [#6177](https://github.com/AnalyticalGraphicsInc/cesium/pull/6177) From 99881167b816f9eb38ec4ea8548bf7bb1c7b7ef1 Mon Sep 17 00:00:00 2001 From: hpinkos Date: Tue, 13 Feb 2018 11:14:18 -0500 Subject: [PATCH 3/3] cleanup --- Apps/CesiumViewer/CesiumViewer.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/Apps/CesiumViewer/CesiumViewer.js b/Apps/CesiumViewer/CesiumViewer.js index 576dbdcc950c..44481f6aa6cb 100644 --- a/Apps/CesiumViewer/CesiumViewer.js +++ b/Apps/CesiumViewer/CesiumViewer.js @@ -54,18 +54,24 @@ define([ var loadingIndicator = document.getElementById('loadingIndicator'); var viewer; try { + var hasBaseLayerPicker = !defined(imageryProvider); viewer = new Viewer('cesiumContainer', { imageryProvider : imageryProvider, - baseLayerPicker : !defined(imageryProvider), + baseLayerPicker : hasBaseLayerPicker, scene3DOnly : endUserOptions.scene3DOnly, requestRenderMode : true }); - viewer.terrainProvider = new CesiumTerrainProvider({ - url : 'https://assets.agi.com/stk-terrain/v1/tilesets/world/tiles', - requestWaterMask : true, - requestVertexNormals : true - }); + if (hasBaseLayerPicker) { + var viewModel = viewer.baseLayerPicker.viewModel; + viewModel.selectedTerrain = viewModel.terrainProviderViewModels[1]; + } else { + viewer.terrainProvider = new CesiumTerrainProvider({ + url: 'https://assets.agi.com/stk-terrain/v1/tilesets/world/tiles', + requestWaterMask: true, + requestVertexNormals: true + }); + } } catch (exception) { loadingIndicator.style.display = 'none'; var message = formatError(exception);