Appearance
KBE3D / KBCore / Cesium / DataSourceCollection
类: DataSourceCollection
A collection of DataSource instances.
属性
length
readonlylength:number
Gets the number of data sources in this collection.
dataSourceAdded
readonlydataSourceAdded: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
readonlydataSourceRemoved: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.
dataSourceMoved
readonlydataSourceMoved:Event
An event that is raised when a data source changes position in the collection. Event handlers are passed the data source that was moved, its new index after the move, and its old index prior to the move.
方法
add()
add(
dataSource:DataSource|Promise<DataSource>):Promise<DataSource>
Adds a data source to the collection.
参数
dataSource
A data source or a promise to a data source to add to the collection. When passing a promise, the data source will not actually be added to the collection until the promise resolves successfully.
DataSource | Promise<DataSource>
返回
Promise<DataSource>
A Promise that resolves once the data source has been added to the collection.
remove()
remove(
dataSource:DataSource,destroy?:boolean):boolean
Removes a data source from this collection, if present.
参数
dataSource
The data source to remove.
destroy?
boolean
Whether to destroy the data source in addition to removing it.
返回
boolean
true if the data source was in the collection and was removed, false if the data source was not in the collection.
removeAll()
removeAll(
destroy?:boolean):void
Removes all data sources from this collection.
参数
destroy?
boolean
whether to destroy the data sources in addition to removing them.
返回
void
contains()
contains(
dataSource:DataSource):boolean
Checks to see if the collection contains a given data source.
参数
dataSource
The data source to check for.
返回
boolean
true if the collection contains the data source, false otherwise.
indexOf()
indexOf(
dataSource:DataSource):number
Determines the index of a given data source in the collection.
参数
dataSource
The data source to find the index of.
返回
number
The index of the data source in the collection, or -1 if the data source does not exist in the collection.
get()
get(
index:number):DataSource
Gets a data source by index from the collection.
参数
index
number
the index to retrieve.
返回
The data source at the specified index.
getByName()
getByName(
name:string):DataSource[]
Gets a data source by name from the collection.
参数
name
string
The name to retrieve.
返回
A list of all data sources matching the provided name.
raise()
raise(
dataSource:DataSource):void
Raises a data source up one position in the collection.
参数
dataSource
The data source to move.
返回
void
lower()
lower(
dataSource:DataSource):void
Lowers a data source down one position in the collection.
参数
dataSource
The data source to move.
返回
void
raiseToTop()
raiseToTop(
dataSource:DataSource):void
Raises a data source to the top of the collection.
参数
dataSource
The data source to move.
返回
void
lowerToBottom()
lowerToBottom(
dataSource:DataSource):void
Lowers a data source to the bottom of the collection.
参数
dataSource
The data source to move.
返回
void
isDestroyed()
isDestroyed():
boolean
Returns true if this object was destroyed; otherwise, false. If this object was destroyed, it should not be used; calling any function other than <code>isDestroyed</code> will result in a DeveloperError exception.
返回
boolean
true if this object was destroyed; otherwise, false.
destroy()
destroy():
void
Destroys the 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 than <code>isDestroyed</code> will result in a DeveloperError exception. Therefore, assign the return value (<code>undefined</code>) to the object as done in the example.
返回
void
示例
ts
dataSourceCollection = dataSourceCollection && dataSourceCollection.destroy();构造函数
构造函数
new DataSourceCollection():
DataSourceCollection
返回
DataSourceCollection
