- Timestamp:
- Feb 12, 2016, 11:15:24 PM (9 years ago)
- Branches:
- 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
- Children:
- 90821d
- Parents:
- 65c323
- git-author:
- Frederik Heber <heber@…> (10/29/15 12:52:29)
- git-committer:
- Frederik Heber <heber@…> (02/12/16 23:15:24)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_molecule.hpp
r65c323 r494478 18 18 #include <Qt3D/qgeometrydata.h> 19 19 20 #include <vector> 21 #include <boost/any.hpp> 20 #include "UIElements/Qt4/InstanceBoard/QtObservedMolecule.hpp" 21 22 #include <map> 23 22 24 #include <boost/function.hpp> 23 25 24 26 #include "CodePatterns/Cacheable.hpp" 25 #include "CodePatterns/Observer/Observer.hpp" 26 #include "CodePatterns/ObservedValue.hpp" 27 #include "CodePatterns/Observer/Observable.hpp" 27 28 28 29 #include "GLMoleculeObject_bond.hpp" 29 30 30 #include " molecule.hpp"31 #include "types.hpp" 31 32 32 33 class atom; 33 34 class bond; 35 class molecule; 34 36 class GLMoleculeObject_atom; 35 37 class GLWorldScene; 36 38 class QtObservedInstanceBoard; 37 39 38 class GLMoleculeObject_molecule : public GLMoleculeObject , public Observer40 class GLMoleculeObject_molecule : public GLMoleculeObject 39 41 { 40 42 Q_OBJECT … … 42 44 GLMoleculeObject_molecule( 43 45 QObject *parent, 44 const moleculeId_t molid, 45 QtObservedInstanceBoard * _board, 46 std::vector<boost::any> _ObservedValues); 46 QtObservedInstanceBoard &_board, 47 QtObservedMolecule::ptr _ObservedMolecule); 47 48 GLMoleculeObject_molecule( 48 49 QGLSceneNode *mesh[], 49 50 QObject *parent, 50 const moleculeId_t molid, 51 QtObservedInstanceBoard * _board, 52 std::vector<boost::any> _ObservedValues); 51 QtObservedInstanceBoard &_board, 52 QtObservedMolecule::ptr _ObservedMolecule); 53 53 virtual ~GLMoleculeObject_molecule(); 54 55 // Observer functions56 void update(Observable *publisher);57 void subjectKilled(Observable *publisher);58 void recieveNotification(Observable *publisher, Notification_ptr notification);59 54 60 55 void initialize(QGLView *view, QGLPainter *painter); … … 76 71 void atomClicked(atomId_t no); 77 72 void moleculeClicked(moleculeId_t no); 78 void TesselationHullChanged();79 void BoundingBoxChanged();80 73 void IsSelectedChanged(); 81 void AtomInserted(const atomId_t _id);82 void AtomRemoved(const atomId_t _id);83 void IdChanged();84 74 85 75 private slots: … … 97 87 void setVisible(bool value); 98 88 99 void activateObserver();100 void deactivateObserver();101 102 89 void resetTesselationHull(); 103 90 void resetBoundingBox(); 104 91 void resetIndex(); 105 void resetName();106 92 107 93 void AtomSelected(const atomId_t _id); … … 111 97 112 98 private: 113 static const molecule * const getMolecule(const moleculeId_t _id);114 115 void init(const moleculeId_t _molid);116 117 private:118 99 void addAtomBonds( 119 100 const bond::ptr &_bond, … … 121 102 ); 122 103 104 void init(const moleculeId_t _molid); 105 123 106 //!> typedef for the internal set of atoms 124 107 typedef std::set<atomId_t> atoms_t; 125 126 static molecule::BoundingBoxInfo initBoundingBox();127 128 QGeometryData updateTesselationHull() const;129 static molecule::BoundingBoxInfo updateBoundingBox(130 const boost::function<const moleculeId_t ()> &_getMolIndex);131 static moleculeId_t updateIndex();132 static std::string updateName(133 const boost::function<const moleculeId_t ()> &_getMolIndex);134 108 135 109 /** Getter to contained atoms contained in \a ObservedValues. … … 139 113 atoms_t getPresentAtoms() const; 140 114 115 private: 116 141 117 //!> the Observable we are signed on, also indicates whether we are sign on (not NULL) 142 118 const Observable * owner; 143 119 144 //!> internal variable for caching molecule ref in cstor 145 const molecule * const molref; 120 QGeometryData updateTesselationHull() const; 146 121 147 122 //!> list of channels when tesselation hull needs to update 148 123 static const Observable::channels_t HullChannels; 149 //!> list of channels when bounding box needs to update150 static const Observable::channels_t BoundingBoxChannels;151 //!> list of channels when the index needs to update152 static const Observable::channels_t IndexChannels;153 //!> list of channels when the name needs to update154 static const Observable::channels_t NameChannels;155 124 156 private: 157 friend class QtObservedInstanceBoard; 158 /** Observed Values **/ 159 160 //!> enumeration of observed values to match with entries in ObservedValues 161 enum ObservedTypes { 162 //!> contains the current molecule index 163 MolIndex, 164 //!> contains the current molecule name 165 MolName, 166 //!> contains newest version of the bounding box on request 167 BoundingBox, 168 //!> gives the size of the enumeration 169 MAX_ObservedTypes 170 }; 171 172 //!> vector with all observed values 173 std::vector<boost::any> ObservedValues; 174 175 /** Initializes all \a _ObservedValues entries. 176 * 177 * \param _ObservedValues vector of ObservedValue to be filled 178 * \param _moid molecule id 179 * \param _molref reference to molecule 180 * \param _subjectKilled ref to function to call on subjectKilled() 181 */ 182 static void initObservedValues( 183 std::vector<boost::any> &_ObservedValues, 184 const moleculeId_t _molid, 185 const molecule * const _molref, 186 const boost::function<void(const moleculeId_t)> &_subjectKilled); 187 188 /** Destroys all \a ObservedValues entries. 189 * 190 * \param _ObservedValues vector of ObservedValue to be destroyed 191 */ 192 static void destroyObservedValues( 193 std::vector<boost::any> &_ObservedValues); 194 195 /** Getter to molecule index contained in \a ObservedValues. 196 * 197 * \return molecule's index 198 */ 199 moleculeId_t getMolIndex() const; 200 201 /** Getter to molecule name contained in \a ObservedValues. 202 * 203 * \return molecule's name 204 */ 205 std::string getMolName() const; 206 207 /** Getter to molecule's bounding box contained in \a ObservedValues. 208 * 209 * \return molecule's bounding box 210 */ 211 molecule::BoundingBoxInfo getBoundingBox() const; 212 213 //!> counts how many ObservedValues have already been subjectKilled() 214 mutable size_t subjectKilledCount; 215 216 private: 125 //!> internal variable for caching molecule ref in cstor 126 const molecule * const molref; 217 127 218 128 boost::function<QGeometryData ()> TesselationHullUpdater; … … 231 141 atomId_t hoverAtomId; 232 142 233 //!> we get multiple subjectKilled(), count and call callback() only on last 234 const unsigned int AllsignedOnChannels; 235 unsigned int signedOnChannels; 143 QtObservedInstanceBoard &board; 236 144 237 QtObserved InstanceBoard * board;145 QtObservedMolecule::ptr ObservedMolecule; 238 146 }; 239 147
Note:
See TracChangeset
for help on using the changeset viewer.