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

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

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

@file:JsModule("cesium")

@file:Suppress(
    "NON_EXTERNAL_DECLARATION_IN_INAPPROPRIATE_FILE",
)

package cesium

/**
 * A description of a wall, which is similar to a KML line string. A wall is defined by a series of points,
 * which extrude down to the ground. Optionally, they can extrude downwards to a specified height.
 * ```
 * // create a wall that spans from ground level to 10000 meters
 * const wall = new WallGeometry({
 *   positions : Cartesian3.fromDegreesArrayHeights([
 *     19.0, 47.0, 10000.0,
 *     19.0, 48.0, 10000.0,
 *     20.0, 48.0, 10000.0,
 *     20.0, 47.0, 10000.0,
 *     19.0, 47.0, 10000.0
 *   ])
 * });
 * const geometry = WallGeometry.createGeometry(wall);
 * ```
 * @see Online Documentation
 */
external class WallGeometry(options: ConstructorOptions) {
    /**
     * @property [positions] An array of Cartesian objects, which are the points of the wall.
     * @property [granularity] The distance, in radians, between each latitude and longitude. Determines the number of positions in the buffer.
     *   Default value - [Math.RADIANS_PER_DEGREE]
     * @property [maximumHeights] An array parallel to `positions` that give the maximum height of the
     *   wall at `positions`. If undefined, the height of each position in used.
     * @property [minimumHeights] An array parallel to `positions` that give the minimum height of the
     *   wall at `positions`. If undefined, the height at each position is 0.0.
     * @property [ellipsoid] The ellipsoid for coordinate manipulation
     *   Default value - [Ellipsoid.WGS84]
     * @property [vertexFormat] The vertex attributes to be computed.
     *   Default value - [VertexFormat.DEFAULT]
     */
    interface ConstructorOptions {
        var positions: Array
        var granularity: Double?
        var maximumHeights: Array?
        var minimumHeights: Array?
        var ellipsoid: Ellipsoid?
        var vertexFormat: VertexFormat?
    }

    /**
     * The number of elements used to pack the object into an array.
     * @see Online Documentation
     */
    val packedLength: Int

    companion object {
        /**
         * Stores the provided instance into the provided array.
         * @param [value] The value to pack.
         * @param [array] The array to pack into.
         * @param [startingIndex] The index into the array at which to start packing the elements.
         *   Default value - `0`
         * @return The array that was packed into
         * @see Online Documentation
         */
        fun pack(
            value: WallGeometry,
            array: Array,
            startingIndex: Int? = definedExternally,
        ): Array

        /**
         * Retrieves an instance from a packed array.
         * @param [array] The packed array.
         * @param [startingIndex] The starting index of the element to be unpacked.
         *   Default value - `0`
         * @param [result] The object into which to store the result.
         * @return The modified result parameter or a new WallGeometry instance if one was not provided.
         * @see Online Documentation
         */
        fun unpack(
            array: Array,
            startingIndex: Int? = definedExternally,
            result: WallGeometry? = definedExternally,
        ): WallGeometry

        /**
         * A description of a wall, which is similar to a KML line string. A wall is defined by a series of points,
         * which extrude down to the ground. Optionally, they can extrude downwards to a specified height.
         * ```
         * // create a wall that spans from 10000 meters to 20000 meters
         * const wall = WallGeometry.fromConstantHeights({
         *   positions : Cartesian3.fromDegreesArray([
         *     19.0, 47.0,
         *     19.0, 48.0,
         *     20.0, 48.0,
         *     20.0, 47.0,
         *     19.0, 47.0,
         *   ]),
         *   minimumHeight : 20000.0,
         *   maximumHeight : 10000.0
         * });
         * const geometry = WallGeometry.createGeometry(wall);
         * ```
         * @see Online Documentation
         */
        fun fromConstantHeights(options: FromConstantHeightsOptions): WallGeometry

        /**
         * @property [positions] An array of Cartesian objects, which are the points of the wall.
         * @property [maximumHeight] A constant that defines the maximum height of the
         *   wall at `positions`. If undefined, the height of each position in used.
         * @property [minimumHeight] A constant that defines the minimum height of the
         *   wall at `positions`. If undefined, the height at each position is 0.0.
         * @property [ellipsoid] The ellipsoid for coordinate manipulation
         *   Default value - [Ellipsoid.WGS84]
         * @property [vertexFormat] The vertex attributes to be computed.
         *   Default value - [VertexFormat.DEFAULT]
         */
        interface FromConstantHeightsOptions {
            var positions: Array
            var maximumHeight: Double?
            var minimumHeight: Double?
            var ellipsoid: Ellipsoid?
            var vertexFormat: VertexFormat?
        }

        /**
         * Computes the geometric representation of a wall, including its vertices, indices, and a bounding sphere.
         * @param [wallGeometry] A description of the wall.
         * @return The computed vertices and indices.
         * @see Online Documentation
         */
        fun createGeometry(wallGeometry: WallGeometry): Geometry?
    }
}

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy