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

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

The newest version!
// Automatically generated - do not modify!

@file:JsModule("cesium")

@file:Suppress(
    "NON_EXTERNAL_DECLARATION_IN_INAPPROPRIATE_FILE",
    "EXTERNAL_CLASS_CONSTRUCTOR_PROPERTY_PARAMETER",
)

package cesium

/**
 * A [Property] whose value is lazily evaluated by a callback function.
 * @see Online Documentation
 *
 * @constructor
 * @param [callback] The function to be called when the property is evaluated.
 * @property [isConstant] `true` when the callback function returns the same value every time, `false` if the value will change.
 * @see Online Documentation
 */
external class CallbackProperty(
    callback: CallbackPropertyCallback,
    val isConstant: Boolean,
) {
    /**
     * Gets the event that is raised whenever the definition of this property changes.
     * The definition is changed whenever setCallback is called.
     * @see Online Documentation
     */
    val definitionChanged: Event

    /**
     * Gets the value of the property.
     * @param [time] The time for which to retrieve the value.  This parameter is unused since the value does not change with respect to time.
     * @param [result] The object to store the value into, if omitted, a new instance is created and returned.
     * @return The modified result parameter or a new instance if the result parameter was not supplied or is unsupported.
     * @see Online Documentation
     */
    fun getValue(
        time: JulianDate? = definedExternally,
        result: Any? = definedExternally,
    ): Any

    /**
     * Sets the callback to be used.
     * @param [callback] The function to be called when the property is evaluated.
     * @param [isConstant] `true` when the callback function returns the same value every time, `false` if the value will change.
     * @see Online Documentation
     */
    fun setCallback(
        callback: CallbackPropertyCallback,
        isConstant: Boolean,
    )
}

/**
 * A function that returns the value of the property.
 * @param [time] The time for which to retrieve the value.
 * @param [result] The object to store the value into, if omitted, a new instance is created and returned.
 * @see Online Documentation
 */
typealias CallbackPropertyCallback = (time: JulianDate?, result: Any?) -> Any




© 2015 - 2024 Weber Informatics LLC | Privacy Policy