Class: EntityCluster

EntityCluster

new EntityCluster()

Defines the clustering method for screen space objects (billboards, points, labels).

Name Type Default Description
options.enabled Boolean false optional

Is the cluster enabled.

options.pixelRange Number 80 optional

Expand the pixel range of the screen space bounding box.

options.minimumClusterSize Number 2 optional

The minimum number of screen space objects that can be clustered.

options.clusterBillboards Boolean true optional

Whether to cluster the billboards of entities.

options.clusterLabels Boolean true optional

Whether to cluster the labels of entities.

options.clusterPoints Boolean true optional

Whether to cluster the points of the entity.

Members

clusterBillboardsBoolean

Get or set whether to enable clustering billboard entities.

clusterEventEvent

Get the events that will be triggered when displaying a new cluster. The signature of the event listener is ElementCluster~newClustercallbacks.

clusterLabelsBoolean

Get or set whether to enable cluster label entities.

clusterPointsBoolean

Get or set whether to enable cluster point entities.

enabledBoolean

Get or set whether to enable clustering.

minimumClusterSizeNumber

Get or set the minimum number of screen space objects that can be aggregated.

pixelRangeNumber

Get or set the pixel range of the expanded screen space bounding box.

Methods

destroy(){undefined}

Destroy the WebGL resources held by the object. Destroying an object can release WebGL resources deterministically, rather than relying on a garbage collector to destroy the object.

Unlike other objects that use WebGL resources, this object can be reused. For example, removing from one set of data sources and adding to another set of data sources.

Returns:
Type Description
undefined

Type Definitions

newClusterCallback(clusteredEntities, cluster)

Event listener function, used for style clustering.

Name Type Description
clusteredEntities Array.<Entity>

The entity array included in the group.

cluster Object

An object that contains billboard, label, and point attributes. Its value is the same as the billboard, label, and point entity, but it must be the value of ConstantProperty.

Example
// The default cluster values.
dataSource.clustering.clusterEvent.addEventListener(function(entities, cluster) {
    cluster.label.show = true;
    cluster.label.text = entities.length.toLocaleString();
});