DataSourceCollection

new Cesium.DataSourceCollection()

DataSource个实例的集合。

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:
一旦将数据源添加到集合中,就解析的承诺。

contains(dataSource)Boolean

检查集合是否包含给定的数据源。
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:
与所提供名称匹配的所有数据源的列表。

indexOf(dataSource)Number

确定集合中给定数据源的索引。
Name Type Description
dataSource DataSource 要查找其索引的数据源。
Returns:
集合中数据源的索引,如果集合中不存在该数据源,则为-1。

isDestroyed()Boolean

如果此对象已销毁,则返回true;否则返回false。 如果此对象已被销毁,则不应使用它;调用除 isDestroyed将导致DeveloperError异常。
Returns:
如果此对象被销毁,则为true;否则为false。
See:
将数据源在集合中下移一个位置。
Name Type Description
dataSource DataSource 要移动的数据源。
Throws:

lowerToBottom(dataSource)

将数据源降低到集合的底部。
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 是否除了删除数据源之外还要销毁这些数据源。