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

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

Added enable/disable for DreiBein and domain box.

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