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 #include <QSet>
00043
00044 class QDockWidget;
00045 class QWidget;
00046
00047 namespace Ogre
00048 {
00049 class SceneManager;
00050 class SceneNode;
00051 }
00052
00053
00054 Q_DECLARE_METATYPE(ros::Time);
00055
00056 namespace rviz
00057 {
00058
00059 class StatusList;
00060 class DisplayContext;
00061 class PanelDockWidget;
00062
00063 class Display: public BoolProperty
00064 {
00065 Q_OBJECT
00066 public:
00067 Display();
00068 virtual ~Display();
00069
00071 void initialize( DisplayContext* context );
00072
00076 virtual QVariant getViewData( int column, int role ) const;
00077
00080 virtual Qt::ItemFlags getViewFlags( int column ) const;
00081
00085 virtual QString getClassId() const { return class_id_; }
00086
00089 virtual void setClassId( const QString& class_id ) { class_id_ = class_id; }
00090
00098 virtual void load( const Config& config );
00099
00103 virtual void save( Config config ) const;
00104
00116 virtual void setTopic( const QString &topic, const QString &datatype ) { }
00117
00119 bool isEnabled() const;
00120
00122 void setFixedFrame( const QString& fixed_frame );
00123
00127 virtual void update( float wall_dt, float ros_dt ) {}
00128
00130 virtual void reset();
00131
00144 virtual void setStatus( StatusProperty::Level level, const QString& name, const QString& text );
00145
00149 void setStatusStd( StatusProperty::Level level, const std::string& name, const std::string& text )
00150 {
00151 setStatus( level, QString::fromStdString( name ), QString::fromStdString( text ));
00152 }
00153
00155 virtual void deleteStatus( const QString& name );
00156
00158 void deleteStatusStd( const std::string& name ) { deleteStatus( QString::fromStdString( name )); }
00159
00161 void setVisibilityBits( uint32_t bits );
00162 void unsetVisibilityBits( uint32_t bits );
00163 uint32_t getVisibilityBits() { return visibility_bits_; }
00164
00166 Ogre::SceneNode* getSceneNode() const { return scene_node_; }
00167
00181 void setAssociatedWidget( QWidget* widget );
00182
00185 QWidget* getAssociatedWidget() const { return associated_widget_; }
00186
00189 PanelDockWidget* getAssociatedWidgetPanel() { return associated_widget_panel_; }
00190
00192 void setName( const QString& name );
00193
00195 void emitTimeSignal( ros::Time time );
00196
00197 Q_SIGNALS:
00198
00199 void timeSignal( rviz::Display* display, ros::Time time );
00200
00201 public Q_SLOTS:
00206 void setEnabled( bool enabled );
00207
00209 void queueRender();
00210
00212 virtual void setIcon( const QIcon& icon );
00213
00214 protected:
00215
00222 virtual void onInitialize() {}
00223
00225 virtual void onEnable() {}
00226
00228 virtual void onDisable() {}
00229
00233 virtual void clearStatuses();
00234
00236 virtual void fixedFrameChanged() {}
00237
00239 bool initialized() const { return initialized_; }
00240
00248 DisplayContext* context_;
00249
00253 Ogre::SceneManager* scene_manager_;
00254
00256 Ogre::SceneNode* scene_node_;
00257
00261 ros::NodeHandle update_nh_;
00262
00266 ros::NodeHandle threaded_nh_;
00267
00273 QString fixed_frame_;
00274
00275 public Q_SLOTS:
00276 virtual void onEnableChanged();
00277
00278 private Q_SLOTS:
00279 void setStatusInternal( int level, const QString& name, const QString& text );
00280 void deleteStatusInternal( const QString& name );
00281 void clearStatusesInternal();
00282 void associatedPanelVisibilityChange( bool visible );
00283 void disable();
00284
00285 private:
00286 StatusList* status_;
00287 QString class_id_;
00288 bool initialized_;
00289 uint32_t visibility_bits_;
00290 QWidget* associated_widget_;
00291 PanelDockWidget* associated_widget_panel_;
00292 };
00293
00294 }
00295
00296 #endif // DISPLAY_H