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

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

Introduced atom_observables and GLWorldView observes World, GLMoleculeObject_atom observes its atom.

Observer changes:

  • new Channels pattern required from CodePatterns 1.1.5 and that Observable signing on and off is now with const instance possible.
  • class atom is now observable, encapsulated in class AtomObservable:
    • enums have notification types
    • we use NotificationChannels of Observable to emit these distinct types.
  • atominfo, particleinfo, bondedparticleinfo all have OBSERVE and NOTIFY(..) in their setter functions (thx encapsulation).
  • class GLMoleculeObject_atom signs on to atom to changes to position, element, and index.
  • World equally has notifications for atom (new,remove) and molecules (new, remove).
  • GLWorldView now observes World for these changes.

Other changes:

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