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

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 bca99d was 585f78, checked in by Michael Ankele <ankele@…>, 13 years ago

GL: redraw only once during loading

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