source: src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_molecule.hpp@ 0070aa

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 0070aa was 2f7988, checked in by Frederik Heber <heber@…>, 9 years ago

Moved and renamed QtInstanceInformationBoard -> QtObservedInstanceBoard.

  • Property mode set to 100644
File size: 7.0 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 <vector>
21#include <boost/any.hpp>
22#include <boost/function.hpp>
23
24#include "CodePatterns/Cacheable.hpp"
25#include "CodePatterns/Observer/Observer.hpp"
26#include "CodePatterns/ObservedValue.hpp"
27
28#include "GLMoleculeObject_bond.hpp"
29
30#include "molecule.hpp"
31
32class atom;
33class bond;
34class GLMoleculeObject_atom;
35class GLWorldScene;
36class QtObservedInstanceBoard;
37
38class GLMoleculeObject_molecule : public GLMoleculeObject, public Observer
39{
40 Q_OBJECT
41public:
42 GLMoleculeObject_molecule(
43 QObject *parent,
44 const moleculeId_t molid,
45 QtObservedInstanceBoard * _board,
46 std::vector<boost::any> _ObservedValues);
47 GLMoleculeObject_molecule(
48 QGLSceneNode *mesh[],
49 QObject *parent,
50 const moleculeId_t molid,
51 QtObservedInstanceBoard * _board,
52 std::vector<boost::any> _ObservedValues);
53 virtual ~GLMoleculeObject_molecule();
54
55 // Observer functions
56 void update(Observable *publisher);
57 void subjectKilled(Observable *publisher);
58 void recieveNotification(Observable *publisher, Notification_ptr notification);
59
60 void initialize(QGLView *view, QGLPainter *painter);
61 void draw(QGLPainter *painter, const QVector4D &cameraPlane);
62
63 typedef std::pair< atomId_t, atomId_t> BondIds;
64 friend std::ostream &operator<<(std::ostream &ost, const BondIds &t);
65
66 static BondIds getBondIds(
67 const bond::ptr _bond,
68 const enum GLMoleculeObject_bond::SideOfBond side);
69
70signals:
71 void changed();
72 void changeOccured();
73 void hoverChanged(const atomId_t);
74 void hoverChanged(const moleculeId_t, int);
75 void indexChanged(GLMoleculeObject_molecule *, const moleculeId_t, const moleculeId_t);
76 void atomClicked(atomId_t no);
77 void moleculeClicked(moleculeId_t no);
78 void TesselationHullChanged();
79 void BoundingBoxChanged();
80 void IsSelectedChanged();
81 void AtomInserted(const atomId_t _id);
82 void AtomRemoved(const atomId_t _id);
83 void IdChanged();
84
85private slots:
86 //!> grant GLWorldScene access to private slots
87 friend class GLWorldScene;
88
89 void wasClicked();
90 void atomInserted(const atomId_t _id);
91 void atomRemoved(const atomId_t _id);
92 void bondInserted(const atomId_t, const atomId_t, const GLMoleculeObject_bond::SideOfBond side);
93 void bondRemoved(const atomId_t leftnr, const atomId_t rightnr);
94 void hoverChangedSignalled(GLMoleculeObject *ob);
95 void changeAtomId(GLMoleculeObject_atom *, const atomId_t, const atomId_t);
96
97 void setVisible(bool value);
98
99 void activateObserver();
100 void deactivateObserver();
101
102 void resetTesselationHull();
103 void resetBoundingBox();
104 void resetIndex();
105 void resetName();
106
107 void AtomSelected(const atomId_t _id);
108 void AtomUnselected(const atomId_t _id);
109 void Selected();
110 void Unselected();
111
112private:
113 static const molecule * const getMolecule(const moleculeId_t _id);
114
115 void init(const moleculeId_t _molid);
116
117private:
118 void addAtomBonds(
119 const bond::ptr &_bond,
120 const GLMoleculeObject_bond::SideOfBond _side
121 );
122
123 //!> typedef for the internal set of atoms
124 typedef std::set<atomId_t> atoms_t;
125
126 static molecule::BoundingBoxInfo initBoundingBox();
127
128 QGeometryData updateTesselationHull() const;
129 static molecule::BoundingBoxInfo updateBoundingBox(
130 const boost::function<const moleculeId_t ()> &_getMolIndex);
131 static moleculeId_t updateIndex();
132 static std::string updateName(
133 const boost::function<const moleculeId_t ()> &_getMolIndex);
134
135 /** Getter to contained atoms contained in \a ObservedValues.
136 *
137 * \return molecule's contained atoms
138 */
139 atoms_t getPresentAtoms() const;
140
141 //!> the Observable we are signed on, also indicates whether we are sign on (not NULL)
142 const Observable * owner;
143
144 //!> internal variable for caching molecule ref in cstor
145 const molecule * const molref;
146
147 //!> list of channels when tesselation hull needs to update
148 static const Observable::channels_t HullChannels;
149 //!> list of channels when bounding box needs to update
150 static const Observable::channels_t BoundingBoxChannels;
151 //!> list of channels when the index needs to update
152 static const Observable::channels_t IndexChannels;
153 //!> list of channels when the name needs to update
154 static const Observable::channels_t NameChannels;
155
156private:
157 friend class QtObservedInstanceBoard;
158 /** Observed Values **/
159
160 //!> enumeration of observed values to match with entries in ObservedValues
161 enum ObservedTypes {
162 //!> contains the current molecule index
163 MolIndex,
164 //!> contains the current molecule name
165 MolName,
166 //!> contains newest version of the bounding box on request
167 BoundingBox,
168 //!> gives the size of the enumeration
169 MAX_ObservedTypes
170 };
171
172 //!> vector with all observed values
173 std::vector<boost::any> ObservedValues;
174
175 /** Initializes all \a _ObservedValues entries.
176 *
177 * \param _ObservedValues vector of ObservedValue to be filled
178 * \param _moid molecule id
179 * \param _molref reference to molecule
180 * \param _subjectKilled ref to function to call on subjectKilled()
181 */
182 static void initObservedValues(
183 std::vector<boost::any> &_ObservedValues,
184 const moleculeId_t _molid,
185 const molecule * const _molref,
186 const boost::function<void(const moleculeId_t)> &_subjectKilled);
187
188 /** Destroys all \a ObservedValues entries.
189 *
190 * \param _ObservedValues vector of ObservedValue to be destroyed
191 */
192 static void destroyObservedValues(
193 std::vector<boost::any> &_ObservedValues);
194
195 /** Getter to molecule index contained in \a ObservedValues.
196 *
197 * \return molecule's index
198 */
199 moleculeId_t getMolIndex() const;
200
201 /** Getter to molecule name contained in \a ObservedValues.
202 *
203 * \return molecule's name
204 */
205 std::string getMolName() const;
206
207 /** Getter to molecule's bounding box contained in \a ObservedValues.
208 *
209 * \return molecule's bounding box
210 */
211 molecule::BoundingBoxInfo getBoundingBox() const;
212
213 //!> counts how many ObservedValues have already been subjectKilled()
214 mutable size_t subjectKilledCount;
215
216private:
217
218 boost::function<QGeometryData ()> TesselationHullUpdater;
219
220 //!> contains current version of the tesselation hull on request
221 Cacheable<QGeometryData> TesselationHull;
222
223 //!> contains the set of atoms displayed
224 atoms_t DisplayedAtoms;
225
226 typedef std::map< atomId_t, GLMoleculeObject_atom* > AtomNodeMap;
227 typedef std::map< BondIds , GLMoleculeObject_bond* > BondNodeMap;
228 AtomNodeMap AtomsinSceneMap;
229 BondNodeMap BondsinSceneMap;
230
231 atomId_t hoverAtomId;
232
233 //!> we get multiple subjectKilled(), count and call callback() only on last
234 const unsigned int AllsignedOnChannels;
235 unsigned int signedOnChannels;
236
237 QtObservedInstanceBoard * board;
238};
239
240std::ostream &operator<<(std::ostream &ost, const GLMoleculeObject_molecule::BondIds &t);
241
242
243#endif /* GLMOLECULEOBJECT_MOLECULE_HPP_ */
Note: See TracBrowser for help on using the repository browser.