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
sampleHeightMostDetailedcan 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+Vm4YmFEKZxocK6lxC5S570byHAY0Cfy1TGboUJWhVCWGSx1g7dS9lQBvBrOw0kOz6UXxL/Gd3101sp5r9WtpcN9Ho+vrsbXl9e+iHMpiVzchz9yXMntkw43I3iBvDa8LecG3sIu0PN02h4tKLewGMcGSfcGL2A688VCoM+EoqRcdnQfNM8xb9N/aFC5B2EdMTOx1y4+hAcVKpF9X2grOlGnryJw4/Ta8KoQWadAa6ArruIA3zNY6lrlQq0fqwINMhLDoRkFPy9A+/i6jjSzvKwkfkSxLtwnbd0d0vRJzOOvh7y+7WNkfgKZ1OsDJmm0IHfMoegiwYaGCSxRolkNbX5tz00ajfbQwzzMwweo9/rHwbLzH7tfT+fZuf69oa1OQx3v87kd+oNTP8Dh7MQPrsZAgP9r8q/W5GQ/CBy68hdWJRpFE+u2Emet9b3w/6/ayJixxCHVyUnBZFkTUccya1vcJAmQSS4aEPl04H8FmeTW0s2qlvJR/MA0mk0S8j+CSeo9NeFzg0bybetSXM4evJExNknoeIpyWsslNwcRfwI
Author checklist
CONTRIBUTORS.md.CHANGES.mdwith a short summary of my change