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
获取或设置是否启用聚类分析标签实体。
获取或设置是否启用聚类分析点实体。
获取或设置是否启用群集。
获取或设置可以群集的屏幕空间对象的最小数量。
获取或设置pixel range 来扩展屏幕空间边界框。
确定是否显示此集合中的实体。
Default Value: true

Methods

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

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

Type Definitions

Cesium.EntityCluster.newClusterCallback(clusteredEntities, cluster)

用于设置集群样式的事件侦听器函数。
Name Type Description
clusteredEntities Array.<Entity> An array of the entities contained in the cluster.
cluster object An object containing the Billboard, Label, and Point primitives that represent this cluster of entities.
Name Type Description
billboard Billboard
label Label
point PointPrimitive
Example:
// The default cluster values.
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.