view_manager.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2012, Willow Garage, Inc.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * * Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * * Neither the name of the Willow Garage, Inc. nor the names of its
14  * contributors may be used to endorse or promote products derived from
15  * this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27  * POSSIBILITY OF SUCH DAMAGE.
28  */
29 #ifndef VIEW_MANAGER_H
30 #define VIEW_MANAGER_H
31 
32 #include <QList>
33 #include <QObject>
34 #include <QStringList>
35 
36 #include <rviz/pluginlib_factory.h>
37 #include <rviz/view_controller.h>
38 #include <rviz/rviz_export.h>
39 
40 namespace Ogre
41 {
42 class SceneNode;
43 }
44 
45 namespace rviz
46 {
47 class DisplayContext;
48 class Property;
49 class PropertyTreeModel;
50 class ViewController;
51 class ViewControllerContainer;
52 
53 class RVIZ_EXPORT ViewManager : public QObject
54 {
55  Q_OBJECT
56 public:
57  ViewManager(DisplayContext* context);
58  ~ViewManager() override;
59 
60  void initialize();
61 
62  void update(float wall_dt, float ros_dt);
63 
66  ViewController* getCurrent() const;
67 
68  ViewController* create(const QString& type);
69 
70  int getNumViews() const;
71 
72  ViewController* getViewAt(int index) const;
73 
74  void add(ViewController* view, int index = -1);
75 
79  ViewController* take(ViewController* view);
80 
84  ViewController* takeAt(int index);
85 
87  {
88  return property_model_;
89  }
90 
91  void load(const Config& config);
92  void save(Config config) const;
93 
95  void setCurrentFrom(ViewController* view_to_copy);
96 
99  ViewController* copy(ViewController* source);
100 
102  {
103  return factory_;
104  }
105 
108  void setRenderPanel(RenderPanel* render_panel);
109 
112  {
113  return render_panel_;
114  }
115 
116 public Q_SLOTS:
117 
120  void copyCurrentToList();
121 
124  void setCurrentViewControllerType(const QString& new_class_id);
125 
126 Q_SIGNALS:
127  void configChanged();
128 
130  void currentChanged();
131 
132 private Q_SLOTS:
133  void onCurrentDestroyed(QObject* obj);
134 
135 private:
143  void setCurrent(ViewController* new_current, bool mimic_view);
144 
151 };
152 
157 {
158  Q_OBJECT
159 public:
160  Qt::ItemFlags getViewFlags(int column) const override;
161 
172  void addChild(Property* child, int index = -1) override;
173 
174  void addChildToFront(Property* child);
175 };
176 
177 } // end namespace rviz
178 
179 #endif // VIEW_MANAGER_H
Ogre
Definition: axes_display.h:35
rviz::ViewManager::getPropertyModel
PropertyTreeModel * getPropertyModel()
Definition: view_manager.h:86
rviz::ViewManager::root_property_
ViewControllerContainer * root_property_
Definition: view_manager.h:146
rviz::PropertyTreeModel
Definition: property_tree_model.h:38
rviz::PluginlibFactory
Definition: pluginlib_factory.h:51
rviz::ViewManager::render_panel_
RenderPanel * render_panel_
Definition: view_manager.h:150
rviz::ViewControllerContainer::getViewFlags
Qt::ItemFlags getViewFlags(int column) const override
Return item flags appropriate for the given column (0 or 1) for this Property.
Definition: view_manager.cpp:278
rviz::Property
A single element of a property tree, with a name, value, description, and possibly children.
Definition: property.h:100
rviz::ViewManager::factory_
PluginlibFactory< ViewController > * factory_
Definition: view_manager.h:148
rviz::ViewManager::getFactory
PluginlibFactory< ViewController > * getFactory() const
Definition: view_manager.h:101
rviz::ViewManager::getRenderPanel
RenderPanel * getRenderPanel() const
Return the 3D view widget managed by this ViewManager.
Definition: view_manager.h:111
rviz::ViewControllerContainer::addChildToFront
void addChildToFront(Property *child)
Definition: view_manager.cpp:292
update
void update(const std::string &key, const XmlRpc::XmlRpcValue &v)
rviz
Definition: add_display_dialog.cpp:54
rviz::ViewControllerContainer
Container property for ViewControllers which gets the drag/drop right for the funky way Current-View ...
Definition: view_manager.h:156
rviz::ViewManager::current_
ViewController * current_
Definition: view_manager.h:149
pluginlib_factory.h
rviz::DisplayContext
Pure-virtual base class for objects which give Display subclasses context in which to work.
Definition: display_context.h:81
rviz::ViewManager
Definition: view_manager.h:53
rviz::ViewControllerContainer::addChild
void addChild(Property *child, int index=-1) override
Add a child ViewController.
Definition: view_manager.cpp:283
add
bool add(const actionlib::TwoIntsGoal &req, actionlib::TwoIntsResult &res)
rviz::ViewController
Definition: view_controller.h:55
rviz::ViewManager::context_
DisplayContext * context_
Definition: view_manager.h:145
initialize
ROSCONSOLE_DECL void initialize()
view_controller.h
rviz::RenderPanel
Definition: render_panel.h:74
rviz::ViewManager::property_model_
PropertyTreeModel * property_model_
Definition: view_manager.h:147
rviz::Config
Configuration data storage class.
Definition: config.h:124


rviz
Author(s): Dave Hershberger, David Gossow, Josh Faust, William Woodall
autogenerated on Fri Aug 2 2024 08:43:10