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 #include <set>
00039 #include <boost/shared_ptr.hpp>
00040 
00041 #include <pluginlib/class_loader.h>
00042 
00043 #include "rviz/window_manager_interface.h"
00044 #include "rviz/config.h"
00045 #include "rviz/panel.h"
00046 
00047 class QSplashScreen;
00048 class QAction;
00049 class QActionGroup;
00050 class QTimer;
00051 
00052 namespace rviz
00053 {
00054 
00055 class PanelDockWidget;
00056 class RenderPanel;
00057 class DisplaysPanel;
00058 class ViewsPanel;
00059 class TimePanel;
00060 class SelectionPanel;
00061 class ToolPropertiesPanel;
00062 class VisualizationManager;
00063 class Tool;
00064 class HelpPanel;
00065 class WidgetGeometryChangeDetector;
00066 
00076 class VisualizationFrame : public QMainWindow, public WindowManagerInterface
00077 {
00078 Q_OBJECT
00079 public:
00080   VisualizationFrame( QWidget* parent = 0 );
00081   ~VisualizationFrame();
00082 
00083   void initialize( const std::string& display_config_file = "",
00084                    const std::string& fixed_frame = "",
00085                    const std::string& target_frame = "",
00086                    const std::string& splash_path = "",
00087                    const std::string& help_path = "",
00088                    bool verbose = false,
00089                    bool show_choose_new_master_option = false );
00090 
00091   VisualizationManager* getManager() { return manager_; }
00092 
00093   // overrides from WindowManagerInterface
00094   virtual QWidget* getParentWindow();
00095   virtual PanelDockWidget* addPane( const std::string& name,
00096                                     QWidget* panel,
00097                                     Qt::DockWidgetArea area = Qt::LeftDockWidgetArea,
00098                                     bool floating = true );
00099 
00100 public Q_SLOTS:
00103   void setDisplayConfigModified();
00104 
00105 protected Q_SLOTS:
00106   void onOpen();
00107   void save();
00108   void saveAs();
00109   void onSaveImage();
00110   void onRecentConfigSelected();
00111   void onHelpWiki();
00112   void openNewPanelDialog();
00113   void showHelpPanel();
00114 
00117   void onToolbarActionTriggered( QAction* action );
00118 
00124   void addTool(Tool* tool);
00125 
00130   void indicateToolIsCurrent(Tool* tool);
00131 
00135   void changeMaster();
00136 
00139   void onPanelRemoved( QObject* panel );
00140 
00145   void onDeletePanel();
00146 
00147 protected Q_SLOTS:
00149   void markLoadingDone();
00150 
00152   void setImageSaveDirectory( const QString& directory );
00153 
00154 protected:
00159   void initConfigs( const std::string& display_config_file_override );
00160 
00161   void initMenus();
00162 
00165   bool prepareToExit();
00166 
00167   virtual void moveEvent( QMoveEvent* event );
00168   virtual void closeEvent( QCloseEvent* event );
00169 
00170   void setSplashStatus( const std::string& status );
00171 
00172   void markRecentConfig(const std::string& path);
00173   void updateRecentConfigMenu();
00174 
00175   QRect hackedFrameGeometry();
00176 
00177   PanelDockWidget* addCustomPanel( const std::string& name,
00178                                    const std::string& class_lookup_name,
00179                                    Qt::DockWidgetArea area = Qt::LeftDockWidgetArea,
00180                                    bool floating = true );
00181 
00182   void loadCustomPanels( const boost::shared_ptr<Config>& config );
00183   void saveCustomPanels( const boost::shared_ptr<Config>& config );
00184 
00185   void loadWindowGeometry( const boost::shared_ptr<Config>& config );
00186   void saveWindowGeometry( const boost::shared_ptr<Config>& config );
00187 
00192   void loadGeneralConfig();
00193 
00198   void saveGeneralConfig();
00199 
00202   void loadDisplayConfig( const std::string& path );
00203 
00210   bool saveDisplayConfig( const std::string& path );
00211 
00212   QString getErrorMessage() const { return error_message_; }
00213 
00218   void setDisplayConfigFile( const std::string& path );
00219 
00220   RenderPanel* render_panel_;
00221   DisplaysPanel* displays_panel_;
00222   ViewsPanel* views_panel_;
00223   TimePanel* time_panel_;
00224   SelectionPanel* selection_panel_;
00225   ToolPropertiesPanel* tool_properties_panel_;
00226 
00227   HelpPanel* help_panel_;
00228   QAction* show_help_action_;
00229 
00230   std::string config_dir_;
00231   std::string general_config_file_;
00232   std::string display_config_file_;
00233   std::string default_display_config_file_;
00234   std::string last_config_dir_;
00235   std::string last_image_dir_;
00236   std::string home_dir_;
00237 
00238   QMenu* file_menu_;
00239   QMenu* recent_configs_menu_;
00240   QMenu* view_menu_;
00241   QMenu* delete_view_menu_;
00242   QMenu* plugins_menu_;
00243   QList<QAction*> view_menu_actions_;
00244 
00245   QToolBar* toolbar_;
00246 
00247   VisualizationManager* manager_;
00248 
00249   std::string package_path_;
00250   std::string help_path_;
00251 
00252   QSplashScreen* splash_;
00253 
00254   typedef std::deque<std::string> D_string;
00255   D_string recent_configs_;
00256 
00257   QPoint first_position_;
00258   QPoint position_correction_;
00259   int num_move_events_;
00260   QActionGroup* toolbar_actions_;
00261   std::map<QAction*,Tool*> action_to_tool_map_;
00262   std::map<Tool*,QAction*> tool_to_action_map_;
00263   bool show_choose_new_master_option_;
00264 
00265   typedef std::set<std::string> S_string;
00266   S_string panel_names_;
00267   pluginlib::ClassLoader<Panel>* panel_class_loader_;
00268 
00269   struct PanelRecord
00270   {
00271     Panel* panel;
00272     PanelDockWidget* dock;
00273     std::string name;
00274     std::string lookup_name; // class lookup name needed by pluginlib.
00275     QAction* delete_action;
00276   };
00277   typedef std::map<std::string, PanelRecord> M_PanelRecord;
00278   M_PanelRecord custom_panels_;
00279   bool initialized_;
00280   WidgetGeometryChangeDetector* geom_change_detector_;
00281   bool loading_; 
00282   QTimer* post_load_timer_; 
00283 
00284   QString error_message_; 
00285 };
00286 
00287 }
00288 
00289 #endif // RVIZ_VISUALIZATION_FRAME_H


rviz
Author(s): Dave Hershberger, Josh Faust
autogenerated on Mon Jan 6 2014 11:54:33