visualization_manager.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2012, 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 
00031 #ifndef RVIZ_VISUALIZATION_MANAGER_H_
00032 #define RVIZ_VISUALIZATION_MANAGER_H_
00033 
00034 #include <deque>
00035 
00036 #include <ros/time.h>
00037 
00038 #include "rviz/bit_allocator.h"
00039 #include "rviz/config.h"
00040 #include "rviz/display_context.h"
00041 
00042 class QKeyEvent;
00043 class QTimer;
00044 
00045 namespace Ogre
00046 {
00047 class Root;
00048 class SceneManager;
00049 class SceneNode;
00050 class Light;
00051 }
00052 
00053 namespace ros
00054 {
00055 class CallbackQueueInterface;
00056 }
00057 
00058 namespace tf
00059 {
00060 class TransformListener;
00061 }
00062 
00063 namespace rviz
00064 {
00065 
00066 class ColorProperty;
00067 class Display;
00068 class DisplayFactory;
00069 class DisplayGroup;
00070 class FrameManager;
00071 class Property;
00072 class PropertyTreeModel;
00073 class RenderPanel;
00074 class SelectionManager;
00075 class StatusList;
00076 class TfFrameProperty;
00077 class ViewportMouseEvent;
00078 class WindowManagerInterface;
00079 class Tool;
00080 class OgreRenderQueueClearer;
00081 
00082 class VisualizationManagerPrivate;
00083 
00098 class VisualizationManager: public DisplayContext
00099 {
00100 Q_OBJECT
00101 public:
00109   VisualizationManager( RenderPanel* render_panel, WindowManagerInterface* wm = 0 );
00110 
00115   virtual ~VisualizationManager();
00116 
00121   void initialize();
00122 
00127   void startUpdate();
00128 
00129   /*
00130    * \brief Stop the update timers. No Displays will be updated and no ROS
00131    *        callbacks will be called during this period.
00132    */
00133   void stopUpdate();
00134 
00143   Display* createDisplay( const QString& class_lookup_name, const QString& name, bool enabled );
00144 
00149   void addDisplay( Display* display, bool enabled );
00150 
00154   void removeAllDisplays();
00155 
00163   void load( const Config& config );
00164 
00173   void save( Config config ) const;
00174 
00177   QString getFixedFrame() const;
00178 
00182   void setFixedFrame( const QString& frame );
00183   
00187   tf::TransformListener* getTFClient() const;
00188 
00192   Ogre::SceneManager* getSceneManager() const { return scene_manager_; }
00193 
00197   RenderPanel* getRenderPanel() const { return render_panel_; }
00198 
00202   double getWallClock();
00203 
00207   double getROSTime();
00208 
00212   double getWallClockElapsed();
00213 
00217   double getROSTimeElapsed();
00218 
00226   void handleChar( QKeyEvent* event, RenderPanel* panel );
00227 
00235   void handleMouseEvent( const ViewportMouseEvent& event );
00236 
00240   void resetTime();
00241 
00245   SelectionManager* getSelectionManager() const { return selection_manager_; }
00246 
00248   virtual ToolManager* getToolManager() const { return tool_manager_; }
00249 
00251   virtual ViewManager* getViewManager() const { return view_manager_; }
00252 
00256   void lockRender();
00257 
00261   void unlockRender();
00262 
00267   void queueRender();
00268 
00272   WindowManagerInterface* getWindowManager() const { return window_manager_; }
00273 
00277   ros::CallbackQueueInterface* getUpdateQueue();
00278 
00282   ros::CallbackQueueInterface* getThreadedQueue();
00283 
00285   FrameManager* getFrameManager() const { return frame_manager_; }
00286 
00292   uint64_t getFrameCount() const { return frame_count_; }
00293 
00296   void notifyConfigChanged();
00297 
00299   virtual DisplayFactory* getDisplayFactory() const { return display_factory_; }
00300 
00301   PropertyTreeModel* getDisplayTreeModel() const { return display_property_tree_model_; }
00302 
00304   void emitStatusUpdate( const QString& message );
00305 
00306   virtual DisplayGroup* getRootDisplayGroup() const { return root_display_group_; }
00307 
00308   virtual uint32_t getDefaultVisibilityBit() const { return default_visibility_bit_; }
00309 
00310   virtual BitAllocator* visibilityBits() { return &visibility_bit_allocator_; }
00311 
00312   virtual void setStatus( const QString & message );
00313 
00314   virtual void setHelpPath( const QString& help_path ) { help_path_ = help_path; }
00315   virtual QString getHelpPath() const { return help_path_; }
00316 
00317 Q_SIGNALS:
00318 
00320   void preUpdate();
00321 
00323   void configChanged();
00324 
00326   void statusUpdate( const QString& message );
00327 
00328 protected Q_SLOTS:
00338   void onUpdate();
00339 
00340   void onToolChanged( Tool* );
00341 
00342 protected:
00343   void updateTime();
00344   void updateFrames();
00345 
00346   void createColorMaterials();
00347 
00348   void threadedQueueThreadFunc();
00349 
00350   Ogre::Root* ogre_root_;                                 
00351   Ogre::SceneManager* scene_manager_;                     
00352 
00353   QTimer* update_timer_;                                 
00354   ros::Time last_update_ros_time_;                        
00355   ros::WallTime last_update_wall_time_;
00356 
00357   volatile bool shutting_down_;
00358 
00359   PropertyTreeModel* display_property_tree_model_;
00360   DisplayGroup* root_display_group_;
00361 
00362   ToolManager* tool_manager_;
00363   ViewManager* view_manager_;
00364 
00365   Property* global_options_;
00366   TfFrameProperty* fixed_frame_property_;          
00367   StatusList* global_status_;
00368 
00369   RenderPanel* render_panel_;
00370 
00371   ros::WallTime wall_clock_begin_;
00372   ros::Time ros_time_begin_;
00373   ros::WallDuration wall_clock_elapsed_;
00374   ros::Duration ros_time_elapsed_;
00375 
00376   ColorProperty* background_color_property_;
00377 
00378   float time_update_timer_;
00379   float frame_update_timer_;
00380 
00381   SelectionManager* selection_manager_;
00382 
00383   uint32_t render_requested_;
00384   uint64_t frame_count_;
00385 
00386   WindowManagerInterface* window_manager_;
00387   
00388   FrameManager* frame_manager_;
00389 
00390   OgreRenderQueueClearer* ogre_render_queue_clearer_;
00391 
00392 private Q_SLOTS:
00393   void updateFixedFrame();
00394   void updateBackgroundColor();
00395 
00396 private:
00397   DisplayFactory* display_factory_;
00398   VisualizationManagerPrivate* private_;
00399   uint32_t default_visibility_bit_;
00400   BitAllocator visibility_bit_allocator_;
00401   QString help_path_;
00402   Ogre::Light* directional_light_;
00403 };
00404 
00405 }
00406 
00407 #endif /* RVIZ_VISUALIZATION_MANAGER_H_ */


rviz
Author(s): Dave Hershberger, David Gossow, Josh Faust
autogenerated on Mon Oct 6 2014 07:26:36