From e6ca00d930ed124b61b46010ad7526e608bcdb00 Mon Sep 17 00:00:00 2001 From: Gabby Getz Date: Wed, 8 Feb 2023 16:03:05 -0500 Subject: [PATCH] Cleanup doc --- packages/engine/Source/Scene/Terrain.js | 36 +++++++++++++------------ 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/packages/engine/Source/Scene/Terrain.js b/packages/engine/Source/Scene/Terrain.js index 3dfdf84f7068..90fe4e2bd5ed 100644 --- a/packages/engine/Source/Scene/Terrain.js +++ b/packages/engine/Source/Scene/Terrain.js @@ -37,15 +37,16 @@ async function handlePromise(instance, promise) { * @example * // Create * const viewer = new Cesium.Viewer("cesiumContainer", { - * terrainProvider: new Cesium.Terrain(Cesium.CesiumTerrainProvider.fromUrl("https://myTestTerrain.com")); + * terrain: new Cesium.Terrain(Cesium.CesiumTerrainProvider.fromUrl("https://myTestTerrain.com")); * }); * * @example * // Handle loading events * const terrain = new Cesium.Terrain(Cesium.CesiumTerrainProvider.fromUrl("https://myTestTerrain.com")); * + * scene.setTerrain(terrain); + * * terrain.readyEvent.addEventListener(provider => { - * scene.terrainProvider = provider; * scene.globe.enableLighting = true; * * terrain.provider.errorEvent.addEventListener(error => { @@ -57,18 +58,18 @@ async function handlePromise(instance, promise) { * alert(`Encountered an error while creating terrain! ${error}`); * }); * - * @param {Promise} A promise which resolves to a terrain provider + * @param {Promise} terrainProviderPromise A promise which resolves to a terrain provider */ -function Terrain(providerPromise) { +function Terrain(terrainProviderPromise) { //>>includeStart('debug', pragmas.debug); - Check.typeOf.object("providerPromise", providerPromise); + Check.typeOf.object("terrainProviderPromise", terrainProviderPromise); //>>includeEnd('debug'); this._provider = undefined; this._errorEvent = new Event(); this._readyEvent = new Event(); - handlePromise(this, providerPromise); + handlePromise(this, terrainProviderPromise); } Object.defineProperties(Terrain.prototype, { @@ -77,7 +78,7 @@ Object.defineProperties(Terrain.prototype, { * to the event, you will be notified of the error and can potentially recover from it. Event listeners * are passed an instance of {@link TileProviderError}. * @memberof TerrainProvider.prototype - * @type {Event} + * @type {Event} * @readonly */ errorEvent: { @@ -90,7 +91,7 @@ Object.defineProperties(Terrain.prototype, { * Gets an event that is raised when the terrain provider has been successfully created. Event listeners * are passed the created instance of {@link TerrainProvider}. * @memberof TerrainProvider.prototype - * @type {Event} + * @type {Event} * @readonly */ readyEvent: { @@ -120,7 +121,7 @@ Object.defineProperties(Terrain.prototype, { * @param {Object} [options] Object with the following properties: * @param {Boolean} [options.requestVertexNormals=false] Flag that indicates if the client should request additional lighting information from the server if available. * @param {Boolean} [options.requestWaterMask=false] Flag that indicates if the client should request per tile water masks from the server if available. - * @returns {} A promise that resolves to the created CesiumTerrainProvider + * @returns {Terrain} An asynchronous helper object for a CesiumTerrainProvider * * @see Ion * @see createWorldTerrainAsync @@ -128,13 +129,13 @@ Object.defineProperties(Terrain.prototype, { * @example * // Create Cesium World Terrain with default settings * const viewer = new Cesium.Viewer("cesiumContainer", { - * terrainProvider: Cesium.Terrain.fromWorldTerrain() + * terrain: Cesium.Terrain.fromWorldTerrain() * }); * * @example * // Create Cesium World Terrain with water and normals. * const viewer1 = new Cesium.Viewer("cesiumContainer", { - * terrainProvider: Cesium.Terrain.fromWorldTerrain({ + * terrain: Cesium.Terrain.fromWorldTerrain({ * requestWaterMask: true, * requestVertexNormals: true * }); @@ -142,18 +143,19 @@ Object.defineProperties(Terrain.prototype, { * * @example * // Handle loading events - * const providerManager = Cesium.Terrain.fromWorldTerrain(); + * const terrain = Cesium.Terrain.fromWorldTerrain(); + * + * scene.setTerrain(terrain); * - * providerManager.readyEvent.addEventListener(provider => { - * viewer.terrainProvider = provider; - * viewer.scene.globe.enableLighting = true; + * terrain.readyEvent.addEventListener(provider => { + * scene.globe.enableLighting = true; * - * providerManager.provider.errorEvent.addEventListener(error => { + * terrain.provider.errorEvent.addEventListener(error => { * alert(`Encountered an error while loading terrain tiles! ${error}`); * }); * }); * - * providerManager.errorEvent.addEventListener(error => { + * terrain.errorEvent.addEventListener(error => { * alert(`Encountered an error while creating terrain! ${error}`); * }); */