Flatland
flatland_viz.h
1 /*
2  * ______ __ __ __
3  * /\ _ \ __ /\ \/\ \ /\ \__
4  * \ \ \L\ \ __ __ /\_\ \_\ \ \ \____ ___\ \ ,_\ ____
5  * \ \ __ \/\ \/\ \\/\ \ /'_` \ \ '__`\ / __`\ \ \/ /',__\
6  * \ \ \/\ \ \ \_/ |\ \ \/\ \L\ \ \ \L\ \/\ \L\ \ \ \_/\__, `\
7  * \ \_\ \_\ \___/ \ \_\ \___,_\ \_,__/\ \____/\ \__\/\____/
8  * \/_/\/_/\/__/ \/_/\/__,_ /\/___/ \/___/ \/__/\/___/
9  * @copyright Copyright 2017 Avidbots Corp.
10  * @name flatland_viz.h
11  * @brief Manages the librviz viewport for flatland
12  * @author Joseph Duchesne
13  *
14  * Software License Agreement (BSD License)
15  *
16  * Copyright (c) 2017, Avidbots Corp.
17  * All rights reserved.
18  *
19  * Redistribution and use in source and binary forms, with or without
20  * modification, are permitted provided that the following conditions
21  * are met:
22  *
23  * * Redistributions of source code must retain the above copyright
24  * notice, this list of conditions and the following disclaimer.
25  * * Redistributions in binary form must reproduce the above
26  * copyright notice, this list of conditions and the following
27  * disclaimer in the documentation and/or other materials provided
28  * with the distribution.
29  * * Neither the name of the Avidbots Corp. nor the names of its
30  * contributors may be used to endorse or promote products derived
31  * from this software without specific prior written permission.
32  *
33  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
34  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
35  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
36  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
37  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
38  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
39  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
40  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
41  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
42  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
43  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
44  * POSSIBILITY OF SUCH DAMAGE.
45  */
46 
47 #ifndef FLATLAND_VIZ_FLATLAND_VIZ_H
48 #define FLATLAND_VIZ_FLATLAND_VIZ_H
49 
50 #include <ros/ros.h>
51 #include <QAction>
52 #include <QActionGroup>
53 #include <QList>
54 #include <QMainWindow>
55 #include <QMenu>
56 #include <QMenuBar>
57 #include <QToolBar>
58 #include <QToolButton>
59 #include <QWidget>
60 #include <map>
61 #include <set>
62 
63 #include "flatland_msgs/DebugTopicList.h"
64 #include "rviz/config.h"
65 #include "rviz/panel.h"
66 #include "rviz/properties/property_tree_widget.h"
67 #include "rviz/tool.h"
68 #include "rviz/tool_manager.h"
69 #include "rviz/window_manager_interface.h"
70 
71 class QSplashScreen;
72 class QAction;
73 class QActionGroup;
74 class QTimer;
75 class QDockWidget;
76 class QLabel;
77 class QToolButton;
78 
79 namespace rviz {
80 class PanelFactory;
81 class Tool;
82 class Display;
83 class RenderPanel;
84 class VisualizationManager;
85 class WidgetGeometryChangeDetector;
86 }
87 
88 class FlatlandWindow;
89 
90 class FlatlandViz : public QWidget {
91  Q_OBJECT public :
97  FlatlandViz(FlatlandWindow* parent = 0);
98 
104  void RecieveDebugTopics(const flatland_msgs::DebugTopicList& msg);
105 
109  virtual ~FlatlandViz();
110 
111  rviz::VisualizationManager* manager_;
112 
113  private:
114  rviz::RenderPanel* render_panel_;
115 
116  rviz::Display* grid_;
117  rviz::Display* interactive_markers_;
118  std::map<std::string, rviz::Display*> debug_displays_;
119  ros::Subscriber debug_topic_subscriber_;
120  rviz::PropertyTreeWidget* tree_widget_;
121  FlatlandWindow* parent_;
122 
123  QMenu* file_menu_;
124  QMenu* recent_configs_menu_;
125  QMenu* view_menu_;
126  QMenu* delete_view_menu_;
127  QMenu* plugins_menu_;
128 
129  QToolBar* toolbar_;
130 
131  QActionGroup* toolbar_actions_;
132  std::map<QAction*, rviz::Tool*> action_to_tool_map_;
133  std::map<rviz::Tool*, QAction*> tool_to_action_map_;
134  bool show_choose_new_master_option_;
135 
136  QAction* add_tool_action_;
137  QMenu* remove_tool_menu_;
138 
140  bool toolbar_visible_;
141 
142  // protected Q_SLOTS:
143  void fullScreenChange(bool hidden);
144 
145  void setDisplayConfigModified();
146  void addTool(rviz::Tool*);
147  void removeTool(rviz::Tool*);
148  void refreshTool(rviz::Tool*);
149  void indicateToolIsCurrent(rviz::Tool*);
150  void onToolbarActionTriggered(QAction* action);
151  void onToolbarRemoveTool(QAction* remove_tool_menu_action);
152  void initToolbars();
153  void initMenus();
154  void openNewToolDialog();
155  void setFullScreen(bool full_screen);
156 };
157 
158 #endif // FLATLAND_VIZ_FLATLAND_VIZ_H
Definition: flatland_window.h:85
Definition: flatland_viz.h:79
Definition: flatland_viz.h:90