new DataSourceCollection
A collection of DataSource instances.
Members
-
dataSourceAdded :Event
-
An event that is raised when a data source is added to the collection. Event handlers are passed the data source that was added.
-
dataSourceRemoved :Event
-
An event that is raised when a data source is removed from the collection. Event handlers are passed the data source that was removed.
-
length :Event
-
Gets the number of data sources in this collection.
Methods
-
add
-
Adds a data source to the collection.
Parameters:
Name Type Description dataSource
DataSource The data source to add. -
contains
-
Checks to see if the collection contains a given data source.
Parameters:
Name Type Description dataSource
DataSource The data source to check for. Returns:
Boolean true if the collection contains the data source, false otherwise. -
destroy
-
Destroys the WebGL resources held by all data sources in this collection. Explicitly destroying this object allows for deterministic release of WebGL resources, instead of relying on the garbage collector.
Once this object is destroyed, it should not be used; calling any function other thanisDestroyed
will result in a DeveloperError exception. Therefore, assign the return value (undefined
) to the object as done in the example.Throws:
DeveloperError : This object was destroyed, i.e., destroy() was called.Returns:
Example
dataSourceCollection = dataSourceCollection && dataSourceCollection.destroy();
-
get
-
Gets a data source by index from the collection.
Parameters:
Name Type Description index
Number the index to retrieve. Throws:
DeveloperError : This object was destroyed, i.e., destroy() was called. -
indexOf
-
Determines the index of a given data source in the collection.
Parameters:
Name Type Description dataSource
DataSource The data source to find the index of. Returns:
Number The index of the data source in the collection, or -1 if the data source does not exist in the collection. -
isDestroyed
-
Returns true if this object was destroyed; otherwise, false.
If this object was destroyed, it should not be used; calling any function other thanisDestroyed
will result in a DeveloperError exception.Returns:
Boolean true if this object was destroyed; otherwise, false. -
remove
-
Removes a data source from this collection, if present.
Parameters:
Name Type Argument Default Description dataSource
DataSource The data source to remove. destroy
Boolean <optional>
true whether to destroy the data sources in addition to removing them. Returns:
Boolean true if the data source was in the collection and was removed, false if the data source was not in the collection. -
removeAll
-
Removes all data sources from this collection.
Parameters:
Name Type Argument Default Description destroy
Boolean <optional>
true whether to destroy the data sources in addition to removing them.