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 TransformPoint(StampedPoint& point, const swri_transform_util::Transform& transform);
98  virtual void UpdateColor(QColor base_color, int i);
99  virtual void DrawCovariance();
100 
101  protected Q_SLOTS:
102  virtual void BufferSizeChanged(int value);
103  virtual void DrawIcon();
104  virtual void SetColor(const QColor& color);
105  virtual void SetDrawStyle(QString style);
106  virtual void SetDrawStyle(DrawStyle style);
107  virtual void SetStaticArrowSizes(bool isChecked);
108  virtual void SetArrowSize(int arrowSize);
109  virtual void PositionToleranceChanged(double value);
110  virtual void LapToggled(bool checked);
111  virtual void CovariancedToggled(bool checked);
112  virtual void ShowAllCovariancesToggled(bool checked);
113  virtual void SetUseLatestTransforms(bool checked);
114 
115  void ResetTransformedPoints();
116  void ClearPoints();
117 
118  protected:
119  void pushPoint(StampedPoint point);
120  double bufferSize() const;
121  double positionTolerance() const;
122  const std::deque<StampedPoint>& points() const;
124 
125 
126  private:
130  std::deque<StampedPoint> points_;
135  bool new_lap_;
136  QColor color_;
139  double scale_;
142 
143  private:
144  std::vector<std::deque<StampedPoint> > laps_;
147  };
148 }
149 
150 #endif // MAPVIZ_PLUGINS_POINT_DRAW_H_
mapviz_plugins::PointDrawingPlugin::CovariancedToggled
virtual void CovariancedToggled(bool checked)
Definition: point_drawing_plugin.cpp:165
mapviz_plugins::PointDrawingPlugin::points_
std::deque< StampedPoint > points_
Definition: point_drawing_plugin.h:130
mapviz_plugins::PointDrawingPlugin::StampedPoint
Definition: point_drawing_plugin.h:56
mapviz_plugins::PointDrawingPlugin::LapToggled
virtual void LapToggled(bool checked)
Definition: point_drawing_plugin.cpp:160
mapviz_plugins::PointDrawingPlugin::got_begin_
bool got_begin_
Definition: point_drawing_plugin.h:145
mapviz_plugins::PointDrawingPlugin::DrawArrow
virtual bool DrawArrow(const StampedPoint &point)
Definition: point_drawing_plugin.cpp:363
mapviz_plugins::PointDrawingPlugin::DrawPoints
virtual bool DrawPoints(double scale)
Definition: point_drawing_plugin.cpp:258
mapviz_plugins::PointDrawingPlugin::use_latest_transforms_
bool use_latest_transforms_
Definition: point_drawing_plugin.h:141
mapviz_plugins::PointDrawingPlugin::CollectLaps
virtual void CollectLaps()
Definition: point_drawing_plugin.cpp:297
mapviz_plugins::PointDrawingPlugin::ClearPoints
void ClearPoints()
Definition: point_drawing_plugin.cpp:218
mapviz_plugins::PointDrawingPlugin::laps_
std::vector< std::deque< StampedPoint > > laps_
Definition: point_drawing_plugin.h:144
mapviz_plugins::PointDrawingPlugin::covariance_checked_
bool covariance_checked_
Definition: point_drawing_plugin.h:133
mapviz_plugins::PointDrawingPlugin::buffer_size_
int buffer_size_
Definition: point_drawing_plugin.h:132
mapviz_plugins::PointDrawingPlugin::BufferSizeChanged
virtual void BufferSizeChanged(int value)
Definition: point_drawing_plugin.cpp:245
mapviz_plugins::PointDrawingPlugin
Definition: point_drawing_plugin.h:51
mapviz_plugins::PointDrawingPlugin::StampedPoint::transformed_arrow_point
tf::Point transformed_arrow_point
Definition: point_drawing_plugin.h:63
ros.h
mapviz_plugins::PointDrawingPlugin::begin_
tf::Point begin_
Definition: point_drawing_plugin.h:146
mapviz_plugins::PointDrawingPlugin::TransformPoint
virtual bool TransformPoint(StampedPoint &point)
Definition: point_drawing_plugin.cpp:414
mapviz_plugins::PointDrawingPlugin::ClearHistory
void ClearHistory()
Definition: point_drawing_plugin.cpp:73
mapviz_plugins::PointDrawingPlugin::SetColor
virtual void SetColor(const QColor &color)
Definition: point_drawing_plugin.cpp:405
mapviz_plugins::PointDrawingPlugin::SetStaticArrowSizes
virtual void SetStaticArrowSizes(bool isChecked)
Definition: point_drawing_plugin.cpp:149
mapviz_plugins::PointDrawingPlugin::SetUseLatestTransforms
virtual void SetUseLatestTransforms(bool checked)
Definition: point_drawing_plugin.cpp:175
mapviz_plugins::PointDrawingPlugin::pushPoint
void pushPoint(StampedPoint point)
Definition: point_drawing_plugin.cpp:198
mapviz_plugins::PointDrawingPlugin::Transform
virtual void Transform()
Definition: point_drawing_plugin.cpp:487
mapviz_plugins::PointDrawingPlugin::StampedPoint::source_frame
std::string source_frame
Definition: point_drawing_plugin.h:66
mapviz_plugins::PointDrawingPlugin::static_arrow_sizes_
bool static_arrow_sizes_
Definition: point_drawing_plugin.h:140
mapviz_plugins::PointDrawingPlugin::positionTolerance
double positionTolerance() const
Definition: point_drawing_plugin.cpp:235
mapviz_plugins::PointDrawingPlugin::DrawLines
virtual bool DrawLines()
Definition: point_drawing_plugin.cpp:328
mapviz_plugins::PointDrawingPlugin::StampedPoint::StampedPoint
StampedPoint()
Definition: point_drawing_plugin.h:58
mapviz_plugins::PointDrawingPlugin::ResetTransformedPoints
void ResetTransformedPoints()
Definition: point_drawing_plugin.cpp:181
mapviz_plugins::PointDrawingPlugin::LINES
@ LINES
Definition: point_drawing_plugin.h:76
tf::Point
tf::Vector3 Point
mapviz_plugins::PointDrawingPlugin::show_all_covariances_checked_
bool show_all_covariances_checked_
Definition: point_drawing_plugin.h:134
mapviz_plugins::PointDrawingPlugin::scale_
double scale_
Definition: point_drawing_plugin.h:139
mapviz_plugins::PointDrawingPlugin::lap_checked_
bool lap_checked_
Definition: point_drawing_plugin.h:137
mapviz_plugins::PointDrawingPlugin::DrawCovariance
virtual void DrawCovariance()
Definition: point_drawing_plugin.cpp:634
mapviz_plugins::PointDrawingPlugin::position_tolerance_
double position_tolerance_
Definition: point_drawing_plugin.h:131
mapviz_plugins::PointDrawingPlugin::PositionToleranceChanged
virtual void PositionToleranceChanged(double value)
Definition: point_drawing_plugin.cpp:155
mapviz_plugins::PointDrawingPlugin::color_
QColor color_
Definition: point_drawing_plugin.h:136
swri_transform_util::Transform
mapviz_plugins::PointDrawingPlugin::bufferSize
double bufferSize() const
Definition: point_drawing_plugin.cpp:223
mapviz_plugins::PointDrawingPlugin::PointDrawingPlugin
PointDrawingPlugin()
Definition: point_drawing_plugin.cpp:47
mapviz_plugins::PointDrawingPlugin::DrawLapsArrows
virtual bool DrawLapsArrows()
Definition: point_drawing_plugin.cpp:679
mapviz_plugins::PointDrawingPlugin::arrow_size_
int arrow_size_
Definition: point_drawing_plugin.h:127
mapviz_plugins::PointDrawingPlugin::buffer_holder_
int buffer_holder_
Definition: point_drawing_plugin.h:138
mapviz_plugins::PointDrawingPlugin::new_lap_
bool new_lap_
Definition: point_drawing_plugin.h:135
mapviz_plugins::PointDrawingPlugin::POINTS
@ POINTS
Definition: point_drawing_plugin.h:77
mapviz_plugins::PointDrawingPlugin::StampedPoint::transformed_point
tf::Point transformed_point
Definition: point_drawing_plugin.h:62
mapviz_plugins::PointDrawingPlugin::DrawLaps
virtual bool DrawLaps()
Definition: point_drawing_plugin.cpp:558
mapviz_plugins::PointDrawingPlugin::StampedPoint::orientation
tf::Quaternion orientation
Definition: point_drawing_plugin.h:61
mapviz_plugins::PointDrawingPlugin::ShowAllCovariancesToggled
virtual void ShowAllCovariancesToggled(bool checked)
Definition: point_drawing_plugin.cpp:170
mapviz_plugins::PointDrawingPlugin::StampedPoint::transformed_cov_points
std::vector< tf::Point > transformed_cov_points
Definition: point_drawing_plugin.h:71
transform_datatypes.h
ros::Time
mapviz_plugins::PointDrawingPlugin::StampedPoint::transformed_arrow_right
tf::Point transformed_arrow_right
Definition: point_drawing_plugin.h:65
mapviz_plugins::PointDrawingPlugin::ARROWS
@ ARROWS
Definition: point_drawing_plugin.h:78
mapviz_plugins::PointDrawingPlugin::DrawArrows
virtual bool DrawArrows()
Definition: point_drawing_plugin.cpp:387
mapviz_plugins::PointDrawingPlugin::SetArrowSize
virtual void SetArrowSize(int arrowSize)
Definition: point_drawing_plugin.cpp:119
mapviz_plugins::PointDrawingPlugin::SetDrawStyle
virtual void SetDrawStyle(QString style)
Definition: point_drawing_plugin.cpp:125
mapviz_plugins::PointDrawingPlugin::StampedPoint::transformed
bool transformed
Definition: point_drawing_plugin.h:67
mapviz_plugins::PointDrawingPlugin::StampedPoint::stamp
ros::Time stamp
Definition: point_drawing_plugin.h:68
mapviz_plugins::PointDrawingPlugin::StampedPoint::cov_points
std::vector< tf::Point > cov_points
Definition: point_drawing_plugin.h:70
mapviz::MapvizPlugin
mapviz_plugins::PointDrawingPlugin::StampedPoint::transformed_arrow_left
tf::Point transformed_arrow_left
Definition: point_drawing_plugin.h:64
mapviz_plugins::PointDrawingPlugin::single_frame_
bool single_frame_
Definition: point_drawing_plugin.h:123
mapviz_plugins::PointDrawingPlugin::cur_point_
StampedPoint cur_point_
Definition: point_drawing_plugin.h:129
mapviz_plugins::PointDrawingPlugin::draw_style_
DrawStyle draw_style_
Definition: point_drawing_plugin.h:128
mapviz_plugins::PointDrawingPlugin::StampedPoint::point
tf::Point point
Definition: point_drawing_plugin.h:60
mapviz_plugins
Definition: attitude_indicator_plugin.h:61
mapviz_plugins::PointDrawingPlugin::DrawStyle
DrawStyle
Definition: point_drawing_plugin.h:74
tf::Quaternion
mapviz_plugins::PointDrawingPlugin::DrawIcon
virtual void DrawIcon()
Definition: point_drawing_plugin.cpp:79
map_canvas.h
mapviz_plugins::PointDrawingPlugin::~PointDrawingPlugin
virtual ~PointDrawingPlugin()
Definition: point_drawing_plugin.h:82
mapviz_plugins::PointDrawingPlugin::UpdateColor
virtual void UpdateColor(QColor base_color, int i)
Definition: point_drawing_plugin.cpp:620
mapviz_plugin.h
mapviz_plugins::PointDrawingPlugin::points
const std::deque< StampedPoint > & points() const
Definition: point_drawing_plugin.cpp:240


mapviz_plugins
Author(s): Marc Alban
autogenerated on Wed Jan 17 2024 03:27:49