source: src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_molecule.hpp@ 25a81d

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 25a81d was 5b61e5, checked in by Frederik Heber <heber@…>, 10 years ago

GLMoleculeObject_molecule also has ObservedValue for name.

  • this removes any (uncached) molecule::getName() from Qt code part.
  • Property mode set to 100644
File size: 5.4 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 resetBoundingBox();
89 void resetAtoms();
90 void resetIndex();
91 void resetName();
92
93 void AtomSelected(const atomId_t _id);
94 void AtomUnselected(const atomId_t _id);
95 void Selected();
96 void Unselected();
97
98private:
99 static const molecule * const getMolecule(const moleculeId_t _id);
100
101private:
102 void addAtomBonds(
103 const bond::ptr &_bond,
104 const GLMoleculeObject_bond::SideOfBond _side
105 );
106 void addAtomBonds(const atom *_atom);
107
108 //!> typedef for the internal set of atoms
109 typedef std::set<atomId_t> atoms_t;
110
111 /** Structure for the required information on the bounding box.
112 *
113 */
114 struct BoundingBoxInfo {
115 //!> position of center
116 Vector position;
117 //!> radius of sphere
118 double radius;
119 };
120
121 /** Structure for the required information on the tesselation hull.
122 *
123 */
124 struct TesselationHullInfo {
125 };
126
127 QGeometryData updateTesselationHull() const;
128 BoundingBoxInfo updateBoundingBox() const;
129 atoms_t updateAtoms();
130 moleculeId_t updateIndex() const;
131 std::string updateName() const;
132
133 //!> the Observable we are signed on, also indicates whether we are sign on (not NULL)
134 const Observable * owner;
135
136 //!> internal variable for caching molecule ref in cstor
137 const molecule * const molref;
138
139 //!> list of channels when contained atoms needs to update
140 static const Observable::channels_t AtomsChannels;
141 //!> list of channels when tesselation hull needs to update
142 static const Observable::channels_t HullChannels;
143 //!> list of channels when bounding box needs to update
144 static const Observable::channels_t BoundingBoxChannels;
145 //!> list of channels when the index needs to update
146 static const Observable::channels_t IndexChannels;
147 //!> list of channels when the name needs to update
148 static const Observable::channels_t NameChannels;
149
150 boost::function<moleculeId_t ()> MolIndexUpdater;
151 boost::function<std::string ()> MolNameUpdater;
152 boost::function<QGeometryData ()> TesselationHullUpdater;
153 boost::function<BoundingBoxInfo ()> BoundingBoxUpdater;
154 boost::function<atoms_t ()> PresentAtomsUpdater;
155
156 //!> contains the current molecule index
157 ObservedValue<moleculeId_t> MolIndex;
158 //!> contains the current molecule name
159 ObservedValue<std::string> MolName;
160 //!> contains current version of the tesselation hull on request
161 Cacheable<QGeometryData> TesselationHull;
162 //!> contains newest version of the bounding box on request
163 ObservedValue<BoundingBoxInfo> BoundingBox;
164 //!> contains the current live set of atoms for the molecule
165 ObservedValue<atoms_t> PresentAtoms;
166
167 //!> contains the set of atoms displayed
168 atoms_t DisplayedAtoms;
169
170 typedef std::map< atomId_t, GLMoleculeObject_atom* > AtomNodeMap;
171 typedef std::map< BondIds , GLMoleculeObject_bond* > BondNodeMap;
172 AtomNodeMap AtomsinSceneMap;
173 BondNodeMap BondsinSceneMap;
174
175 atomId_t hoverAtomId;
176};
177
178std::ostream &operator<<(std::ostream &ost, const GLMoleculeObject_molecule::BondIds &t);
179
180
181#endif /* GLMOLECULEOBJECT_MOLECULE_HPP_ */
Note: See TracBrowser for help on using the repository browser.