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

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

Implemented more efficient per-molecule bounding box information.

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