mapviz.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_MAPVIZ_H_
31 #define MAPVIZ_MAPVIZ_H_
32 
33 // C++ standard libraries
34 #include <string>
35 #include <vector>
36 #include <map>
37 
38 #include <boost/shared_ptr.hpp>
39 
40 // QT libraries
41 #include <QtGui/QtGui>
42 #include <QDialog>
43 #include <QMenu>
44 #include <QTimer>
45 #include <QString>
46 #include <QShowEvent>
47 #include <QCloseEvent>
48 #include <QListWidgetItem>
49 #include <QModelIndex>
50 #include <QColor>
51 #include <QWidget>
52 #include <QStringList>
53 #include <QMainWindow>
54 
55 // ROS libraries
56 #include <ros/ros.h>
57 #include <pluginlib/class_loader.h>
58 #include <tf/transform_listener.h>
59 #include <yaml-cpp/yaml.h>
60 #include <std_srvs/Empty.h>
61 
62 // Auto-generated UI files
63 #include "ui_mapviz.h"
64 #include "ui_pluginselect.h"
65 
67 #include <mapviz/AddMapvizDisplay.h>
68 #include <mapviz/mapviz_plugin.h>
69 #include <mapviz/map_canvas.h>
70 #include <mapviz/video_writer.h>
71 
72 #include "stopwatch.h"
73 
74 namespace mapviz
75 {
76  class Mapviz : public QMainWindow
77  {
78  Q_OBJECT
79 
80  public:
81  Mapviz(bool is_standalone, int argc, char** argv, QWidget *parent = 0, Qt::WindowFlags flags = 0);
82  ~Mapviz();
83 
84  void Initialize();
85 
86  public Q_SLOTS:
87  void AutoSave();
88  void OpenConfig();
89  void SaveConfig();
90  void SaveConfigAs();
91  void ClearConfig();
92  void SelectNewDisplay();
93  void RemoveDisplay();
94  void RemoveDisplay(QListWidgetItem* item);
95  void ReorderDisplays();
96  void FixedFrameSelected(const QString& text);
97  void TargetFrameSelected(const QString& text);
98  void UpdateFrames();
99  void SpinOnce();
100  void UpdateSizeHints();
101  void ToggleConfigPanel(bool on);
102  void ToggleStatusBar(bool on);
103  void ToggleCaptureTools(bool on);
104  void ToggleFixOrientation(bool on);
105  void ToggleRotate90(bool on);
106  void ToggleEnableAntialiasing(bool on);
107  void ToggleShowPlugin(QListWidgetItem* item, bool visible);
108  void ToggleRecord(bool on);
109  void SetImageTransport(QAction* transport_action);
111  void CaptureVideoFrame();
112  void StopRecord();
113  void Screenshot();
114  void Force720p(bool on);
115  void Force480p(bool on);
116  void SetResizable(bool on);
117  void SelectBackgroundColor(const QColor &color);
118  void SetCaptureDirectory();
119  void Hover(double x, double y, double scale);
120  void Recenter();
121  void HandleProfileTimer();
122  void ClearHistory();
123 
124  Q_SIGNALS:
131  void FrameGrabbed(QImage);
132  void ImageTransportChanged();
133 
134  protected:
135  Ui::mapviz ui_;
136 
138 
139  QTimer frame_timer_;
140  QTimer spin_timer_;
141  QTimer save_timer_;
144 
145  QLabel* xy_pos_label_;
147 
148  QWidget* spacer1_;
149  QWidget* spacer2_;
150  QWidget* spacer3_;
151  QPushButton* recenter_button_;
152  QPushButton* rec_button_;
153  QPushButton* stop_button_;
154  QPushButton* screenshot_button_;
155 
156  int argc_;
157  char** argv_;
158 
164  QColor background_;
165 
166  std::string save_location_;
167 
168  std::string capture_directory_;
169  QThread video_thread_;
171 
173 
178 
181  std::map<QListWidgetItem*, MapvizPluginPtr> plugins_;
182 
184 
185  void Open(const std::string& filename);
186  void Save(const std::string& filename);
187 
189  const std::string& name,
190  const std::string& type,
191  bool visible,
192  bool collapsed,
193  int draw_order = 0);
194 
195  bool AddDisplay(
196  AddMapvizDisplay::Request& req,
197  AddMapvizDisplay::Response& resp);
198 
199  void ClearDisplays();
200  void AdjustWindowSize();
201 
202  virtual void showEvent(QShowEvent* event);
203  virtual void closeEvent(QCloseEvent* event);
204 
205  static const QString ROS_WORKSPACE_VAR;
206  static const QString MAPVIZ_CONFIG_FILE;
207  static const std::string IMAGE_TRANSPORT_PARAM;
208  };
209 }
210 
211 #endif // MAPVIZ_MAPVIZ_H_
mapviz::Mapviz::ClearHistory
void ClearHistory()
Definition: mapviz.cpp:932
mapviz::Mapviz::argc_
int argc_
Definition: mapviz.h:156
mapviz::Mapviz::video_thread_
QThread video_thread_
Definition: mapviz.h:169
mapviz::Mapviz::TargetFrameSelected
void TargetFrameSelected(const QString &text)
Definition: mapviz.cpp:1246
mapviz::Mapviz::rec_button_
QPushButton * rec_button_
Definition: mapviz.h:152
mapviz::Stopwatch
Definition: stopwatch.h:41
map_canvas.h
mapviz
Definition: color_button.h:36
mapviz::Mapviz::Force720p
void Force720p(bool on)
Definition: mapviz.cpp:431
mapviz::Mapviz::lat_lon_pos_label_
QLabel * lat_lon_pos_label_
Definition: mapviz.h:146
mapviz::Mapviz::ToggleCaptureTools
void ToggleCaptureTools(bool on)
Definition: mapviz.cpp:1295
mapviz::Mapviz::Recenter
void Recenter()
Definition: mapviz.cpp:1401
class_loader.h
boost::shared_ptr< tf::TransformListener >
mapviz::Mapviz::AddDisplay
bool AddDisplay(AddMapvizDisplay::Request &req, AddMapvizDisplay::Response &resp)
Definition: mapviz.cpp:980
mapviz::Mapviz::plugins_
std::map< QListWidgetItem *, MapvizPluginPtr > plugins_
Definition: mapviz.h:181
video_writer.h
mapviz::Mapviz::capture_directory_
std::string capture_directory_
Definition: mapviz.h:168
mapviz::Mapviz::ui_
Ui::mapviz ui_
Definition: mapviz.h:135
ros.h
mapviz::Mapviz::SetCaptureDirectory
void SetCaptureDirectory()
Definition: mapviz.cpp:1518
mapviz::Mapviz::frame_timer_
QTimer frame_timer_
Definition: mapviz.h:139
mapviz::Mapviz::MAPVIZ_CONFIG_FILE
static const QString MAPVIZ_CONFIG_FILE
Definition: mapviz.h:206
mapviz::Mapviz
Definition: mapviz.h:76
mapviz::Mapviz::image_transport_menu_
QMenu * image_transport_menu_
Definition: mapviz.h:137
mapviz::Mapviz::force_720p_
bool force_720p_
Definition: mapviz.h:161
mapviz::Mapviz::ClearConfig
void ClearConfig()
Definition: mapviz.cpp:883
mapviz::Mapviz::spacer1_
QWidget * spacer1_
Definition: mapviz.h:148
mapviz::Mapviz::profile_timer_
QTimer profile_timer_
Definition: mapviz.h:143
mapviz::Mapviz::Initialize
void Initialize()
Definition: mapviz.cpp:231
mapviz::Mapviz::SelectNewDisplay
void SelectNewDisplay()
Definition: mapviz.cpp:941
mapviz::Mapviz::UpdateImageTransportMenu
void UpdateImageTransportMenu()
Definition: mapviz.cpp:1363
mapviz::Mapviz::xy_pos_label_
QLabel * xy_pos_label_
Definition: mapviz.h:145
mapviz::Mapviz::Mapviz
Mapviz(bool is_standalone, int argc, char **argv, QWidget *parent=0, Qt::WindowFlags flags=0)
Definition: mapviz.cpp:87
mapviz::Mapviz::tf_manager_
swri_transform_util::TransformManagerPtr tf_manager_
Definition: mapviz.h:177
mapviz::Mapviz::node_
ros::NodeHandle * node_
Definition: mapviz.h:174
ros::ServiceServer
mapviz::Mapviz::background_
QColor background_
Definition: mapviz.h:164
mapviz::Mapviz::ToggleStatusBar
void ToggleStatusBar(bool on)
Definition: mapviz.cpp:1288
mapviz::Mapviz::ReorderDisplays
void ReorderDisplays()
Definition: mapviz.cpp:1502
mapviz::Mapviz::spin_timer_
QTimer spin_timer_
Definition: mapviz.h:140
mapviz::Mapviz::is_standalone_
bool is_standalone_
Definition: mapviz.h:159
mapviz::Mapviz::SaveConfigAs
void SaveConfigAs()
Definition: mapviz.cpp:899
mapviz::Mapviz::ToggleShowPlugin
void ToggleShowPlugin(QListWidgetItem *item, bool visible)
Definition: mapviz.cpp:1223
mapviz::Mapviz::SetImageTransport
void SetImageTransport(QAction *transport_action)
Definition: mapviz.cpp:1354
mapviz::Mapviz::record_timer_
QTimer record_timer_
Definition: mapviz.h:142
mapviz::Mapviz::force_480p_
bool force_480p_
Definition: mapviz.h:162
mapviz::Mapviz::ToggleRotate90
void ToggleRotate90(bool on)
Definition: mapviz.cpp:1264
mapviz::Mapviz::closeEvent
virtual void closeEvent(QCloseEvent *event)
Definition: mapviz.cpp:218
mapviz::Mapviz::RemoveDisplay
void RemoveDisplay()
Definition: mapviz.cpp:1468
mapviz::Mapviz::FixedFrameSelected
void FixedFrameSelected(const QString &text)
Definition: mapviz.cpp:1234
mapviz::Mapviz::SpinOnce
void SpinOnce()
Definition: mapviz.cpp:339
mapviz::Mapviz::ToggleEnableAntialiasing
void ToggleEnableAntialiasing(bool on)
Definition: mapviz.cpp:1269
mapviz::Mapviz::ImageTransportChanged
void ImageTransportChanged()
mapviz::Mapviz::CaptureVideoFrame
void CaptureVideoFrame()
Definition: mapviz.cpp:1382
transform_manager.h
mapviz::Mapviz::Hover
void Hover(double x, double y, double scale)
Definition: mapviz.cpp:1049
mapviz::Mapviz::ToggleConfigPanel
void ToggleConfigPanel(bool on)
Definition: mapviz.cpp:1274
mapviz::Mapviz::save_timer_
QTimer save_timer_
Definition: mapviz.h:141
mapviz::Mapviz::showEvent
virtual void showEvent(QShowEvent *event)
Definition: mapviz.cpp:213
mapviz::Mapviz::screenshot_button_
QPushButton * screenshot_button_
Definition: mapviz.h:154
mapviz::Mapviz::FrameGrabbed
void FrameGrabbed(QImage)
mapviz::Mapviz::loader_
pluginlib::ClassLoader< MapvizPlugin > * loader_
Definition: mapviz.h:179
mapviz::Mapviz::canvas_
MapCanvas * canvas_
Definition: mapviz.h:180
mapviz::Mapviz::meas_spin_
Stopwatch meas_spin_
Definition: mapviz.h:183
mapviz::VideoWriter
Definition: video_writer.h:45
mapviz::Mapviz::UpdateFrames
void UpdateFrames()
Definition: mapviz.cpp:353
mapviz::Mapviz::HandleProfileTimer
void HandleProfileTimer()
Definition: mapviz.cpp:1531
mapviz::Mapviz::ROS_WORKSPACE_VAR
static const QString ROS_WORKSPACE_VAR
Definition: mapviz.h:205
mapviz::Mapviz::AutoSave
void AutoSave()
Definition: mapviz.cpp:832
pluginlib::ClassLoader
mapviz::Mapviz::initialized_
bool initialized_
Definition: mapviz.h:160
mapviz::Mapviz::ClearDisplays
void ClearDisplays()
Definition: mapviz.cpp:1487
mapviz::Mapviz::resizable_
bool resizable_
Definition: mapviz.h:163
mapviz::Mapviz::save_location_
std::string save_location_
Definition: mapviz.h:166
mapviz::Mapviz::UpdateSizeHints
void UpdateSizeHints()
Definition: mapviz.cpp:1453
mapviz::Mapviz::ToggleFixOrientation
void ToggleFixOrientation(bool on)
Definition: mapviz.cpp:1259
mapviz::Mapviz::Force480p
void Force480p(bool on)
Definition: mapviz.cpp:447
transform_listener.h
mapviz::MapCanvas
Definition: map_canvas.h:57
mapviz::Mapviz::Save
void Save(const std::string &filename)
Definition: mapviz.cpp:756
mapviz::Mapviz::OpenConfig
void OpenConfig()
Definition: mapviz.cpp:866
mapviz::Mapviz::vid_writer_
VideoWriter * vid_writer_
Definition: mapviz.h:170
mapviz::Mapviz::StopRecord
void StopRecord()
Definition: mapviz.cpp:1406
mapviz::Mapviz::ToggleRecord
void ToggleRecord(bool on)
Definition: mapviz.cpp:1310
mapviz::Mapviz::stop_button_
QPushButton * stop_button_
Definition: mapviz.h:153
mapviz::Mapviz::AdjustWindowSize
void AdjustWindowSize()
Definition: mapviz.cpp:479
mapviz_plugin.h
mapviz::Mapviz::CreateNewDisplay
MapvizPluginPtr CreateNewDisplay(const std::string &name, const std::string &type, bool visible, bool collapsed, int draw_order=0)
Definition: mapviz.cpp:1128
mapviz::Mapviz::Screenshot
void Screenshot()
Definition: mapviz.cpp:1424
mapviz::Mapviz::spacer3_
QWidget * spacer3_
Definition: mapviz.h:150
mapviz::Mapviz::argv_
char ** argv_
Definition: mapviz.h:157
mapviz::Mapviz::add_display_srv_
ros::ServiceServer add_display_srv_
Definition: mapviz.h:175
mapviz::Mapviz::SelectBackgroundColor
void SelectBackgroundColor(const QColor &color)
Definition: mapviz.cpp:1512
mapviz::Mapviz::SaveConfig
void SaveConfig()
Definition: mapviz.cpp:888
mapviz::Mapviz::Open
void Open(const std::string &filename)
Definition: mapviz.cpp:524
mapviz::Mapviz::tf_
boost::shared_ptr< tf::TransformListener > tf_
Definition: mapviz.h:176
mapviz::Mapviz::spacer2_
QWidget * spacer2_
Definition: mapviz.h:149
mapviz::Mapviz::updating_frames_
bool updating_frames_
Definition: mapviz.h:172
mapviz::Mapviz::SetResizable
void SetResizable(bool on)
Definition: mapviz.cpp:463
mapviz::Mapviz::IMAGE_TRANSPORT_PARAM
static const std::string IMAGE_TRANSPORT_PARAM
Definition: mapviz.h:207
ros::NodeHandle
stopwatch.h
mapviz::Mapviz::recenter_button_
QPushButton * recenter_button_
Definition: mapviz.h:151
mapviz::Mapviz::~Mapviz
~Mapviz()
Definition: mapviz.cpp:206


mapviz
Author(s): Marc Alban
autogenerated on Sun Sep 8 2024 02:27:09