source: src/UIElements/Views/Qt4/GLMoleculeView.hpp@ b40b9d

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 Candidate_v1.7.0 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 b40b9d was 29daad, checked in by Frederik Heber <heber@…>, 14 years ago

Added rudimentarily working GlMoleculeView (class was empty before).

  • We took over the code from (ancient) branch MolecuilderGUI and adapated it to the current standards. Atoms are drawn, bonds in some so far wrong direction as well.
  • Note that the guz has trouble showing dialogs for all Actions. This should be some minor bug.
  • Property mode set to 100644
File size: 4.3 KB
Line 
1/*
2 * GLMoleculeView.hpp
3 *
4 * Created on: Auf 11, 2010
5 * Author: heber
6 */
7
8#ifndef GLMOLECULEVIEW_HPP_
9#define GLMOLECULEVIEW_HPP_
10
11// include config.h
12#ifdef HAVE_CONFIG_H
13#include <config.h>
14#endif
15
16#include <qgl.h>
17#include <qdialog.h>
18#include <qlabel.h>
19#include <qlineedit.h>
20//#include <qwidgetfactory.h>
21
22#include "CodePatterns/Observer.hpp"
23#include "LinearAlgebra/Vector.hpp"
24#include "changetypes.hpp"
25
26class atom;
27class element;
28class molecule;
29
30class GLMoleculeView : public QGLWidget, public Observer
31{
32 Q_OBJECT
33
34public:
35
36 GLMoleculeView( QWidget* parent);
37 ~GLMoleculeView();
38
39public slots:
40
41 void setXRotation( int degrees );
42 void setYRotation( int degrees );
43 void setZRotation( int degrees );
44 void setScale( int distance );
45 void setLightPosition( int *light );
46 void setLightDiffuse( int *light );
47 void setLightAmbient( int *light );
48 void createDialogLight();
49 void toggleMultiViewEnabled();
50
51 void init( QLabel *ptr );
52 void initCoordinates(QLabel *ptr);
53 void createView();
54 void hearMoleculeSelected(molecule *mol);
55 void hearAtomSelected(molecule *mol, atom *Walker);
56 void hearMoleculeChanged(molecule *mol, enum ChangesinMolecule type);
57 void hearAtomChanged(molecule *mol, atom *Walker, enum ChangesinAtom type);
58 void hearElementChanged(element *Runner, enum ChangesinElement type);
59 void hearMoleculeAdded(molecule *mol);
60 void hearAtomAdded(molecule *mol, atom *Walker);
61 void hearMoleculeRemoved(molecule *mol);
62 void hearAtomRemoved(molecule *mol, atom *Walker);
63
64signals:
65 void notifyMoleculeSelected( molecule *mol );
66 void notifyAtomSelected( molecule *mol, atom *Walker );
67 void notifyMoleculeChanged( molecule *mol, enum ChangesinMolecule type );
68 void notifyAtomChanged( molecule *mol, atom *Walker, enum ChangesinAtom type );
69 void notifyElementChanged( element *Runner, enum ChangesinElement type );
70 void notifyMoleculeAdded( molecule *mol);
71 void notifyElementAdded( element *Runner);
72 void notifyAtomAdded( molecule *mol, atom *Walker );
73 void notifyMoleculeRemoved( molecule *mol );
74 void notifyAtomRemoved( molecule *mol, atom *Walker );
75
76protected:
77
78 void initializeGL();
79 void paintGL();
80 void resizeGL( int w, int h );
81 void makeSphere(const Vector &x, double radius, const unsigned char color[3]);
82 void makeCylinder(const Vector &x, const Vector &y, double radius, double height, const unsigned char color[3]);
83 void mousePressEvent(QMouseEvent* event);
84 void mouseReleaseEvent(QMouseEvent* event);
85
86public:
87
88 /** Update function as we are an Observer.
89 *
90 * @param publisher ref to Observable
91 */
92 void update(Observable *publisher);
93
94 /**
95 * This method is called when a special named change
96 * of the Observable occured
97 */
98 void recieveNotification(Observable *publisher, Notification_ptr notification);
99
100 /**
101 * This method is called when the observed object is destroyed.
102 */
103 void subjectKilled(Observable *publisher);
104
105
106private:
107
108 GLuint object; // call list for the scene to be rendered
109 GLfloat xRot, yRot, zRot, scale; // rotation angles and scaling (zoom)
110 Vector position; //!< position of observer
111 Vector view; //!< point along line of view
112 Vector top; //!< giving upwards direction
113 Vector X,Y,Z; //!< vectors defining the coordinate system
114 int width; //!< width of window
115 int height; //!< height of window
116
117 QLabel *StatusBar; //!< pointer to status bar for messages
118 QLabel *CoordinatesBar; //!< pointer to coordinates bar for view port
119
120 GLfloat LightPosition[4]; //!< Light Position
121 GLfloat LightDiffuse[4]; //!< Diffuse Light Values
122 GLfloat LightAmbient[4]; //!< Ambient Light Values
123
124 QPoint LeftButtonPos; //!< mouse position on mousePressEvent for LeftButton
125 QPoint MiddleButtonPos; //!< mouse position on mousePressEvent for MidButton
126 QPoint RightButtonPos; //!< mouse position on mousePressEvent for RightButton
127
128 unsigned char SelectionColor[3] ; //!< highlight color
129
130 bool isSignaller;
131
132 bool MultiViewEnabled; //!< if true, split screen into four parts with additional xy,xz,yz views
133};
134
135#endif /* GLMOLECULEVIEW_HPP_ */
Note: See TracBrowser for help on using the repository browser.