The type of Cesium collection (e.g., EntityCollection, PrimitiveCollection)
The type of items in the collection (e.g., Entity, Primitive)
Creates a new Collection instance.
Private
_eventEvent listeners
Private
_tagTag to items map for faster lookups
Private
_valuesCache for values array to improve performance
Protected
collectionThe underlying Cesium collection being wrapped.
Protected
tagDefault tag used when adding items without specifying a tag.
Static
Readonly
symbolSymbol used as a property key to store tags on collection items. Using a Symbol ensures no property naming conflicts with the item's own properties.
Gets the number of items in the collection.
The item count
Gets all item instances in the collection. This array should not be modified directly.
An array of all items in the collection
Private
_addPrivate
_emitPrivate
Emits an event to all registered listeners.
The event type
Optional
data: { items?: I[]; tag?: Tag }Additional event data
Private
_invalidatePrivate
Invalidates the values cache when collection changes.
Private
_removeMakes the collection directly iterable, allowing it to be used in for...of
loops
and with spread operators.
An iterator for the items in the collection
Adds multiple items with the same tag to the collection.
The array of added items
Registers an event listener for collection events.
The event type to listen for
The callback function
The collection instance for method chaining
Returns true if the provided item is in this collection, false otherwise.
The item instance to check for
True if the item is in the collection, false otherwise
Checks if the collection has any items with the specified tag.
The tag to check for
True if items with the tag exist, false otherwise
Filters items in the collection based on a predicate function. Optionally only filters items with a specific tag.
Array of items that pass the test
Returns the first element in the collection that satisfies the provided testing function. Optionally filters by tag before searching.
The first element that passes the test, or undefined if no elements pass
Hides all items with the specified tag. Only affects items that have a 'show' property.
The tag identifying which items to hide
The collection itself.
Creates a new array with the results of calling a provided function on every element in the collection. Optionally filters by tag before mapping.
A new array with each element being the result of the callback function
Removes an item from the collection.
The item to remove
True if the item was removed, false if it wasn't found
Removes all items with the specified tag from the collection.
The tag identifying which items to remove
True if the item was removed, false if it wasn't found
Removes all items with the array of tags from the collection.
The tags identifying which items to remove
True if the item was removed, false if it wasn't found
Removes all items from the collection.
Removes an event listener.
The event type
The callback function to remove
The collection instance for method chaining
Makes all items with the specified tag visible. Only affects items that have a 'show' property.
The tag identifying which items to show
The collection itself.
Toggles visibility of all items with the specified tag. Only affects items that have a 'show' property.
The tag identifying which items to toggle
The collection itself.
Abstract class that enhances Cesium collection objects with tagging functionality. This class provides a consistent API for working with different types of Cesium collections and allows grouping and manipulating collection items by custom tags.
Example