source: src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject.hpp@ 5dfeeb

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 5dfeeb was 7188b1, checked in by Frederik Heber <heber@…>, 13 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: 2.6 KB
Line 
1/*
2 * GLMoleculeObject.hpp
3 *
4 * This is based on the Qt3D example "teaservice", specifically meshobject.h.
5 *
6 * Created on: Aug 17, 2011
7 * Author: heber
8 */
9
10#ifndef GLMOLECULEOBJECT_HPP_
11#define GLMOLECULEOBJECT_HPP_
12
13// include config.h
14#ifdef HAVE_CONFIG_H
15#include <config.h>
16#endif
17
18
19#include <QtCore/qobject.h>
20#include <QtGui/qevent.h>
21
22#include <qglpainter.h>
23#include <qglabstractscene.h>
24
25class QGLView;
26class QGLSceneNode;
27class GLMoleculeScene;
28
29/** This class represents a single object within a molecule, e.g. atom or bond.
30 *
31 */
32class GLMoleculeObject : public QObject
33{
34 Q_OBJECT
35
36 //!> Allow it to call cleanMaterialMap()
37 friend class GLWorldScene;
38public:
39 explicit GLMoleculeObject(QGLSceneNode *GLMoleculeObject, QObject *parent=0);
40 explicit GLMoleculeObject(QGLAbstractScene *scene, QObject *parent=0);
41 virtual ~GLMoleculeObject();
42
43 QVector3D position() const { return m_position; }
44 void setPosition(const QVector3D& value) { m_position = value; }
45
46 qreal scale() const { return m_scale; }
47 void setScale(qreal value) { m_scale = value; }
48
49 qreal rotationAngle() const { return m_rotationAngle; }
50 void setRotationAngle(qreal value) { m_rotationAngle = value; }
51
52 QVector3D rotationVector() const { return m_rotationVector; }
53 void setRotationVector(const QVector3D& value) { m_rotationVector = value; }
54
55 QGLMaterial *material() const { return m_material; }
56 void setMaterial(QGLMaterial *value)
57 { m_material = value; m_hoverMaterial = value; }
58
59 QGLMaterial *hoverMaterial() const { return m_hoverMaterial; }
60 void setHoverMaterial(QGLMaterial *value) { m_hoverMaterial = value; }
61
62 QGLAbstractEffect *effect() const { return m_effect; }
63 void setEffect(QGLAbstractEffect *value) { m_effect = value; }
64
65 int objectId() const { return m_objectId; }
66 void setObjectId(int id) { m_objectId = id; }
67
68 void initialize(QGLView *view, QGLPainter *painter);
69 void draw(QGLPainter *painter);
70
71signals:
72 void pressed();
73 void released();
74 void clicked();
75 void doubleClicked();
76 void hoverChanged();
77
78protected:
79 bool event(QEvent *e);
80
81 static QGLMaterial* getMaterial(size_t);
82 static void cleanMaterialMap();
83
84 typedef std::map< size_t, QGLMaterial *> ElementMaterialMap;
85 static ElementMaterialMap ElementNoMaterialMap;
86
87private:
88
89 QGLSceneNode *m_mesh;
90 QGLSceneNode *m_GLMoleculeObject;
91 QGLAbstractScene *m_scene;
92 QVector3D m_position;
93 qreal m_scale;
94 qreal m_rotationAngle;
95 QVector3D m_rotationVector;
96 QGLMaterial *m_material;
97 QGLMaterial *m_hoverMaterial;
98 QGLAbstractEffect *m_effect;
99 int m_objectId;
100 bool m_hovering;
101};
102
103
104#endif /* GLMOLECULEOBJECT_HPP_ */
Note: See TracBrowser for help on using the repository browser.