gepetto-viewer 6.0.0
An user-friendly Graphical Interface
Loading...
Searching...
No Matches
windows-manager.hh
Go to the documentation of this file.
1// Copyright (c) 2015-2018, LAAS-CNRS
2// Authors: Joseph Mirabel (joseph.mirabel@laas.fr)
3//
4// This file is part of gepetto-viewer.
5// gepetto-viewer is free software: you can redistribute it
6// and/or modify it under the terms of the GNU Lesser General Public
7// License as published by the Free Software Foundation, either version
8// 3 of the License, or (at your option) any later version.
9//
10// gepetto-viewer is distributed in the hope that it will be
11// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
12// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13// General Lesser Public License for more details. You should have
14// received a copy of the GNU Lesser General Public License along with
15// gepetto-viewer. If not, see <http://www.gnu.org/licenses/>.
16
17#ifndef GEPETTO_GUI_WINDOWSMANAGER_HH
18#define GEPETTO_GUI_WINDOWSMANAGER_HH
19
20#include <gepetto/gui/fwd.hh>
21// This include must be include before any other Qt include for GLDEBUGPROC
23
24#include <QColor>
25#include <QObject>
26#include <QVector3D>
27
28namespace gepetto {
29namespace gui {
30class WindowsManager : public QObject, public viewer::WindowsManager {
31 Q_OBJECT
32
33 public:
35
37
38 WindowID createWindow(const std::string& windowName);
39 WindowID createWindow(const std::string& windowName, OSGWidget* widget,
40 osgViewer::Viewer* viewer, osg::GraphicsContext* gc);
41
42 void insertNode(const std::string& nodeName, NodePtr_t node);
43 bool addToGroup(const std::string& nodeName, const std::string& groupName);
44 bool removeFromGroup(const std::string& nodeName,
45 const std::string& groupName);
46 bool deleteNode(const std::string& nodeName, bool all);
47
48 BodyTreeItems_t bodyTreeItems(const std::string& name) const;
49
50 void captureFrame(const WindowID windowId, const std::string& filename);
51 bool startCapture(const WindowID windowId, const std::string& filename,
52 const std::string& extension);
53 bool stopCapture(const WindowID windowId);
54
55 void refresh();
56 void setRefreshIsSynchronous(bool synchonous);
57
58 public slots:
59 WindowID createWindow(QString windowName);
61
62 protected:
64
65 virtual void addNode(const std::string& nodeName, NodePtr_t node,
66 GroupNodePtr_t parent);
67 virtual void addGroup(const std::string& groupName, GroupNodePtr_t group,
68 GroupNodePtr_t parent);
69
70 private:
71 typedef std::pair<BodyTreeItems_t, bool> BodyTreeItemsAndGroup_t;
72 typedef std::map<std::string, BodyTreeItemsAndGroup_t> BodyTreeItemMap_t;
73 BodyTreeWidget* bodyTree_;
74 BodyTreeItemMap_t nodeItemMap_;
75
76 bool initParent(NodePtr_t node, GroupNodePtr_t parent, bool isGroup);
77 void addToGroup(const std::string& nodeName, const std::string& groupName,
78 const NodePtr_t& node, const BodyTreeItems_t& groups,
79 bool isGroup);
80 void deleteBodyItem(const std::string& nodeName);
81
82 std::map<WindowID, OSGWidget*> widgets_;
83
84 bool refreshIsSynchronous_;
85 viewer::Mutex configsAsyncMtx_;
86 NodeConfigurations_t configsAsync_;
87};
88} // namespace gui
89} // namespace gepetto
90
91#endif // GEPETTO_GUI_WINDOWSMANAGER_HH
Contains the list of all the bodies in the scene.
Definition bodytreewidget.hh:31
Widget that displays scenes.
Definition osgwidget.hh:44
Definition windows-manager.hh:30
bool stopCapture(const WindowID windowId)
static WindowsManagerPtr_t create(BodyTreeWidget *bodyTree)
WindowID createWindow(QString windowName)
virtual void addNode(const std::string &nodeName, NodePtr_t node, GroupNodePtr_t parent)
virtual void addGroup(const std::string &groupName, GroupNodePtr_t group, GroupNodePtr_t parent)
viewer::WindowsManager Parent_t
Definition windows-manager.hh:34
bool addToGroup(const std::string &nodeName, const std::string &groupName)
void setRefreshIsSynchronous(bool synchonous)
WindowID createWindow(const std::string &windowName)
void insertNode(const std::string &nodeName, NodePtr_t node)
bool removeFromGroup(const std::string &nodeName, const std::string &groupName)
WindowID createWindow(const std::string &windowName, OSGWidget *widget, osgViewer::Viewer *viewer, osg::GraphicsContext *gc)
bool startCapture(const WindowID windowId, const std::string &filename, const std::string &extension)
WindowsManager(BodyTreeWidget *bodyTree)
bool deleteNode(const std::string &nodeName, bool all)
BodyTreeItems_t bodyTreeItems(const std::string &name) const
void captureFrame(const WindowID windowId, const std::string &filename)
Manage a set of windows that may share 3D objects.
Definition windows-manager.h:48
std::vector< NodeConfiguration > NodeConfigurations_t
Definition windows-manager.h:84
viewer::NodePtr_t NodePtr_t
Definition fwd.hh:52
viewer::shared_ptr< WindowsManager > WindowsManagerPtr_t
Definition fwd.hh:59
viewer::WindowID WindowID
Definition osgwidget.hh:41
viewer::GroupNodePtr_t GroupNodePtr_t
Definition fwd.hh:53
std::vector< BodyTreeItem * > BodyTreeItems_t
Definition fwd.hh:46
OpenThreads::Mutex Mutex
Definition windows-manager.h:30
Definition action-search-bar.hh:27