cesium广告牌 怎么使用聚合
时间: 2023-12-20 14:05:17 浏览: 105
根据提供的引用内容,我们可以了解到在Cesium中使用聚合功能可以将标签、点和广告牌进行聚合。默认情况下,些元素都会被聚合。如果需要开启或关闭聚合功能,可以进行相应的设置。下面是使用Cesium进行广告牌聚合的示例代码:
```javascript
// 创建一个Cesium.Viewer对象
var viewer = new Cesium.Viewer('cesiumContainer');
// 创建一个广告牌实例
var billboards = viewer.scene.primitives.add(new Cesium.BillboardCollection());
// 添加一些广告牌
billboards.add({
position : Cesium.Cartesian3.fromDegrees(-75.59777, 40.03883),
image : 'image1.png'
});
billboards.add({
position : Cesium.Cartesian3.fromDegrees(-80.50, 35.14),
image : 'image2.png'
});
billboards.add({
position : Cesium.Cartesian3.fromDegrees(-80.12, 25.46),
image : 'image3.png'
});
// 开启广告牌聚合功能
viewer.scene.globe.enableLighting = true;
viewer.scene.globe.enableLightingShadow = true;
viewer.scene.globe.enableLightingPbr = true;
viewer.scene.globe.enableLightingPbrSpecular = true;
viewer.scene.globe.enableLightingPbrWithAmbientOcclusion = true;viewer.scene.globe.enableLightingPbrWithSpecular = true;
viewer.scene.globe.enableLightingPbrWithSpecularAntialiasing = true;
viewer.scene.globe.enableLightingPbrWithSpecularReflection = true;
viewer.scene.globe.enableLightingPbrWithSpecularReflectionMap = true;
viewer.scene.globe.enableLightingPbrWithSpecularReflectionMapAtlas = true;
viewer.scene.globe.enableLightingPbrWithSpecularReflectionMapAtlasShadow = true;
viewer.scene.globe.enableLightingPbrWithSpecularReflectionMapAtlasShadowSilhouette = true;
viewer.scene.globe.enableLightingPbrWithSpecularReflectionMapAtlasSilhouette = true;
viewer.scene.globe.enableLightingPbrWithSpecularReflectionMapShadow = true;
viewer.scene.globe.enableLightingPbrWithSpecularReflectionMapShadowSilhouette = true;
viewer.scene.globe.enableLightingPbrWithSpecularReflectionMapSilhouette = true;
viewer.scene.globe.enableLightingPbrWithSpecularReflectionSilhouette = true;
viewer.scene.globe.enableLightingPbrWithSpecularShadow = true;
viewer.scene.globe.enableLightingPbrWithSpecularShadowSilhouette = true;
viewer.scene.globe.enableLightingPbrWithSpecularSilhouette = true;
// 关闭广告牌聚合功能
viewer.scene.globe.enableLighting = false;
viewer.scene.globe.enableLightingShadow = false;
viewer.scene.globe.enableLightingPbr = false;
viewer.scene.globe.enableLightingPbrSpecular = false;
viewer.scene.globe.enableLightingPbrWithAmbientOcclusion = false;
viewer.scene.globe.enableLightingPbrWithSpecular = false;
viewer.scene.globe.enableLightingPbrWithSpecularAntialiasing = false;
viewer.scene.globe.enableLightingPbrWithSpecularReflection = false;
viewer.scene.globe.enableLightingPbrWithSpecularReflectionMap = false;
viewer.scene.globe.enableLightingPbrWithSpecularReflectionMapAtlas = false;
viewer.scene.globe.enableLightingPbrWithSpecularReflectionMapAtlasShadow = false;
viewer.scene.globe.enableLightingPbrWithSpecularReflectionMapAtlasShadowSilhouette = false;
viewer.scene.globe.enableLightingPbrWithSpecularReflectionMapAtlasSilhouette = false;
viewer.scene.globe.enableLightingPbrWithSpecularReflectionMapShadow = false;
viewer.scene.globe.enableLightingPbrWithSpecularReflectionMapShadowSilhouette = false;
viewer.scene.globe.enableLightingPbrWithSpecularReflectionMapSilhouette = false;
viewer.scene.globe.enableLightingPbrWithSpecularReflectionSilhouette = false;
viewer.scene.globe.enableLightingPbrWithSpecularShadow = false;
viewer.scene.globe.enableLightingPbrWithSpecularShadowSilhouette = false;
viewer.scene.globe.enableLightingPbrWithSpecularSilhouette = false;
```
阅读全文