Open s3xysteak opened 3 weeks ago
Thanks for the suggestion @s3xysteak.
I think if we exposed this functionality, we'd likely want to name the functions getSamples
for clarity.
Is this something you'd be interested in contributing?
I'm happy to create a PR for this! Additionally, getSamples
seems to correspond with addSamples
, which receives a list and return a list. Would using the name getSample
, to align with addSample
, make it more intuitive?
This API is like:
function getSample(index: number): Cesium.JulianDate
@s3xysteak Sounds great!
Yes, I agree.
Feature
It looks like:
Assumed API
sampledProperty.getLatestTime()
like above.sampledProperty.times
which exposed_times
attribute.sampledProperty.getTime(index)
which receive a number.index < 0
indicate reverse index.sampledProperty.getTimeByIndex(index)
A clear but cumbersome alias ofgetTime
.I prefer
getTime
orgetTimeByIndex
because it is more comprehensive than getLatestTime. Expose_times
correctly maybe challenging because it is a array returned an address. We don't want user can change_times
by other means thanaddSample(s)
.Use Case:
Assume we have a real-time location entity:
If just use
SampledProperty
, the entity will hide whenSampledProperty.getValue
return undefined. Most time we prefer to make it stay put if there is no value returned at that time, instead of suddenly disappear and suddenly appear when the data was updated.Similarly, for a real-time rotate entity:
When providing a null value, the entity will suddenly return to the default value (if
orientation: ori
). WithgetLatestTime()
we can make it stay to wait for the updated data.