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

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

// Automatically generated - do not modify!

@file:JsModule("cesium")

@file:Suppress(
    "NON_EXTERNAL_DECLARATION_IN_INAPPROPRIATE_FILE",
)

package cesium

/**
 * A widget for finding addresses and landmarks, and flying the camera to them.  Geocoding is
 * performed using [Cesium ion](https://cesium.com/cesium-ion/).
 * @see Online Documentation
 */
external class Geocoder(options: ConstructorOptions) {
    /**
     * @property [container] The DOM element that will contain the widget.
     * @property [scene] The Scene instance to use.
     * @property [geocoderServices] The geocoder services to be used
     * @property [autoComplete] True if the geocoder should query as the user types to autocomplete
     *   Default value - `true`
     * @property [flightDuration] The duration of the camera flight to an entered location, in seconds.
     *   Default value - `1.5`
     * @property [destinationFound] A callback function that is called after a successful geocode.  If not supplied, the default behavior is to fly the camera to the result destination.
     *   Default value - [GeocoderViewModel.flyToDestination]
     */
    interface ConstructorOptions {
        var container: org.w3c.dom.Element
        var scene: Scene
        var geocoderServices: Array?
        var autoComplete: Boolean?
        var flightDuration: Double?
        var destinationFound: DestinationFoundFunction?
    }

    /**
     * Gets the parent container.
     * @see Online Documentation
     */
    var container: org.w3c.dom.Element

    /**
     * Gets the parent container.
     * @see Online Documentation
     */
    var searchSuggestionsContainer: org.w3c.dom.Element

    /**
     * Gets the view model.
     * @see Online Documentation
     */
    var viewModel: GeocoderViewModel

    /**
     * @return true if the object has been destroyed, false otherwise.
     * @see Online Documentation
     */
    fun isDestroyed(): Boolean

    /**
     * Destroys the widget.  Should be called if permanently
     * removing the widget from layout.
     * @see Online Documentation
     */
    fun destroy()
}

/**
 * A function that handles the result of a successful geocode.
 * @param [viewModel] The view model.
 * @param [destination] The destination result of the geocode.
 * @see Online Documentation
 */
typealias DestinationFoundFunction = (viewModel: GeocoderViewModel, destination: dynamic) -> Unit

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy