修复修改点,点击编辑,其他点异常添加问题

tykong-cidian
dongjiajun 2024-07-11 09:52:30 +08:00
parent 504b9c9225
commit e0396fe0f2
2 changed files with 9 additions and 5 deletions

View File

@ -613,15 +613,16 @@ export default {
// //
this.updatePointVisible = true; this.updatePointVisible = true;
this.isClickEventOpen = false;// this.isClickEventOpen = false;//
cu.removePoint() // cu.removePoint()
// //
if (simpleData.length !== 0) { if (simpleData.length !== 0) {
for (let i in simpleData) { for (let i in simpleData) {
if( i == index ){ if( i == index ){
cu.addPoint(simpleData[index].lng, simpleData[index].lat, 10,true); 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);
// }
} }
} }
// //

View File

@ -162,17 +162,20 @@ class CesiumUtils {
this.viewer.imageryLayers.remove(this.privide); 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({ var pointEntity = this.viewer.entities.add({
id: pointId,
position: Cesium.Cartesian3.fromDegrees(pLon, pLat, pAlt), position: Cesium.Cartesian3.fromDegrees(pLon, pLat, pAlt),
point: { point: {
pixelSize: 10, pixelSize: 10,
color: isSelected ? Cesium.Color.RED : Cesium.Color.YELLOW, color: isSelected ? Cesium.Color.RED : Cesium.Color.YELLOW,
}, },
}); });
return pointEntity;
} }
//移除某个点
static removePoint() { static removePoint() {
this.viewer.entities.removeById("theNewPoint");
this.viewer.entities.removeAll(); this.viewer.entities.removeAll();
} }
//修改点的位置 //修改点的位置