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_
mapviz_plugins::GridPlugin::Initialize
bool Initialize(QGLWidget *canvas)
Definition: grid_plugin.cpp:201
mapviz_plugins::GridPlugin::ui_
Ui::grid_config ui_
Definition: grid_plugin.h:93
mapviz_plugins::GridPlugin::rows_
int rows_
Definition: grid_plugin.h:101
ros.h
mapviz_plugins::GridPlugin::right_points_
std::list< tf::Point > right_points_
Definition: grid_plugin.h:109
mapviz_plugins::GridPlugin::transformed_
bool transformed_
Definition: grid_plugin.h:104
mapviz_plugins::GridPlugin::DrawIcon
void DrawIcon()
Definition: grid_plugin.cpp:93
mapviz_plugins::GridPlugin::RecalculateGrid
void RecalculateGrid()
Definition: grid_plugin.cpp:246
mapviz_plugins::GridPlugin::GridPlugin
GridPlugin()
Definition: grid_plugin.cpp:50
mapviz_plugins::GridPlugin::config_widget_
QWidget * config_widget_
Definition: grid_plugin.h:94
mapviz_plugins::GridPlugin::PrintWarning
void PrintWarning(const std::string &message)
Definition: grid_plugin.cpp:189
mapviz_plugins::GridPlugin::SetRows
void SetRows(int rows)
Definition: grid_plugin.cpp:146
mapviz_plugins::GridPlugin::SetColumns
void SetColumns(int columns)
Definition: grid_plugin.cpp:153
mapviz_plugins::GridPlugin::FrameEdited
void FrameEdited()
Definition: grid_plugin.cpp:170
mapviz_plugins::GridPlugin::SetY
void SetY(double y)
Definition: grid_plugin.cpp:132
tf::Point
tf::Vector3 Point
mapviz_plugins::GridPlugin::SetSize
void SetSize(double size)
Definition: grid_plugin.cpp:139
mapviz_plugins::GridPlugin::GetConfigWidget
QWidget * GetConfigWidget(QWidget *parent)
Definition: grid_plugin.cpp:194
mapviz_plugins::GridPlugin::LoadConfig
void LoadConfig(const YAML::Node &node, const std::string &path)
Definition: grid_plugin.cpp:312
mapviz_plugins::GridPlugin::PrintInfo
void PrintInfo(const std::string &message)
Definition: grid_plugin.cpp:184
mapviz_plugins::GridPlugin::alpha_
double alpha_
Definition: grid_plugin.h:96
swri_transform_util::Transform
mapviz_plugins::GridPlugin::SaveConfig
void SaveConfig(YAML::Emitter &emitter, const std::string &path)
Definition: grid_plugin.cpp:369
mapviz_plugins::GridPlugin::transformed_right_points_
std::list< tf::Point > transformed_right_points_
Definition: grid_plugin.h:114
mapviz_plugins::GridPlugin::Transform
void Transform()
Definition: grid_plugin.cpp:285
mapviz_plugins::GridPlugin::left_points_
std::list< tf::Point > left_points_
Definition: grid_plugin.h:108
mapviz_plugins::GridPlugin::columns_
int columns_
Definition: grid_plugin.h:102
mapviz_plugins::GridPlugin::~GridPlugin
virtual ~GridPlugin()
Definition: grid_plugin.cpp:84
mapviz_plugins::GridPlugin::transform_
swri_transform_util::Transform transform_
Definition: grid_plugin.h:116
transform_datatypes.h
mapviz_plugins::GridPlugin::top_left_
tf::Point top_left_
Definition: grid_plugin.h:98
mapviz_plugins::GridPlugin::Shutdown
void Shutdown()
Definition: grid_plugin.cpp:89
mapviz_plugins::GridPlugin::transformed_top_points_
std::list< tf::Point > transformed_top_points_
Definition: grid_plugin.h:111
mapviz_plugins::GridPlugin::SelectFrame
void SelectFrame()
Definition: grid_plugin.cpp:160
mapviz_plugins::GridPlugin::bottom_points_
std::list< tf::Point > bottom_points_
Definition: grid_plugin.h:107
mapviz_plugins::GridPlugin::SetX
void SetX(double x)
Definition: grid_plugin.cpp:125
mapviz::MapvizPlugin
mapviz_plugins::GridPlugin::transformed_bottom_points_
std::list< tf::Point > transformed_bottom_points_
Definition: grid_plugin.h:112
mapviz_plugins::GridPlugin::size_
double size_
Definition: grid_plugin.h:100
mapviz_plugins::GridPlugin
Definition: grid_plugin.h:56
mapviz_plugins::GridPlugin::top_points_
std::list< tf::Point > top_points_
Definition: grid_plugin.h:106
mapviz_plugins::GridPlugin::Draw
void Draw(double x, double y, double scale)
Definition: grid_plugin.cpp:210
mapviz_plugins
Definition: attitude_indicator_plugin.h:61
mapviz_plugins::GridPlugin::SetAlpha
void SetAlpha(double alpha)
Definition: grid_plugin.cpp:120
map_canvas.h
mapviz_plugins::GridPlugin::transformed_left_points_
std::list< tf::Point > transformed_left_points_
Definition: grid_plugin.h:113
mapviz_plugins::GridPlugin::PrintError
void PrintError(const std::string &message)
Definition: grid_plugin.cpp:179
mapviz_plugin.h


mapviz_plugins
Author(s): Marc Alban
autogenerated on Sun Sep 8 2024 02:27:14