From 6a9e951e8c8f57ed5747d220aed166e5bdfbbfe7 Mon Sep 17 00:00:00 2001 From: jvrjsanchez Date: Mon, 26 Aug 2024 21:21:47 -0500 Subject: [PATCH 1/8] Deprecation Updates for SceneTransforms Methods --- Apps/Sandcastle/gallery/Star Burst.html | 2 +- package.json | 3 +- .../engine/Source/Scene/SceneTransforms.js | 4 +-- .../engine/Specs/Scene/SceneTransformsSpec.js | 28 +++++++++---------- 4 files changed, 19 insertions(+), 18 deletions(-) diff --git a/Apps/Sandcastle/gallery/Star Burst.html b/Apps/Sandcastle/gallery/Star Burst.html index ba67dfb41de..539b432f3e2 100644 --- a/Apps/Sandcastle/gallery/Star Burst.html +++ b/Apps/Sandcastle/gallery/Star Burst.html @@ -320,7 +320,7 @@ // Remove the star burst if the mouse exits the screen space circle. // If the mouse is inside the circle, show the label of the billboard the mouse is hovering over. - const screenPosition = Cesium.SceneTransforms.wgs84ToWindowCoordinates( + const screenPosition = Cesium.SceneTransforms.worldToWindowCoordinates( scene, starBurstState.center ); diff --git a/package.json b/package.json index e3a813f1e08..276cfecdfec 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,8 @@ ], "dependencies": { "@cesium/engine": "^10.1.0", - "@cesium/widgets": "^7.1.0" + "@cesium/widgets": "^7.1.0", + "cesium": "^1.120.0" }, "devDependencies": { "@playwright/test": "^1.41.1", diff --git a/packages/engine/Source/Scene/SceneTransforms.js b/packages/engine/Source/Scene/SceneTransforms.js index df0954df213..f878a3a2130 100644 --- a/packages/engine/Source/Scene/SceneTransforms.js +++ b/packages/engine/Source/Scene/SceneTransforms.js @@ -72,7 +72,7 @@ SceneTransforms.worldToWindowCoordinates = function (scene, position, result) { * console.log(Cesium.SceneTransforms.wgs84ToWindowCoordinates(scene, position)); * }, Cesium.ScreenSpaceEventType.MOUSE_MOVE); */ -SceneTransforms.wgs84ToWindowCoordinates = function (scene, position, result) { +SceneTransforms.worldToWindowCoordinates = function (scene, position, result) { deprecationWarning( "SceneTransforms.wgs84ToWindowCoordinates", "SceneTransforms.wgs84ToWindowCoordinates has been deprecated. It will be removed in 1.21. Use SceneTransforms.worldToWindowCoordinates instead." @@ -337,7 +337,7 @@ SceneTransforms.worldToDrawingBufferCoordinates = function ( * console.log(Cesium.SceneTransforms.wgs84ToWindowCoordinates(scene, position)); * }, Cesium.ScreenSpaceEventType.MOUSE_MOVE); */ -SceneTransforms.wgs84ToDrawingBufferCoordinates = function ( +SceneTransforms.worldToDrawingBufferCoordinates = function ( scene, position, result diff --git a/packages/engine/Specs/Scene/SceneTransformsSpec.js b/packages/engine/Specs/Scene/SceneTransformsSpec.js index 0839423d89e..180a57ed445 100644 --- a/packages/engine/Specs/Scene/SceneTransformsSpec.js +++ b/packages/engine/Specs/Scene/SceneTransformsSpec.js @@ -40,13 +40,13 @@ describe( it("throws an exception without scene", function () { const position = Cartesian3.fromDegrees(0.0, 0.0); expect(function () { - SceneTransforms.wgs84ToWindowCoordinates(undefined, position); + SceneTransforms.worldToWindowCoordinates(undefined, position); }).toThrowDeveloperError(); }); it("throws an exception without position", function () { expect(function () { - SceneTransforms.wgs84ToWindowCoordinates(scene); + SceneTransforms.worldToWindowCoordinates(scene); }).toThrowDeveloperError(); }); @@ -61,7 +61,7 @@ describe( // Update scene state scene.renderForSpecs(); - const windowCoordinates = SceneTransforms.wgs84ToWindowCoordinates( + const windowCoordinates = SceneTransforms.worldToWindowCoordinates( scene, position ); @@ -80,7 +80,7 @@ describe( // Update scene state scene.renderForSpecs(); - const drawingBufferCoordinates = SceneTransforms.wgs84ToDrawingBufferCoordinates( + const drawingBufferCoordinates = SceneTransforms.worldToDrawingBufferCoordinates( scene, position ); @@ -105,7 +105,7 @@ describe( // Update scene state scene.renderForSpecs(); - const windowCoordinates = SceneTransforms.wgs84ToWindowCoordinates( + const windowCoordinates = SceneTransforms.worldToWindowCoordinates( scene, position ); @@ -123,7 +123,7 @@ describe( // Update scene state scene.renderForSpecs(); - const drawingBufferCoordinates = SceneTransforms.wgs84ToDrawingBufferCoordinates( + const drawingBufferCoordinates = SceneTransforms.worldToDrawingBufferCoordinates( scene, position ); @@ -138,7 +138,7 @@ describe( const actualWindowCoordinates = new Cartesian2(0.5, 0.5); const position = scene.camera.pickEllipsoid(actualWindowCoordinates); - const windowCoordinates = SceneTransforms.wgs84ToWindowCoordinates( + const windowCoordinates = SceneTransforms.worldToWindowCoordinates( scene, position ); @@ -158,7 +158,7 @@ describe( actualDrawingBufferCoordinates ); - const drawingBufferCoordinates = SceneTransforms.wgs84ToDrawingBufferCoordinates( + const drawingBufferCoordinates = SceneTransforms.worldToDrawingBufferCoordinates( scene, position ); @@ -182,7 +182,7 @@ describe( scene.camera.direction ); - const windowCoordinates = SceneTransforms.wgs84ToWindowCoordinates( + const windowCoordinates = SceneTransforms.worldToWindowCoordinates( scene, position ); @@ -203,7 +203,7 @@ describe( scene.camera.direction ); - const drawingBufferCoordinates = SceneTransforms.wgs84ToDrawingBufferCoordinates( + const drawingBufferCoordinates = SceneTransforms.worldToDrawingBufferCoordinates( scene, position ); @@ -225,7 +225,7 @@ describe( scene.renderForSpecs(); const position = Cartesian3.fromDegrees(0, 0); - const windowCoordinates = SceneTransforms.wgs84ToWindowCoordinates( + const windowCoordinates = SceneTransforms.worldToWindowCoordinates( scene, position ); @@ -256,7 +256,7 @@ describe( }); const position = Cartesian3.fromDegrees(0, 0); - const windowCoordinates = SceneTransforms.wgs84ToWindowCoordinates( + const windowCoordinates = SceneTransforms.worldToWindowCoordinates( scene, position ); @@ -283,7 +283,7 @@ describe( scene.renderForSpecs(); const position = Cartesian3.fromDegrees(0, 0); - const drawingBufferCoordinates = SceneTransforms.wgs84ToDrawingBufferCoordinates( + const drawingBufferCoordinates = SceneTransforms.worldToDrawingBufferCoordinates( scene, position ); @@ -306,7 +306,7 @@ describe( scene.renderForSpecs(); const position = Cartesian3.fromDegrees(-80, 25); - const windowCoordinates = SceneTransforms.wgs84ToWindowCoordinates( + const windowCoordinates = SceneTransforms.worldToWindowCoordinates( scene, position ); From 04ba5cbaddb3954c8e6ab42d736a3b706d90f7e4 Mon Sep 17 00:00:00 2001 From: jvrjsanchez Date: Mon, 26 Aug 2024 21:35:19 -0500 Subject: [PATCH 2/8] added myself to contributors page --- CONTRIBUTORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 5ffba76b8eb..8a8d6815d9e 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -405,3 +405,4 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to Cesiu - [Levi Montgomery](https://github.com/Levi-Montgomery) - [Brandon Berisford](https://github.com/BeyondBelief96) - [Adam Wirth](https://https://github.com/adamwirth) +- [Javier Sanchez](https://github.com/jvrjsanchez) From d15d8ffccc5f078f6ba09f7f9ba427a710d1b69a Mon Sep 17 00:00:00 2001 From: jvrjsanchez Date: Mon, 26 Aug 2024 21:44:03 -0500 Subject: [PATCH 3/8] updated the changes markdown with a short summary of my change --- CHANGES.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 003d3a93908..ade2de6511c 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,17 @@ # Change Log +### 1.121 - 2024-08-26 + +#### @cesium/engine + +##### Additions :Deprecation Updates for SceneTransforms Methods: + +- Updated method calls in the codebase from `wgs84ToDrawingBufferCoordinates` to `worldToDrawingBufferCoordinates`. +- Updated method calls in the codebase from `wgs84ToWindowCoordinates` to `worldToWindowCoordinates`. +- Ran tests using the original `gulpfile.js` to execute them. +- Verified that all tests for `SceneTransforms` pass successfully in different viewing modes (3D, ColumbusView, 2D) and frustum configurations. +- Ensured that test output is correctly reported and errors are handled gracefully. + ### 1.121 - 2024-09-01 #### @cesium/engine From 3f2f8bd94ad96aa32485ce8e514323750c9e0a7d Mon Sep 17 00:00:00 2001 From: jvrjsanchez Date: Tue, 27 Aug 2024 08:47:05 -0500 Subject: [PATCH 4/8] commented the depreciation warning --- CHANGES.md | 15 +++---------- package.json | 3 +-- .../engine/Source/Scene/SceneTransforms.js | 21 ------------------- 3 files changed, 4 insertions(+), 35 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index ade2de6511c..f61aaf89676 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,17 +1,5 @@ # Change Log -### 1.121 - 2024-08-26 - -#### @cesium/engine - -##### Additions :Deprecation Updates for SceneTransforms Methods: - -- Updated method calls in the codebase from `wgs84ToDrawingBufferCoordinates` to `worldToDrawingBufferCoordinates`. -- Updated method calls in the codebase from `wgs84ToWindowCoordinates` to `worldToWindowCoordinates`. -- Ran tests using the original `gulpfile.js` to execute them. -- Verified that all tests for `SceneTransforms` pass successfully in different viewing modes (3D, ColumbusView, 2D) and frustum configurations. -- Ensured that test output is correctly reported and errors are handled gracefully. - ### 1.121 - 2024-09-01 #### @cesium/engine @@ -34,6 +22,9 @@ ##### Breaking Changes :mega: +- `SceneTransforms.wgs84ToWindowCoordinates` has been removed. Use `SceneTransforms.worldToWindowCoordinates` instead. +- `SceneTransforms.wgs84ToDrawingBufferCoordinates` has been removed. Use `SceneTransforms.worldToDrawingBufferCoordinates` instead. + - Removed `jitter` option from `VoxelPrimitive.js`, `VoxelRenderResources.js`, and related test code in `VoxelPrimitiveSpec.js`. [#11913](https://github.com/CesiumGS/cesium/issues/11913) - Custom specular environment maps in `ImageBasedLighting` now require either a WebGL2 context or a WebGL1 context that supports the [`EXT_shader_texture_lod` extension](https://registry.khronos.org/webgl/extensions/EXT_shader_texture_lod/). diff --git a/package.json b/package.json index 276cfecdfec..e3a813f1e08 100644 --- a/package.json +++ b/package.json @@ -52,8 +52,7 @@ ], "dependencies": { "@cesium/engine": "^10.1.0", - "@cesium/widgets": "^7.1.0", - "cesium": "^1.120.0" + "@cesium/widgets": "^7.1.0" }, "devDependencies": { "@playwright/test": "^1.41.1", diff --git a/packages/engine/Source/Scene/SceneTransforms.js b/packages/engine/Source/Scene/SceneTransforms.js index f878a3a2130..d0a67228e82 100644 --- a/packages/engine/Source/Scene/SceneTransforms.js +++ b/packages/engine/Source/Scene/SceneTransforms.js @@ -4,7 +4,6 @@ import Cartesian3 from "../Core/Cartesian3.js"; import Cartesian4 from "../Core/Cartesian4.js"; import Cartographic from "../Core/Cartographic.js"; import defined from "../Core/defined.js"; -import deprecationWarning from "../Core/deprecationWarning.js"; import DeveloperError from "../Core/DeveloperError.js"; import CesiumMath from "../Core/Math.js"; import Matrix4 from "../Core/Matrix4.js"; @@ -73,10 +72,6 @@ SceneTransforms.worldToWindowCoordinates = function (scene, position, result) { * }, Cesium.ScreenSpaceEventType.MOUSE_MOVE); */ SceneTransforms.worldToWindowCoordinates = function (scene, position, result) { - deprecationWarning( - "SceneTransforms.wgs84ToWindowCoordinates", - "SceneTransforms.wgs84ToWindowCoordinates has been deprecated. It will be removed in 1.21. Use SceneTransforms.worldToWindowCoordinates instead." - ); return SceneTransforms.worldToWindowCoordinates(scene, position, result); }; @@ -337,22 +332,6 @@ SceneTransforms.worldToDrawingBufferCoordinates = function ( * console.log(Cesium.SceneTransforms.wgs84ToWindowCoordinates(scene, position)); * }, Cesium.ScreenSpaceEventType.MOUSE_MOVE); */ -SceneTransforms.worldToDrawingBufferCoordinates = function ( - scene, - position, - result -) { - deprecationWarning( - "SceneTransforms.wgs84ToDrawingBufferCoordinates", - "SceneTransforms.wgs84ToDrawingBufferCoordinates has been deprecated. It will be removed in 1.21. Use SceneTransforms.worldToDrawingBufferCoordinates instead." - ); - - return SceneTransforms.worldToDrawingBufferCoordinates( - scene, - position, - result - ); -}; const projectedPosition = new Cartesian3(); const positionInCartographic = new Cartographic(); From 4a92c35f0ece2086dcfe895432c6fca33fb7849a Mon Sep 17 00:00:00 2001 From: jvrjsanchez Date: Tue, 27 Aug 2024 08:49:35 -0500 Subject: [PATCH 5/8] made necessary changes for already defined functions --- packages/engine/Source/Scene/SceneTransforms.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/engine/Source/Scene/SceneTransforms.js b/packages/engine/Source/Scene/SceneTransforms.js index d0a67228e82..86fdeb7c46d 100644 --- a/packages/engine/Source/Scene/SceneTransforms.js +++ b/packages/engine/Source/Scene/SceneTransforms.js @@ -4,6 +4,7 @@ import Cartesian3 from "../Core/Cartesian3.js"; import Cartesian4 from "../Core/Cartesian4.js"; import Cartographic from "../Core/Cartographic.js"; import defined from "../Core/defined.js"; +/*import deprecationWarning from "../Core/deprecationWarning.js";*/ import DeveloperError from "../Core/DeveloperError.js"; import CesiumMath from "../Core/Math.js"; import Matrix4 from "../Core/Matrix4.js"; From 38857018d0eed84b472af8e8b0c38376146ee3dd Mon Sep 17 00:00:00 2001 From: Gabby Getz Date: Thu, 29 Aug 2024 16:33:31 -0400 Subject: [PATCH 6/8] Update SceneTransforms.js --- packages/engine/Source/Scene/SceneTransforms.js | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/engine/Source/Scene/SceneTransforms.js b/packages/engine/Source/Scene/SceneTransforms.js index 86fdeb7c46d..d0a67228e82 100644 --- a/packages/engine/Source/Scene/SceneTransforms.js +++ b/packages/engine/Source/Scene/SceneTransforms.js @@ -4,7 +4,6 @@ import Cartesian3 from "../Core/Cartesian3.js"; import Cartesian4 from "../Core/Cartesian4.js"; import Cartographic from "../Core/Cartographic.js"; import defined from "../Core/defined.js"; -/*import deprecationWarning from "../Core/deprecationWarning.js";*/ import DeveloperError from "../Core/DeveloperError.js"; import CesiumMath from "../Core/Math.js"; import Matrix4 from "../Core/Matrix4.js"; From 951a0e57bc0c022e373297fc79048e38b287b731 Mon Sep 17 00:00:00 2001 From: jvrjsanchez Date: Thu, 29 Aug 2024 18:09:23 -0500 Subject: [PATCH 7/8] added the deprecation warning backs for it to pass all checks --- packages/engine/Source/Scene/SceneTransforms.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/engine/Source/Scene/SceneTransforms.js b/packages/engine/Source/Scene/SceneTransforms.js index 86fdeb7c46d..e7fa6d7fa2e 100644 --- a/packages/engine/Source/Scene/SceneTransforms.js +++ b/packages/engine/Source/Scene/SceneTransforms.js @@ -4,7 +4,7 @@ import Cartesian3 from "../Core/Cartesian3.js"; import Cartesian4 from "../Core/Cartesian4.js"; import Cartographic from "../Core/Cartographic.js"; import defined from "../Core/defined.js"; -/*import deprecationWarning from "../Core/deprecationWarning.js";*/ +import deprecationWarning from "../Core/deprecationWarning.js"; import DeveloperError from "../Core/DeveloperError.js"; import CesiumMath from "../Core/Math.js"; import Matrix4 from "../Core/Matrix4.js"; @@ -73,6 +73,10 @@ SceneTransforms.worldToWindowCoordinates = function (scene, position, result) { * }, Cesium.ScreenSpaceEventType.MOUSE_MOVE); */ SceneTransforms.worldToWindowCoordinates = function (scene, position, result) { + deprecationWarning( + "SceneTransforms.wgs84ToWindowCoordinates", + "SceneTransforms.wgs84ToWindowCoordinates has been deprecated. It will be removed in 1.21. Use SceneTransforms.worldToWindowCoordinates instead." + ); return SceneTransforms.worldToWindowCoordinates(scene, position, result); }; @@ -308,6 +312,10 @@ SceneTransforms.worldToDrawingBufferCoordinates = function ( position, result ) { + deprecationWarning( + "SceneTransforms.wgs84ToDrawingBufferCoordinates", + "SceneTransforms.wgs84ToDrawingBufferCoordinates has been deprecated. It will be removed in 1.21. Use SceneTransforms.worldToDrawingBufferCoordinates instead." + ); result = SceneTransforms.worldToWindowCoordinates(scene, position, result); if (!defined(result)) { return undefined; From 393fb39c03efe25952b46ebf777533b99669994a Mon Sep 17 00:00:00 2001 From: jjspace <8007967+jjspace@users.noreply.github.com> Date: Fri, 30 Aug 2024 15:22:01 -0400 Subject: [PATCH 8/8] remove some excess code --- .../engine/Source/Scene/SceneTransforms.js | 50 ------------------- 1 file changed, 50 deletions(-) diff --git a/packages/engine/Source/Scene/SceneTransforms.js b/packages/engine/Source/Scene/SceneTransforms.js index e7fa6d7fa2e..84ae7a032b5 100644 --- a/packages/engine/Source/Scene/SceneTransforms.js +++ b/packages/engine/Source/Scene/SceneTransforms.js @@ -4,7 +4,6 @@ import Cartesian3 from "../Core/Cartesian3.js"; import Cartesian4 from "../Core/Cartesian4.js"; import Cartographic from "../Core/Cartographic.js"; import defined from "../Core/defined.js"; -import deprecationWarning from "../Core/deprecationWarning.js"; import DeveloperError from "../Core/DeveloperError.js"; import CesiumMath from "../Core/Math.js"; import Matrix4 from "../Core/Matrix4.js"; @@ -53,33 +52,6 @@ SceneTransforms.worldToWindowCoordinates = function (scene, position, result) { ); }; -/** - * Transforms a position in WGS84 coordinates to window coordinates. This is commonly used to place an - * HTML element at the same screen position as an object in the scene. - * - * @param {Scene} scene The scene. - * @param {Cartesian3} position The position in WGS84 (world) coordinates. - * @param {Cartesian2} [result] An optional object to return the input position transformed to window coordinates. - * @returns {Cartesian2|undefined} The modified result parameter or a new Cartesian2 instance if one was not provided. This may be undefined if the input position is near the center of the ellipsoid. - * - * @example - * // Output the window position of longitude/latitude (0, 0) every time the mouse moves. - * const scene = widget.scene; - * const ellipsoid = scene.ellipsoid; - * const position = Cesium.Cartesian3.fromDegrees(0.0, 0.0); - * const handler = new Cesium.ScreenSpaceEventHandler(scene.canvas); - * handler.setInputAction(function(movement) { - * console.log(Cesium.SceneTransforms.wgs84ToWindowCoordinates(scene, position)); - * }, Cesium.ScreenSpaceEventType.MOUSE_MOVE); - */ -SceneTransforms.worldToWindowCoordinates = function (scene, position, result) { - deprecationWarning( - "SceneTransforms.wgs84ToWindowCoordinates", - "SceneTransforms.wgs84ToWindowCoordinates has been deprecated. It will be removed in 1.21. Use SceneTransforms.worldToWindowCoordinates instead." - ); - return SceneTransforms.worldToWindowCoordinates(scene, position, result); -}; - const scratchCartesian4 = new Cartesian4(); const scratchEyeOffset = new Cartesian3(); @@ -312,10 +284,6 @@ SceneTransforms.worldToDrawingBufferCoordinates = function ( position, result ) { - deprecationWarning( - "SceneTransforms.wgs84ToDrawingBufferCoordinates", - "SceneTransforms.wgs84ToDrawingBufferCoordinates has been deprecated. It will be removed in 1.21. Use SceneTransforms.worldToDrawingBufferCoordinates instead." - ); result = SceneTransforms.worldToWindowCoordinates(scene, position, result); if (!defined(result)) { return undefined; @@ -324,24 +292,6 @@ SceneTransforms.worldToDrawingBufferCoordinates = function ( return SceneTransforms.transformWindowToDrawingBuffer(scene, result, result); }; -/** - * Transforms a position in world coordinates to drawing buffer coordinates. This may produce different - * results from SceneTransforms.wgs84ToWindowCoordinates when the browser zoom is not 100%, or on high-DPI displays. - * - * @param {Scene} scene The scene. - * @param {Cartesian3} position The position in world (WGS84 or alternative ellipsoid) coordinates. - * @param {Cartesian2} [result] An optional object to return the input position transformed to window coordinates. - * @returns {Cartesian2|undefined} The modified result parameter or a new Cartesian2 instance if one was not provided. This may be undefined if the input position is near the center of the ellipsoid. - * - * @example - * // Output the window position of longitude/latitude (0, 0) every time the mouse moves. - * const position = Cesium.Cartesian3.fromDegrees(0.0, 0.0); - * const handler = new Cesium.ScreenSpaceEventHandler(scene.canvas); - * handler.setInputAction(function(movement) { - * console.log(Cesium.SceneTransforms.wgs84ToWindowCoordinates(scene, position)); - * }, Cesium.ScreenSpaceEventType.MOUSE_MOVE); - */ - const projectedPosition = new Cartesian3(); const positionInCartographic = new Cartographic();