PlotTracker.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 
18 #ifndef GAZEBO_GUI_PLOT_PLOTTRACKER_HH_
19 #define GAZEBO_GUI_PLOT_PLOTTRACKER_HH_
20 
21 #include <memory>
22 
24 
25 namespace gazebo
26 {
27  namespace gui
28  {
29  class PlotTrackerPrivate;
30 
32  class PlotTracker: public QwtPlotPicker
33  {
36 #if (QWT_VERSION < ((6 << 16) | (1 << 8) | 0))
37  public: PlotTracker(QwtPlotCanvas *_canvas);
38 #else
39  public: PlotTracker(QWidget *_canvas);
40 #endif
41 
43  public: void Update();
44 
46  protected: virtual void updateDisplay();
47 
51  protected: virtual QwtText trackerTextF(const QPointF &_pos) const;
52 
56  protected: virtual void widgetMousePressEvent(QMouseEvent *_e);
57 
61  protected: virtual void widgetMouseReleaseEvent(QMouseEvent *_e);
62 
67  private: QString CurveInfoAt(const QwtPlotCurve *_curve,
68  const QPointF &_pos) const;
69 
74  private: QLineF CurveLineAt(const QwtPlotCurve *_curve,
75  const double _x) const;
76 
82  private: int UpperSampleIndex(const QwtSeriesData<QPointF> &_series,
83  const double _value) const;
84 
87  private: std::unique_ptr<PlotTrackerPrivate> dataPtr;
88  };
89  }
90 }
91 
92 #endif
virtual void widgetMousePressEvent(QMouseEvent *_e)
Mouse press event used to determine when to show/hide hover line.
void Update()
Update the tracker text.
virtual void updateDisplay()
Overriden to update the hover line and tracker text.
Mouse hover tracking.
Definition: PlotTracker.hh:32
PlotTracker(QwtPlotCanvas *_canvas)
Constructor.
virtual QwtText trackerTextF(const QPointF &_pos) const
Overriden to provide customized hover text.
virtual void widgetMouseReleaseEvent(QMouseEvent *_e)
Mouse release event used to determine when to show/hide hover line.