标签:view class mat viewer span hal rem console alpha
本文示列 实体的添加、删除、获取
//创建viewer
var viewer = new Cesium.Viewer(‘cesiumContainer‘);
//添加实体
var redBox = viewer.entities.add({ id:‘Box‘, position : Cesium.Cartesian3.fromDegrees(108, 34,0), box : { dimensions : new Cesium.Cartesian3(4000, 3000, 5000), material : Cesium.Color.RED.withAlpha(0.5), outline : true, outlineColor : Cesium.Color.BLACK } })
//获取实体
var getByIdBox = viewer.entities.getById(‘Box‘); console.log(getByIdBox)
//删除实体
//方法一(针对性删除某一个) viewer.entities.remove(redBox); //方法二(通过id删除) viewer.entities.remove(getByIdBox);
//方法三(删除所有实体) viewer.entities.removeAll();
标签:view class mat viewer span hal rem console alpha
原文地址:https://www.cnblogs.com/MaShuai666/p/9949637.html