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

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 5e2f80 was 37b2575, checked in by Frederik Heber <heber@…>, 14 years ago

GLMoleculeObject_atom listens to BondsChanged notification.

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