10
2019
06

cesium 对entity的操作

viewer.entities.removeById(该实体ID)

隐藏实体: viewer.entities.getById("rain").show = false;

Var rainEntity=viewer.entities.add({
      id: "rain",
   name: 'RainStation',
   parent: rainLayer3D,               
   position: Cesium.Cartesian3.fromDegrees(lon, lat),
   billboard: {
       image: 'images/pointIcons/rain1.png',
       scale:0.7,
       verticalOrigin: Cesium.VerticalOrigin.BOTTOM
   },
   label: {
            text: rainfall,
            font: '12px SimHei ',
            Width: 3,
        style: Cesium.LabelStyle.FILL,
            fillColor: Cesium.Color.AQUA,
            horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
            verticalOrigin: Cesium.VerticalOrigin.TOP
   }
 }); //添加viewer.entities.getById("rain").show = false;   //隐藏
viewer.entities.getById("rain").label.text= "drp";   //修改属性
viewer.entities.removeAll();  //移除所有
viewer.zoomTo(rainEntity);   //居中显示


« 上一篇下一篇 »

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。