CesiumGS / CesiumGS/cesium

ConstantPositionProperty#getValue throws when `time` isn't defined, even if it's not used

Open
#8,676 6 comments 0 reactions 0 assignees View on GitHub
category - entity FCF onramping type - cleanup
Dominant language
JavaScript
Stars
15.7k
Forks
3.9k
Avg merge
4d 6h
Merged PRs (30d)
34

Description

[Sandcastle example](https://sandcastle.cesium.com/#c=nZDBTsMwEER/xcqFRKqcFo6kEVI5IlEJCS6+uO42sXC80XpdFL4eJ1VCEeKCT/Z438zYBn1gYTQxBKv9ndiKXdrFTu4WTZ4Iu0doCCDkm/Xqdl3cK28msseQEA8fCzbK2vMeg2WLfk/YA/GQf2fMNDqQDptceZGWyt4st0JTEzvwrLLVdRNsSPetNVOXpVqe4mUD/KpdhJwpQlEoP/r/kYD+Jr0Wu94Bwz8iZvtslVWBBwf1xfrBdj0Si0gul7JkSAk6GZSHaN6BpQlhxKpyhqqjPQt73KrMTA3St7G2HkhlwjgdQro5Rede7GfqWVdlmv+BOdRH65vnM5DTwzjSbuqniyilrMp0/E0xojtounL8Ag). Note that the first `console.log` is fine even though the "time" is just `true`, but the second throws a `DeveloperError`.

Browser: any

Operating System: any

If I understand the code correctly, the `time` argument to `getValue` will only be used if the property was defined in a reference frame other than `FIXED`. This means that it should be safe to call `getValue` with no arguments if you know ahead of time that it was declared as fixed-frame, but the function does [an overzealous check first](https://github.com/CesiumGS/cesium/blob/1.67/Source/DataSources/ConstantPositionProperty.js#L108) and throws. I think the check can safely be changed to `if (this._referenceFrame !== referenceFrame && !defined(time))`.

Contributor guide

Open the contributing guide

Research direction

Start at Source/DataSources/ConstantPositionProperty.js around line 108 and reproduce the two cases from the linked Sandcastle example. Check how getValue handles an undefined time for fixed-frame and non-fixed-frame properties, then add or update the relevant test coverage if the repository identifies a test location. Done means the fixed-frame case no longer throws while required time validation remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
computer-graphics
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.