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

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 073a2ff was 26ed25, checked in by Michael Ankele <ankele@…>, 13 years ago

GL: dreibein as a real mesh

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