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

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

GLWorldScene RemovedMolecules now uses QtObservedMolecule* as key.

  • moleculeId_t is not unique, a new molecule of the same id might have already been instantiated. The shared_ptrs live till the end, hence the memory address can be safely used as unique key to the respective molecule instance.
  • signatures of signal removeMolecule() and slots moleculeRemoved() and moleculeEmptied() changed from id to this ptr.
  • Property mode set to 100644
File size: 3.8 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 "UIElements/Qt4/InstanceBoard/QtObservedMolecule.hpp"
21
22#include <map>
23
24#include <boost/function.hpp>
25
26#include "CodePatterns/Cacheable.hpp"
27#include "CodePatterns/Observer/Observable.hpp"
28
29#include "GLMoleculeObject_bond.hpp"
30
31#include "types.hpp"
32
33class atom;
34class bond;
35class molecule;
36class GLMoleculeObject_atom;
37class GLWorldScene;
38class QtObservedInstanceBoard;
39
40class GLMoleculeObject_molecule : public GLMoleculeObject
41{
42 Q_OBJECT
43public:
44 GLMoleculeObject_molecule(
45 QObject *parent,
46 QtObservedInstanceBoard &_board,
47 QtObservedMolecule::ptr &_ObservedMolecule);
48 GLMoleculeObject_molecule(
49 QGLSceneNode *mesh[],
50 QObject *parent,
51 QtObservedInstanceBoard &_board,
52 QtObservedMolecule::ptr &_ObservedMolecule);
53 virtual ~GLMoleculeObject_molecule();
54
55 void initialize(QGLView *view, QGLPainter *painter);
56 void draw(QGLPainter *painter, const QVector4D &cameraPlane);
57
58 typedef std::pair< atomId_t, atomId_t> BondIds;
59 friend std::ostream &operator<<(std::ostream &ost, const BondIds &t);
60
61 static BondIds getBondIds(
62 const bond::ptr _bond,
63 const enum GLMoleculeObject_bond::SideOfBond side);
64
65signals:
66 void changed();
67 void changeOccured();
68 void hoverChanged(const atomId_t);
69 void hoverChanged(const moleculeId_t, int);
70 void indexChanged(GLMoleculeObject_molecule *, const moleculeId_t, const moleculeId_t);
71 void atomClicked(atomId_t);
72 void moleculeClicked(moleculeId_t);
73 void moleculeEmptied(QtObservedMolecule::ptr);
74 void IsSelectedChanged();
75
76private slots:
77 //!> grant GLWorldScene access to private slots
78 friend class GLWorldScene;
79
80 void wasClicked();
81 void atomInserted(QtObservedAtom::ptr _atom);
82 void atomRemoved(const atomId_t _id);
83 void bondInserted(const atomId_t, const atomId_t, const GLMoleculeObject_bond::SideOfBond side);
84 void bondRemoved(const atomId_t leftnr, const atomId_t rightnr);
85 void hoverChangedSignalled(GLMoleculeObject *ob);
86 void changeAtomId(GLMoleculeObject_atom *, const atomId_t, const atomId_t);
87
88 void setVisible(bool value);
89
90 void resetTesselationHull();
91 void resetBoundingBox();
92 void resetIndex(const moleculeId_t, const moleculeId_t);
93 void resetSelected();
94
95private:
96 void addAtomBonds(
97 const bond::ptr &_bond,
98 const GLMoleculeObject_bond::SideOfBond _side
99 );
100
101 void init(const moleculeId_t _molid);
102
103 //!> typedef for the internal set of atoms
104 typedef std::set<atomId_t> atoms_t;
105
106 /** Getter to contained atoms contained in \a ObservedValues.
107 *
108 * \return molecule's contained atoms
109 */
110 atoms_t getPresentAtoms() const;
111
112private:
113
114 //!> the Observable we are signed on, also indicates whether we are sign on (not NULL)
115 const Observable * owner;
116
117 QGeometryData updateTesselationHull() const;
118
119 //!> list of channels when tesselation hull needs to update
120 static const Observable::channels_t HullChannels;
121
122 //!> internal variable for caching molecule ref in cstor
123 const molecule * const molref;
124
125 //!> contains current version of the tesselation hull on request
126 QGeometryData TesselationHull;
127
128 //!> contains the set of atoms displayed
129 atoms_t DisplayedAtoms;
130
131 typedef std::map< atomId_t, GLMoleculeObject_atom* > AtomNodeMap;
132 typedef std::map< BondIds , GLMoleculeObject_bond* > BondNodeMap;
133 AtomNodeMap AtomsinSceneMap;
134 BondNodeMap BondsinSceneMap;
135
136 atomId_t hoverAtomId;
137
138 QtObservedInstanceBoard &board;
139
140 QtObservedMolecule::ptr ObservedMolecule;
141};
142
143std::ostream &operator<<(std::ostream &ost, const GLMoleculeObject_molecule::BondIds &t);
144
145
146#endif /* GLMOLECULEOBJECT_MOLECULE_HPP_ */
Note: See TracBrowser for help on using the repository browser.