source: src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_molecule.hpp@ 88846b

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 88846b was 6c16a0, checked in by Frederik Heber <heber@…>, 10 years ago

GLMoleculeObject_molecule uses ObservedValue for internally representing atom's state.

  • Property mode set to 100644
File size: 5.3 KB
Line 
1/*
2 * GLMoleculeObject_molecule.hpp
3 *
4 * Created on: Mar 30, 2012
5 * Author: ankele
6 */
7
8#ifndef GLMOLECULEOBJECT_MOLECULE_HPP_
9#define GLMOLECULEOBJECT_MOLECULE_HPP_
10
11// include config.h
12#ifdef HAVE_CONFIG_H
13#include <config.h>
14#endif
15
16#include "GLMoleculeObject.hpp"
17
18#include <Qt3D/qgeometrydata.h>
19
20#include "CodePatterns/Cacheable.hpp"
21#include "CodePatterns/Observer/Observer.hpp"
22#include "CodePatterns/ObservedValue.hpp"
23
24#include "GLMoleculeObject_bond.hpp"
25
26class atom;
27class bond;
28class GLMoleculeObject_atom;
29class GLWorldScene;
30class molecule;
31
32class GLMoleculeObject_molecule : public GLMoleculeObject, public Observer
33{
34 Q_OBJECT
35public:
36 GLMoleculeObject_molecule(QObject *parent, const moleculeId_t molid);
37 GLMoleculeObject_molecule(QGLSceneNode *mesh[], QObject *parent, const moleculeId_t molid);
38 virtual ~GLMoleculeObject_molecule();
39
40 // Observer functions
41 void update(Observable *publisher);
42 void subjectKilled(Observable *publisher);
43 void recieveNotification(Observable *publisher, Notification_ptr notification);
44
45 void initialize(QGLView *view, QGLPainter *painter);
46 void draw(QGLPainter *painter, const QVector4D &cameraPlane);
47
48 typedef std::pair< atomId_t, atomId_t> BondIds;
49 friend std::ostream &operator<<(std::ostream &ost, const BondIds &t);
50
51 static BondIds getBondIds(
52 const bond::ptr _bond,
53 const enum GLMoleculeObject_bond::SideOfBond side);
54
55signals:
56 void changed();
57 void changeOccured();
58 void hoverChanged(const atomId_t);
59 void hoverChanged(const moleculeId_t, int);
60 void indexChanged(GLMoleculeObject_molecule *, const moleculeId_t, const moleculeId_t);
61 void atomClicked(atomId_t no);
62 void moleculeClicked(moleculeId_t no);
63 void TesselationHullChanged();
64 void BoundingBoxChanged();
65 void IsSelectedChanged();
66 void AtomInserted(const atomId_t _id);
67 void AtomRemoved(const atomId_t _id);
68 void IdChanged();
69
70private slots:
71 //!> grant GLWorldScene access to private slots
72 friend class GLWorldScene;
73
74 void wasClicked();
75 void atomInserted(const atomId_t _id);
76 void atomRemoved(const atomId_t _id);
77 void bondInserted(const atomId_t, const atomId_t, const GLMoleculeObject_bond::SideOfBond side);
78 void bondRemoved(const atomId_t leftnr, const atomId_t rightnr);
79 void hoverChangedSignalled(GLMoleculeObject *ob);
80 void changeAtomId(GLMoleculeObject_atom *, const atomId_t, const atomId_t);
81
82 void setVisible(bool value);
83
84 void activateObserver();
85 void deactivateObserver();
86
87 void resetTesselationHull();
88 void resetIsSelected();
89 void resetBoundingBox();
90 void resetAtoms();
91 void resetIndex();
92
93private:
94 static const molecule * const getMolecule(const moleculeId_t _id);
95
96private:
97 void addAtomBonds(
98 const bond::ptr &_bond,
99 const GLMoleculeObject_bond::SideOfBond _side
100 );
101 void addAtomBonds(const atom *_atom);
102
103 //!> typedef for the internal set of atoms
104 typedef std::set<atomId_t> atoms_t;
105
106 /** Structure for the required information on the bounding box.
107 *
108 */
109 struct BoundingBoxInfo {
110 //!> position of center
111 Vector position;
112 //!> radius of sphere
113 double radius;
114 };
115
116 /** Structure for the required information on the tesselation hull.
117 *
118 */
119 struct TesselationHullInfo {
120 };
121
122 QGeometryData updateTesselationHull() const;
123 bool updateIsSelected() const;
124 BoundingBoxInfo updateBoundingBox() const;
125 atoms_t updateAtoms();
126 moleculeId_t updateIndex() const;
127
128 //!> the Observable we are signed on, also indicates whether we are sign on (not NULL)
129 const Observable * owner;
130
131 //!> internal variable for caching molecule ref in cstor
132 const molecule * const molref;
133
134 //!> list of channels when contained atoms needs to update
135 static const Observable::channels_t AtomsChannels;
136 //!> list of channels when tesselation hull needs to update
137 static const Observable::channels_t HullChannels;
138 //!> list of channels when selection status needs to update
139 static const Observable::channels_t SelectionStatusChannels;
140 //!> list of channels when bounding box needs to update
141 static const Observable::channels_t BoundingBoxChannels;
142 //!> list of channels when the index needs to update
143 static const Observable::channels_t IndexChannels;
144
145 boost::function<moleculeId_t ()> MolIndexUpdater;
146 boost::function<QGeometryData ()> TesselationHullUpdater;
147 boost::function<bool ()> IsSelectedUpdater;
148 boost::function<BoundingBoxInfo ()> BoundingBoxUpdater;
149 boost::function<atoms_t ()> PresentAtomsUpdater;
150
151 //!> contains the current molecule index
152 ObservedValue<moleculeId_t> MolIndex;
153 //!> contains current version of the tesselation hull on request
154 Cacheable<QGeometryData> TesselationHull;
155 //!> contains newest version of the selection status
156 ObservedValue<bool> isSelected;
157 //!> contains newest version of the bounding box on request
158 ObservedValue<BoundingBoxInfo> BoundingBox;
159 //!> contains the current live set of atoms for the molecule
160 ObservedValue<atoms_t> PresentAtoms;
161
162 //!> contains the set of atoms displayed
163 atoms_t DisplayedAtoms;
164
165 typedef std::map< atomId_t, GLMoleculeObject_atom* > AtomNodeMap;
166 typedef std::map< BondIds , GLMoleculeObject_bond* > BondNodeMap;
167 AtomNodeMap AtomsinSceneMap;
168 BondNodeMap BondsinSceneMap;
169
170 atomId_t hoverAtomId;
171};
172
173std::ostream &operator<<(std::ostream &ost, const GLMoleculeObject_molecule::BondIds &t);
174
175
176#endif /* GLMOLECULEOBJECT_MOLECULE_HPP_ */
Note: See TracBrowser for help on using the repository browser.