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

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

// Automatically generated - do not modify!

@file:JsModule("cesium")

@file:Suppress(
    "NON_EXTERNAL_DECLARATION_IN_INAPPROPRIATE_FILE",
)

package cesium

/**
 * The view model for the [Geocoder] widget.
 * @see Online Documentation
 */
external class GeocoderViewModel(options: ConstructorOptions) {
    /**
     * @property [scene] The Scene instance to use.
     * @property [geocoderServices] Geocoder services to use for geocoding queries.
     *   If more than one are supplied, suggestions will be gathered for the geocoders that support it,
     *   and if no suggestion is selected the result from the first geocoder service wil be used.
     * @property [flightDuration] The duration of the camera flight to an entered location, in seconds.
     * @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 scene: Scene
        var geocoderServices: Array?
        var flightDuration: Double?
        var destinationFound: DestinationFoundFunction?
    }

    /**
     * Gets or sets a value indicating if this instance should always show its text input field.
     * @see Online Documentation
     */
    var keepExpanded: Boolean

    /**
     * True if the geocoder should query as the user types to autocomplete
     * @see Online Documentation
     */
    var autoComplete: Boolean

    /**
     * Gets and sets the command called when a geocode destination is found
     * @see Online Documentation
     */
    var destinationFound: DestinationFoundFunction

    /**
     * Gets a value indicating whether a search is currently in progress.  This property is observable.
     * @see Online Documentation
     */
    var isSearchInProgress: Boolean

    /**
     * Gets or sets the text to search for.  The text can be an address, or longitude, latitude,
     * and optional height, where longitude and latitude are in degrees and height is in meters.
     * @see Online Documentation
     */
    var searchText: String

    /**
     * Gets or sets the the duration of the camera flight in seconds.
     * A value of zero causes the camera to instantly switch to the geocoding location.
     * The duration will be computed based on the distance when undefined.
     * @see Online Documentation
     */
    var flightDuration: Double?

    /**
     * Gets the event triggered on flight completion.
     * @see Online Documentation
     */
    var complete: Event

    /**
     * Gets the scene to control.
     * @see Online Documentation
     */
    var scene: Scene

    /**
     * Gets the Command that is executed when the button is clicked.
     * @see Online Documentation
     */
    var search: Command

    /**
     * Gets the currently selected geocoder search suggestion
     * @see Online Documentation
     */
    var selectedSuggestion: Any

    /**
     * Gets the list of geocoder search suggestions
     * @see Online Documentation
     */
    var suggestions: Array

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

    companion object {
        /**
         * A function to fly to the destination found by a successful geocode.
         * @see Online Documentation
         */
        var flyToDestination: DestinationFoundFunction
    }
}

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy