IncrementalPlot.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2016 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 
18 #ifndef _INCREMENTAL_PLOT_HH_
19 #define _INCREMENTAL_PLOT_HH_
20 
21 #include <map>
22 #include <list>
23 
24 #include <qwt/qwt_plot_magnifier.h>
25 #include <qwt/qwt_plot.h>
26 
27 #include "gazebo/math/Vector2d.hh"
28 
29 #include "gazebo/gui/qt.h"
30 #include "gazebo/util/system.hh"
31 
32 class QwtPlotCurve;
33 class QwtPlotDirectPainter;
34 
35 namespace gazebo
36 {
37  namespace gui
38  {
40  class GZ_GUI_VISIBLE IncrementalPlot : public QwtPlot
41  {
42  Q_OBJECT
43 
46  public: IncrementalPlot(QWidget *_parent = NULL);
47 
49  public: virtual ~IncrementalPlot();
50 
53  public: virtual QSize sizeHint() const;
54 
59  public slots: void Add(const QString &_label, const QPointF &_pt);
60 
65  public slots: void Add(const QString &_label,
66  const std::list<QPointF> &_pts);
67 
70  public: void Clear(const QString &_label);
71 
73  public: void Clear();
74 
78  public: bool HasCurve(const QString &_label);
79 
81  public: void Update();
82 
85  protected: void dragEnterEvent(QDragEnterEvent *_evt);
86 
89  protected: void dropEvent(QDropEvent *_evt);
90 
93  private: void AdjustCurve(QwtPlotCurve *_curve);
94 
98  private: QwtPlotCurve *AddCurve(const QString &_label);
99 
102  private: typedef std::map<QString, QwtPlotCurve *> CurveMap;
103 
105  private: CurveMap curves;
106 
108  private: QwtPlotDirectPainter *directPainter;
109 
111  private: QwtPlotMagnifier *magnifier;
112  };
113  }
114 }
115 #endif
#define NULL
Definition: CommonTypes.hh:31
A plotting widget that handles incremental addition of data.
Definition: IncrementalPlot.hh:40