Class: PrimitiveCluster

PrimitiveCluster(optionsopt)

new PrimitiveCluster(optionsopt)

Defines how screen space objects (billboards, points, labels) are clustered.
Parameters:
Name Type Attributes Description
options Object <optional>
An object with the following properties:
Properties
Name Type Attributes Default Description
enabled Boolean <optional>
false Whether or not to enable clustering.
pixelRange Number <optional>
80 The pixel range to extend the screen space bounding box.
minimumClusterSize Number <optional>
2 The minimum number of screen space objects that can be clustered.
clusterBillboards Boolean <optional>
true Whether or not to cluster the billboards of an entity.
clusterLabels Boolean <optional>
true Whether or not to cluster the labels of an entity.
clusterPoints Boolean <optional>
true Whether or not to cluster the points of an entity.
show Boolean <optional>
true Determines if the entities in the cluster will be shown.
Source:

Members

clusterBillboards :Boolean

Gets or sets whether clustering billboard entities is enabled.
Type:
  • Boolean
Source:

clusterEvent :Event.<PrimitiveCluster.newClusterCallback>

Gets the event that will be raised when a new cluster will be displayed. The signature of the event listener is PrimitiveCluster.newClusterCallback.
Type:
Source:

clusterLabels :Boolean

Gets or sets whether clustering labels entities is enabled.
Type:
  • Boolean
Source:

clusterPoints :Boolean

Gets or sets whether clustering point entities is enabled.
Type:
  • Boolean
Source:

delay :Number

设置防抖间隔降低处理频率
Type:
  • Number
Source:

enabled :Boolean

Gets or sets whether clustering is enabled.
Type:
  • Boolean
Source:

minimumClusterSize :Number

Gets or sets the minimum number of screen space objects that can be clustered.
Type:
  • Number
Source:

pixelRange :Number

Gets or sets the pixel range to extend the screen space bounding box.
Type:
  • Number
Source:

show :Boolean

Determines if entities in this collection will be shown.
Type:
  • Boolean
Default Value:
  • true
Source:

Methods

destroy()

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.

Source:

Type Definitions

newClusterCallback(clusteredEntities, cluster)

A event listener function used to style clusters.
Parameters:
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.
Properties
Name Type Description
billboard Billboard
label Label
point PointPrimitive
Source:
Example
// The default cluster values.
dataSource.clustering.clusterEvent.addEventListener(function(entities, cluster) {
    cluster.label.show = true;
    cluster.label.text = entities.length.toLocaleString();
});