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(); } //修改点的位置