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

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 e25448 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
RevLine 
[c67518]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
[6c16a0]18#include <Qt3D/qgeometrydata.h>
19
20#include "CodePatterns/Cacheable.hpp"
[c67518]21#include "CodePatterns/Observer/Observer.hpp"
[6c16a0]22#include "CodePatterns/ObservedValue.hpp"
[c67518]23
24#include "GLMoleculeObject_bond.hpp"
25
[e39e7a]26#include "molecule.hpp"
27
[c67518]28class atom;
29class bond;
[8c001a]30class GLMoleculeObject_atom;
31class GLWorldScene;
[c67518]32
33class GLMoleculeObject_molecule : public GLMoleculeObject, public Observer
34{
35 Q_OBJECT
36public:
[704d59]37 GLMoleculeObject_molecule(QObject *parent, const moleculeId_t molid);
38 GLMoleculeObject_molecule(QGLSceneNode *mesh[], QObject *parent, const moleculeId_t molid);
[c67518]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
[8c001a]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();
[704d59]59 void hoverChanged(const atomId_t);
60 void hoverChanged(const moleculeId_t, int);
[6c16a0]61 void indexChanged(GLMoleculeObject_molecule *, const moleculeId_t, const moleculeId_t);
[8c001a]62 void atomClicked(atomId_t no);
[9a7ef9]63 void moleculeClicked(moleculeId_t no);
[6c16a0]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();
[8c001a]70
71private slots:
72 //!> grant GLWorldScene access to private slots
73 friend class GLWorldScene;
74
[9a7ef9]75 void wasClicked();
[2f76d2]76 void atomInserted(const atomId_t _id);
77 void atomRemoved(const atomId_t _id);
[6c16a0]78 void bondInserted(const atomId_t, const atomId_t, const GLMoleculeObject_bond::SideOfBond side);
[8c001a]79 void bondRemoved(const atomId_t leftnr, const atomId_t rightnr);
80 void hoverChangedSignalled(GLMoleculeObject *ob);
[6c16a0]81 void changeAtomId(GLMoleculeObject_atom *, const atomId_t, const atomId_t);
[8c001a]82
[34e7fdb]83 void setVisible(bool value);
84
[73b13c]85 void activateObserver();
[6c16a0]86 void deactivateObserver();
87
88 void resetTesselationHull();
89 void resetBoundingBox();
90 void resetAtoms();
91 void resetIndex();
[5b61e5]92 void resetName();
[6c16a0]93
[015f8c]94 void AtomSelected(const atomId_t _id);
95 void AtomUnselected(const atomId_t _id);
96 void Selected();
97 void Unselected();
98
[6c16a0]99private:
100 static const molecule * const getMolecule(const moleculeId_t _id);
[73b13c]101
[c67518]102private:
[8c001a]103 void addAtomBonds(
104 const bond::ptr &_bond,
105 const GLMoleculeObject_bond::SideOfBond _side
106 );
[ca4b63b]107 void addAtomBonds(const atomId_t _id);
[8c001a]108
[6c16a0]109 //!> typedef for the internal set of atoms
110 typedef std::set<atomId_t> atoms_t;
111
[e39e7a]112 molecule::BoundingBoxInfo initBoundingBox() const;
[6fe4f7]113
[6c16a0]114 QGeometryData updateTesselationHull() const;
[e39e7a]115 molecule::BoundingBoxInfo updateBoundingBox() const;
[6c16a0]116 atoms_t updateAtoms();
117 moleculeId_t updateIndex() const;
[5b61e5]118 std::string updateName() const;
[6c16a0]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;
[5b61e5]134 //!> list of channels when the name needs to update
135 static const Observable::channels_t NameChannels;
[6c16a0]136
137 boost::function<moleculeId_t ()> MolIndexUpdater;
[5b61e5]138 boost::function<std::string ()> MolNameUpdater;
[6c16a0]139 boost::function<QGeometryData ()> TesselationHullUpdater;
[e39e7a]140 boost::function<molecule::BoundingBoxInfo ()> BoundingBoxUpdater;
[6c16a0]141 boost::function<atoms_t ()> PresentAtomsUpdater;
142
143 //!> contains the current molecule index
144 ObservedValue<moleculeId_t> MolIndex;
[5b61e5]145 //!> contains the current molecule name
146 ObservedValue<std::string> MolName;
[6c16a0]147 //!> contains current version of the tesselation hull on request
148 Cacheable<QGeometryData> TesselationHull;
149 //!> contains newest version of the bounding box on request
[e39e7a]150 ObservedValue<molecule::BoundingBoxInfo> BoundingBox;
[6c16a0]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;
[7b5984]156
[8c001a]157 typedef std::map< atomId_t, GLMoleculeObject_atom* > AtomNodeMap;
158 typedef std::map< BondIds , GLMoleculeObject_bond* > BondNodeMap;
159 AtomNodeMap AtomsinSceneMap;
160 BondNodeMap BondsinSceneMap;
161
[704d59]162 atomId_t hoverAtomId;
[c67518]163};
164
[8c001a]165std::ostream &operator<<(std::ostream &ost, const GLMoleculeObject_molecule::BondIds &t);
[c67518]166
167
168#endif /* GLMOLECULEOBJECT_MOLECULE_HPP_ */
Note: See TracBrowser for help on using the repository browser.