DataSourceCollection

new Cesium.DataSourceCollection()

一个 DataSource 实例的集合。

Members

当数据源被添加到集合时触发的事件。 事件处理函数会收到被添加的数据源。
当数据源在集合中的位置发生变化时触发的事件。事件处理函数会收到被移动的数据源、 移动后的新索引,以及移动前的旧索引。
当数据源从集合中被移除时触发的事件。 事件处理函数会收到被移除的数据源。
获取此集合中的数据源数量。

Methods

向集合中添加数据源。
Name Type Description
dataSource DataSource | Promise.<DataSource> 要添加到集合中的数据源,或解析为数据源的 promise。 当传入 promise 时,在 promise 成功解析之前, 数据源不会被实际添加到集合中。
Returns:
在数据源被添加到集合后解析的 Promise。
检查集合是否包含给定的数据源。
Name Type Description
dataSource DataSource 要检查的数据源。
Returns:
如果集合包含该数据源则为 true,否则为 false。
销毁此集合中所有数据源持有的资源。显式销毁此 对象可以实现 WebGL 资源的确定性释放,而不是依赖垃圾 回收器。一旦此对象被销毁,就不应再使用它;调用除 isDestroyed 之外的任何函数都将导致 DeveloperError 异常。因此, 应像示例中那样将返回值(undefined)赋给该对象。
Throws:
Example:
dataSourceCollection = dataSourceCollection && dataSourceCollection.destroy();
See:
按索引从集合中获取数据源。
Name Type Description
index number 要检索的索引。
Returns:
指定索引处的数据源。
按名称从集合中获取数据源。
Name Type Description
name string 要检索的名称。
Returns:
所有匹配所提供名称的数据源列表。
确定给定数据源在集合中的索引。
Name Type Description
dataSource DataSource 要查找索引的数据源。
Returns:
数据源在集合中的索引;如果数据源不在集合中,则为 -1。
如果此对象已销毁则为 true,否则为 false。 此对象被销毁后不应再使用;调用除 isDestroyed 之外的任何函数都将导致 DeveloperError 异常。
Returns:
如果此对象已销毁则为 true,否则为 false。
See:
将数据源在集合中向下移动一个位置。
Name Type Description
dataSource DataSource 要移动的数据源。
Throws:
将数据源移到集合底部。
Name Type Description
dataSource DataSource 要移动的数据源。
Throws:
将数据源在集合中向上移动一个位置。
Name Type Description
dataSource DataSource 要移动的数据源。
Throws:
将数据源移到集合顶部。
Name Type Description
dataSource DataSource 要移动的数据源。
Throws:

remove(dataSource, destroy)boolean

如果集合中存在,则从集合中移除数据源。
Name Type Default Description
dataSource DataSource 要移除的数据源。
destroy boolean false optional 是否在移除数据源的同时销毁它。
Returns:
如果数据源原本在集合中且已被移除则为 true, 如果数据源不在集合中则为 false。
从集合中移除所有数据源。
Name Type Default Description
destroy boolean false optional 是否在移除数据源的同时销毁它们。
需要帮助?获取答案的最快方式是在 Cesium 论坛 上向社区和团队提问。.