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 
00043 class QDockWidget;
00044 class QWidget;
00045 
00046 namespace Ogre
00047 {
00048 class SceneManager;
00049 class SceneNode;
00050 }
00051 
00052 // needed for timeSignal
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 } // end namespace rviz
00278 
00279 #endif // DISPLAY_H


rviz
Author(s): Dave Hershberger, David Gossow, Josh Faust
autogenerated on Mon Oct 6 2014 07:26:35