$search
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 <boost/shared_ptr.hpp> 00039 00040 #include "rviz/window_manager_interface.h" 00041 #include "rviz/config.h" 00042 00043 class QSplashScreen; 00044 class QAction; 00045 class QActionGroup; 00046 00047 namespace rviz 00048 { 00049 00050 class PanelDockWidget; 00051 class RenderPanel; 00052 class DisplaysPanel; 00053 class ViewsPanel; 00054 class TimePanel; 00055 class SelectionPanel; 00056 class ToolPropertiesPanel; 00057 class VisualizationManager; 00058 class Tool; 00059 00069 class VisualizationFrame : public QMainWindow, public WindowManagerInterface 00070 { 00071 Q_OBJECT 00072 public: 00073 VisualizationFrame( QWidget* parent = 0 ); 00074 ~VisualizationFrame(); 00075 00076 void initialize( const std::string& display_config_file = "", 00077 const std::string& fixed_frame = "", 00078 const std::string& target_frame = "", 00079 const std::string& splash_path = "", 00080 bool verbose=false ); 00081 00082 VisualizationManager* getManager() { return manager_; } 00083 00084 // overrides from WindowManagerInterface 00085 virtual QWidget* getParentWindow(); 00086 virtual PanelDockWidget* addPane( const std::string& name, QWidget* panel, Qt::DockWidgetArea area = Qt::LeftDockWidgetArea, bool floating = true ); 00087 00088 protected Q_SLOTS: 00089 void onOpen(); 00090 void onSave(); 00091 void onRecentConfigSelected(); 00092 void onHelpWiki(); 00093 00096 void onToolbarActionTriggered( QAction* action ); 00097 00102 void addTool(Tool* tool); 00103 00106 void indicateToolIsCurrent(Tool* tool); 00107 00108 protected: 00109 void initConfigs(); 00110 void initMenus(); 00111 void loadDisplayConfig(const std::string& path); 00112 void saveConfigs(); 00113 00114 void moveEvent( QMoveEvent* event ); 00115 void closeEvent( QCloseEvent* event ); 00116 00118 00119 void onSplashLoadStatus( const std::string& status ); 00120 00121 void markRecentConfig(const std::string& path); 00122 void updateRecentConfigMenu(); 00123 00124 QRect hackedFrameGeometry(); 00125 00126 RenderPanel* render_panel_; 00127 DisplaysPanel* displays_panel_; 00128 ViewsPanel* views_panel_; 00129 TimePanel* time_panel_; 00130 SelectionPanel* selection_panel_; 00131 ToolPropertiesPanel* tool_properties_panel_; 00132 00133 boost::shared_ptr<Config> general_config_; 00134 boost::shared_ptr<Config> display_config_; 00135 std::string config_dir_; 00136 std::string general_config_file_; 00137 std::string display_config_file_; 00138 std::string last_config_dir_; 00139 00140 QMenu* file_menu_; 00141 QMenu* recent_configs_menu_; 00142 QMenu* view_menu_; 00143 QMenu* plugins_menu_; 00144 QList<QAction*> view_menu_actions_; 00145 00146 QToolBar* toolbar_; 00147 00148 VisualizationManager* manager_; 00149 00150 std::string package_path_; 00151 00152 QSplashScreen* splash_; 00153 00154 typedef std::deque<std::string> D_string; 00155 D_string recent_configs_; 00156 00157 QPoint first_position_; 00158 QPoint position_correction_; 00159 int num_move_events_; 00160 QActionGroup* toolbar_actions_; 00161 std::map<QAction*,Tool*> action_to_tool_map_; 00162 std::map<Tool*,QAction*> tool_to_action_map_; 00163 }; 00164 00165 } 00166 00167 #endif // RVIZ_VISUALIZATION_FRAME_H