new Cesium.EntityCollection(owner)

An observable collection of Entity instances where each entity has a unique id.
Name Type Description
owner DataSource | CompositeEntityCollection optional 创建此集的数据源(或复合实体集).

Members

获取当实体被添加或从收藏中移除时被发射的事件. 生成的事件为 EntityCollection.CollectionChangedEventCallback .

readonly id : string

获取此收藏的全球独有标识符 .
得到这个实体收藏的主人,ie。 创建该数据库的数据源或复合实体的收集.

show : boolean

获取此实体收藏是否应该 显示。 当真实时,每个实体仅在 它自己的表演财产也是真实的.

readonly values : Array.<Entity>

Gets the array of Entity instances in the collection. 此数组不应直接修改 .

Methods

add(entity)Entity

在收藏中添加一个实体 .
Name Type Description
entity Entity | Entity.ConstructorOptions 拟加实体.
Returns:
添加的实体.
Throws:

computeAvailability()TimeInterval

计算收藏中实体的最大可用性. 如果收集中包含无限可得数据和非无限数据的组合, 它只返回与非无限数据有关的间隔。 如果有的话 数据是无限的,将返回一个无限的间隔.
Returns:
收藏中实体的有无.

contains(entity)boolean

如果提供的实体在此收藏中, 则返回真实性, 否则是虚假的 .
Name Type Description
entity Entity The entity.
Returns:
如果所提供实体在此集合中,则不实.

getById(id)Entity|undefined

获取带有指定标识的实体.
Name Type Description
id string 取回实体的ID.
Returns:
如果收藏中id不存在,则提供id或未定义的实体.

getOrCreateEntity(id)Entity

获取指定的 id 或创建它的实体,如果不存在,则将其添加到收藏中.
Name Type Description
id string 要获取或创建的实体的 ID .
Returns:
新对象或已有对象.

remove(entity)boolean

从收藏中删除一个实体.
Name Type Description
entity Entity 要删除的实体.
Returns:
如果项被移除, 如果收藏中不存在, 则为真.

removeAll()

从收藏中删除所有实体.

removeById(id)boolean

从收藏中删除一个带有提供 ID 的实体.
Name Type Description
id string 要删除的实体的 ID .
Returns:
如果物品被移除, 如果收藏中不存在提供的身份标识, 则为假.

resumeEvents()

Resumes raising EntityCollection#collectionChanged events immediately 当某一项被添加或删除时。 活动暂停期间所作的任何修改 当调用此函数时, 将会作为单个事件触发. 此函数被计算为参考, 只要有, 可以安全地调用多次 are corresponding calls to EntityCollection#resumeEvents.
Throws:
  • DeveloperError : resumeEvents can not be called before suspendEvents.

suspendEvents()

Prevents EntityCollection#collectionChanged events from being raised until a corresponding call is made to EntityCollection#resumeEvents, at which 点将提出一个涵盖所有暂停操作的事件. 这样可以有效地添加和删除许多项目. 只要有, 此函数可以安全调用多次 are corresponding calls to EntityCollection#resumeEvents.

Type Definitions

Cesium.EntityCollection.CollectionChangedEventCallback(collection, added, removed, changed)

The signature of the event generated by EntityCollection#collectionChanged.
Name Type Description
collection EntityCollection 引发事件的收藏.
added Array.<Entity> The array of Entity instances that have been added to the collection.
removed Array.<Entity> The array of Entity instances that have been removed from the collection.
changed Array.<Entity> The array of Entity instances that have been modified.
Need help? The fastest way to get answers is from the community and team on the Cesium Forum.