English中文

EntityCluster

new Cesium.EntityCluster(options)

定义屏幕空间对象(广告牌、点、标签)如何聚集。 Defines how screen space objects (billboards, points, labels) are clustered.
名称 Name 类型 Type 说明 Description
options object 可选 optional 具有以下属性的对象: An object with the following properties:
名称 Name 类型 Type 默认值 Default 说明 Description
enabled boolean false 可选 optional 是否启用集群。 Whether or not to enable clustering.
pixelRange number 80 可选 optional 扩展屏幕空间边界框的像素范围。 The pixel range to extend the screen space bounding box.
minimumClusterSize number 2 可选 optional 可聚类的屏幕空间对象的最小数量。 The minimum number of screen space objects that can be clustered.
clusterBillboards boolean true 可选 optional 是否对实体的广告牌进行聚类。 Whether or not to cluster the billboards of an entity.
clusterLabels boolean true 可选 optional 是否对实体的标签进行聚类。 Whether or not to cluster the labels of an entity.
clusterPoints boolean true 可选 optional 是否对实体的点进行聚类。 Whether or not to cluster the points of an entity.
show boolean true 可选 optional 确定是否显示集群中的实体。 Determines if the entities in the cluster will be shown.
演示: Demo:

成员 Members

获取或设置是否启用集群广告牌实体。 Gets or sets whether clustering billboard entities is enabled.
获取显示新集群时将引发的事件。事件监听器的签名是 Gets the event that will be raised when a new cluster will be displayed. The signature of the event listener is EntityCluster.newClusterCallback.
获取或设置是否启用聚类标签实体。 Gets or sets whether clustering labels entities is enabled.
获取或设置是否启用聚类点实体。 Gets or sets whether clustering point entities is enabled.
获取或设置是否启用集群。 Gets or sets whether clustering is enabled.
获取或设置可以聚集的屏幕空间对象的最小数量。 Gets or sets the minimum number of screen space objects that can be clustered.
获取或设置像素范围以扩展屏幕空间边界框。 Gets or sets the pixel range to extend the screen space bounding box.
确定是否显示此集合中的实体。 Determines if entities in this collection will be shown.
默认值: Default Value: true

方法 Methods

销毁该对象持有的 WebGL 资源。销毁对象可以确定性地释放 WebGL 资源,而不是依赖垃圾收集器来销毁该对象。 Destroys the WebGL resources held by this object. Destroying an object allows for deterministic release of WebGL resources, instead of relying on the garbage collector to destroy this object.

与使用 WebGL 资源的其他对象不同,该对象可以重复使用。例如,如果从数据源集合中删除数据源并将其添加到另一个数据源集合中。 Unlike other objects that use WebGL resources, this object can be reused. For example, if a data source is removed from a data source collection and added to another.

类型定义 Type Definitions

Cesium.EntityCluster.newClusterCallback(clusteredEntities, cluster)

用于设置集群样式的事件侦听器函数。 A event listener function used to style clusters.
名称 Name 类型 Type 说明 Description
clusteredEntities Array.<Entity> 集群中包含的实体数组。 An array of the entities contained in the cluster.
cluster object 包含代表该实体簇的 Billboard、Label 和 Point 原语的对象。 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.