From 538d7313f98da3c304365f1c2b22c3e23d91db35 Mon Sep 17 00:00:00 2001 From: surprise <15810472099@163.com> Date: 星期一, 23 十月 2023 15:04:06 +0800 Subject: [PATCH] 版本更新,阴影分析,等高线添加 --- src/assets/js/Map/menuTool.js | 85 ++++++++++++++++++++++++++++++++---------- 1 files changed, 64 insertions(+), 21 deletions(-) diff --git a/src/assets/js/Map/menuTool.js b/src/assets/js/Map/menuTool.js index 65c3031..bfc8daf 100644 --- a/src/assets/js/Map/menuTool.js +++ b/src/assets/js/Map/menuTool.js @@ -19,6 +19,7 @@ polygon: SmartEarth.Cesium.Color.fromCssColorString("#ffff0050"), }, exportSquare: null, + imageryProvider: null, topTools(res) { this.toolFlag = res.id; switch (res.id) { @@ -103,6 +104,9 @@ Viewer.animation.container.style.visibility = "visible"; Viewer.timeline.container.style.visibility = "visible"; earthCtrl.shadows = true; + earthCtrl.terrainShadows = SmartEarth.Cesium.ShadowMode.ENABLED + + earthCtrl.shadowMap.size = 1024 }, setLocalPosition(res) { if (this.localPoint) { @@ -155,32 +159,67 @@ Viewer.scene.globe.material = window.material; }, + setImageLayerChange() { + if (this.imageryProvider) { + Viewer.imageryLayers.raiseToTop(this.imageryProvider); + } + }, //绛夐珮绾� setcontour() { - var globe = window.Viewer.scene.globe; - if (window.material) { - window.material = null; - globe.material = null; - store.state.slopeQueyFla = false - store.state.slopeQueyFlag = false; - store.state.showSlopeQuey = false; - return; + if (this.imageryProvider) { + Viewer.imageryLayers.remove(this.imageryProvider); + this.imageryProvider = null; + return + } + var that = this; + var imageryProvider = new Cesium.UrlTemplateImageryProvider({ + url: 'http://192.168.20.83:80/Moon/LFData/2d/tiles/contour_500/{mz}/{my}/{mx}.png', + tilingScheme: new Cesium.GeographicTilingScheme(), + customTags: { + mz: function (imageryProvider, x, y, level) { + return 'L' + that.zeroFill(level + 1, 2, 10); // 娉ㄦ剰瑙傛祴锛屽眰绾у姞1浜� + }, + mx: function (imageryProvider, x, y, level) { + return 'C' + that.zeroFill(x, 8, 16); + }, + my: function (imageryProvider, x, y, level) { + return 'R' + that.zeroFill(y, 8, 16); + } + } + }); + this.imageryProvider = Viewer.imageryLayers.addImageryProvider(imageryProvider); + // var globe = window.Viewer.scene.globe; + // if (window.material) { + // window.material = null; + // globe.material = null; + // store.state.slopeQueyFla = false + // store.state.slopeQueyFlag = false; + // store.state.showSlopeQuey = false; + // return; + // } + + // var contourColor = new SmartEarth.Cesium.Color( + // 117 / 255, + // 71 / 255, + // 18 / 255, + // 255 / 255 + // ); + // var contourUniforms = {}; + // window.material = Cesium.Material.fromType("ElevationContour"); + // contourUniforms = material.uniforms; + // contourUniforms.width = 1.0; + // contourUniforms.spacing = 100.0; + // contourUniforms.color = contourColor; + // globe.material = window.material; + }, + zeroFill(num, len, radix) { + var str = num.toString(radix || 10) + while (str.length < len) { + str = '0' + str } - var contourColor = new SmartEarth.Cesium.Color( - 117 / 255, - 71 / 255, - 18 / 255, - 255 / 255 - ); - var contourUniforms = {}; - window.material = Cesium.Material.fromType("ElevationContour"); - contourUniforms = material.uniforms; - contourUniforms.width = 1.0; - contourUniforms.spacing = 100.0; - contourUniforms.color = contourColor; - globe.material = window.material; + return str; }, //绾挎煡璇� spatialLineQuery() { @@ -634,6 +673,10 @@ store.state.slopeQueyFlag = false; store.state.showSlopeQuey = false; } + if (this.imageryProvider) { + Viewer.imageryLayers.remove(this.imageryProvider) + this.imageryProvider = null; + } if (window.DoubleScreen) { window.DoubleScreen && window.DoubleScreen.destroy(); window.DoubleScreen = null; -- Gitblit v1.9.3