MCPcopy Create free account
hub / github.com/PlotJuggler/PlotJuggler / sampleFromTime

Method sampleFromTime

pj_plotting/core/src/DatastoreCurveAdapter.cpp:170–183  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

168}
169
170std::optional<QPointF> DatastoreCurveAdapter::sampleFromTime(double display_time_sec) const {
171 if (session_ == nullptr) {
172 return std::nullopt;
173 }
174
175 const Timestamp raw_time = displaySecondsToRawNs(display_time_sec, displayOffsetNow());
176 auto series_or = session_->createReader().series(source_.topic_id, source_.column_index);
177 if (!series_or.has_value()) {
178 return std::nullopt;
179 }
180
181 const auto sample = series_or->sampleAtOrBeforeTime(raw_time);
182 return sample.has_value() ? std::optional<QPointF>{readPoint(*sample)} : std::nullopt;
183}
184
185void DatastoreCurveAdapter::ensureChunkIndex() const {
186 if (!sample_index_dirty_) {

Callers 1

TEST_FFunction · 0.80

Calls 4

displaySecondsToRawNsFunction · 0.85
seriesMethod · 0.80
sampleAtOrBeforeTimeMethod · 0.80
createReaderMethod · 0.45

Tested by 1

TEST_FFunction · 0.64