const onlineterrains = function onlineterrainterrain() { viewer.terrainProvider = Cesium.createWorldTerrain({ requestWaterMask: true, // required for water effects requestVertexNormals: true // required for terrain lighting }); }; const outlineterrainterrains = function outlineterrainterrain() { // 本地地形 var terrainLayer = new Cesium.CesiumTerrainProvider({ url: "http://data.mars3d.cn/terrain" }); viewer.terrainProvider = terrainLayer; }; const ArcGlsterrainterrains = function ArcGlsterrainterrain() { // 本地地形 var terrainLayer = new Cesium.ArcGISTiledElevationTerrainProvider({ url: "https://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer" }); viewer.terrainProvider = terrainLayer; }; const contourLines = function contourLine() { viewer.terrainProvider = Cesium.createWorldTerrain({ requestWaterMask: true, // required for water effects requestVertexNormals: true // required for terrain lighting }); let globe = viewer.scene.globe; let contourUniforms = {}; // 使用等高线材质 let material = Cesium.Material.fromType("ElevationContour"); contourUniforms = material.uniforms; // 线宽2.0px contourUniforms.width = 2.0; // 高度间隔为150米 contourUniforms.spacing = 150; contourUniforms.color = Cesium.Color.RED; // 设置材质 globe.material = material; }; const terrainExaggerations = function terrainExaggeration() { viewer.terrainProvider = Cesium.createWorldTerrain({ requestWaterMask: true, // required for water effects requestVertexNormals: true // required for terrain lighting }); // 地形夸张 viewer.scene.globe.terrainExaggeration = 50.0; }; const getclippens = function getclippen() { //左键绘制,右键结束 drawClippings = new ClippingPlanes({ viewer: viewer, color: "#fff" }); drawClippings.StartClippingPlanes(); }; const unclippens = function unclippen() { drawClippings.unterrionclippingPlanes(); }; const terrainList = data => { let Vuemouunted = null; let bodydiv = null; let Vuedata = null; let Vuemethod = null; let importData = null; let refdata = null; switch (data.name) { case "在线地形": Vuemouunted = "\n" + data.interiormethod + "\n" + onlineterrains.toString(); break; case "离线地形": Vuemouunted = "\n" + data.interiormethod + "\n" + outlineterrainterrains.toString(); break; case "ArcGis地形": Vuemouunted = "\n" + data.interiormethod + "\n" + ArcGlsterrainterrains.toString(); break; case "等高线": Vuemouunted = "\n" + data.interiormethod + "\n" + contourLines.toString(); break; case "地形夸张": Vuemouunted = "\n" + data.interiormethod + "\n" + terrainExaggerations.toString(); break; case "地形开挖": bodydiv = data.bodydiv; importData = data.importData; let methods = getclippens.toString() + "," + unclippens.toString(); Vuemethod = methods.replace(/function/g, "\n"); break; } return { bodydiv, Vuedata, importData, Vuemethod, Vuemouunted, refdata }; }; export { terrainList };