EntityCluster

new Cesium.EntityCluster(options)

定义屏幕空间对象(广告牌、点、标签)的聚合方式。
Name Type Description
options object optional 包含以下属性的对象:
Name Type Default Description
enabled boolean false optional 是否启用聚合。
pixelRange number 80 optional 扩展屏幕空间边界框的像素范围。
minimumClusterSize number 2 optional 可聚合的屏幕空间对象的最小数量。
clusterBillboards boolean true optional 是否聚合实体的广告牌。
clusterLabels boolean true optional 是否聚合实体的标签。
clusterPoints boolean true optional 是否聚合实体的点。
show boolean true optional 确定是否显示聚合中的实体。
Demo:

Members

获取或设置是否启用广告牌实体聚合。
获取当新聚合即将显示时将触发的事件。事件监听器的签名为 EntityCluster.newClusterCallback
获取或设置是否启用标签实体聚合。
获取或设置是否启用点实体聚合。
获取或设置是否启用聚合。
获取或设置可聚合的屏幕空间对象的最小数量。
获取或设置扩展屏幕空间边界框的像素范围。
获取或设置是否显示此集合中的实体。
Default Value: true

Methods

销毁此对象持有的 WebGL 资源。销毁对象可以确定性地 释放 WebGL 资源,而不是依赖垃圾回收器来销毁此对象。

与其他使用 WebGL 资源的对象不同,此对象可以重复使用。例如,如果数据源从 数据源集合中移除并添加到另一个集合中。

Type Definitions

Cesium.EntityCluster.newClusterCallback(clusteredEntities, cluster)

用于设置聚合样式的事件监听器函数。
Name Type Description
clusteredEntities Array.<Entity> 聚合中包含的实体数组。
cluster object 包含代表此实体聚合的 Billboard、Label 和 Point 基元的对象。
Name Type Description
billboard Billboard
label Label
point PointPrimitive
Example:
// 默认聚合值。
dataSource.clustering.clusterEvent.addEventListener(function(entities, cluster) {
    cluster.label.show = true;
    cluster.label.text = entities.length.toLocaleString();
});
Need help? The fastest way to get answers is from the community and team on the Cesium Forum.