码农札记

在cesium实体上面使用自定义属性

2024-08-16T09:42:59.000Z
10 views
1 min read
default
  • 在开发广告牌的时候,有时候需要再广告牌上面添加一下自定义属性,这个时候就可以使用properties

设置的时候

js
billboardCollection.entities.add({ position: Cesium.Cartesian3.fromDegrees(Lon, Lat), name: `label${index}`, billboard: { image: pinBuilder.fromText(index + '', newColor, 38).toDataURL(), pixelOffset: new Cesium.Cartesian2(0, -20) }, properties: { index: index, age: age } })

获取里面的数据

js
实体.properties?.getValue(new Cesium.JulianDate()) // {index:'xxx',age:'xxx'}

参考链接 https://cesium.com/learn/cesiumjs/ref-doc/PropertyBag.html?classFilter=PropertyBag https://cesium.com/learn/cesiumjs/ref-doc/JulianDate.html

© 2025 朝阳. 保留所有权利.

原始文章发表于 2024-08-16T09:42:59.000Z

发表留言

全部留言 (0)

暂无留言,成为第一个留言的人吧!