DataSourceCollection

new SuperMap3D.DataSourceCollection()

Data source instance collection class.

Members

readonlydataSourceAdded : Event

Event fired when a data source is added to the collection. The added data source is passed by the event handler.

readonlydataSourceRemoved : Event

Event fired when a data source is removed from the collection. Passed the removed data source by the event handler.

readonlylength : Number

Gets the number of data sources in the collection.

Methods

add(dataSource)Promise.<DataSource>

Add a data source to the collection.
Name Type Description
dataSource DataSource | Promise.<DataSource> The data source or the promise of the data source to be added. The data source is added to the collection after passing the promise resolution successfully.
Returns:
The data source is added to the collection of resolved promises.

contains(dataSource)Boolean

Check whether the specified data source is contained in the collection.
Name Type Description
dataSource DataSource Datasource to be checked.
Returns:
true Returns true if the set contains, otherwise returns false.

destroy()

Releases resources occupied by all data sources in the collection. Once the object resource is released, it cannot be used; calling any method will throwDeveloperErrorabnormal.
Throws:
Example:
dataSourceCollection = dataSourceCollection && dataSourceCollection.destroy();
See:

get(index)DataSource

Gets the data source of the specified index in the collection.
Name Type Description
index Number The specified index number.
Returns:
data source.

indexOf(dataSource)Number

Determines the index number of the specified data source within the collection.
Name Type Description
dataSource DataSource The data source to retrieve.
Returns:
The index number of the data source in the collection, if the collection does not contain the data source, return -1.

isDestroyed()Boolean

Returns true if the object is destroyed, false otherwise. Once the object resource is released, it cannot be used; calling any method will throwDeveloperErrorabnormal.
Returns:
See:

remove(dataSource, destroy)Boolean

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

removeAll(destroy)

Removes all data sources in the collection.
Name Type Default Description
destroy Boolean false optional Specifies whether to destroy the data source after removal.