grid_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_PLUGINS_GRID_PLUGIN_H_
31 #define MAPVIZ_PLUGINS_GRID_PLUGIN_H_
32 
33 // C++ standard libraries
34 #include <string>
35 #include <list>
36 
37 #include <mapviz/mapviz_plugin.h>
38 
39 // QT libraries
40 #include <QGLWidget>
41 #include <QObject>
42 #include <QWidget>
43 #include <QTimer>
44 
45 // ROS libraries
46 #include <ros/ros.h>
47 #include <tf/transform_datatypes.h>
48 
49 #include <mapviz/map_canvas.h>
50 
51 // QT autogenerated files
52 #include "ui_grid_config.h"
53 
54 namespace mapviz_plugins
55 {
57  {
58  Q_OBJECT
59 
60  public:
61  GridPlugin();
62  virtual ~GridPlugin();
63 
64  bool Initialize(QGLWidget* canvas);
65  void Shutdown();
66 
67  void Draw(double x, double y, double scale);
68 
69  void Transform();
70 
71  void LoadConfig(const YAML::Node& node, const std::string& path);
72  void SaveConfig(YAML::Emitter& emitter, const std::string& path);
73 
74  QWidget* GetConfigWidget(QWidget* parent);
75 
76  protected:
77  void PrintError(const std::string& message);
78  void PrintInfo(const std::string& message);
79  void PrintWarning(const std::string& message);
80 
81  protected Q_SLOTS:
82  void SelectFrame();
83  void FrameEdited();
84  void SetAlpha(double alpha);
85  void SetX(double x);
86  void SetY(double y);
87  void SetSize(double size);
88  void SetRows(int rows);
89  void SetColumns(int columns);
90  void DrawIcon();
91 
92  private:
93  Ui::grid_config ui_;
94  QWidget* config_widget_;
95 
96  double alpha_;
97 
99 
100  double size_;
101  int rows_;
102  int columns_;
103 
105 
106  std::list<tf::Point> top_points_;
107  std::list<tf::Point> bottom_points_;
108  std::list<tf::Point> left_points_;
109  std::list<tf::Point> right_points_;
110 
111  std::list<tf::Point> transformed_top_points_;
112  std::list<tf::Point> transformed_bottom_points_;
113  std::list<tf::Point> transformed_left_points_;
114  std::list<tf::Point> transformed_right_points_;
115 
117 
118  void RecalculateGrid();
119  void Transform(std::list<tf::Point>& src, std::list<tf::Point>& dst);
120  };
121 }
122 
123 #endif // MAPVIZ_PLUGINS_GRID_PLUGIN_H_
void LoadConfig(const YAML::Node &node, const std::string &path)
bool Initialize(QGLWidget *canvas)
swri_transform_util::Transform transform_
Definition: grid_plugin.h:116
std::list< tf::Point > transformed_left_points_
Definition: grid_plugin.h:113
void Draw(double x, double y, double scale)
TFSIMD_FORCE_INLINE const tfScalar & y() const
void PrintError(const std::string &message)
void PrintWarning(const std::string &message)
std::list< tf::Point > right_points_
Definition: grid_plugin.h:109
std::list< tf::Point > transformed_top_points_
Definition: grid_plugin.h:111
TFSIMD_FORCE_INLINE const tfScalar & x() const
std::list< tf::Point > top_points_
Definition: grid_plugin.h:106
void PrintInfo(const std::string &message)
std::list< tf::Point > transformed_bottom_points_
Definition: grid_plugin.h:112
void SetAlpha(double alpha)
std::list< tf::Point > bottom_points_
Definition: grid_plugin.h:107
QWidget * GetConfigWidget(QWidget *parent)
std::list< tf::Point > transformed_right_points_
Definition: grid_plugin.h:114
std::list< tf::Point > left_points_
Definition: grid_plugin.h:108
void SaveConfig(YAML::Emitter &emitter, const std::string &path)
void SetColumns(int columns)
void SetSize(double size)


mapviz_plugins
Author(s): Marc Alban
autogenerated on Thu Jun 6 2019 19:25:16