Fix scene sampleHeightMostDetailed does not work when a tileset is added by primitive collection
#13097
+2
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Fix the bug that
sampleHeightMostDetailed/clampToHeightMostDetailedcan not get height from a tileset that is added to thescene.primitivesby a primitive collection. This bug was originally reported in the community 4 years ago.Possible Cause:
cesium/packages/engine/Source/Scene/Picking.js
Line 1008 in 8209a59
Here we can know
scene.primitives.contains(tileset)will returnfalsewhen the tileset is added by primitive collection - That is not expected, and causes the height sample to fail.Here is a comment that says:
But we can know the
tilesetsare already collected from thescene.primitivesfrom the following function (Line 1070):cesium/packages/engine/Source/Scene/Picking.js
Lines 1061 to 1080 in 8209a59
So I think we can remove the
scene.primitives.contains(tileset)check to make the sample work, or consider adding a new function to check whether a tileset is inscene.primitivesto replace this check?Comparison
Issue number and link
Fix https://community.cesium.com/t/clamptoheightmostdetailed-get-the-elevation-problem/15056
Sandcastle
https://sandcastle.cesium.com/#c=7VVRa9swEP4rh5/cEeSV9KVdElbSwQodC7SsD/MeFPsSi8mSkWSHrOS/72xZTUIcBmNjL/OLrdN9d999d4dFWWnj4A1wC3O0oi5hZXQJaZR1pzR6l6pUZVpZB43ADRqYgsJN782+dLY4+M+1clwoNGl00SGTBJ65ywpwBQLdWi0RdO2q2qXK1Cr2btxuVQarWmVOaAXdBbykCoBvuHDA8/xJSLToOsCp+Vm4YmFEKZxocK6lxC5S570byHAY0Cfy1TGboUJWhVCWGSx1g7dS9lQBvBrOw0kOz6UXx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O5sXm14D5AKFkGCyJcy0hFWv4Hpuj6squZHiUsPiJneAjSgq7SE0HqOtVN81MmVit2RXb9okFYqtmWEvVGOS506NZj2pxNoKKI2g7YoKBIJAGiKtb0bC4rGxdAVE0qzk+hBFcXp43B492s6w1O/RfOsp6o+lR7OqUJQRSDdyoJ2kGh64lpxiLp+db7PyAHFZ1UYT5Bn68bXS2H9r65zoncjQciNsQBpag1PbGtqpLddtCeUHvoBniq7lC72EWmtItgxlTQd4x8T0dkaQutiNgsAPg3Ry3BghTrwwjNMwOOqM0MNpnMRp7IO6Lc7zHnD/34D70GWhFwReEiVHbenHPnb91HVTaIYOeujGOA1Cv3TLi1v0Dr7ciLLEA7fPKV07dQnzb+dUstZ56CjkcChABhLuObym1tQ5eveO1QlozMnl0vYRQ2NkraD3yLOWUAftN/Y7SJ0wgGE+FjUNHXFvdLLlt1sWs132Mzusz60n+yNeymlL86suE3YM9Mz17jR2DuEc8twU+InV4X8g8209l5322gRYSM3skD3BAFZbHijnrNCS5WeoVUVIQb+xv7sVXOyPUPMYjg5aawIXJyO8nazQ7VLhT7PrVmhff+2PGP6HQArJdxwu5457TWS6J7QWiKhsvito68qlXeP7h/tZK7RluVmdoUORHCLozsPahYeNKV93tcyjkgVc0zunw1tWBvwm/K+z29uHLwcGDozltDCrX6BI7v5HWJuB/eEH4XhSwvZgNJhqs+P0opT8mdnfrY3iDsZjQ0EcXNHjp032HW67TFdlPR03KtOcvSCWf+j5vSrzpTWcLDecf2Z/0sXgYjoG+SO1eto/vFDF4YoEkZV3cWs3McbTMSxPtYyU/ImojsW/AA
Author checklist
CONTRIBUTORS.md.CHANGES.mdwith a short summary of my change