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

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

REFACTORING: moved drawDomainBox()/drawDreiBein() from GLWorldScene to GLWorldView

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