Skip to content

KBE3D / KBCore / Cesium / EntityCollection

类: EntityCollection

An observable collection of Entity instances where each entity has a unique id.

参数

The data source (or composite entity collection) which created this collection.

属性

collectionChanged

readonly collectionChanged: Event<CollectionChangedEventCallback>

Gets the event that is fired when entities are added or removed from the collection. The generated event is a EntityCollection.CollectionChangedEventCallback.


id

readonly id: string

Gets a globally unique identifier for this collection.


values

readonly values: Entity[]

Gets the array of Entity instances in the collection. This array should not be modified directly.


show

show: boolean

Gets whether or not this entity collection should be displayed. When true, each entity is only displayed if its own show property is also true.


owner

readonly owner: DataSource | CompositeEntityCollection

Gets the owner of this entity collection, ie. the data source or composite entity collection which created it.

方法

suspendEvents()

suspendEvents(): void

Prevents EntityCollection#collectionChanged events from being raised until a corresponding call is made to EntityCollection#resumeEvents, at which point a single event will be raised that covers all suspended operations. This allows for many items to be added and removed efficiently. This function can be safely called multiple times as long as there are corresponding calls to EntityCollection#resumeEvents.

返回

void


resumeEvents()

resumeEvents(): void

Resumes raising EntityCollection#collectionChanged events immediately when an item is added or removed. Any modifications made while while events were suspended will be triggered as a single event when this function is called. This function is reference counted and can safely be called multiple times as long as there are corresponding calls to EntityCollection#resumeEvents.

返回

void


computeAvailability()

computeAvailability(): TimeInterval

Computes the maximum availability of the entities in the collection. If the collection contains a mix of infinitely available data and non-infinite data, it will return the interval pertaining to the non-infinite data only. If all data is infinite, an infinite interval will be returned.

返回

TimeInterval

The availability of entities in the collection.


add()

add(entity: Entity | ConstructorOptions): Entity

Add an entity to the collection.

参数

entity

The entity to be added.

Entity | ConstructorOptions

返回

Entity

The entity that was added.


remove()

remove(entity: Entity): boolean

Removes an entity from the collection.

参数

entity

Entity

The entity to be removed.

返回

boolean

true if the item was removed, false if it did not exist in the collection.


contains()

contains(entity: Entity): boolean

Returns true if the provided entity is in this collection, false otherwise.

参数

entity

Entity

The entity.

返回

boolean

true if the provided entity is in this collection, false otherwise.


removeById()

removeById(id: string): boolean

Removes an entity with the provided id from the collection.

参数

id

string

The id of the entity to remove.

返回

boolean

true if the item was removed, false if no item with the provided id existed in the collection.


removeAll()

removeAll(): void

Removes all Entities from the collection.

返回

void


getById()

getById(id: string): Entity | undefined

Gets an entity with the specified id.

参数

id

string

The id of the entity to retrieve.

返回

Entity | undefined

The entity with the provided id or undefined if the id did not exist in the collection.


getOrCreateEntity()

getOrCreateEntity(id: string): Entity

Gets an entity with the specified id or creates it and adds it to the collection if it does not exist.

参数

id

string

The id of the entity to retrieve or create.

返回

Entity

The new or existing object.

构造函数

构造函数

new EntityCollection(owner?: DataSource | CompositeEntityCollection): EntityCollection

参数

owner?

DataSource | CompositeEntityCollection

返回

EntityCollection

KBE3D @3.0.0 Copyright © 2024-present KBE3D