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

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 25e08a was 284551, checked in by Frederik Heber <heber@…>, 12 years ago

GLWorldView shows the selected shapes from ShapeRegistry

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