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

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

There is a newer version: 1.90.0-10
Show newest version
// Automatically generated - do not modify!

package cesium

/**
 * A feature of a [Cesium3DTileset].
 *
 * Provides access to a feature's properties stored in the tile's batch table, as well
 * as the ability to show/hide a feature and change its highlight color via
 * [Cesium3DTileFeature.show] and [Cesium3DTileFeature.color], respectively.
 *
 * Modifications to a `Cesium3DTileFeature` object have the lifetime of the tile's
 * content.  If the tile's content is unloaded, e.g., due to it going out of view and needing
 * to free space in the cache for visible tiles, listen to the [Cesium3DTileset.tileUnload] event to save any
 * modifications. Also listen to the [Cesium3DTileset.tileVisible] event to reapply any modifications.
 *
 * Do not construct this directly.  Access it through [Cesium3DTileContent.getFeature]
 * or picking using [Scene.pick].
 * ```
 * // On mouse over, display all the properties for a feature in the console log.
 * handler.setInputAction(function(movement) {
 *     var feature = scene.pick(movement.endPosition);
 *     if (feature instanceof Cesium3DTileFeature) {
 *         var propertyNames = feature.getPropertyNames();
 *         var length = propertyNames.length;
 *         for (var i = 0; i < length; ++i) {
 *             var propertyName = propertyNames[i];
 *             console.log(propertyName + ': ' + feature.getProperty(propertyName));
 *         }
 *     }
 * }, ScreenSpaceEventType.MOUSE_MOVE);
 * ```
 * @see Online Documentation
 */
@JsName("\$cesium__Cesium3DTileFeature")
external class Cesium3DTileFeature {
    /**
     * Gets or sets if the feature will be shown. This is set for all features
     * when a style's show is evaluated.
     * @see Online Documentation
     */
    var show: Boolean

    /**
     * Gets or sets the highlight color multiplied with the feature's color.  When
     * this is white, the feature's color is not changed. This is set for all features
     * when a style's color is evaluated.
     * @see Online Documentation
     */
    var color: Color

    /**
     * Gets a typed array containing the ECEF positions of the polyline.
     * Returns undefined if [Cesium3DTileset.vectorKeepDecodedPositions] is false
     * or the feature is not a polyline in a vector tile.
     * @see Online Documentation
     */
    var polylinePositions: org.khronos.webgl.Float64Array

    /**
     * Gets the tileset containing the feature.
     * @see Online Documentation
     */
    val tileset: Cesium3DTileset

    /**
     * All objects returned by [Scene.pick] have a `primitive` property. This returns
     * the tileset containing the feature.
     * @see Online Documentation
     */
    val primitive: Cesium3DTileset

    /**
     * Returns whether the feature contains this property. This includes properties from this feature's
     * class and inherited classes when using a batch table hierarchy.
     * @param [name] The case-sensitive name of the property.
     * @return Whether the feature contains this property.
     * @see Online Documentation
     */
    fun hasProperty(name: String): Boolean

    /**
     * Returns an array of property names for the feature. This includes properties from this feature's
     * class and inherited classes when using a batch table hierarchy.
     * @param [results] An array into which to store the results.
     * @return The names of the feature's properties.
     * @see Online Documentation
     */
    fun getPropertyNames(results: Array? = definedExternally): Array

    /**
     * Returns a copy of the value of the feature's property with the given name. This includes properties from this feature's
     * class and inherited classes when using a batch table hierarchy.
     * ```
     * // Display all the properties for a feature in the console log.
     * var propertyNames = feature.getPropertyNames();
     * var length = propertyNames.length;
     * for (var i = 0; i < length; ++i) {
     *     var propertyName = propertyNames[i];
     *     console.log(propertyName + ': ' + feature.getProperty(propertyName));
     * }
     * ```
     * @param [name] The case-sensitive name of the property.
     * @return The value of the property or `undefined` if the feature does not have this property.
     * @see Online Documentation
     */
    fun getProperty(name: String): Any

    /**
     * Sets the value of the feature's property with the given name.
     *
     * If a property with the given name doesn't exist, it is created.
     * ```
     * var height = feature.getProperty('Height'); // e.g., the height of a building
     * ```
     * ```
     * var name = 'clicked';
     * if (feature.getProperty(name)) {
     *     console.log('already clicked');
     * } else {
     *     feature.setProperty(name, true);
     *     console.log('first click');
     * }
     * ```
     * @param [name] The case-sensitive name of the property.
     * @param [value] The value of the property that will be copied.
     * @see Online Documentation
     */
    fun setProperty(
        name: String,
        value: Any,
    )

    companion object {
        /**
         * Returns a copy of the feature's property with the given name, examining all
         * the metadata from 3D Tiles 1.0 formats, the EXT_mesh_features and legacy
         * EXT_feature_metadata glTF extensions, and the 3DTILES_metadata 3D Tiles
         * extension. Metadata is checked against name from most specific to most
         * general and the first match is returned. Metadata is checked in this order:
         *
         * 
    *
  1. Batch table (feature metadata) property by semantic
  2. *
  3. Batch table (feature metadata) property by property ID
  4. *
  5. Tile metadata property by semantic
  6. *
  7. Tile metadata property by property ID
  8. *
  9. Group metadata property by semantic
  10. *
  11. Group metadata property by property ID
  12. *
  13. Tileset metadata property by semantic
  14. *
  15. Tileset metadata property by property ID
  16. *
  17. Otherwise, return undefined
  18. *
* * For 3D Tiles Next details, see the [3DTILES_metadata Extension](https://github.com/CesiumGS/3d-tiles/tree/3d-tiles-next/extensions/3DTILES_metadata) * for 3D Tiles, as well as the [EXT_mesh_features Extension](https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_mesh_features) * for glTF. For the legacy glTF extension, see [EXT_feature_metadata Extension](https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata) * @param [content] The content for accessing the metadata * @param [batchId] The batch ID (or feature ID) of the feature to get a property for * @param [name] The semantic or property ID of the feature. Semantics are checked before property IDs in each granularity of metadata. * @return The value of the property or `undefined` if the feature does not have this property. * @see Online Documentation */ fun getPropertyInherited( content: Cesium3DTileContent, batchId: Int, name: String, ): Any } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy