Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef DISPLAY_H
00030 #define DISPLAY_H
00031
00032 #include <string>
00033
00034 #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829
00035 # include <ros/ros.h>
00036 #endif
00037
00038 #include "rviz/properties/status_property.h"
00039 #include "rviz/properties/bool_property.h"
00040
00041 #include <QIcon>
00042
00043 class QDockWidget;
00044 class QWidget;
00045
00046 namespace Ogre
00047 {
00048 class SceneManager;
00049 class SceneNode;
00050 }
00051
00052
00053 Q_DECLARE_METATYPE(ros::Time);
00054
00055 namespace rviz
00056 {
00057
00058 class StatusList;
00059 class DisplayContext;
00060 class PanelDockWidget;
00061
00062 class Display: public BoolProperty
00063 {
00064 Q_OBJECT
00065 public:
00066 Display();
00067 virtual ~Display();
00068
00070 void initialize( DisplayContext* context );
00071
00075 virtual QVariant getViewData( int column, int role ) const;
00076
00079 virtual Qt::ItemFlags getViewFlags( int column ) const;
00080
00084 virtual QString getClassId() const { return class_id_; }
00085
00088 virtual void setClassId( const QString& class_id ) { class_id_ = class_id; }
00089
00097 virtual void load( const Config& config );
00098
00102 virtual void save( Config config ) const;
00103
00105 bool isEnabled() const;
00106
00108 void setFixedFrame( const QString& fixed_frame );
00109
00113 virtual void update( float wall_dt, float ros_dt ) {}
00114
00116 virtual void reset();
00117
00130 virtual void setStatus( StatusProperty::Level level, const QString& name, const QString& text );
00131
00135 void setStatusStd( StatusProperty::Level level, const std::string& name, const std::string& text )
00136 {
00137 setStatus( level, QString::fromStdString( name ), QString::fromStdString( text ));
00138 }
00139
00141 virtual void deleteStatus( const QString& name );
00142
00144 void deleteStatusStd( const std::string& name ) { deleteStatus( QString::fromStdString( name )); }
00145
00147 void setVisibilityBits( uint32_t bits );
00148 void unsetVisibilityBits( uint32_t bits );
00149 uint32_t getVisibilityBits() { return visibility_bits_; }
00150
00152 Ogre::SceneNode* getSceneNode() const { return scene_node_; }
00153
00167 void setAssociatedWidget( QWidget* widget );
00168
00171 QWidget* getAssociatedWidget() const { return associated_widget_; }
00172
00175 PanelDockWidget* getAssociatedWidgetPanel() { return associated_widget_panel_; }
00176
00178 void setName( const QString& name );
00179
00181 void emitTimeSignal( ros::Time time );
00182
00183 Q_SIGNALS:
00184
00185 void timeSignal( rviz::Display* display, ros::Time time );
00186
00187 public Q_SLOTS:
00192 void setEnabled( bool enabled );
00193
00195 void queueRender();
00196
00198 virtual void setIcon( const QIcon& icon );
00199
00200 protected:
00201
00208 virtual void onInitialize() {}
00209
00211 virtual void onEnable() {}
00212
00214 virtual void onDisable() {}
00215
00219 virtual void clearStatuses();
00220
00222 virtual void fixedFrameChanged() {}
00223
00231 DisplayContext* context_;
00232
00236 Ogre::SceneManager* scene_manager_;
00237
00239 Ogre::SceneNode* scene_node_;
00240
00244 ros::NodeHandle update_nh_;
00245
00249 ros::NodeHandle threaded_nh_;
00250
00256 QString fixed_frame_;
00257
00258 public Q_SLOTS:
00259 virtual void onEnableChanged();
00260
00261 private Q_SLOTS:
00262 void setStatusInternal( int level, const QString& name, const QString& text );
00263 void deleteStatusInternal( const QString& name );
00264 void clearStatusesInternal();
00265 void associatedPanelVisibilityChange( bool visible );
00266 void disable();
00267
00268 private:
00269 StatusList* status_;
00270 QString class_id_;
00271 bool initialized_;
00272 uint32_t visibility_bits_;
00273 QWidget* associated_widget_;
00274 PanelDockWidget* associated_widget_panel_;
00275 };
00276
00277 }
00278
00279 #endif // DISPLAY_H