plotwidget_base.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 PLOTWIDGET_BASE_H
8 #define PLOTWIDGET_BASE_H
9 
10 #include <QWidget>
11 #include "plotdata.h"
12 #include "timeseries_qwt.h"
13 
14 class QwtPlot;
15 class QwtPlotCurve;
16 class QwtPlotMarker;
17 
18 class PlotPanner;
19 class PlotZoomer;
20 class PlotMagnifier;
21 class PlotLegend;
22 
23 namespace PJ
24 {
25 class PlotWidgetBase : public QWidget
26 {
27  Q_OBJECT
28 
29 public:
31  {
38  };
39 
40  struct CurveInfo
41  {
42  std::string src_name;
45  };
46 
47  PlotWidgetBase(QWidget* parent);
48 
49  virtual ~PlotWidgetBase();
50 
51  virtual CurveInfo* addCurve(const std::string& name, PlotDataXY& src_data,
52  QColor color = Qt::transparent);
53 
54  virtual void removeCurve(const QString& title);
55 
56  const std::list<CurveInfo>& curveList() const;
57  std::list<CurveInfo>& curveList();
58 
59  bool isEmpty() const;
60 
61  QColor getColorHint(PlotDataXY* data);
62 
63  std::map<QString, QColor> getCurveColors() const;
64 
65  CurveInfo* curveFromTitle(const QString& title);
66 
68  const QString& transform_ID = {});
69 
70  virtual void resetZoom();
71 
72  virtual PJ::Range getVisualizationRangeX() const;
73 
74  virtual PJ::Range getVisualizationRangeY(PJ::Range range_X) const;
75 
76  virtual void setModeXY(bool enable);
77 
78  void setLegendSize(int size);
79 
80  void setLegendAlignment(Qt::Alignment alignment);
81 
82  void setZoomEnabled(bool enabled);
83 
84  bool isZoomEnabled() const;
85 
86  void changeCurvesStyle(CurveStyle style);
87 
88  bool isXYPlot() const;
89 
90  QRectF currentBoundingRect() const;
91 
92  QRectF maxZoomRect() const;
93 
94  CurveStyle curveStyle() const;
95 
96  bool keepRatioXY() const;
97 
98  void setKeepRatioXY(bool active);
99 
100  void setAcceptDrops(bool accept);
101 
102 public slots:
103 
104  void replot();
105 
106  virtual void removeAllCurves();
107 
108 signals:
109 
110  void curveListChanged();
111 
112  void viewResized(const QRectF&);
113 
114  void dragEnterSignal(QDragEnterEvent* event);
115  void dragLeaveSignal(QDragLeaveEvent* event);
116 
117  void dropSignal(QDropEvent* event);
118 
119  void legendSizeChanged(int new_size);
120 
121  void widgetResized();
122 
123 protected:
124  class QwtPlotPimpl;
125  QwtPlotPimpl* p = nullptr;
126 
127  static void setStyle(QwtPlotCurve* curve, CurveStyle style);
128 
129  QwtPlot* qwtPlot();
130  const QwtPlot* qwtPlot() const;
131 
132  PlotLegend* legend();
133  PlotZoomer* zoomer();
135 
136  void updateMaximumZoomArea();
137 
138  bool eventFilter(QObject* obj, QEvent* event);
139 
140 private:
141  bool _xy_mode;
142 
144 
146 };
147 
148 } // namespace PJ
149 
150 #endif // PLOTWIDGET_PROXY_H
PJ::PlotWidgetBase::removeCurve
virtual void removeCurve(const QString &title)
Definition: plotwidget_base.cpp:461
PJ::PlotWidgetBase::legendSizeChanged
void legendSizeChanged(int new_size)
color
color
Definition: color.h:16
PJ::PlotWidgetBase::CurveInfo::marker
QwtPlotMarker * marker
Definition: plotwidget_base.h:44
PJ::PlotWidgetBase::curveList
const std::list< CurveInfo > & curveList() const
Definition: plotwidget_base.cpp:480
PJ::TimeseriesBase
Definition: timeseries.h:16
PJ::PlotWidgetBase::eventFilter
bool eventFilter(QObject *obj, QEvent *event)
Definition: plotwidget_base.cpp:527
PlotZoomer
Definition: plotzoomer.h:15
QwtSeriesWrapper
Definition: timeseries_qwt.h:17
PJ::PlotWidgetBase::setAcceptDrops
void setAcceptDrops(bool accept)
Definition: plotwidget_base.cpp:522
PJ::PlotWidgetBase::CurveInfo::src_name
std::string src_name
Definition: plotwidget_base.h:42
PJ::PlotWidgetBase::CurveInfo
Definition: plotwidget_base.h:40
PJ::PlotWidgetBase::LINES_AND_DOTS
@ LINES_AND_DOTS
Definition: plotwidget_base.h:34
PJ::PlotWidgetBase::p
QwtPlotPimpl * p
Definition: plotwidget_base.h:125
PJ::PlotWidgetBase::setZoomEnabled
void setZoomEnabled(bool enabled)
Definition: plotwidget_base.cpp:766
PJ::PlotWidgetBase::viewResized
void viewResized(const QRectF &)
QwtPlot
A 2-D plotting widget.
Definition: qwt_plot.h:78
PJ::PlotWidgetBase::~PlotWidgetBase
virtual ~PlotWidgetBase()
Definition: plotwidget_base.cpp:382
PlotPanner
Definition: plotpanner.h:6
PJ::PlotWidgetBase::removeAllCurves
virtual void removeAllCurves()
Definition: plotwidget_base.cpp:789
PJ::PlotWidgetBase::resetZoom
virtual void resetZoom()
Definition: plotwidget_base.cpp:175
PJ::PlotWidgetBase::curveStyle
CurveStyle curveStyle() const
Definition: plotwidget_base.cpp:499
PJ::PlotWidgetBase::getCurveColors
std::map< QString, QColor > getCurveColors() const
Definition: plotwidget_base.cpp:687
PJ::PlotWidgetBase::_max_zoom_rect
QRectF _max_zoom_rect
Definition: plotwidget_base.h:143
PJ::PlotWidgetBase::getVisualizationRangeY
virtual PJ::Range getVisualizationRangeY(PJ::Range range_X) const
Definition: plotwidget_base.cpp:229
PJ::PlotWidgetBase::dragEnterSignal
void dragEnterSignal(QDragEnterEvent *event)
PJ::PlotWidgetBase::keepRatioXY
bool keepRatioXY() const
Definition: plotwidget_base.cpp:504
PJ::PlotWidgetBase::getVisualizationRangeX
virtual PJ::Range getVisualizationRangeX() const
Definition: plotwidget_base.cpp:189
PJ::PlotWidgetBase::replot
void replot()
Definition: plotwidget_base.cpp:780
PJ::PlotWidgetBase::dragLeaveSignal
void dragLeaveSignal(QDragLeaveEvent *event)
nonstd::span_lite::size
span_constexpr std::size_t size(span< T, Extent > const &spn)
Definition: span.hpp:1554
timeseries_qwt.h
PJ::PlotWidgetBase::addCurve
virtual CurveInfo * addCurve(const std::string &name, PlotDataXY &src_data, QColor color=Qt::transparent)
Definition: plotwidget_base.cpp:391
PlotLegend
Definition: plotlegend.h:14
PJ::PlotWidgetBase::setStyle
static void setStyle(QwtPlotCurve *curve, CurveStyle style)
Definition: plotwidget_base.cpp:698
PJ::PlotWidgetBase::curveFromTitle
CurveInfo * curveFromTitle(const QString &title)
Definition: plotwidget_base.cpp:737
PJ::PlotWidgetBase::magnifier
PlotMagnifier * magnifier()
Definition: plotwidget_base.cpp:813
PJ::PlotWidgetBase::_keep_aspect_ratio
bool _keep_aspect_ratio
Definition: plotwidget_base.h:145
PJ::PlotWidgetBase::STEPS
@ STEPS
Definition: plotwidget_base.h:36
PJ::PlotWidgetBase::curveListChanged
void curveListChanged()
PJ::PlotWidgetBase::LINES
@ LINES
Definition: plotwidget_base.h:32
sol::meta::enable
std::enable_if_t< all< Args... >::value, enable_t > enable
Definition: sol.hpp:2244
PJ::PlotWidgetBase::isZoomEnabled
bool isZoomEnabled() const
Definition: plotwidget_base.cpp:775
PJ::Range
Definition: plotdatabase.h:24
PJ::PlotWidgetBase::dropSignal
void dropSignal(QDropEvent *event)
PJ::PlotWidgetBase::qwtPlot
QwtPlot * qwtPlot()
Definition: plotwidget_base.cpp:165
PJ::PlotWidgetBase::CurveStyle
CurveStyle
Definition: plotwidget_base.h:30
plotdata.h
PJ::PlotWidgetBase::isEmpty
bool isEmpty() const
Definition: plotwidget_base.cpp:456
PlotWidgetBase
PJ::PlotWidgetBase::setLegendSize
void setLegendSize(int size)
Definition: plotwidget_base.cpp:753
PJ::PlotWidgetBase::setModeXY
virtual void setModeXY(bool enable)
Definition: plotwidget_base.cpp:304
PJ::PlotWidgetBase::STICKS
@ STICKS
Definition: plotwidget_base.h:35
PJ::PlotWidgetBase::CurveInfo::curve
QwtPlotCurve * curve
Definition: plotwidget_base.h:43
PJ::PlotWidgetBase::legend
PlotLegend * legend()
Definition: plotwidget_base.cpp:804
PJ::PlotWidgetBase::_xy_mode
bool _xy_mode
Definition: plotwidget_base.h:141
PJ::PlotWidgetBase::setKeepRatioXY
void setKeepRatioXY(bool active)
Definition: plotwidget_base.cpp:509
PJ::PlotWidgetBase::PlotWidgetBase
PlotWidgetBase(QWidget *parent)
Definition: plotwidget_base.cpp:309
PJ::PlotWidgetBase::maxZoomRect
QRectF maxZoomRect() const
Definition: plotwidget_base.cpp:299
PJ
Definition: dataloader_base.h:16
mqtt_test.data
dictionary data
Definition: mqtt_test.py:22
PlotMagnifier
Definition: plotmagnifier.h:15
PJ::PlotWidgetBase::STEPSINV
@ STEPSINV
Definition: plotwidget_base.h:37
PJ::PlotWidgetBase::widgetResized
void widgetResized()
PJ::PlotWidgetBase::setLegendAlignment
void setLegendAlignment(Qt::Alignment alignment)
Definition: plotwidget_base.cpp:761
QwtPlotMarker
A class for drawing markers.
Definition: qwt_plot_marker.h:45
PJ::PlotWidgetBase::createTimeSeries
virtual QwtSeriesWrapper * createTimeSeries(const PlotData *data, const QString &transform_ID={})
Definition: plotwidget_base.cpp:490
PJ::PlotWidgetBase::isXYPlot
bool isXYPlot() const
Definition: plotwidget_base.cpp:289
PJ::PlotWidgetBase::zoomer
PlotZoomer * zoomer()
Definition: plotwidget_base.cpp:808
PJ::PlotWidgetBase::updateMaximumZoomArea
void updateMaximumZoomArea()
Definition: plotwidget_base.cpp:818
PJ::PlotDataBase
Definition: plotdatabase.h:122
PJ::PlotWidgetBase::DOTS
@ DOTS
Definition: plotwidget_base.h:33
PJ::PlotWidgetBase::changeCurvesStyle
void changeCurvesStyle(CurveStyle style)
Definition: plotwidget_base.cpp:727
PJ::PlotWidgetBase::getColorHint
QColor getColorHint(PlotDataXY *data)
Definition: plotwidget_base.cpp:627
QwtPlotCurve
A plot item, that represents a series of points.
Definition: qwt_plot_curve.h:56
PJ::PlotWidgetBase::currentBoundingRect
QRectF currentBoundingRect() const
Definition: plotwidget_base.cpp:294


plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Nov 11 2024 03:23:45