source: src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_atom.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: 5.3 KB
RevLine 
[907636]1/*
2 * GLMoleculeObject_atom.hpp
3 *
4 * Created on: Aug 17, 2011
5 * Author: heber
6 */
7
8#ifndef GLMOLECULEOBJECT_ATOM_HPP_
9#define GLMOLECULEOBJECT_ATOM_HPP_
10
11// include config.h
12#ifdef HAVE_CONFIG_H
13#include <config.h>
14#endif
15
16#include "GLMoleculeObject.hpp"
17
[7c7c4a]18#include <vector>
19#include <boost/any.hpp>
20
[534374]21#include "CodePatterns/ObservedValue.hpp"
[02ce36]22#include "CodePatterns/Observer/Observer.hpp"
[7188b1]23
[534374]24#include "LinearAlgebra/Vector.hpp"
25
[88c8ec]26#include "Bond/bond.hpp"
[917659]27#include "UIElements/Views/Qt4/Qt3D/GLMoleculeObject_bond.hpp"
28#include "types.hpp"
[907636]29
[ce4126]30class GLWorldScene;
[2f7988]31class QtObservedInstanceBoard;
[ce4126]32
[534374]33class GLMoleculeObject_atom : public GLMoleculeObject, Observer
[907636]34{
[06ebf5]35 Q_OBJECT
[907636]36public:
[026bef]37 GLMoleculeObject_atom(
38 QGLSceneNode *mesh[],
39 QObject *parent,
40 const atomId_t id,
[2f7988]41 QtObservedInstanceBoard * _board,
[026bef]42 std::vector<boost::any> _ObservedValues
43 );
[9c18e4]44 virtual ~GLMoleculeObject_atom();
[7188b1]45
[f115cc]46 void draw(QGLPainter *painter, const QVector4D &cameraPlane);
47
[7188b1]48 // Observer functions
49 void update(Observable *publisher);
50 void subjectKilled(Observable *publisher);
51 void recieveNotification(Observable *publisher, Notification_ptr notification);
[06ebf5]52
[015f8c]53public slots:
54 void Selected();
55 void Unselected();
56
[06ebf5]57private slots:
58 void wasClicked();
[534374]59 void resetIndex();
60 void resetElement();
61 void resetPosition();
62 void resetBonds();
[06ebf5]63
64signals:
65 void clicked(atomId_t);
[534374]66 void BondsAdded(const atomId_t _left, const atomId_t _right, const GLMoleculeObject_bond::SideOfBond side);
67 void BondsRemoved(const atomId_t _left, const atomId_t _right);
68 void indexChanged(GLMoleculeObject_atom *ob, const atomId_t oldId, const atomId_t newId);
69 void idChanged();
70 void positionChanged();
71 void elementChanged();
72 void bondsChanged();
[907636]73
[ce4126]74private:
[8c001a]75 //!> grant GLMoleculeObject_molecule acess to reset functions
76 friend class GLMoleculeObject_molecule;
[ce4126]77
[534374]78 //!> typedef for list of bonds, defined by pairs of atom ids
79 typedef std::vector< std::pair<atomId_t, atomId_t> > ListOfBonds_t;
[89b992]80
[534374]81 static const atom * const getAtomConst(const atomId_t _id);
82 static atom * const getAtom(const atomId_t _id);
83
[16bd37]84 static atomId_t updateIndex();
85 static Vector updatePosition(
86 const boost::function<const atomId_t ()> &_getAtomIndex);
87 static atomicNumber_t updateElement(
88 const boost::function<const atomId_t ()> &_getAtomIndex);
89 static ListOfBonds_t updateBonds(
90 const boost::function<const atomId_t ()> &_getAtomIndex);
[7188b1]91
[534374]92 void activateObserver();
93 void deactivateObserver();
94
[026bef]95 void init(const atomId_t _id);
96
[534374]97private:
[f115cc]98
[534374]99 //!> current list of bonds to compare new onw against for changes
100 ListOfBonds_t ListOfBonds;
101
102 //!> temporary variable used in cstor
103 atom * const atomref;
104
[7c7c4a]105private:
[2f7988]106 friend class QtObservedInstanceBoard;
[7c7c4a]107 /** Observed Values **/
108
109 //!> enumeration of observed values to match with entries in ObservedValues
110 enum ObservedTypes {
111 //!> contains the current atom index
112 AtomIndex,
113 //!> contains the current atom position
114 AtomPosition,
115 //!> contains the current atom element
116 AtomElement,
117 //!> contains the current set of bonds atoms fort the atom
118 AtomBonds,
119 //!> gives the size of the enumeration
120 MAX_ObservedTypes
121 };
122
123 //!> vector with all observed values
124 std::vector<boost::any> ObservedValues;
125
126 /** Initializes all \a ObservedValues entries.
127 *
[16bd37]128 * \param _ObservedValues vector of ObservedValue to be filled
[7c7c4a]129 * \param _id atom id
[16bd37]130 * \param _atomref reference to atom
131 * \param _subjectKilled ref to function to call on subjectKilled()
[7c7c4a]132 */
[16bd37]133 static void initObservedValues(
134 std::vector<boost::any> &_ObservedValues,
135 const atomId_t _id,
136 const atom * const _atomref,
[026bef]137 const boost::function<void(const atomId_t)> &_subjectKilled);
[7c7c4a]138
139 /** Destroys all \a ObservedValues entries.
140 *
[16bd37]141 * \param _ObservedValues vector of ObservedValue to be destroyed
[7c7c4a]142 */
[16bd37]143 static void destroyObservedValues(
144 std::vector<boost::any> &_ObservedValues);
[7c7c4a]145
146 /** Getter to atom index contained in \a ObservedValues.
147 *
148 * \return atom's index
149 */
150 atomId_t getAtomIndex() const;
151
152 /** Getter to atom position contained in \a ObservedValues.
153 *
154 * \return atom's position
155 */
156 Vector getAtomPosition() const;
157
158 /** Getter to atom element contained in \a ObservedValues.
159 *
160 * \return atom's elemnt
161 */
162 atomicNumber_t getAtomElement() const;
163
164 /** Getter to atom bonds contained in \a ObservedValues.
165 *
166 * \return atom's bonds
167 */
168 ListOfBonds_t getAtomBonds() const;
169
170 //!> counts how many ObservedValues have already been subjectKilled()
171 mutable size_t subjectKilledCount;
172
173private:
[534374]174
175 //!> list of channels when index needs to update
176 static const Observable::channels_t AtomIndexChannels;
177 //!> list of channels when position needs to update
178 static const Observable::channels_t AtomPositionChannels;
179 //!> list of channels when element needs to update
180 static const Observable::channels_t AtomElementChannels;
181 //!> list of channels when bonds needs to update
182 static const Observable::channels_t AtomBondsChannels;
183
184 //!> the Observable we are signed on, also indicates whether we are sign on (not NULL)
185 const Observable *owner;
[8d5fbf1]186
187 //!> we get multiple subjectKilled(), count and call callback() only on last
188 const unsigned int AllsignedOnChannels;
189 unsigned int signedOnChannels;
190
[2f7988]191 QtObservedInstanceBoard * board;
[907636]192};
193
194
195
196#endif /* GLMOLECULEOBJECT_ATOM_HPP_ */
Note: See TracBrowser for help on using the repository browser.