Skip to main content

cesium 常用函数

对 Entity 的操作:添加、隐藏、修改、去除、居中显示

let entities = viewer.entities;
// 创建Entity 对象
let rainEntity = entities.add({
    id: 'rain',
    name: 'RainStation',
    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); //居中显示

去掉 entity 的双击事件

注册VIP

如果已经是VIP,请直接登陆 登陆

发表回复