DataSourceCollection

new Cesium.DataSourceCollection()

The datasource instance collection class.

Members

readonlydataSourceAdded : Event

The event that is triggered when the datasource is added to the collection. The added datasource is passed by the event handler.

readonlydataSourceRemoved : Event

Event triggered when the datasource in the collection is removed. The removed datasource is passed by the event handler.

readonlylength : Number

Get the number of datasources in the collection.

Methods

add(dataSource)Promise.<DataSource>

Add a datasource to the collection.
Name Type Description
dataSource DataSource | Promise.<DataSource> The datasource to be added or the promise of the datasource. After the promise is successfully resolved, the datasource is added to the collection.
Returns:
The datasource is added to the resolved promise in the collection.

contains(dataSource)Boolean

Check whether the specified datasource is included in the collection.
Name Type Description
dataSource DataSource The datasource to be retrieved.
Returns:
If true is included in the set, return true, otherwise return false.

destroy()

Release the resources occupied by all datasources in the collection. Once the object resource is released, it cannot be used; calling any method will throw an DeveloperError exception.
Throws:
Example:
dataSourceCollection = dataSourceCollection && dataSourceCollection.destroy();
See:

get(index)DataSource

Get the datasource of the specified index in the collection.
Name Type Description
index Number The specified index number.
Returns:
datasource.

indexOf(dataSource)Number

Determine the index number of the specified datasource in the collection.
Name Type Description
dataSource DataSource The datasource to be retrieved.
Returns:
The index number of the datasource in the collection. If the collection does not contain the datasource, return -1.

isDestroyed()Boolean

It returns true if the object is destroyed, otherwise it returns false. Once the object resource is released, it cannot be used; calling any method will throw an DeveloperError exception.
Returns:
See:

remove(dataSource, destroy)Boolean

Remove a datasource from the collection.
Name Type Default Description
dataSource DataSource The datasource to be removed.
destroy Boolean false optional Specify whether to destroy the datasource after removal.
Returns:
After the datasource in the collection is removed, true is returned; if the datasource does not exist in the collection, the removal fails and false is returned.

removeAll(destroy)

Remove all datasources in the collection.
Name Type Default Description
destroy Boolean false optional Specify whether to destroy the datasource after removal.