source: src/UIElements/Views/Qt4/Qt3D/GLWorldView.hpp@ 1e1098

Action_Thermostats Add_AtomRandomPerturbation Add_FitFragmentPartialChargesAction Add_RotateAroundBondAction Add_SelectAtomByNameAction Added_ParseSaveFragmentResults AddingActions_SaveParseParticleParameters Adding_Graph_to_ChangeBondActions Adding_MD_integration_tests Adding_ParticleName_to_Atom Adding_StructOpt_integration_tests AtomFragments Automaking_mpqc_open AutomationFragmentation_failures Candidate_v1.5.4 Candidate_v1.6.0 Candidate_v1.6.1 ChangeBugEmailaddress ChangingTestPorts ChemicalSpaceEvaluator CombiningParticlePotentialParsing Combining_Subpackages Debian_Package_split Debian_package_split_molecuildergui_only Disabling_MemDebug Docu_Python_wait EmpiricalPotential_contain_HomologyGraph EmpiricalPotential_contain_HomologyGraph_documentation Enable_parallel_make_install Enhance_userguide Enhanced_StructuralOptimization Enhanced_StructuralOptimization_continued Example_ManyWaysToTranslateAtom Exclude_Hydrogens_annealWithBondGraph FitPartialCharges_GlobalError Fix_BoundInBox_CenterInBox_MoleculeActions Fix_ChargeSampling_PBC Fix_ChronosMutex Fix_FitPartialCharges Fix_FitPotential_needs_atomicnumbers Fix_ForceAnnealing Fix_IndependentFragmentGrids Fix_ParseParticles Fix_ParseParticles_split_forward_backward_Actions Fix_PopActions Fix_QtFragmentList_sorted_selection Fix_Restrictedkeyset_FragmentMolecule Fix_StatusMsg Fix_StepWorldTime_single_argument Fix_Verbose_Codepatterns Fix_fitting_potentials Fixes ForceAnnealing_goodresults ForceAnnealing_oldresults ForceAnnealing_tocheck ForceAnnealing_with_BondGraph ForceAnnealing_with_BondGraph_continued ForceAnnealing_with_BondGraph_continued_betteresults ForceAnnealing_with_BondGraph_contraction-expansion FragmentAction_writes_AtomFragments FragmentMolecule_checks_bonddegrees GeometryObjects Gui_Fixes Gui_displays_atomic_force_velocity ImplicitCharges IndependentFragmentGrids IndependentFragmentGrids_IndividualZeroInstances IndependentFragmentGrids_IntegrationTest IndependentFragmentGrids_Sole_NN_Calculation JobMarket_RobustOnKillsSegFaults JobMarket_StableWorkerPool JobMarket_unresolvable_hostname_fix MoreRobust_FragmentAutomation ODR_violation_mpqc_open PartialCharges_OrthogonalSummation PdbParser_setsAtomName PythonUI_with_named_parameters QtGui_reactivate_TimeChanged_changes Recreated_GuiChecks Rewrite_FitPartialCharges RotateToPrincipalAxisSystem_UndoRedo SaturateAtoms_findBestMatching SaturateAtoms_singleDegree StoppableMakroAction Subpackage_CodePatterns Subpackage_JobMarket Subpackage_LinearAlgebra Subpackage_levmar Subpackage_mpqc_open Subpackage_vmg Switchable_LogView ThirdParty_MPQC_rebuilt_buildsystem TrajectoryDependenant_MaxOrder TremoloParser_IncreasedPrecision TremoloParser_MultipleTimesteps TremoloParser_setsAtomName Ubuntu_1604_changes stable
Last change on this file since 1e1098 was 85c36d, checked in by Frederik Heber <heber@…>, 12 years ago

cached shapes in GLWorldScene + cleaner ShapeRegistry notifications

  • Property mode set to 100644
