Appearance
KBE3D / KBCore / Cesium / CompositeEntityCollection
类: CompositeEntityCollection
Non-destructively composites multiple EntityCollection instances into a single collection. If a Entity with the same ID exists in multiple collections, it is non-destructively merged into a single new entity instance. If an entity has the same property in multiple collections, the property of the Entity in the last collection of the list it belongs to is used. CompositeEntityCollection can be used almost anywhere that a EntityCollection is used.
参数
The initial list of EntityCollection instances to merge.
参数
The data source (or composite entity collection) which created this collection.
属性
collectionChanged
readonlycollectionChanged:Event
Gets the event that is fired when entities are added or removed from the collection. The generated event is a EntityCollection.collectionChangedEventCallback.
id
readonlyid:string
Gets a globally unique identifier for this collection.
values
readonlyvalues:Entity[]
Gets the array of Entity instances in the collection. This array should not be modified directly.
owner
readonlyowner:DataSource|CompositeEntityCollection
Gets the owner of this composite entity collection, ie. the data source or composite entity collection which created it.
方法
addCollection()
addCollection(
collection:EntityCollection,index?:number):void
Adds a collection to the composite.
参数
collection
the collection to add.
index?
number
the index to add the collection at. If omitted, the collection will added on top of all existing collections.
返回
void
removeCollection()
removeCollection(
collection:EntityCollection):boolean
Removes a collection from this composite, if present.
参数
collection
The collection to remove.
返回
boolean
true if the collection was in the composite and was removed, false if the collection was not in the composite.
removeAllCollections()
removeAllCollections():
void
Removes all collections from this composite.
返回
void
containsCollection()
containsCollection(
collection:EntityCollection):boolean
Checks to see if the composite contains a given collection.
参数
collection
the collection to check for.
返回
boolean
true if the composite contains the collection, false otherwise.
contains()
contains(
entity:Entity):boolean
Returns true if the provided entity is in this collection, false otherwise.
参数
entity
The entity.
返回
boolean
true if the provided entity is in this collection, false otherwise.
indexOfCollection()
indexOfCollection(
collection:EntityCollection):number
Determines the index of a given collection in the composite.
参数
collection
The collection to find the index of.
返回
number
The index of the collection in the composite, or -1 if the collection does not exist in the composite.
getCollection()
getCollection(
index:number):void
Gets a collection by index from the composite.
参数
index
number
the index to retrieve.
返回
void
getCollectionsLength()
getCollectionsLength():
void
Gets the number of collections in this composite.
返回
void
raiseCollection()
raiseCollection(
collection:EntityCollection):void
Raises a collection up one position in the composite.
参数
collection
the collection to move.
返回
void
lowerCollection()
lowerCollection(
collection:EntityCollection):void
Lowers a collection down one position in the composite.
参数
collection
the collection to move.
返回
void
raiseCollectionToTop()
raiseCollectionToTop(
collection:EntityCollection):void
Raises a collection to the top of the composite.
参数
collection
the collection to move.
返回
void
lowerCollectionToBottom()
lowerCollectionToBottom(
collection:EntityCollection):void
Lowers a collection to the bottom of the composite.
参数
collection
the collection to move.
返回
void
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. While events are suspended, recompositing of the collections will also be suspended, as this can be a costly operation. 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 also ensures the collection is recomposited if events are also resumed. 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.
返回
The availability of entities in the collection.
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.
构造函数
构造函数
new CompositeEntityCollection(
collections?:EntityCollection[],owner?:DataSource|CompositeEntityCollection):CompositeEntityCollection
参数
collections?
owner?
DataSource | CompositeEntityCollection
返回
CompositeEntityCollection
