DataSourceCollection

new Cesium.DataSourceCollection()

DataSource 实例的集合。

Members

将数据源添加到集合时引发的事件。 事件处理程序将传递已添加的数据源。
数据源在集合中的位置发生更改时引发的事件。 事件处理程序将数据源传递给 已移动,移动后的新索引,以及移动前的旧索引。
从集合中删除数据源时引发的事件。 事件处理程序将传递已删除的数据源。
获取此集合中的数据源数。

Methods

将数据源添加到集合中。
Name Type Description
dataSource DataSource | Promise.<DataSource> 数据源或对要添加到集合的数据源的承诺。 传递 Promise 时,实际上不会添加数据源 添加到集合中,直到 Promise 成功解析。
Returns:
在将数据源添加到集合后解析的 Promise。
检查集合是否包含给定数据源。
Name Type Description
dataSource DataSource 要检查的数据源。 如果集合包含数据源,则@returns {boolean} 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 if this object was destroyed; otherwise, 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 是否除了删除数据源之外还要销毁数据源。
Need help? The fastest way to get answers is from the community and team on the Cesium Forum.