display.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 #ifndef RVIZ_DISPLAY_H
00031 #define RVIZ_DISPLAY_H
00032 
00033 #include <QObject>
00034 
00035 #include "properties/forwards.h"
00036 #include "status_level.h"
00037 
00038 #include <string>
00039 #include <boost/function.hpp>
00040 
00041 #include <ros/ros.h>
00042 
00043 namespace Ogre
00044 {
00045 class SceneManager;
00046 }
00047 
00048 namespace rviz
00049 {
00050 
00051 class PropertyManager;
00052 class CategoryProperty;
00053 class BoolProperty;
00054 
00055 class VisualizationManager;
00056 
00057 class Display;
00058 
00074 class Display: public QObject
00075 {
00076 Q_OBJECT
00077 public:
00078   Display();
00079   virtual ~Display();
00080 
00082   void initialize( const std::string& name, VisualizationManager* manager );
00083 
00087   virtual void onInitialize() {}
00088 
00093   void enable( bool force = false );
00098   void disable( bool force = false );
00099 
00100   bool isEnabled() { return enabled_; }
00101 
00103   void setEnabled(bool enable, bool force = false);
00104 
00105   const std::string& getName() const { return name_; }
00106   void setName(const std::string& name);
00107 
00112   virtual void update( float wall_dt, float ros_dt ) {}
00113 
00115 
00119   void setRenderCallback( boost::function<void ()> func );
00120 
00122   void setLockRenderCallback( boost::function<void ()> func );
00124   void setUnlockRenderCallback( boost::function<void ()> func );
00125 
00131   void setPropertyManager( PropertyManager* manager, const CategoryPropertyWPtr& parent );
00132 
00138   virtual void createProperties() {}
00139 
00144   void setFixedFrame( const std::string& frame );
00145 
00150   virtual void fixedFrameChanged() {}
00151 
00155   virtual void reset();
00156 
00169   void setStatus(StatusLevel level, const std::string& name, const std::string& text);
00170 
00174   void deleteStatus(const std::string& name);
00175 
00179   void clearStatuses();
00180 
00182   StatusLevel getStatus();
00183 
00185   virtual void hideVisible() {}
00186 
00188   virtual void restoreVisible() {}
00189 
00190 Q_SIGNALS:
00192   void stateChanged( Display* );
00193 
00194 protected:
00196   virtual void onEnable() = 0;
00198   virtual void onDisable() = 0;
00199 
00204   void causeRender();
00205 
00207   void lockRender();
00209   void unlockRender();
00210 
00211   VisualizationManager* vis_manager_;
00212 
00213   Ogre::SceneManager* scene_manager_;                 
00214   std::string name_;                                  
00215   bool enabled_;                                      
00216   StatusLevel status_;
00217 
00218   ros::NodeHandle update_nh_;
00219   ros::NodeHandle threaded_nh_;
00220 
00221   std::string fixed_frame_;                           
00222 
00223   boost::function<void ()> render_callback_;          
00224   boost::function<void ()> render_lock_;              
00225   boost::function<void ()> render_unlock_;            
00226 
00227   std::string property_prefix_;                       
00228 
00229   PropertyManager* property_manager_;                 
00230   CategoryPropertyWPtr parent_category_;                 
00231   StatusPropertyWPtr status_property_;
00232 
00233   friend class RenderAutoLock;
00234 };
00235 
00243 class RenderAutoLock
00244 {
00245 public:
00246   RenderAutoLock( Display* display )
00247   : display_( display )
00248   {
00249     display_->lockRender();
00250   }
00251 
00252   ~RenderAutoLock()
00253   {
00254     display_->unlockRender();
00255   }
00256 
00257 private:
00258   Display* display_;
00259 };
00260 
00261 } // namespace rviz
00262 
00263 #endif


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