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

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 beadd0 was beadd0, checked in by Frederik Heber <heber@…>, 11 years ago

Changed atom ptr into atomicId_t param for atomInserted of GLWorld... classes.

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