# EntityCluster

#### new Cesium.EntityCluster(options)
DataSources/EntityCluster.js 35

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:

- Cesium Sandcastle Clustering Demo

### Members

#### clusterBillboards : Boolean
DataSources/EntityCluster.js 573

Gets or sets whether clustering billboard entities is enabled.

#### clusterEvent : Event
DataSources/EntityCluster.js 563

Gets the event that will be raised when a new cluster will be displayed. The signature of the event listener is `EntityCluster.newClusterCallback`.

#### clusterLabels : Boolean
DataSources/EntityCluster.js 588

Gets or sets whether clustering labels entities is enabled.

#### clusterPoints : Boolean
DataSources/EntityCluster.js 602

Gets or sets whether clustering point entities is enabled.

#### enabled : Boolean
DataSources/EntityCluster.js 520

Gets or sets whether clustering is enabled.

#### minimumClusterSize : Number
DataSources/EntityCluster.js 548

Gets or sets the minimum number of screen space objects that can be clustered.

#### pixelRange : Number
DataSources/EntityCluster.js 534

Gets or sets the pixel range to extend the screen space bounding box.

#### show : Boolean
DataSources/EntityCluster.js 76

Determines if entities in this collection will be shown.

Default Value: `true`

### Methods

#### destroy()
DataSources/EntityCluster.js 929

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.

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)
DataSources/EntityCluster.js 974

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 | An object containing billboard, label, and point properties. The values are the same as billboard, label and point entities, but must be the values of the ConstantProperty.

##### Example:

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