view_manager.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 VIEW_MANAGER_H
00030 #define VIEW_MANAGER_H
00031 
00032 #include <QList>
00033 #include <QObject>
00034 #include <QStringList>
00035 
00036 #include "rviz/pluginlib_factory.h"
00037 #include "rviz/view_controller.h"
00038 
00039 namespace Ogre
00040 {
00041 class SceneNode;
00042 }
00043 
00044 namespace rviz
00045 {
00046 class DisplayContext;
00047 class Property;
00048 class PropertyTreeModel;
00049 class ViewController;
00050 class ViewControllerContainer;
00051 
00052 class ViewManager: public QObject
00053 {
00054 Q_OBJECT
00055 public:
00056   ViewManager( DisplayContext* context );
00057   ~ViewManager();
00058 
00059   void initialize();
00060 
00061   void update( float wall_dt, float ros_dt );
00062 
00065   ViewController* getCurrent() const;
00066 
00067   ViewController* create( const QString& type );
00068 
00069   int getNumViews() const;
00070 
00071   ViewController* getViewAt( int index ) const;
00072 
00073   void add( ViewController* view, int index = -1 );
00074 
00078   ViewController* take( ViewController* view );
00079 
00083   ViewController* takeAt( int index );
00084 
00085   PropertyTreeModel* getPropertyModel() { return property_model_; }
00086 
00087   void load( const Config& config );
00088   void save( Config config ) const;
00089 
00091   void setCurrentFrom( ViewController* view_to_copy );
00092 
00095   ViewController* copy( ViewController* source );
00096 
00097   PluginlibFactory<ViewController>* getFactory() const { return factory_; }
00098 
00101   void setRenderPanel( RenderPanel* render_panel );
00102 
00104   RenderPanel* getRenderPanel() const { return render_panel_; }
00105 
00106 public Q_SLOTS:
00107 
00109   void copyCurrentToList();
00110 
00113   void setCurrentViewControllerType( const QString& new_class_id );
00114 
00115 Q_SIGNALS:
00116   void configChanged();
00117 
00119   void currentChanged();
00120 
00121 private Q_SLOTS:
00122   void onCurrentDestroyed( QObject* obj );
00123 
00124 private:
00131   void setCurrent( ViewController* new_current, bool mimic_view );
00132 
00133   DisplayContext* context_;
00134   ViewControllerContainer* root_property_;
00135   PropertyTreeModel* property_model_;
00136   PluginlibFactory<ViewController>* factory_;
00137   ViewController* current_;
00138   RenderPanel* render_panel_;
00139 };
00140 
00144 class ViewControllerContainer: public Property
00145 {
00146 Q_OBJECT
00147 public:
00148   Qt::ItemFlags getViewFlags( int column ) const;
00149 
00160   virtual void addChild( Property* child, int index = -1 );
00161 
00162   void addChildToFront( Property* child );
00163 };
00164 
00165 } // end namespace rviz
00166 
00167 #endif // VIEW_MANAGER_H


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