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

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

// Automatically generated - do not modify!

@file:JsModule("cesium")

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

package cesium

/**
 * A [DataSource] which processes both
 * [GeoJSON](http://www.geojson.org/) and [TopoJSON](https://github.com/mbostock/topojson) data.
 * [simplestyle-spec](https://github.com/mapbox/simplestyle-spec) properties will also be used if they
 * are present.
 * ```
 * const viewer = new Viewer('cesiumContainer');
 * viewer.dataSources.add(GeoJsonDataSource.load('../../SampleData/ne_10m_us_states.topojson', {
 *   stroke: Color.HOTPINK,
 *   fill: Color.PINK,
 *   strokeWidth: 3,
 *   markerSymbol: '?'
 * }));
 * ```
 * @see Online Documentation
 *
 * @constructor
 * @property [name] The name of this data source.  If undefined, a name will be taken from
 *   the name of the GeoJSON file.
 * @see Online Documentation
 */
external class GeoJsonDataSource(var name: String = definedExternally) {
    /**
     * This DataSource only defines static data, therefore this property is always undefined.
     * @see Online Documentation
     */
    var clock: DataSourceClock

    /**
     * Gets the collection of [Entity] instances.
     * @see Online Documentation
     */
    var entities: EntityCollection

    /**
     * Gets a value indicating if the data source is currently loading data.
     * @see Online Documentation
     */
    var isLoading: Boolean

    /**
     * Gets an event that will be raised when the underlying data changes.
     * @see Online Documentation
     */
    var changedEvent: Event

    /**
     * Gets an event that will be raised if an error is encountered during processing.
     * @see Online Documentation
     */
    var errorEvent: Event

    /**
     * Gets an event that will be raised when the data source either starts or stops loading.
     * @see Online Documentation
     */
    var loadingEvent: Event

    /**
     * Gets whether or not this data source should be displayed.
     * @see Online Documentation
     */
    var show: Boolean

    /**
     * Gets or sets the clustering options for this data source. This object can be shared between multiple data sources.
     * @see Online Documentation
     */
    var clustering: EntityCluster

    /**
     * Gets the credit that will be displayed for the data source
     * @see Online Documentation
     */
    var credit: Credit

    /**
     * Asynchronously loads the provided GeoJSON or TopoJSON data, replacing any existing data.
     * @param [data] A url, GeoJSON object, or TopoJSON object to be loaded.
     * @return a promise that will resolve when the GeoJSON is loaded.
     * @see Online Documentation
     */
    fun load(
        data: Resource,
        options: LoadOptions? = definedExternally,
    ): kotlin.js.Promise

    /**
     * @property [sourceUri] Overrides the url to use for resolving relative links.
     * @property [describe] A function which returns a Property object (or just a string),
     *   which converts the properties into an html description.
     *   Default value - [GeoJsonDataSource.defaultDescribeProperty]
     * @property [markerSize] The default size of the map pin created for each point, in pixels.
     *   Default value - [GeoJsonDataSource.markerSize]
     * @property [markerSymbol] The default symbol of the map pin created for each point.
     *   Default value - [GeoJsonDataSource.markerSymbol]
     * @property [markerColor] The default color of the map pin created for each point.
     *   Default value - [GeoJsonDataSource.markerColor]
     * @property [stroke] The default color of polylines and polygon outlines.
     *   Default value - [GeoJsonDataSource.stroke]
     * @property [strokeWidth] The default width of polylines and polygon outlines.
     *   Default value - [GeoJsonDataSource.strokeWidth]
     * @property [fill] The default color for polygon interiors.
     *   Default value - [GeoJsonDataSource.fill]
     * @property [clampToGround] true if we want the features clamped to the ground.
     *   Default value - [GeoJsonDataSource.clampToGround]
     * @property [credit] A credit for the data source, which is displayed on the canvas.
     */
    interface LoadOptions {
        var sourceUri: String?
        var describe: describe?
        var markerSize: Double?
        var markerSymbol: String?
        var markerColor: Color?
        var stroke: Color?
        var strokeWidth: Double?
        var fill: Color?
        var clampToGround: Boolean?
        var credit: Credit?
    }

    fun load(
        data: String,
        options: LoadOptions? = definedExternally,
    ): kotlin.js.Promise

    fun load(
        data: Any,
        options: LoadOptions? = definedExternally,
    ): kotlin.js.Promise

    /**
     * Updates the data source to the provided time.  This function is optional and
     * is not required to be implemented.  It is provided for data sources which
     * retrieve data based on the current animation time or scene state.
     * If implemented, update will be called by [DataSourceDisplay] once a frame.
     * @param [time] The simulation time.
     * @return True if this data source is ready to be displayed at the provided time, false otherwise.
     * @see Online Documentation
     */
    fun update(time: JulianDate): Boolean

    companion object {
        /**
         * Creates a Promise to a new instance loaded with the provided GeoJSON or TopoJSON data.
         * @param [data] A url, GeoJSON object, or TopoJSON object to be loaded.
         * @param [options] An object specifying configuration options
         * @return A promise that will resolve when the data is loaded.
         * @see Online Documentation
         */
        fun load(
            data: Resource,
            options: LoadOptions? = definedExternally,
        ): kotlin.js.Promise

        fun load(
            data: String,
            options: LoadOptions? = definedExternally,
        ): kotlin.js.Promise

        fun load(
            data: Any,
            options: LoadOptions? = definedExternally,
        ): kotlin.js.Promise

        /**
         * Gets or sets the default size of the map pin created for each point, in pixels.
         * @see Online Documentation
         */
        var markerSize: Double

        /**
         * Gets or sets the default symbol of the map pin created for each point.
         * This can be any valid [Maki](http://mapbox.com/maki/) identifier, any single character,
         * or blank if no symbol is to be used.
         * @see Online Documentation
         */
        var markerSymbol: String

        /**
         * Gets or sets the default color of the map pin created for each point.
         * @see Online Documentation
         */
        var markerColor: Color

        /**
         * Gets or sets the default color of polylines and polygon outlines.
         * @see Online Documentation
         */
        var stroke: Color

        /**
         * Gets or sets the default width of polylines and polygon outlines.
         * @see Online Documentation
         */
        var strokeWidth: Double

        /**
         * Gets or sets default color for polygon interiors.
         * @see Online Documentation
         */
        var fill: Color

        /**
         * Gets or sets default of whether to clamp to the ground.
         * @see Online Documentation
         */
        var clampToGround: Boolean

        /**
         * Gets an object that maps the name of a crs to a callback function which takes a GeoJSON coordinate
         * and transforms it into a WGS84 Earth-fixed Cartesian.  Older versions of GeoJSON which
         * supported the EPSG type can be added to this list as well, by specifying the complete EPSG name,
         * for example 'EPSG:4326'.
         * @see Online Documentation
         */
        var crsNames: Any

        /**
         * Gets an object that maps the href property of a crs link to a callback function
         * which takes the crs properties object and returns a Promise that resolves
         * to a function that takes a GeoJSON coordinate and transforms it into a WGS84 Earth-fixed Cartesian.
         * Items in this object take precedence over those defined in `crsLinkHrefs`, assuming
         * the link has a type specified.
         * @see Online Documentation
         */
        var crsLinkHrefs: Any

        /**
         * Gets an object that maps the type property of a crs link to a callback function
         * which takes the crs properties object and returns a Promise that resolves
         * to a function that takes a GeoJSON coordinate and transforms it into a WGS84 Earth-fixed Cartesian.
         * Items in `crsLinkHrefs` take precedence over this object.
         * @see Online Documentation
         */
        var crsLinkTypes: Any

        /**
         * Initialization options for the `load` method.
         * @property [sourceUri] Overrides the url to use for resolving relative links.
         * @property [markerSize] The default size of the map pin created for each point, in pixels.
         *   Default value - [GeoJsonDataSource.markerSize]
         * @property [markerSymbol] The default symbol of the map pin created for each point.
         *   Default value - [GeoJsonDataSource.markerSymbol]
         * @property [markerColor] The default color of the map pin created for each point.
         *   Default value - [GeoJsonDataSource.markerColor]
         * @property [stroke] The default color of polylines and polygon outlines.
         *   Default value - [GeoJsonDataSource.stroke]
         * @property [strokeWidth] The default width of polylines and polygon outlines.
         *   Default value - [GeoJsonDataSource.strokeWidth]
         * @property [fill] The default color for polygon interiors.
         *   Default value - [GeoJsonDataSource.fill]
         * @property [clampToGround] true if we want the geometry features (polygons or linestrings) clamped to the ground.
         *   Default value - [GeoJsonDataSource.clampToGround]
         * @property [credit] A credit for the data source, which is displayed on the canvas.
         * @see Online Documentation
         */
        interface LoadOptions {
            var sourceUri: String?
            var markerSize: Double?
            var markerSymbol: String?
            var markerColor: Color?
            var stroke: Color?
            var strokeWidth: Double?
            var fill: Color?
            var clampToGround: Boolean?
            var credit: Credit?
        }
    }
}

/**
 * This callback is displayed as part of the GeoJsonDataSource class.
 * @param [properties] The properties of the feature.
 * @param [nameProperty] The property key that Cesium estimates to have the name of the feature.
 * @see Online Documentation
 */
typealias describe = (properties: Any, nameProperty: String) -> Unit




© 2015 - 2024 Weber Informatics LLC | Privacy Policy