| 168 | } |
| 169 | |
| 170 | std::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 | |
| 185 | void DatastoreCurveAdapter::ensureChunkIndex() const { |
| 186 | if (!sample_index_dirty_) { |