File size: 7.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
22class molecule;
23class QKeyEvent;
24class GLWorldScene;
25class QGLPainter;
26class QToolBar;
27class QTimer;
28
29/** This class is the view on the 3D representation of the World, i.e. the whole
30 * of all molecules (consisting of atoms).
31 *
32 */
33class GLWorldView : public QGLView, public Observer
34{
35 Q_OBJECT
36public:
37 GLWorldView(QWidget *parent=0);
38 virtual ~GLWorldView();
39
40 void addToolBarActions(QToolBar *toolbar);
41 void createDomainBox();
42 void createDreiBein();
43
44 // Observer functions
45 void update(Observable *publisher);
46 void subjectKilled(Observable *publisher);
47 void recieveNotification(Observable *publisher, Notification_ptr notification);
48
49public slots:
50 void changeSignalled();
51 void checkChanges();
52 void sceneChangeSignalled();
53 void sceneHoverSignalled(const atom *_atom);
54
55signals:
56 void changed();
57 void atomInserted(const atom *_atom);
58 void atomRemoved(const atom *_atom);
59 void moleculeInserted(const molecule *_molecule);
60 void moleculeRemoved(const molecule *_molecule);
61 void worldSelectionChanged();
62 void hoverChanged(const atom *_atom);
63
64protected:
65 void initializeGL(QGLPainter *painter);
66 void paintGL(QGLPainter *painter);
67 void drawDomainBox(QGLPainter *painter) const;
68 void drawDreiBein(QGLPainter *painter);
69
70 // input functions
71 void mousePressEvent(QMouseEvent *event);
72 void mouseMoveEvent(QMouseEvent *event);
73 void keyPressEvent(QKeyEvent *event);
74 void wheelEvent(QWheelEvent *event);
75
76 // camera functions
77 enum CameraControlModeType{
78 Rotate,
79 Translate
80 };
81
82 void setCameraControlMode(CameraControlModeType mode);
83 CameraControlModeType getCameraControlMode(bool inverted = false);
84public slots:
85 void fitCameraToDomain();
86 void setCameraControlModeRotation();
87 void setCameraControlModeTranslation();
88 void setCameraStereoModeDisable();
89 void setCameraStereoModeHardware();
90 void setCameraStereoModeLeftRight();
91 void setCameraStereoModeRightLeft();
92 void setCameraStereoModeTopBottom();
93 void setCameraStereoModeBottomTop();
94 void setCameraStereoModeAnaglyph();
95
96protected:
97 CameraControlModeType cameraControlMode;
98
99private:
100
101 GLWorldScene *worldscene;
102
103 bool changesPresent;
104 bool processingSelectionChanged; // workaround to prevent a loop in (atom_iterator <-> observer)
105
106 QPointF lastMousePos;
107
108 QGLSceneNode *meshDomainBox;
109 QGLSceneNode *meshDreiBein;
110
111 QGLMaterial *domainBoxMaterial;
112 QGLMaterial *dreiBeinMaterial[3];
113
114 QTimer *redrawTimer;
115 bool needsRedraw;
116
117 double defaultEyeSeparation;
118};
119
120
121
122//#include "CodePatterns/Observer/Observer.hpp"
123//#include "LinearAlgebra/Vector.hpp"
124//#include "changetypes.hpp"
125//
126//class atom;
127//class element;
128//class molecule;
129//
130//class GLMoleculeView : public QGLWidget, public Observer
131//{
132// Q_OBJECT
133//
134//public:
135//
136// GLMoleculeView( QWidget* parent);
137// ~GLMoleculeView();
138//
139//public slots:
140//
141// void setXRotation( int degrees );
142// void setYRotation( int degrees );
143// void setZRotation( int degrees );
144// void setScale( int distance );
145// void setLightPosition( int *light );
146// void setLightDiffuse( int *light );
147// void setLightAmbient( int *light );
148// void createDialogLight();
149// void toggleMultiViewEnabled();
150//
151// void init( QLabel *ptr );
152// void initCoordinates(QLabel *ptr);
153// void createView();
154// void hearMoleculeSelected(molecule *mol);
155// void hearAtomSelected(molecule *mol, atom *Walker);
156// void hearMoleculeChanged(molecule *mol, enum ChangesinMolecule type);
157// void hearAtomChanged(molecule *mol, atom *Walker, enum ChangesinAtom type);
158// void hearElementChanged(element *Runner, enum ChangesinElement type);
159// void hearMoleculeAdded(molecule *mol);
160// void hearAtomAdded(molecule *mol, atom *Walker);
161// void hearMoleculeRemoved(molecule *mol);
162// void hearAtomRemoved(molecule *mol, atom *Walker);
163//
164//signals:
165// void notifyMoleculeSelected( molecule *mol );
166// void notifyAtomSelected( molecule *mol, atom *Walker );
167// void notifyMoleculeChanged( molecule *mol, enum ChangesinMolecule type );
168// void notifyAtomChanged( molecule *mol, atom *Walker, enum ChangesinAtom type );
169// void notifyElementChanged( element *Runner, enum ChangesinElement type );
170// void notifyMoleculeAdded( molecule *mol);
171// void notifyElementAdded( element *Runner);
172// void notifyAtomAdded( molecule *mol, atom *Walker );
173// void notifyMoleculeRemoved( molecule *mol );
174// void notifyAtomRemoved( molecule *mol, atom *Walker );
175//
176//protected:
177//
178// void initializeGL();
179// void paintGL();
180// void resizeGL( int w, int h );
181// void makeSphere(const Vector &x, double radius, const unsigned char color[3]);
182// void makeCylinder(const Vector &x, const Vector &y, double radius, double height, const unsigned char color[3]);
183// void mousePressEvent(QMouseEvent* event);
184// void mouseReleaseEvent(QMouseEvent* event);
185//
186//public:
187//
188// /** Update function as we are an Observer.
189// *
190// * @param publisher ref to Observable
191// */
192// void update(Observable *publisher);
193//
194// /**
195// * This method is called when a special named change
196// * of the Observable occured
197// */
198// void recieveNotification(Observable *publisher, Notification_ptr notification);
199//
200// /**
201// * This method is called when the observed object is destroyed.
202// */
203// void subjectKilled(Observable *publisher);
204//
205//
206//private:
207//
208// typedef std::map< size_t, node > AtomNodeMap;
209// typedef std::map< std::pair< size_t, size_t> , node > BondNodeMap;
210// typedef std::map< size_t, QGLMaterial *> ElementMaterialMap;
211//
212// ElementMaterialMap ElementNoMaterialMap;
213// AtomNodeMap AtomsinSceneMap;
214// BondNodeMap BondsinSceneMap;
215//
216// QGLMaterial* getMaterial(size_t);
217// QGLSceneNode* getAtom(size_t);
218// QGLSceneNode* getBond(size_t, size_t);
219//
220// // old stuff
221//
222// GLuint object; // call list for the scene to be rendered
223// GLfloat xRot, yRot, zRot, scale; // rotation angles and scaling (zoom)
224// Vector position; //!< position of observer
225// Vector view; //!< point along line of view
226// Vector top; //!< giving upwards direction
227// Vector X,Y,Z; //!< vectors defining the coordinate system
228// int width; //!< width of window
229// int height; //!< height of window
230//
231// QLabel *StatusBar; //!< pointer to status bar for messages
232// QLabel *CoordinatesBar; //!< pointer to coordinates bar for view port
233//
234// GLfloat LightPosition[4]; //!< Light Position
235// GLfloat LightDiffuse[4]; //!< Diffuse Light Values
236// GLfloat LightAmbient[4]; //!< Ambient Light Values
237//
238// QPoint LeftButtonPos; //!< mouse position on mousePressEvent for LeftButton
239// QPoint MiddleButtonPos; //!< mouse position on mousePressEvent for MidButton
240// QPoint RightButtonPos; //!< mouse position on mousePressEvent for RightButton
241//
242// unsigned char SelectionColor[3] ; //!< highlight color
243//
244// bool isSignaller;
245//
246// bool MultiViewEnabled; //!< if true, split screen into four parts with additional xy,xz,yz views
247//};
248
249#endif /* GLWORLDVIEW_HPP_ */
Note: See TracBrowser for help on using the repository browser.