gepetto-viewer 6.0.0
An user-friendly Graphical Interface
Loading...
Searching...
No Matches
osgwidget.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_OSGWIDGET_HH
18#define GEPETTO_GUI_OSGWIDGET_HH
19
20#include <gepetto/gui/fwd.hh>
21// This include must be include before any other Qt include for GLDEBUGPROC
23
24#include <QLabel>
25#include <QString>
26#include <QThread>
27#include <QTimer>
28#include <osg/ref_ptr>
29#include <osgQt/GraphicsWindowQt>
30#include <osgViewer/ViewerBase>
31#include <osgViewer/ViewerEventHandlers>
32
33class QToolBar;
34class QProcess;
35class QTextBrowser;
36class QTemporaryDir;
37
38namespace gepetto {
39namespace gui {
40typedef viewer::WindowManagerPtr_t WindowManagerPtr_t;
42
44class OSGWidget : public QWidget {
45 Q_OBJECT
46 public:
47 OSGWidget(WindowsManagerPtr_t wm, const std::string& name, MainWindow* parent,
48 Qt::WindowFlags f = 0,
49 osgViewer::ViewerBase::ThreadingModel threadingModel =
50 osgViewer::Viewer::ThreadPerContext);
51
52 virtual ~OSGWidget();
53
55
57
59
60 public slots:
62 void onHome();
63
64 void addFloor();
65
66 void toggleCapture(bool active);
67
69 void captureFrame(const std::string& filename);
70 bool startCapture(const std::string& filename, const std::string& extension);
72
73 protected:
74 virtual void paintEvent(QPaintEvent* event);
75
76 bool isFixedSize() const;
77
78 void setFixedSize(bool fixedSize);
79
80 void setWindowDimension(const osgVector2& size);
81
82 private slots:
83 void readyReadProcessOutput();
84 void toggleFullscreenMode(bool fullscreenOn);
85
86 private:
87 void initToolBar();
88 void initGraphicsWindowsAndViewer(MainWindow* parent,
89 const std::string& name);
90
91 osg::ref_ptr<osgQt::GraphicsWindowQt> graphicsWindow_;
93 osg::ref_ptr<PickHandler> pickHandler_;
94 WindowID wid_;
96 QTimer timer_;
97 int nSuccessiveStaticFrames_;
98 osgViewer::ViewerRefPtr viewer_;
99 osg::ref_ptr<osgViewer::ScreenCaptureHandler> screenCapture_;
100 QTemporaryDir* tmpDirectory_;
101
102 QToolBar* toolBar_;
103 QAction* recordMovie_;
104
105 // To record movies.
106 QProcess* process_;
107 QDialog* showPOutput_;
108 QTextBrowser* pOutput_;
109
110 QWidget *fullscreen_, *normal_;
111
112 friend class PickHandler;
113};
114} // namespace gui
115} // namespace gepetto
116
117#endif // GEPETTO_GUI_OSGWIDGET_HH
Class.
Definition mainwindow.hh:40
Widget that displays scenes.
Definition osgwidget.hh:44
bool isFixedSize() const
virtual void paintEvent(QPaintEvent *event)
WindowID windowID() const
WindowManagerPtr_t window() const
void captureFrame(const std::string &filename)
void setWindowDimension(const osgVector2 &size)
void onHome()
Replace the camera at her home position.
void setFixedSize(bool fixedSize)
void toggleCapture(bool active)
WindowsManagerPtr_t osg() const
bool startCapture(const std::string &filename, const std::string &extension)
OSGWidget(WindowsManagerPtr_t wm, const std::string &name, MainWindow *parent, Qt::WindowFlags f=0, osgViewer::ViewerBase::ThreadingModel threadingModel=osgViewer::Viewer::ThreadPerContext)
Definition pick-handler.hh:36
::osg::Vec2f osgVector2
Definition config-osg.h:98
viewer::shared_ptr< WindowsManager > WindowsManagerPtr_t
Definition fwd.hh:59
viewer::WindowID WindowID
Definition osgwidget.hh:41
viewer::WindowManagerPtr_t WindowManagerPtr_t
Definition osgwidget.hh:40
std::string WindowID
Definition fwd.h:26
Definition action-search-bar.hh:27