yzt
2023-05-08 24e1c6a1c3d5331b5a4f1111dcbae3ef148eda1a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import CesiumTerrainProvider from "./CesiumTerrainProvider.js";
import defaultValue from "./defaultValue.js";
import IonResource from "./IonResource.js";
 
/**
 * Creates a {@link CesiumTerrainProvider} instance for the {@link https://cesium.com/content/#cesium-world-terrain|Cesium World Terrain}.
 *
 * @function
 *
 * @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 {CesiumTerrainProvider}
 *
 * @see Ion
 *
 * @example
 * // Create Cesium World Terrain with default settings
 * var viewer = new Cesium.Viewer('cesiumContainer', {
 *     terrainProvider : Cesium.createWorldTerrain();
 * });
 *
 * @example
 * // Create Cesium World Terrain with water and normals.
 * var viewer = new Cesium.Viewer('cesiumContainer', {
 *     terrainProvider : Cesium.createWorldTerrain({
 *         requestWaterMask : true,
 *         requestVertexNormals : true
 *     });
 * });
 *
 */
function createWorldTerrain(options) {
  options = defaultValue(options, defaultValue.EMPTY_OBJECT);
 
  return new CesiumTerrainProvider({
    url: IonResource.fromAssetId(1),
    requestVertexNormals: defaultValue(options.requestVertexNormals, false),
    requestWaterMask: defaultValue(options.requestWaterMask, false),
  });
}
export default createWorldTerrain;