source: src/UIElements/Views/Qt4/Qt3D/GLWorldView.hpp

Candidate_v1.7.1 stable v1.7.1
Last change on this file was c742bb1, checked in by Frederik Heber <frederik.heber@…>, 4 months ago

Removes some Observer::signOn's from GLWorldView.

  • Property mode set to 100644
File size: 3.4 KB
Line 
1/*
2 * GLWorldView.hpp
3 *
4 * Created on: Auf 11, 2010
5 * Author: heber
6 */
7
8#ifndef GLWORLDVIEW_HPP_
9#define GLWORLDVIEW_HPP_
10
11// include config.h
12#ifdef HAVE_CONFIG_H
13#include <config.h>
14#endif
15
16#include <Qt3D/qglview.h>
17
18#include "CodePatterns/Observer/Observer.hpp"
19
20#include "World.hpp"
21
22#include <boost/thread/recursive_mutex.hpp>
23
24class molecule;
25class QKeyEvent;
26class GLWorldScene;
27class QGLPainter;
28class QToolBar;
29class QTimer;
30
31class QtObservedInstanceBoard;
32
33#include "UIElements/Qt4/InstanceBoard/ObservedValue_types.hpp"
34#include "UIElements/Views/Qt4/Qt3D/GLWorldScene.hpp"
35
36/** This class is the view on the 3D representation of the World, i.e. the whole
37 * of all molecules (consisting of atoms).
38 *
39 */
40class GLWorldView : public QGLView, public Observer
41{
42 Q_OBJECT
43public:
44 GLWorldView(
45 QtObservedInstanceBoard * _board,
46 QWidget *parent=0);
47 virtual ~GLWorldView();
48
49 void addToolBarActions(QToolBar *toolbar);
50 void createDomainBox();
51 void createDreiBein();
52
53 // Observer functions
54 void update(Observable *publisher);
55 void subjectKilled(Observable *publisher);
56 void recieveNotification(Observable *publisher, Notification_ptr notification);
57
58 GLWorldScene::SelectionModeType getSelectionMode() const;
59
60public slots:
61 void sceneChangeSignalled();
62 void triggerUpdateGL(const bool _needsRedraw = true);
63 void sceneHoverSignalled(const atomId_t _id);
64 void sceneHoverSignalled(const moleculeId_t _id, int);
65 void changeDreiBein();
66 void changeDomain();
67
68signals:
69 void updated(const bool _needsRedraw);
70 void sceneUpdated();
71 void worldSelectionChanged();
72 void hoverChanged(const atomId_t _id);
73 void hoverChanged(const moleculeId_t _id, int);
74 void ShapeAdded(const std::string &);
75 void ShapeRemoved(const std::string &);
76 void moleculesVisibilityChanged(ObservedValue_Index_t,bool);
77 void customContextMenuRequested(const QPoint&);
78
79protected:
80 void initializeGL(QGLPainter *painter);
81 void paintGL(QGLPainter *painter);
82 void drawDomainBox(QGLPainter *painter) const;
83 void drawDreiBein(QGLPainter *painter);
84 void updateGL();
85
86 // input functions
87 void mousePressEvent(QMouseEvent *event);
88 void mouseMoveEvent(QMouseEvent *event);
89 void keyPressEvent(QKeyEvent *event);
90 void wheelEvent(QWheelEvent *event);
91
92 // camera functions
93 enum CameraControlModeType{
94 Rotate,
95 Translate
96 };
97
98 void setCameraControlMode(CameraControlModeType mode);
99 CameraControlModeType getCameraControlMode(bool inverted = false);
100public slots:
101 void fitCameraToDomain();
102 void setCameraControlModeRotation();
103 void setCameraControlModeTranslation();
104 void setCameraStereoModeDisable();
105 void setCameraStereoModeHardware();
106 void setCameraStereoModeLeftRight();
107 void setCameraStereoModeRightLeft();
108 void setCameraStereoModeTopBottom();
109 void setCameraStereoModeBottomTop();
110 void setCameraStereoModeAnaglyph();
111
112protected:
113 CameraControlModeType cameraControlMode;
114
115private:
116 void setdreiBeinStatus(const bool status);
117 void setDomainStatus(const bool status);
118
119private:
120
121 GLWorldScene *worldscene;
122
123 bool changesPresent;
124 bool processingSelectionChanged; // workaround to prevent a loop in (atom_iterator <-> observer)
125
126 QPointF lastMousePos;
127
128 QGLSceneNode *meshDomainBox;
129 QGLSceneNode *meshDreiBein;
130
131 QGLMaterial *domainBoxMaterial;
132 QGLMaterial *dreiBeinMaterial[3];
133
134 QTimer *redrawTimer;
135 bool needsRedraw;
136
137 double defaultEyeSeparation;
138
139 boost::recursive_mutex changed_mutex;
140
141};
142
143#endif /* GLWORLDVIEW_HPP_ */
Note: See TracBrowser for help on using the repository browser.