new EntityCollection(owner)
Entity object collection. Each entity in the set has a unique identifier, and the set can be monitored.
| Name | Type | Description |
|---|---|---|
owner |
DataSource | CompositeEntityCollection |
optional
Create a data source (or composite entity collection) for this collection. |
Members
-
readonly collectionChangedEvent
-
Gets the event triggered when adding or removing entities from the collection. The generated event is of type EntityCollection.collectionChangedEventCallback.
-
readonly idString
-
Get the globally unique identifier of this collection.
-
readonly ownerDataSource CompositeEntityCollection
-
Obtain the owner of this entity collection, that is, the data source or composite entity collection that created it.
-
showBoolean
-
Get whether this entity collection is displayed. If this property is true, the show property of the entity needs to be set to true in order to be displayed.
-
swipeEnabledBoolean
-
Get or set whether the roller shutter is turned on
- Default Value: false
swipeRegionBoundingRectangle
Get or set the rolling shutter area, valid when swineEEnabled is true
readonly valuesArray.<Entity>
Retrieve an array of entities from the collection. This array cannot be directly modified.
Methods
-
static collectionChangedEventCallback(collection, added, removed, changed)
-
The event signature generated by the collection change EntityCollection#collectionChanged.
Name Type Description collectionEntityCollection A collection of triggering events.
addedArray.<Entity> Entity instance array that has been added to the collection.
removedArray.<Entity> Entity instance array that has been removed from the collection.
changedArray.<Entity> Modified Entity instance array.
-
add(entity){Entity}
-
Add an entity object to the entity collection.
Name Type Description entityEntity The entity object to be added.
Throws:
-
An entity with this ID identifier already exists in the collection.
- Type
- DeveloperError
Returns:
Type Description Entity Add successfully returns true, otherwise returns false. -
-
computeAvailability(){TimeInterval}
-
Calculate the maximum availability of entity objects in the collection. If the collection contains a mixture of available and unavailable data, return the interval of unavailable data. If all data is available, return the interval of available data.
Returns:
Type Description TimeInterval The availability of entity objects in the collection. -
contains(entity){Boolean}
-
Determine whether the entity object already exists in the collection.
Name Type Description entityEntity The specified entity object.
Returns:
Type Description Boolean The entity object has returned true in the collection, and false if it does not exist. -
getById(id){Entity}
-
Retrieve the entity object with the specified ID.
Name Type Description idObject The entity ID to be retrieved.
Returns:
Type Description Entity Specify the entity object with the specified ID; If there is no entity with this ID in the collection, return undefined. -
getOrCreateEntity(id){Entity}
-
Retrieve an entity object with a specified ID or create an entity object. If the entity object does not exist in the collection, add it to the collection.
Name Type Description idObject The ID of the entity object to be retrieved or created.
Returns:
Type Description Entity Newly created or existing entity objects. -
remove(entity){Boolean}
-
Remove an entity object from the collection.
Name Type Description entityEntity The entity object to be removed.
Returns:
Type Description Boolean Remove successfully and return true; Return false to indicate that this entity does not exist in the collection, removal failed. -
removeAll()
-
Remove all entity objects from the collection.
-
removeById(id){Boolean}
-
Remove the entity object with the specified ID from the collection.
Name Type Description idObject The entity ID to be removed.
Returns:
Type Description Boolean Remove successfully and return true; If the entity with the specified ID does not exist in the collection, the removal fails and returns false. -
resumeEvents()
-
When adding or deleting an item, re-trigger the EntityCollection#collectionChanged event. When events are suspended, any modifications made will trigger this event as a single event. The event can be called multiple times as long as a request is made to call EntityCollection#resumeEvents.
Throws:
-
resumeEvents is triggered after the suspendEvents event.
- Type
- DeveloperError
-
-
suspendEvents()
-
Before calling EntityCollection#resumeEvents, prevent the EntityCollection#collectionChanged event from being triggered by triggering an event for all stopped operations, which can effectively add or remove many items. As long as a request is made to call EntityCollection#resumeEvents, the event can be called multiple times.