From 2db5eafabf905f9e433e8788929e9e00d39fa269 Mon Sep 17 00:00:00 2001 From: zh <972939975@qq.com> Date: Mon, 14 Jul 2025 09:27:46 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=A8=E7=90=83=E7=AD=89=E9=AB=98=E7=BA=BF?= =?UTF-8?q?=E5=BF=BD=E7=95=A5=E5=B0=8F=E4=BA=8E0=E7=9A=84=E9=AB=98?= =?UTF-8?q?=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Global/Contour/index.js | 9 ++++++++- src/Tools/index.js | 4 ++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/Global/Contour/index.js b/src/Global/Contour/index.js index cbe7f65..b4608d1 100644 --- a/src/Global/Contour/index.js +++ b/src/Global/Contour/index.js @@ -111,7 +111,7 @@ async function dialog(sdk) { if (e.target.checked) { show = true let height = sdk.viewer.camera.positionCartographic.height - if(height>16360) { + if (height > 16360) { let cartographic = sdk.viewer.camera.positionCartographic let options = { position: { @@ -413,6 +413,9 @@ function showContour(sdk) { let gap = pos84.alt - mainContourHeight let gap2 = material.uniforms.spacing / (material.uniforms.secondaryLinesCount + 1) let activeHeight = Math.floor(gap / gap2) * gap2 + mainContourHeight + if (pos84.alt < 0) { + pos84.alt = 0 + } if ((pos84.alt - activeHeight) > gap2 / 2) { activeHeight = activeHeight + gap2 } @@ -581,6 +584,10 @@ czm_material czm_getMaterial(czm_materialInput materialInput) outColor = vec4(0.0); } + if(materialInput.height<0.0) { + outColor = vec4(0.0); + } + material.diffuse = outColor.rgb; material.alpha = outColor.a; return material; diff --git a/src/Tools/index.js b/src/Tools/index.js index a81f143..a06198c 100644 --- a/src/Tools/index.js +++ b/src/Tools/index.js @@ -123,8 +123,8 @@ class Tools { var cartographic = ellipsoid.cartesianToCartographic(cartesian3) var lat = Cesium.Math.toDegrees(cartographic.latitude) var lng = Cesium.Math.toDegrees(cartographic.longitude) - // var alt = cartographic.height < 0 ? 0 : cartographic.height - var alt = cartographic.height + var alt = cartographic.height < 0 ? 0 : cartographic.height + // var alt = cartographic.height return { lng: lng, lat: lat,