point_drawing_plugin.h
Go to the documentation of this file.
1 // *****************************************************************************
2 //
3 // Copyright (c) 2014, Southwest Research Institute® (SwRI®)
4 // All rights reserved.
5 //
6 // Redistribution and use in source and binary forms, with or without
7 // modification, are permitted provided that the following conditions are met:
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright
11 // notice, this list of conditions and the following disclaimer in the
12 // documentation and/or other materials provided with the distribution.
13 // * Neither the name of Southwest Research Institute® (SwRI®) nor the
14 // names of its contributors may be used to endorse or promote products
15 // derived from this software without specific prior written permission.
16 //
17 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 // ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
21 // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 //
28 // *****************************************************************************
29 
30 #ifndef MAPVIZ_POINT_DRAW_H_
31 #define MAPVIZ_POINT_DRAW_H_
32 
33 // C++ standard libraries
34 #include <string>
35 #include <list>
36 
37 #include <mapviz/mapviz_plugin.h>
38 #include <mapviz/map_canvas.h>
39 
40 // QT libraries
41 #include <QGLWidget>
42 #include <QObject>
43 #include <QWidget>
44 
45 // ROS libraries
46 #include <ros/ros.h>
47 #include <tf/transform_datatypes.h>
48 
49 namespace mapviz_plugins
50 {
52  {
53  Q_OBJECT
54 
55  public:
56  struct StampedPoint
57  {
59 
66  std::string source_frame;
69 
70  std::vector<tf::Point> cov_points;
71  std::vector<tf::Point> transformed_cov_points;
72  };
73 
74  enum DrawStyle
75  {
76  LINES = 0,
79  };
80 
83  {
84  }
85 
86  void ClearHistory();
87 
88  virtual void Transform();
89  virtual bool DrawPoints(double scale);
90  virtual bool DrawArrows();
91  virtual bool DrawArrow(const StampedPoint& point);
92  virtual bool DrawLaps();
93  virtual bool DrawLines();
94  virtual void CollectLaps();
95  virtual bool DrawLapsArrows();
96  virtual bool TransformPoint(StampedPoint& point);
97  virtual void UpdateColor(QColor base_color, int i);
98  virtual void DrawCovariance();
99 
100  protected Q_SLOTS:
101  virtual void BufferSizeChanged(int value);
102  virtual void DrawIcon();
103  virtual void SetColor(const QColor& color);
104  virtual void SetDrawStyle(QString style);
105  virtual void SetDrawStyle(DrawStyle style);
106  virtual void SetStaticArrowSizes(bool isChecked);
107  virtual void SetArrowSize(int arrowSize);
108  virtual void PositionToleranceChanged(double value);
109  virtual void LapToggled(bool checked);
110  virtual void CovariancedToggled(bool checked);
111  virtual void ShowAllCovariancesToggled(bool checked);
112  void ResetTransformedPoints();
113  void ClearPoints();
114 
115  protected:
116  void pushPoint(StampedPoint point);
117  double bufferSize() const;
118  double positionTolerance() const;
119  const std::deque<StampedPoint>& points() const;
120 
121  private:
125  std::deque<StampedPoint> points_;
130  bool new_lap_;
131  QColor color_;
134  double scale_;
136 
137  private:
138  std::vector<std::deque<StampedPoint> > laps_;
141  };
142 }
143 
144 #endif // MAPVIZ_PLUGINS_POINT_DRAW_H_
virtual void PositionToleranceChanged(double value)
virtual void SetArrowSize(int arrowSize)
virtual void UpdateColor(QColor base_color, int i)
std::vector< std::deque< StampedPoint > > laps_
tf::Vector3 Point
std::deque< StampedPoint > points_
virtual void SetColor(const QColor &color)
virtual void SetStaticArrowSizes(bool isChecked)
virtual bool DrawArrow(const StampedPoint &point)
virtual void ShowAllCovariancesToggled(bool checked)
virtual void CovariancedToggled(bool checked)
virtual void SetDrawStyle(QString style)
const std::deque< StampedPoint > & points() const
virtual bool TransformPoint(StampedPoint &point)


mapviz_plugins
Author(s): Marc Alban
autogenerated on Fri Dec 16 2022 03:59:33