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

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

// Automatically generated - do not modify!

@file:JsModule("cesium")

@file:Suppress(
    "NON_EXTERNAL_DECLARATION_IN_INAPPROPRIATE_FILE",
)

package cesium

/**
 * Visualizes a collection of [DataSource] instances.
 * @see Online Documentation
 */
external class DataSourceDisplay(options: ConstructorOptions) {
    /**
     * @property [scene] The scene in which to display the data.
     * @property [dataSourceCollection] The data sources to display.
     * @property [visualizersCallback] A function which creates an array of visualizers used for visualization.
     *   If undefined, all standard visualizers are used.
     *   Default value - [DataSourceDisplay.defaultVisualizersCallback]
     */
    interface ConstructorOptions {
        var scene: Scene
        var dataSourceCollection: DataSourceCollection
        var visualizersCallback: VisualizersCallback?
    }

    /**
     * Gets the scene associated with this display.
     * @see Online Documentation
     */
    var scene: Scene

    /**
     * Gets the collection of data sources to display.
     * @see Online Documentation
     */
    var dataSources: DataSourceCollection

    /**
     * Gets the default data source instance which can be used to
     * manually create and visualize entities not tied to
     * a specific data source. This instance is always available
     * and does not appear in the list dataSources collection.
     * @see Online Documentation
     */
    var defaultDataSource: CustomDataSource

    /**
     * Gets a value indicating whether or not all entities in the data source are ready
     * @see Online Documentation
     */
    val ready: Boolean

    /**
     * Returns true if this object was destroyed; otherwise, false.
     *
     * If this object was destroyed, it should not be used; calling any function other than
     * `isDestroyed` will result in a [DeveloperError] exception.
     * @return True if this object was destroyed; otherwise, false.
     * @see Online Documentation
     */
    fun isDestroyed(): Boolean

    /**
     * Destroys the WebGL resources held by this object.  Destroying an object allows for deterministic
     * release of WebGL resources, instead of relying on the garbage collector to destroy this object.
     *
     * Once an object is destroyed, it should not be used; calling any function other than
     * `isDestroyed` will result in a [DeveloperError] exception.  Therefore,
     * assign the return value (`undefined`) to the object as done in the example.
     * ```
     * dataSourceDisplay = dataSourceDisplay.destroy();
     * ```
     * @see Online Documentation
     */
    fun destroy()

    /**
     * Updates the display to the provided time.
     * @param [time] The simulation time.
     * @return True if all data sources are ready to be displayed, false otherwise.
     * @see Online Documentation
     */
    fun update(time: JulianDate): Boolean

    companion object {
        /**
         * Gets or sets the default function which creates an array of visualizers used for visualization.
         * By default, this function uses all standard visualizers.
         * @see Online Documentation
         */
        fun defaultVisualizersCallback()
    }
}

/**
 * A function which creates an array of visualizers used for visualization.
 * ```
 * function createVisualizers(scene, dataSource) {
 *     return [new BillboardVisualizer(scene, dataSource.entities)];
 * }
 * ```
 * @param [scene] The scene to create visualizers for.
 * @param [dataSource] The data source to create visualizers for.
 * @see Online Documentation
 */
typealias VisualizersCallback = (scene: Scene, dataSource: DataSource) -> Array

inline fun DataSourceDisplay(
    block: DataSourceDisplay.ConstructorOptions.() -> Unit,
): DataSourceDisplay {
    val options: DataSourceDisplay.ConstructorOptions = js("({})")
    block(options)
    return DataSourceDisplay(options)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy