Skip to content

Commit

Permalink
Update declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
turansky committed Oct 2, 2023
1 parent a2ebcd0 commit 3ca49a8
Show file tree
Hide file tree
Showing 9 changed files with 77 additions and 27 deletions.
22 changes: 0 additions & 22 deletions cesium-kotlin/src/jsMain/kotlin/cesium/Cesium3DTileset.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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 <a href="https://cesium.com/docs/cesiumjs-ref-doc/Cesium3DTileset.html#maximumMemoryUsage">Online Documentation</a>
*/
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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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?
Expand Down
2 changes: 1 addition & 1 deletion cesium-kotlin/src/jsMain/kotlin/cesium/CesiumWidget.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
18 changes: 18 additions & 0 deletions cesium-kotlin/src/jsMain/kotlin/cesium/PolygonGeometry.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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 <a href="https://cesium.com/docs/cesiumjs-ref-doc/PolygonGeometry.html#.computeRectangleFromPositions">Online Documentation</a>
*/
fun computeRectangleFromPositions(
positions: ReadonlyArray<Cartesian3>,
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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 <a href="https://cesium.com/docs/cesiumjs-ref-doc/PostProcessStageLibrary.html#.createEdgeDetectionStage">Online Documentation</a>
Expand Down
16 changes: 16 additions & 0 deletions cesium-kotlin/src/jsMain/kotlin/cesium/PrimitiveCollection.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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 <a href="https://cesium.com/docs/cesiumjs-ref-doc/PrimitiveCollection.html#primitiveAdded">Online Documentation</a>
*/
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 <a href="https://cesium.com/docs/cesiumjs-ref-doc/PrimitiveCollection.html#primitiveRemoved">Online Documentation</a>
*/
val primitiveRemoved: DefaultEvent

/**
* Adds a primitive to the collection.
* ```
Expand Down
18 changes: 18 additions & 0 deletions cesium-kotlin/src/jsMain/kotlin/cesium/Stereographic.kt
Original file line number Diff line number Diff line change
@@ -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 <a href="https://cesium.com/docs/cesiumjs-ref-doc/Stereographic.html">Online Documentation</a>
*/
external fun Stereographic(
position: Cartesian2? = definedExternally,
tangentPlane: EllipseGeometry? = definedExternally,
)
2 changes: 1 addition & 1 deletion cesium-kotlin/src/jsMain/kotlin/cesium/Viewer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
10 changes: 10 additions & 0 deletions cesium-kotlin/src/jsMain/kotlin/cesium/sampleTerrain.kt
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,25 @@ 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 <a href="https://cesium.com/docs/cesiumjs-ref-doc/sampleTerrain.html">Online Documentation</a>
*/
external fun sampleTerrain(
terrainProvider: TerrainProvider,
level: Int,
positions: ReadonlyArray<Cartographic>,
rejectOnTileFail: Boolean? = definedExternally,
): Promise<ReadonlyArray<Cartographic>>
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,24 @@ 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 <a href="https://cesium.com/docs/cesiumjs-ref-doc/sampleTerrainMostDetailed.html">Online Documentation</a>
*/
external fun sampleTerrainMostDetailed(
terrainProvider: TerrainProvider,
positions: ReadonlyArray<Cartographic>,
rejectOnTileFail: Boolean? = definedExternally,
): Promise<ReadonlyArray<Cartographic>>

0 comments on commit 3ca49a8

Please sign in to comment.