timeseries_qwt.h
Go to the documentation of this file.
1 /*
2  * This Source Code Form is subject to the terms of the Mozilla Public
3  * License, v. 2.0. If a copy of the MPL was not distributed with this
4  * file, You can obtain one at https://mozilla.org/MPL/2.0/.
5  */
6 
7 #ifndef TIMESERIES_QWT_H
8 #define TIMESERIES_QWT_H
9 
10 #include "qwt_series_data.h"
11 #include "PlotJuggler/plotdata.h"
13 
14 using namespace PJ;
15 
16 // wrapper to Timeseries inclduing a time offset
17 class QwtSeriesWrapper : public QwtSeriesData<QPointF>
18 {
19 private:
20  const PlotDataXY* _data;
21 
22 public:
23  QwtSeriesWrapper(const PlotDataXY* data) : _data(data)
24  {
25  }
26 
27  QPointF sample(size_t i) const override;
28 
29  size_t size() const override;
30 
31  QRectF boundingRect() const override;
32 
33  virtual const PlotDataXY* plotData() const;
34 
35  virtual RangeOpt getVisualizationRangeX();
36 
37  virtual RangeOpt getVisualizationRangeY(Range range_X);
38 
39  virtual void updateCache(bool reset_old_data)
40  {
41  }
42 };
43 
45 {
46 public:
47  QwtTimeseries(const PlotData* data) : QwtSeriesWrapper(data), _ts_data(data)
48  {
49  }
50 
51  QPointF sample(size_t i) const override;
52 
53  QRectF boundingRect() const override;
54 
55  void setTimeOffset(double offset);
56 
57  virtual RangeOpt getVisualizationRangeX() override;
58 
59  virtual RangeOpt getVisualizationRangeY(Range range_X) override;
60 
61  virtual std::optional<QPointF> sampleFromTime(double t);
62 
63  void updateCache(bool) override
64  {
65  }
66 
67 protected:
69  double _time_offset = 0.0;
70 };
71 
72 //------------------------------------
73 
75 {
76 public:
77  TransformedTimeseries(const PlotData* source_data);
78 
79  TransformFunction::Ptr transform();
80 
81  void setTransform(QString transform_ID);
82 
83  virtual void updateCache(bool reset_old_data) override;
84 
85  QString transformName();
86 
87  QString alias() const;
88 
89  void setAlias(QString alias);
90 
91 protected:
92  QString _alias;
96 };
97 
98 //---------------------------------------------------------
99 
100 #endif // PLOTDATA_H
Abstract interface for iterating over samples.
const PlotData * _ts_data
const PlotDataXY * _data
void updateCache(bool) override
std::optional< Range > RangeOpt
Definition: plotdatabase.h:35
virtual void updateCache(bool reset_old_data)
QwtSeriesWrapper(const PlotDataXY *data)
TransformFunction_SISO::Ptr _transform
const PlotData * _src_data
QwtTimeseries(const PlotData *data)
span_constexpr std::size_t size(span< T, Extent > const &spn)
Definition: span.hpp:1485
Definition: format.h:895
std::shared_ptr< TransformFunction > Ptr


plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Jun 19 2023 03:12:53