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 IntProperty;
00073 class PropertyTreeModel;
00074 class RenderPanel;
00075 class SelectionManager;
00076 class StatusList;
00077 class TfFrameProperty;
00078 class ViewportMouseEvent;
00079 class WindowManagerInterface;
00080 class Tool;
00081 class OgreRenderQueueClearer;
00082 
00083 class VisualizationManagerPrivate;
00084 
00099 class VisualizationManager: public DisplayContext
00100 {
00101 Q_OBJECT
00102 public:
00110   VisualizationManager( RenderPanel* render_panel, WindowManagerInterface* wm = 0 );
00111 
00116   virtual ~VisualizationManager();
00117 
00122   void initialize();
00123 
00128   void startUpdate();
00129 
00130   /*
00131    * \brief Stop the update timers. No Displays will be updated and no ROS
00132    *        callbacks will be called during this period.
00133    */
00134   void stopUpdate();
00135 
00144   Display* createDisplay( const QString& class_lookup_name, const QString& name, bool enabled );
00145 
00150   void addDisplay( Display* display, bool enabled );
00151 
00155   void removeAllDisplays();
00156 
00164   void load( const Config& config );
00165 
00174   void save( Config config ) const;
00175 
00178   QString getFixedFrame() const;
00179 
00183   void setFixedFrame( const QString& frame );
00184   
00188   tf::TransformListener* getTFClient() const;
00189 
00193   Ogre::SceneManager* getSceneManager() const { return scene_manager_; }
00194 
00198   RenderPanel* getRenderPanel() const { return render_panel_; }
00199 
00203   double getWallClock();
00204 
00208   double getROSTime();
00209 
00213   double getWallClockElapsed();
00214 
00218   double getROSTimeElapsed();
00219 
00227   void handleChar( QKeyEvent* event, RenderPanel* panel );
00228 
00236   void handleMouseEvent( const ViewportMouseEvent& event );
00237 
00241   void resetTime();
00242 
00246   SelectionManager* getSelectionManager() const { return selection_manager_; }
00247 
00249   virtual ToolManager* getToolManager() const { return tool_manager_; }
00250 
00252   virtual ViewManager* getViewManager() const { return view_manager_; }
00253 
00257   void lockRender();
00258 
00262   void unlockRender();
00263 
00268   void queueRender();
00269 
00273   WindowManagerInterface* getWindowManager() const { return window_manager_; }
00274 
00278   ros::CallbackQueueInterface* getUpdateQueue();
00279 
00283   ros::CallbackQueueInterface* getThreadedQueue();
00284 
00286   FrameManager* getFrameManager() const { return frame_manager_; }
00287 
00293   uint64_t getFrameCount() const { return frame_count_; }
00294 
00297   void notifyConfigChanged();
00298 
00300   virtual DisplayFactory* getDisplayFactory() const { return display_factory_; }
00301 
00302   PropertyTreeModel* getDisplayTreeModel() const { return display_property_tree_model_; }
00303 
00305   void emitStatusUpdate( const QString& message );
00306 
00307   virtual DisplayGroup* getRootDisplayGroup() const { return root_display_group_; }
00308 
00309   virtual uint32_t getDefaultVisibilityBit() const { return default_visibility_bit_; }
00310 
00311   virtual BitAllocator* visibilityBits() { return &visibility_bit_allocator_; }
00312 
00313   virtual void setStatus( const QString & message );
00314 
00315   virtual void setHelpPath( const QString& help_path ) { help_path_ = help_path; }
00316   virtual QString getHelpPath() const { return help_path_; }
00317 
00318 Q_SIGNALS:
00319 
00321   void preUpdate();
00322 
00324   void configChanged();
00325 
00327   void statusUpdate( const QString& message );
00328 
00329 protected Q_SLOTS:
00339   void onUpdate();
00340 
00341   void onToolChanged( Tool* );
00342 
00343 protected:
00344   void updateTime();
00345   void updateFrames();
00346 
00347   void createColorMaterials();
00348 
00349   void threadedQueueThreadFunc();
00350 
00351   Ogre::Root* ogre_root_;                                 
00352   Ogre::SceneManager* scene_manager_;                     
00353 
00354   QTimer* update_timer_;                                 
00355   ros::Time last_update_ros_time_;                        
00356   ros::WallTime last_update_wall_time_;
00357 
00358   volatile bool shutting_down_;
00359 
00360   PropertyTreeModel* display_property_tree_model_;
00361   DisplayGroup* root_display_group_;
00362 
00363   ToolManager* tool_manager_;
00364   ViewManager* view_manager_;
00365 
00366   Property* global_options_;
00367   TfFrameProperty* fixed_frame_property_;          
00368   StatusList* global_status_;
00369   IntProperty* fps_property_;
00370 
00371   RenderPanel* render_panel_;
00372 
00373   ros::WallTime wall_clock_begin_;
00374   ros::Time ros_time_begin_;
00375   ros::WallDuration wall_clock_elapsed_;
00376   ros::Duration ros_time_elapsed_;
00377 
00378   ColorProperty* background_color_property_;
00379 
00380   float time_update_timer_;
00381   float frame_update_timer_;
00382 
00383   SelectionManager* selection_manager_;
00384 
00385   uint32_t render_requested_;
00386   uint64_t frame_count_;
00387 
00388   WindowManagerInterface* window_manager_;
00389   
00390   FrameManager* frame_manager_;
00391 
00392   OgreRenderQueueClearer* ogre_render_queue_clearer_;
00393 
00394 private Q_SLOTS:
00395   void updateFixedFrame();
00396   void updateBackgroundColor();
00397   void updateFps();
00398 
00399 private:
00400   DisplayFactory* display_factory_;
00401   VisualizationManagerPrivate* private_;
00402   uint32_t default_visibility_bit_;
00403   BitAllocator visibility_bit_allocator_;
00404   QString help_path_;
00405   Ogre::Light* directional_light_;
00406 };
00407 
00408 }
00409 
00410 #endif /* RVIZ_VISUALIZATION_MANAGER_H_ */


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