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

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

added toolbar actions for camera modes

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