-
-
Notifications
You must be signed in to change notification settings - Fork 901
Expand file tree
/
Copy pathIfcViewerWidget.h
More file actions
62 lines (48 loc) · 1.65 KB
/
IfcViewerWidget.h
File metadata and controls
62 lines (48 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#ifndef IFCVIEWERWIDGET_H
#define IFCVIEWERWIDGET_H
#include <QOpenGLWidget>
#include <QOpenGLFunctions>
#include <QOpenGLContext>
#include <QMatrix4x4>
#include <osg/ref_ptr>
#include <osgViewer/GraphicsWindow>
#include <osgViewer/Viewer>
#include <osgGA/TrackballManipulator>
#include <osg/Group>
#include <string>
#include "ParseIfcFile.h"
#include "osg/Vec4"
class IfcViewerWidget : public QOpenGLWidget
{
Q_OBJECT
public:
IfcViewerWidget(
qreal dpiScale,
QWidget *parent = nullptr
);
public slots:
void loadFile(const std::string& filePath);
protected:
virtual void initializeGL() override; // to set up resources, state
virtual void resizeGL(int w, int h) override; // to set up viewport, projection, etc.
virtual void paintGL() override; // to render OpenGL scene
virtual void mousePressEvent(QMouseEvent *event) override;
virtual void mouseMoveEvent(QMouseEvent *event) override;
virtual void mouseReleaseEvent(QMouseEvent *event) override;
virtual void wheelEvent(QWheelEvent *event) override;
virtual bool event(QEvent* event) override;
private:
qreal m_dpiScale;
QMatrix4x4 m_projection;
osg::Vec4 m_clearColor;
osg::ref_ptr<osgGA::TrackballManipulator> m_mouseHandler;
osg::ref_ptr<osgViewer::GraphicsWindowEmbedded> m_graphicsWindow;
osg::ref_ptr<osgViewer::Viewer> m_viewer;
osg::ref_ptr<osg::Group> root; // OSG root node
ParseIfcFile m_parser;
osgGA::EventQueue* getEventQueue() const;
unsigned int getMouseButtonNum(QMouseEvent* event);
void setupViewController();
void orientScene(osg::ref_ptr<osg::Group> rootGroup);
};
#endif // IFCVIEWERWIDGET_H