CompositeDynamicObjectCollection

CompositeDynamicObjectCollection

new

Non-destructively composites multiple DynamicObjectCollection instances into a single collection. If a DynamicObject with the same ID exists in multiple collections, it is non-destructively merged into a single new object instance. If an object has the same property in multiple collections, the property of the DynamicObject in the last collection of the list it belongs to is used. CompositeDynamicObjectCollection can be used almost anywhere that a DynamicObjectCollection is used.

Parameters:
Name Type Argument Description
collections Array <optional>
The initial list of DynamicObjectCollection instances to merge.
Source:

Members

:Event

Gets the event that is fired when objects are added or removed from the collection. The generated event is a DynamicObjectCollection.collectionChangedEventCallback.

:String

Gets a globally unique identifier for this collection.

Methods

Adds a collection to the composite.

Parameters:
Name Type Argument Description
collection DynamicObjectCollection the collection to add.
index Number <optional>
the index to add the collection at. If omitted, the collection will added on top of all existing collections.
Throws:
  • DeveloperError : collection is required.
  • DeveloperError : index, if supplied, must be greater than or equal to zero and less than or equal to the number of collections.

Computes the maximum availability of the DynamicObjects 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.

Returns:
TimeInterval The availability of DynamicObjects in the collection.

Checks to see if the composite contains a given collection.

Parameters:
Name Type Description
collection DynamicObjectCollection the collection to check for.
Returns:
Boolean true if the composite contains the collection, false otherwise.

Gets an object with the specified id.

Parameters:
Name Type Description
id Object The id of the object to retrieve.
Throws:
DeveloperError : id is required.
Returns:
DynamicObject The object with the provided id or undefined if the id did not exist in the collection.

Gets a collection by index from the composite.

Parameters:
Name Type Description
index Number the index to retrieve.
Throws:
DeveloperError : index is required.

Gets the number of collections in this composite.

Gets the array of DynamicObject instances in the collection. The array should not be modified directly.

Returns:
Array the array of DynamicObject instances in the collection.

Determines the index of a given collection in the composite.

Parameters:
Name Type Description
collection DynamicObjectCollection The collection to find the index of.
Returns:
Number The index of the collection in the composite, or -1 if the collection does not exist in the composite.

Lowers a collection down one position in the composite.

Parameters:
Name Type Description
collection DynamicObjectCollection the collection to move.
Throws:
DeveloperError : collection is not in this composite.

Lowers a collection to the bottom of the composite.

Parameters:
Name Type Description
collection DynamicObjectCollection the collection to move.
Throws:
DeveloperError : collection is not in this composite.

Raises a collection up one position in the composite.

Parameters:
Name Type Description
collection DynamicObjectCollection the collection to move.
Throws:
DeveloperError : collection is not in this composite.

Raises a collection to the top of the composite.

Parameters:
Name Type Description
collection DynamicObjectCollection the collection to move.
Throws:
DeveloperError : collection is not in this composite.

Removes all collections from this composite.

Removes a collection from this composite, if present.

Parameters:
Name Type Description
collection DynamicObjectCollection The collection to remove.
Returns:
Boolean true if the collection was in the composite and was removed, false if the collection was not in the composite.

Resumes raising DynamicObjectCollection#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 DynamicObjectCollection#resumeEvents.

Throws:
DeveloperError : resumeEvents can not be called before suspendEvents.

Prevents DynamicObjectCollection#collectionChanged events from being raised until a corresponding call is made to DynamicObjectCollection#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 DynamicObjectCollection#resumeEvents.