PlotCurve.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 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 #ifndef GAZEBO_GUI_PLOT_PLOTCURVE_HH_
18 #define GAZEBO_GUI_PLOT_PLOTCURVE_HH_
19 
20 #include <memory>
21 #include <string>
22 #include <vector>
23 
24 #include <ignition/math/Vector2.hh>
25 
26 #include "gazebo/gui/qt.h"
27 #include "gazebo/util/system.hh"
28 
29 class QwtPlotCurve;
30 
31 namespace gazebo
32 {
33  namespace gui
34  {
35  // Forward declare private data class
36  class PlotCurvePrivate;
37 
38  class IncrementalPlot;
39 
41  class GZ_GUI_VISIBLE PlotCurve
42  {
45  public: explicit PlotCurve(const std::string &_label);
46 
48  public: ~PlotCurve();
49 
52  public: void AddPoint(const ignition::math::Vector2d &_pt);
53 
56  public: void AddPoints(const std::vector<ignition::math::Vector2d> &_pt);
57 
59  public: void Clear();
60 
63  public: void Attach(IncrementalPlot *_plot);
64 
66  public: void Detach();
67 
70  public: void SetLabel(const std::string &_label);
71 
74  public: std::string Label() const;
75 
78  public: void SetId(const unsigned int _id);
79 
82  public: unsigned int Id() const;
83 
87  public: void SetActive(const bool _active);
88 
91  public: bool Active() const;
92 
96  public: void SetAge(const unsigned int _age);
97 
100  public: unsigned int Age() const;
101 
104  public: unsigned int Size() const;
105 
108  public: ignition::math::Vector2d Min();
109 
112  public: ignition::math::Vector2d Max();
113 
118  public: ignition::math::Vector2d Point(const unsigned int _index) const;
119 
122  public: std::vector<ignition::math::Vector2d> Points() const;
123 
127  public: QwtPlotCurve *Curve();
128 
131  private: std::unique_ptr<PlotCurvePrivate> dataPtr;
132  };
133  }
134 }
135 #endif
A plotting widget that handles incremental addition of data.
Definition: IncrementalPlot.hh:46
Plot Curve data.
Definition: PlotCurve.hh:41