EntityCollection

new SuperMap3D.EntityCollection(owner)

A collection of entity objects, each entity in the collection has a unique identifier.
Name Type Description
owner DataSource | CompositeEntityCollection optional The data source (or composite entity collection) from which this collection was created.

Members

readonlycollectionChanged : Event

Gets the event fired when an entity is added or removed from the collection. The event generated is EntityCollection.collectionChangedEventCallback.

readonlyid : String

Gets the globally unique identifier for this collection.
Gets the owner of this entity collection, the data source or composite entity collection that created it.

show : Boolean

Gets whether this entity collection is displayed. If this property is true, you also need to set the show property of the entity to true before it can be displayed.

readonlyvalues : Array.<Entity>

Get an array of entities in the collection. This array cannot be modified directly.

Methods

staticSuperMap3D.EntityCollection.collectionChangedEventCallback(collection, added, removed, changed)

change by setEntityCollection#collectionChangedThe generated event signature.
Name Type Description
collection EntityCollection A collection of triggering events.
added Array.<Entity> Entities that have been added to the collectionEntityinstance array.
removed Array.<Entity> Entities that have been removed from the collectionEntityinstance array.
changed Array.<Entity> modified entityEntityinstance array.

add(entity)Entity

Adds an entity object to the entity collection.
Name Type Description
entity Entity The entity object to be added.
Returns:
Returns true if added successfully, otherwise returns false.
Throws:
  • DeveloperError : An entity with this id identifier already exists in the collection.

computeAvailability()TimeInterval

Computes the maximum availability of entity objects in the collection. If the collection contains a mixture of available and unavailable data, returns the range of unavailable data. If all data is available, returns the range of available data.
Returns:
The availability of entity objects in the collection.

contains(entity)Boolean

Determine whether the entity object already exists in the collection.
Name Type Description
entity Entity The specified entity object.
Returns:
Returns true if the entity object is present in the collection, false if not present.

getById(id)Entity

Get the entity object with the specified id.
Name Type Description
id Object The entity id to retrieve.
Returns:
The entity object with the specified id; if the entity with the id does not exist in the collection, undefined is returned.

getOrCreateEntity(id)Entity

Get the entity object with the 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
id Object The ID of the entity object to be retrieved or created.
Returns:
Newly created or existing entity objects.

remove(entity)Boolean

Removes an entity object from the collection.
Name Type Description
entity Entity Entity object to be removed.
Returns:
Return true if the removal is successful; return false to indicate that the entity does not exist in the collection, and the removal fails.

removeAll()

Removes all entity objects in the collection.

removeById(id)Boolean

Remove the entity object with the specified id from the collection.
Name Type Description
id Object The entity id to be removed.
Returns:
Returns true if the removal is successful; if the entity with the specified id does not exist in the collection, it returns false if the removal fails.

resumeEvents()

Retriggered when an item is added or removedEntityCollection#collectionChangedevent. Any modifications made while the event is being paused will trigger this event as an event. Just issue the callEntityCollection#resumeEventsrequest, the event can be called multiple times.
Throws:
  • DeveloperError : resumeEvents is triggered after event suspendEvents.

suspendEvents()

Prevent EntityCollection#collectionChanged event is fired, raising an event for all stopped operations, effectively adding or removing many items. Events can be invoked multiple times as long as a EntityCollection#resumeEvents request is issued.