00001 #ifndef PLOTDATA_QWT_H 00002 #define PLOTDATA_QWT_H 00003 00004 #include <QColor> 00005 #include <qwt_series_data.h> 00006 #include <qwt_plot_marker.h> 00007 #include "PlotJuggler/plotdata.h" 00008 00009 class TimeseriesQwt: public QwtSeriesData<QPointF> 00010 { 00011 public: 00012 00013 TimeseriesQwt(PlotDataPtr base); 00014 00015 virtual ~TimeseriesQwt() {} 00016 00017 virtual QPointF sample( size_t i ) const override; 00018 00019 virtual QRectF boundingRect() const override; 00020 00021 virtual size_t size() const override; 00022 00023 PlotDataPtr data() { return _plot_data; } 00024 00025 void setSubsampleFactor(); 00026 00027 void updateData(); 00028 00029 PlotData::RangeTimeOpt getVisualizationRangeX(); 00030 00031 PlotData::RangeValueOpt getVisualizationRangeY(int first_index, int last_index ); 00032 00033 void setAlternativeAxisX( PlotDataPtr new_x_data); 00034 00035 nonstd::optional<QPointF> sampleFromTime(double t); 00036 00037 typedef enum{ 00038 noTransform, 00039 firstDerivative, 00040 secondDerivative, 00041 XYPlot 00042 } Transform; 00043 00044 void setTransform(Transform trans); 00045 00046 Transform transform() const { return _transform; } 00047 00048 double timeOffset() const { return _time_offset; } 00049 00050 public slots: 00051 00052 void setTimeOffset(double offset); 00053 00054 private: 00055 PlotDataPtr _plot_data; 00056 00057 std::vector<QPointF> _cached_transformed_curve; 00058 00059 unsigned _subsample; 00060 00061 Transform _transform; 00062 00063 PlotDataPtr _alternative_X_axis; 00064 00065 QRectF _bounding_box; 00066 00067 double _time_offset; 00068 }; 00069 00070 00071 00072 #endif // PLOTDATA_H