All Downloads are FREE. Search and download functionalities are using the official Maven repository.

main.cesium.EntityCollection.kt Maven / Gradle / Ivy

There is a newer version: 1.90.0-10
Show newest version
// Automatically generated - do not modify!

package cesium

/**
 * An observable collection of [Entity] instances where each entity has a unique id.
 * @see Online Documentation
 */
@JsName("\$cesium__EntityCollection")
external class EntityCollection() {
    constructor(owner: DataSource)

    constructor(owner: CompositeEntityCollection)

    /**
     * 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.
     * This function can be safely called multiple times as long as there
     * are corresponding calls to [EntityCollection.resumeEvents].
     * @see Online Documentation
     */
    fun suspendEvents()

    /**
     * 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 is reference counted and can safely be called multiple times as long as there
     * are corresponding calls to [EntityCollection.resumeEvents].
     * @see Online Documentation
     */
    fun resumeEvents()

    /**
     * Gets the event that is fired when entities are added or removed from the collection.
     * The generated event is a [EntityCollection.collectionChangedEventCallback].
     * @see Online Documentation
     */
    val collectionChanged: Event

    /**
     * Gets a globally unique identifier for this collection.
     * @see Online Documentation
     */
    val id: String

    /**
     * Gets the array of Entity instances in the collection.
     * This array should not be modified directly.
     * @see Online Documentation
     */
    val values: Array

    /**
     * Gets whether or not this entity collection should be
     * displayed.  When true, each entity is only displayed if
     * its own show property is also true.
     * @see Online Documentation
     */
    var show: Boolean

    /**
     * Gets the owner of this entity collection, ie. the data source or composite entity collection which created it.
     * @see Online Documentation
     */
    val owner: dynamic

    /**
     * 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.
     * @return The availability of entities in the collection.
     * @see Online Documentation
     */
    fun computeAvailability(): TimeInterval

    /**
     * Add an entity to the collection.
     * @param [entity] The entity to be added.
     * @return The entity that was added.
     * @see Online Documentation
     */
    fun add(entity: Entity): Entity

    /**
     * Removes an entity from the collection.
     * @param [entity] The entity to be removed.
     * @return true if the item was removed, false if it did not exist in the collection.
     * @see Online Documentation
     */
    fun remove(entity: Entity): Boolean

    /**
     * Returns true if the provided entity is in this collection, false otherwise.
     * @param [entity] The entity.
     * @return true if the provided entity is in this collection, false otherwise.
     * @see Online Documentation
     */
    fun contains(entity: Entity): Boolean

    /**
     * Removes an entity with the provided id from the collection.
     * @param [id] The id of the entity to remove.
     * @return true if the item was removed, false if no item with the provided id existed in the collection.
     * @see Online Documentation
     */
    fun removeById(id: String): Boolean

    /**
     * Removes all Entities from the collection.
     * @see Online Documentation
     */
    fun removeAll()

    /**
     * Gets an entity with the specified id.
     * @param [id] The id of the entity to retrieve.
     * @return The entity with the provided id or undefined if the id did not exist in the collection.
     * @see Online Documentation
     */
    fun getById(id: String): Entity?

    /**
     * Gets an entity with the specified id or creates it and adds it to the collection if it does not exist.
     * @param [id] The id of the entity to retrieve or create.
     * @return The new or existing object.
     * @see Online Documentation
     */
    fun getOrCreateEntity(id: String): Entity

    companion object {
        /**
         * The signature of the event generated by [EntityCollection.collectionChanged].
         * @param [collection] The collection that triggered the event.
         * @param [added] The array of [Entity] instances that have been added to the collection.
         * @param [removed] The array of [Entity] instances that have been removed from the collection.
         * @param [changed] The array of [Entity] instances that have been modified.
         * @see Online Documentation
         */
        fun collectionChangedEventCallback(
            collection: EntityCollection,
            added: Array,
            removed: Array,
            changed: Array,
        )
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy