new Cesium.DataSourceCollection()

A collection of DataSource instances.

Members

readonly dataSourceAdded : Event

当一个数据源被添加到收集中时,一个事件被提起. 事件处理器通过添加的数据源.

readonly dataSourceMoved : Event

当一个数据源改变收集中的位置时,一个事件会被提出. 事件处理器通过数据源 移动,移动后它的新指数,移动前它的旧指数.

readonly dataSourceRemoved : Event

数据源从收集中移除时提起的事件. 事件处理器通过被删除的数据源 .

readonly length : number

获取此收藏中的数据源数量.

Methods

add(dataSource)Promise.<DataSource>

将数据源添加到收藏中.
Name Type Description
dataSource DataSource | Promise.<DataSource> 数据源或对数据源的许诺可以添加到收集中. 在通过承诺时, 数据源将不会被实际添加 直到承诺成功实现为止.
Returns:
一旦数据源被添加到收藏中,则解决的 Promise .

contains(dataSource)boolean

检查收藏是否包含给定的数据源 .
Name Type Description
dataSource DataSource 要检查的数据源 .
Returns:
如果收集中包含数据源,则真实性为真.

destroy()

摧毁此收藏中所有数据来源所持有的资源。 明目张胆地摧毁它 对象允许确定释放 NT 0 资源,而不是依赖垃圾 collector. Once this object is destroyed, it should not be used; calling any function other than isDestroyed 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.
Example:
dataSourceCollection = dataSourceCollection && dataSourceCollection.destroy();
See:

get(index)DataSource

从收集中按索引获取数据源.
Name Type Description
index number 用于检索的索引.
Returns:
指定索引的数据源.

getByName(name)Array.<DataSource>

从收集中获取一个名称的数据源.
Name Type Description
name string 取来之名.
Returns:
匹配所提供名称的所有数据源列表 .

indexOf(dataSource)number

确定收集中特定数据源的索引.
Name Type Description
dataSource DataSource 查找索引的数据源 .
Returns:
收集中数据源的索引,如果在收集中不存在数据源,则使用 -1 .

isDestroyed()boolean

如果此对象被销毁, 返回真实; 否则, 错误 . If this object was destroyed, it should not be used; calling any function other than isDestroyed will result in a DeveloperError exception.
Returns:
如果此对象已被销毁, 则属真; 否则, 属假 .
See:

lower(dataSource)

将数据源降低到收集中的一个位置.
Name Type Description
dataSource DataSource 要移动的数据源 .
Throws:

lowerToBottom(dataSource)

将数据源降低到收藏的底部.
Name Type Description
dataSource DataSource 要移动的数据源 .
Throws:

raise(dataSource)

将数据源提升到收集中的一个位置.
Name Type Description
dataSource DataSource 要移动的数据源 .
Throws:

raiseToTop(dataSource)

将数据源提升到收藏的顶端.
Name Type Description
dataSource DataSource 要移动的数据源 .
Throws:

remove(dataSource, destroy)boolean

如果存在,则从此收藏中删除数据源.
Name Type Default Description
dataSource DataSource 要删除的数据源 .
destroy boolean false optional Whether to destroy the data source in addition to removing it.
Returns:
如果数据来源在收集中并被删除,则真实性为真, 如果数据源不在收集中,则不真实.

removeAll(destroy)

从此收藏中删除所有数据源.
Name Type Default Description
destroy boolean false optional
Need help? The fastest way to get answers is from the community and team on the Cesium Forum.