From e0396fe0f28ec28bc27206bedfcf18d59686b0f9 Mon Sep 17 00:00:00 2001 From: dongjiajun <1756465965@qq.com> Date: Thu, 11 Jul 2024 09:52:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BF=AE=E6=94=B9=E7=82=B9?= =?UTF-8?q?=EF=BC=8C=E7=82=B9=E5=87=BB=E7=BC=96=E8=BE=91=EF=BC=8C=E5=85=B6?= =?UTF-8?q?=E4=BB=96=E7=82=B9=E5=BC=82=E5=B8=B8=E6=B7=BB=E5=8A=A0=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ration/soilMoisture/index.vue | 7 ++++--- src/lib/cesiumUtils.js | 7 +++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/components/ration/soilMoisture/index.vue b/src/components/ration/soilMoisture/index.vue index d460e50..b61b476 100644 --- a/src/components/ration/soilMoisture/index.vue +++ b/src/components/ration/soilMoisture/index.vue @@ -613,15 +613,16 @@ export default { //显示地图按钮 this.updatePointVisible = true; this.isClickEventOpen = false;//关闭弹窗事件 - cu.removePoint() + // cu.removePoint() //将当前选择要修改的点变为红色 if (simpleData.length !== 0) { for (let i in simpleData) { if( i == index ){ cu.addPoint(simpleData[index].lng, simpleData[index].lat, 10,true); - }else{ - cu.addPoint(simpleData[i].lng, simpleData[i].lat, 10); } + // else{ + // cu.addPoint(simpleData[i].lng, simpleData[i].lat, 10); + // } } } //保存当前修改的点信息 diff --git a/src/lib/cesiumUtils.js b/src/lib/cesiumUtils.js index fa2298d..7d2a947 100644 --- a/src/lib/cesiumUtils.js +++ b/src/lib/cesiumUtils.js @@ -162,17 +162,20 @@ class CesiumUtils { this.viewer.imageryLayers.remove(this.privide); } - static addPoint(pLon, pLat, pAlt, isSelected = false) { + static addPoint(pLon, pLat, pAlt, isSelected = false,pointId = null) { var pointEntity = this.viewer.entities.add({ + id: pointId, position: Cesium.Cartesian3.fromDegrees(pLon, pLat, pAlt), point: { pixelSize: 10, color: isSelected ? Cesium.Color.RED : Cesium.Color.YELLOW, }, }); + return pointEntity; } - + //移除某个点 static removePoint() { + this.viewer.entities.removeById("theNewPoint"); this.viewer.entities.removeAll(); } //修改点的位置