diff --git a/cesium-kotlin/src/jsMain/kotlin/cesium/Cesium3DTileset.kt b/cesium-kotlin/src/jsMain/kotlin/cesium/Cesium3DTileset.kt index 61d51c388..1e31905cb 100644 --- a/cesium-kotlin/src/jsMain/kotlin/cesium/Cesium3DTileset.kt +++ b/cesium-kotlin/src/jsMain/kotlin/cesium/Cesium3DTileset.kt @@ -625,25 +625,6 @@ external class Cesium3DTileset(options: ConstructorOptions) { */ var maximumScreenSpaceError: Int - /** - * The maximum amount of GPU memory (in MB) that may be used to cache tiles. This value is estimated from - * geometry, textures, and batch table textures of loaded tiles. For point clouds, this value also - * includes per-point metadata. - * - * Tiles not in view are unloaded to enforce this. - * - * If decreasing this value results in unloading tiles, the tiles are unloaded the next frame. - * - * If tiles sized more than `maximumMemoryUsage` are needed - * to meet the desired screen space error, determined by [Cesium3DTileset.maximumScreenSpaceError], - * for the current view, then the memory usage of the tiles loaded will exceed - * `maximumMemoryUsage`. For example, if the maximum is 256 MB, but - * 300 MB of tiles are needed to meet the screen space error, then 300 MB of tiles may be loaded. When - * these tiles go out of view, they will be unloaded. - * @see Online Documentation - */ - var maximumMemoryUsage: Int - /** * The amount of GPU memory (in bytes) used to cache tiles. This memory usage is estimated from * geometry, textures, and batch table textures of loaded tiles. For point clouds, this value also @@ -902,8 +883,6 @@ external class Cesium3DTileset(options: ConstructorOptions) { * Default value - [ShadowMode.ENABLED] * @property [maximumScreenSpaceError] The maximum screen space error used to drive level of detail refinement. * Default value - `16` - * @property [maximumMemoryUsage] The maximum amount of memory in MB that can be used by the tileset. Deprecated. - * Default value - `512` * @property [cacheBytes] The size (in bytes) to which the tile cache will be trimmed, if the cache contains tiles not needed for the current view. * Default value - `536870912` * @property [maximumCacheOverflowBytes] The maximum additional memory (in bytes) to allow for cache headroom, if more than [Cesium3DTileset.cacheBytes] are needed for the current view. @@ -1012,7 +991,6 @@ external class Cesium3DTileset(options: ConstructorOptions) { var modelForwardAxis: Axis? var shadows: ShadowMode? var maximumScreenSpaceError: Int? - var maximumMemoryUsage: Int? var cacheBytes: Int? var maximumCacheOverflowBytes: Int? var cullWithChildrenBounds: Boolean? diff --git a/cesium-kotlin/src/jsMain/kotlin/cesium/CesiumWidget.kt b/cesium-kotlin/src/jsMain/kotlin/cesium/CesiumWidget.kt index 0ccf2620a..a56acdce8 100644 --- a/cesium-kotlin/src/jsMain/kotlin/cesium/CesiumWidget.kt +++ b/cesium-kotlin/src/jsMain/kotlin/cesium/CesiumWidget.kt @@ -69,7 +69,7 @@ external class CesiumWidget( * Default value - `true` * @property [mapProjection] The map projection to use in 2D and Columbus View modes. * Default value - [GeographicProjection()][GeographicProjection] - * @property [globe] The globe to use in the scene. If set to `false`, no globe will be added. + * @property [globe] The globe to use in the scene. If set to `false`, no globe will be added and the sky atmosphere will be hidden by default. * Default value - [Globe(mapProjection.ellipsoid)][Globe] * @property [useDefaultRenderLoop] True if this widget should control the render loop, false otherwise. * Default value - `true` diff --git a/cesium-kotlin/src/jsMain/kotlin/cesium/PolygonGeometry.kt b/cesium-kotlin/src/jsMain/kotlin/cesium/PolygonGeometry.kt index 06408e1bc..694b0d3c9 100644 --- a/cesium-kotlin/src/jsMain/kotlin/cesium/PolygonGeometry.kt +++ b/cesium-kotlin/src/jsMain/kotlin/cesium/PolygonGeometry.kt @@ -214,6 +214,24 @@ external class PolygonGeometry(options: ConstructorOptions) { result: PolygonGeometry? = definedExternally, ) + /** + * Computes a rectangle which encloses the polygon defined by the list of positions, including cases over the international date line and the poles. + * @param [positions] A linear ring defining the outer boundary of the polygon. + * @param [ellipsoid] The ellipsoid to be used as a reference. + * Default value - [Ellipsoid.WGS84] + * @param [arcType] The type of line the polygon edges must follow. Valid options are [ArcType.GEODESIC] and [ArcType.RHUMB]. + * Default value - [ArcType.GEODESIC] + * @param [result] An object in which to store the result. + * @return The result rectangle + * @see Online Documentation + */ + fun computeRectangleFromPositions( + positions: ReadonlyArray, + ellipsoid: Ellipsoid? = definedExternally, + arcType: ArcType? = definedExternally, + result: Rectangle? = definedExternally, + ): Rectangle + /** * Returns the bounding rectangle given the provided options * @param [result] An object in which to store the result. diff --git a/cesium-kotlin/src/jsMain/kotlin/cesium/PostProcessStageLibrary.kt b/cesium-kotlin/src/jsMain/kotlin/cesium/PostProcessStageLibrary.kt index 2292ef1fb..795aaa67f 100644 --- a/cesium-kotlin/src/jsMain/kotlin/cesium/PostProcessStageLibrary.kt +++ b/cesium-kotlin/src/jsMain/kotlin/cesium/PostProcessStageLibrary.kt @@ -64,16 +64,16 @@ external object PostProcessStageLibrary { * This stage is not supported in 2D. * ``` * // multiple silhouette effects - * const yellowEdge = PostProcessLibrary.createEdgeDetectionStage(); + * const yellowEdge = PostProcessStageLibrary.createEdgeDetectionStage(); * yellowEdge.uniforms.color = Color.YELLOW; * yellowEdge.selected = [feature0]; * - * const greenEdge = PostProcessLibrary.createEdgeDetectionStage(); + * const greenEdge = PostProcessStageLibrary.createEdgeDetectionStage(); * greenEdge.uniforms.color = Color.LIME; * greenEdge.selected = [feature1]; * * // draw edges around feature0 and feature1 - * postProcessStages.add(PostProcessLibrary.createSilhouetteStage([yellowEdge, greenEdge]); + * postProcessStages.add(PostProcessStageLibrary.createSilhouetteStage([yellowEdge, greenEdge]); * ``` * @return A post-process stage that applies an edge detection effect. * @see Online Documentation diff --git a/cesium-kotlin/src/jsMain/kotlin/cesium/PrimitiveCollection.kt b/cesium-kotlin/src/jsMain/kotlin/cesium/PrimitiveCollection.kt index e1b83f8cf..c4b6a0d61 100644 --- a/cesium-kotlin/src/jsMain/kotlin/cesium/PrimitiveCollection.kt +++ b/cesium-kotlin/src/jsMain/kotlin/cesium/PrimitiveCollection.kt @@ -61,6 +61,22 @@ external class PrimitiveCollection { */ val length: Int + /** + * An event that is raised when a primitive is added to the collection. + * Event handlers are passed the primitive that was added. + * @see Online Documentation + */ + val primitiveAdded: DefaultEvent + + /** + * An event that is raised when a primitive is removed from the collection. + * Event handlers are passed the primitive that was removed. + * + * Note: Depending on the destroyPrimitives constructor option, the primitive may already be destroyed. + * @see Online Documentation + */ + val primitiveRemoved: DefaultEvent + /** * Adds a primitive to the collection. * ``` diff --git a/cesium-kotlin/src/jsMain/kotlin/cesium/Stereographic.kt b/cesium-kotlin/src/jsMain/kotlin/cesium/Stereographic.kt new file mode 100644 index 000000000..251b04130 --- /dev/null +++ b/cesium-kotlin/src/jsMain/kotlin/cesium/Stereographic.kt @@ -0,0 +1,18 @@ +// Automatically generated - do not modify! + +@file:JsModule("cesium") + +package cesium + +/** + * Represents a point in stereographic coordinates, which can be obtained by projecting a cartesian coordinate from one pole onto a tangent plane at the other pole. + * The stereographic projection faithfully represents the relative directions of all great circles passing through its center point. + * To faithfully represents angles everywhere, this is a conformal projection, which means points are projected onto an arbrary sphere. + * @param [position] The steroegraphic coordinates. + * @param [tangentPlane] The tangent plane onto which the point was projected. + * @see Online Documentation + */ +external fun Stereographic( + position: Cartesian2? = definedExternally, + tangentPlane: EllipseGeometry? = definedExternally, +) diff --git a/cesium-kotlin/src/jsMain/kotlin/cesium/Viewer.kt b/cesium-kotlin/src/jsMain/kotlin/cesium/Viewer.kt index 52b29b576..9e04a8e79 100644 --- a/cesium-kotlin/src/jsMain/kotlin/cesium/Viewer.kt +++ b/cesium-kotlin/src/jsMain/kotlin/cesium/Viewer.kt @@ -658,7 +658,7 @@ external class Viewer( * Default value - [SceneMode.SCENE3D] * @property [mapProjection] The map projection to use in 2D and Columbus View modes. * Default value - [GeographicProjection()][GeographicProjection] - * @property [globe] The globe to use in the scene. If set to `false`, no globe will be added. + * @property [globe] The globe to use in the scene. If set to `false`, no globe will be added and the sky atmosphere will be hidden by default. * Default value - [Globe(mapProjection.ellipsoid)][Globe] * @property [orderIndependentTranslucency] If true and the configuration supports it, use order independent translucency. * Default value - `true` diff --git a/cesium-kotlin/src/jsMain/kotlin/cesium/sampleTerrain.kt b/cesium-kotlin/src/jsMain/kotlin/cesium/sampleTerrain.kt index c1dae78fb..c28ad6777 100644 --- a/cesium-kotlin/src/jsMain/kotlin/cesium/sampleTerrain.kt +++ b/cesium-kotlin/src/jsMain/kotlin/cesium/sampleTerrain.kt @@ -30,10 +30,19 @@ import js.promise.Promise * const updatedPositions = await sampleTerrain(terrainProvider, 11, positions); * // positions[0].height and positions[1].height have been updated. * // updatedPositions is just a reference to positions. + * + * // To handle tile errors, pass true for the rejectOnTileFail parameter. + * try { + * const updatedPositions = await sampleTerrain(terrainProvider, 11, positions, true); + * } catch (error) { + * // A tile request error occurred. + * } * ``` * @param [terrainProvider] The terrain provider from which to query heights. * @param [level] The terrain level-of-detail from which to query terrain heights. * @param [positions] The positions to update with terrain heights. + * @param [rejectOnTileFail] If true, for a failed terrain tile request the promise will be rejected. If false, returned heights will be undefined. + * Default value - `false` * @return A promise that resolves to the provided list of positions when terrain the query has completed. * @see Online Documentation */ @@ -41,4 +50,5 @@ external fun sampleTerrain( terrainProvider: TerrainProvider, level: Int, positions: ReadonlyArray, + rejectOnTileFail: Boolean? = definedExternally, ): Promise> diff --git a/cesium-kotlin/src/jsMain/kotlin/cesium/sampleTerrainMostDetailed.kt b/cesium-kotlin/src/jsMain/kotlin/cesium/sampleTerrainMostDetailed.kt index 0949f43fa..c25c6a3b1 100644 --- a/cesium-kotlin/src/jsMain/kotlin/cesium/sampleTerrainMostDetailed.kt +++ b/cesium-kotlin/src/jsMain/kotlin/cesium/sampleTerrainMostDetailed.kt @@ -19,9 +19,18 @@ import js.promise.Promise * const updatedPositions = await sampleTerrainMostDetailed(terrainProvider, positions); * // positions[0].height and positions[1].height have been updated. * // updatedPositions is just a reference to positions. + * + * // To handle tile errors, pass true for the rejectOnTileFail parameter. + * try { + * const updatedPositions = await sampleTerrainMostDetailed(terrainProvider, positions, true); + * } catch (error) { + * // A tile request error occurred. + * } * ``` * @param [terrainProvider] The terrain provider from which to query heights. * @param [positions] The positions to update with terrain heights. + * @param [rejectOnTileFail] If true, for a failed terrain tile request the promise will be rejected. If false, returned heights will be undefined. + * Default value - `false` * @return A promise that resolves to the provided list of positions when terrain the query has completed. This * promise will reject if the terrain provider's `availability` property is undefined. * @see Online Documentation @@ -29,4 +38,5 @@ import js.promise.Promise external fun sampleTerrainMostDetailed( terrainProvider: TerrainProvider, positions: ReadonlyArray, + rejectOnTileFail: Boolean? = definedExternally, ): Promise>