visualization_frame.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2008, Willow Garage, Inc.
00003  * All rights reserved.
00004  *
00005  * Redistribution and use in source and binary forms, with or without
00006  * modification, are permitted provided that the following conditions are met:
00007  *
00008  *     * Redistributions of source code must retain the above copyright
00009  *       notice, this list of conditions and the following disclaimer.
00010  *     * Redistributions in binary form must reproduce the above copyright
00011  *       notice, this list of conditions and the following disclaimer in the
00012  *       documentation and/or other materials provided with the distribution.
00013  *     * Neither the name of the Willow Garage, Inc. nor the names of its
00014  *       contributors may be used to endorse or promote products derived from
00015  *       this software without specific prior written permission.
00016  *
00017  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00018  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00019  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00020  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
00021  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00022  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00023  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00024  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00025  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00026  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00027  * POSSIBILITY OF SUCH DAMAGE.
00028  */
00029 
00030 #ifndef RVIZ_VISUALIZATION_FRAME_H
00031 #define RVIZ_VISUALIZATION_FRAME_H
00032 
00033 #include <QMainWindow>
00034 #include <QList>
00035 
00036 #include <string>
00037 #include <deque>
00038 
00039 #include "rviz/config.h"
00040 #include "rviz/window_manager_interface.h"
00041 #include "rviz/panel.h"
00042 
00043 #include <ros/time.h>
00044 
00045 class QSplashScreen;
00046 class QAction;
00047 class QActionGroup;
00048 class QTimer;
00049 class QDockWidget;
00050 class QLabel;
00051 class QToolButton;
00052 
00053 namespace rviz
00054 {
00055 
00056 class PanelFactory;
00057 class RenderPanel;
00058 class VisualizationManager;
00059 class Tool;
00060 class WidgetGeometryChangeDetector;
00061 
00071 class VisualizationFrame : public QMainWindow, public WindowManagerInterface
00072 {
00073 Q_OBJECT
00074 public:
00075   VisualizationFrame( QWidget* parent = 0 );
00076   ~VisualizationFrame();
00077 
00079   void setShowChooseNewMaster( bool show );
00080 
00083   void setHelpPath( const QString& help_path );
00084 
00089   void setSplashPath( const QString& splash_path );
00090 
00100   void initialize( const QString& display_config_file = "" );
00101 
00102   VisualizationManager* getManager() { return manager_; }
00103 
00104   // overrides from WindowManagerInterface
00105   virtual QWidget* getParentWindow();
00106   virtual PanelDockWidget* addPane( const QString& name,
00107                                 QWidget* panel,
00108                                 Qt::DockWidgetArea area = Qt::LeftDockWidgetArea,
00109                                 bool floating = true );
00110 
00115   void loadPersistentSettings();
00116 
00121   void savePersistentSettings();
00122 
00125   void loadDisplayConfig( const QString& path );
00126 
00133   bool saveDisplayConfig( const QString& path );
00134 
00135   QString getErrorMessage() const { return error_message_; }
00136 
00143   virtual void load( const Config& config );
00144 
00152   virtual void save( Config config );
00153 
00155   void setHideButtonVisibility( bool visible );
00156 
00157 public Q_SLOTS:
00160   void setDisplayConfigModified();
00161 
00163   virtual void setStatus( const QString & message );
00164 
00165 Q_SIGNALS:
00167   void statusUpdate( const QString& message );
00168 
00169 protected Q_SLOTS:
00170   void onOpen();
00171   void onSave();
00172   void onSaveAs();
00173   void onSaveImage();
00174   void onRecentConfigSelected();
00175   void onHelpWiki();
00176   void openNewPanelDialog();
00177   void openNewToolDialog();
00178   void showHelpPanel();
00179 
00181   void onToolbarRemoveTool( QAction* remove_tool_menu_action );
00182 
00185   void onToolbarActionTriggered( QAction* action );
00186 
00192   void addTool( Tool* tool );
00193 
00195   void removeTool( Tool* tool );
00196 
00201   void indicateToolIsCurrent(Tool* tool);
00202 
00206   void changeMaster();
00207 
00212   void onDeletePanel();
00213 
00214 protected Q_SLOTS:
00216   void markLoadingDone();
00217 
00219   void setImageSaveDirectory( const QString& directory );
00220 
00221   void reset();
00222 
00223   void onHelpDestroyed();
00224 
00225   void hideLeftDock( bool hide );
00226   void hideRightDock( bool hide );
00227 
00228   virtual void onDockPanelVisibilityChange( bool visible );
00229 
00230   void updateFps();
00231 
00232 protected:
00236   void initConfigs();
00237 
00238   void initMenus();
00239 
00240   void initToolbars();
00241 
00244   bool prepareToExit();
00245 
00246   virtual void closeEvent( QCloseEvent* event );
00247 
00248   virtual void leaveEvent ( QEvent * event );
00249 
00250   void markRecentConfig(const std::string& path);
00251   void updateRecentConfigMenu();
00252 
00253   QDockWidget* addPanelByName( const QString& name,
00254                                const QString& class_lookup_name,
00255                                Qt::DockWidgetArea area = Qt::LeftDockWidgetArea,
00256                                bool floating = true );
00257 
00259   void loadPanels( const Config& config );
00260 
00262   void savePanels( Config config );
00263 
00264   void loadWindowGeometry( const Config& config );
00265   void saveWindowGeometry( Config config );
00266 
00271   void setDisplayConfigFile( const std::string& path );
00272 
00273   void hideDockImpl( Qt::DockWidgetArea area, bool hide );
00274 
00275   RenderPanel* render_panel_;
00276 
00277   QAction* show_help_action_;
00278 
00279   std::string config_dir_;
00280   std::string persistent_settings_file_;
00281   std::string display_config_file_;
00282   std::string default_display_config_file_;
00283   std::string last_config_dir_;
00284   std::string last_image_dir_;
00285   std::string home_dir_;
00286 
00287   QMenu* file_menu_;
00288   QMenu* recent_configs_menu_;
00289   QMenu* view_menu_;
00290   QMenu* delete_view_menu_;
00291   QMenu* plugins_menu_;
00292   QList<QAction*> view_menu_actions_;
00293 
00294   QToolBar* toolbar_;
00295 
00296   VisualizationManager* manager_;
00297 
00298   std::string package_path_;
00299   QString help_path_;
00300   QString splash_path_;
00301 
00302   QSplashScreen* splash_;
00303 
00304   typedef std::deque<std::string> D_string;
00305   D_string recent_configs_;
00306 
00307   QActionGroup* toolbar_actions_;
00308   std::map<QAction*,Tool*> action_to_tool_map_;
00309   std::map<Tool*,QAction*> tool_to_action_map_;
00310   bool show_choose_new_master_option_;
00311 
00312   QToolButton* hide_left_dock_button_;
00313   QToolButton* hide_right_dock_button_;
00314 
00315   PanelFactory* panel_factory_;
00316 
00317   struct PanelRecord
00318   {
00319     Panel* panel;
00320     PanelDockWidget* dock;
00321     QString name;
00322     QString class_id;
00323     QAction* delete_action;
00324   };
00325   QList<PanelRecord> custom_panels_;
00326 
00327   QAction* add_tool_action_;
00328   QMenu* remove_tool_menu_;
00329 
00330   bool initialized_;
00331   WidgetGeometryChangeDetector* geom_change_detector_;
00332   bool loading_; 
00333   QTimer* post_load_timer_; 
00334 
00335   QLabel* status_label_;
00336   QLabel* fps_label_;
00337 
00338   int frame_count_;
00339   ros::WallTime last_fps_calc_time_;
00340 
00341   QString error_message_; 
00342 };
00343 
00344 }
00345 
00346 #endif // RVIZ_VISUALIZATION_FRAME_H


rviz
Author(s): Dave Hershberger, David Gossow, Josh Faust
autogenerated on Thu Aug 27 2015 15:02:28