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 #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 // needed for timeSignal
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 } // end namespace rviz
00295 
00296 #endif // DISPLAY_H


rviz
Author(s): Dave Hershberger, David Gossow, Josh Faust
autogenerated on Thu Jun 6 2019 18:02:15