Changeset 2f7988 for src/UIElements/Qt4/InstanceBoard
- Timestamp:
- Feb 12, 2016, 11:15:07 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:
- 0070aa
- Parents:
- 0f7ffe
- git-author:
- Frederik Heber <heber@…> (10/28/15 13:23:09)
- git-committer:
- Frederik Heber <heber@…> (02/12/16 23:15:07)
- Location:
- src/UIElements/Qt4/InstanceBoard
- Files:
-
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
src/UIElements/Qt4/InstanceBoard/QtObservedInstanceBoard.cpp
r0f7ffe r2f7988 22 22 23 23 /* 24 * Qt InstanceInformationBoard.cpp24 * QtObservedInstanceBoard.cpp 25 25 * 26 26 * Created on: Oct 17, 2015 … … 34 34 #endif 35 35 36 #include "Qt InstanceInformationBoard.hpp"36 #include "QtObservedInstanceBoard.hpp" 37 37 38 38 #include "UIElements/Views/Qt4/Qt3D/GLMoleculeObject_atom.hpp" … … 49 49 #include "World.hpp" 50 50 51 Qt InstanceInformationBoard::QtInstanceInformationBoard(QWidget * _parent) :51 QtObservedInstanceBoard::QtObservedInstanceBoard(QWidget * _parent) : 52 52 QWidget(_parent), 53 Observer("Qt InstanceInformationBoard"),53 Observer("QtObservedInstanceBoard"), 54 54 WorldSignedOn(false), 55 55 atomSubjectKilled( 56 boost::bind(&Qt InstanceInformationBoard::atomcountsubjectKilled, this, _1)),56 boost::bind(&QtObservedInstanceBoard::atomcountsubjectKilled, this, _1)), 57 57 moleculeSubjectKilled( 58 boost::bind(&Qt InstanceInformationBoard::moleculecountsubjectKilled, this, _1)),58 boost::bind(&QtObservedInstanceBoard::moleculecountsubjectKilled, this, _1)), 59 59 lastremovedatom((atomId_t)-1), 60 60 lastremovedatomsmolecule( std::make_pair((moleculeId_t)-1,(atomId_t)-1) ), … … 69 69 } 70 70 71 Qt InstanceInformationBoard::~QtInstanceInformationBoard()71 QtObservedInstanceBoard::~QtObservedInstanceBoard() 72 72 { 73 73 if (WorldSignedOn) { … … 93 93 } 94 94 95 void Qt InstanceInformationBoard::update(Observable *publisher)95 void QtObservedInstanceBoard::update(Observable *publisher) 96 96 { 97 97 ASSERT(0, 98 "Qt InstanceInformationBoard::update() - we are not signed on to general updates.");99 } 100 101 void Qt InstanceInformationBoard::subjectKilled(Observable *publisher)98 "QtObservedInstanceBoard::update() - we are not signed on to general updates."); 99 } 100 101 void QtObservedInstanceBoard::subjectKilled(Observable *publisher) 102 102 { 103 103 SignedOn_t::iterator iter = AtomSignedOn.find(publisher); … … 117 117 } 118 118 119 void Qt InstanceInformationBoard::recieveNotification(Observable *publisher, Notification_ptr notification)119 void QtObservedInstanceBoard::recieveNotification(Observable *publisher, Notification_ptr notification) 120 120 { 121 121 if (static_cast<World *>(publisher) == World::getPointer()) { … … 144 144 std::make_pair( _id, ObservedValues)); 145 145 ASSERT( inserter.second, 146 "Qt InstanceInformationBoard::recieveNotification() - could not insert ObservedValues for"146 "QtObservedInstanceBoard::recieveNotification() - could not insert ObservedValues for" 147 147 +toString(_id)+"."); 148 148 // we need to check for index changes … … 157 157 emit moleculeInserted(_id); 158 158 } else { 159 ELOG(1, "Qt InstanceInformationBoard got MoleculeInserted for unknown molecule id " << _id);159 ELOG(1, "QtObservedInstanceBoard got MoleculeInserted for unknown molecule id " << _id); 160 160 } 161 161 break; … … 192 192 std::make_pair( _id, ObservedValues)); 193 193 ASSERT( inserter.second, 194 "Qt InstanceInformationBoard::recieveNotification() - could not insert ObservedValues for"194 "QtObservedInstanceBoard::recieveNotification() - could not insert ObservedValues for" 195 195 +toString(_id)+"."); 196 196 // we need to check for index changes … … 199 199 AtomSignedOn.insert( static_cast<Observable *>(const_cast<atom *>(_atom)) ); 200 200 } else { 201 ELOG(1, "Qt InstanceInformationBoard got AtomInserted for unknown atom id " << _id);201 ELOG(1, "QtObservedInstanceBoard got AtomInserted for unknown atom id " << _id); 202 202 } 203 203 break; … … 212 212 } 213 213 default: 214 ASSERT(0, "Qt InstanceInformationBoard::recieveNotification() - we cannot get here for World.");214 ASSERT(0, "QtObservedInstanceBoard::recieveNotification() - we cannot get here for World."); 215 215 break; 216 216 } … … 228 228 // check whether atom's observedvalues are present 229 229 ASSERT( atomObservedValues.find(atomid) != atomObservedValues.end(), 230 "Qt InstanceInformationBoard::recieveNotification() - ObservedValues for atom "230 "QtObservedInstanceBoard::recieveNotification() - ObservedValues for atom " 231 231 +toString(atomid)+" are not present yet."); 232 232 // and emit 233 233 emit atomInserted(molid, atomid); 234 234 } else { 235 ELOG(2, "Qt InstanceInformationBoard::recieveNotification() - molecule "235 ELOG(2, "QtObservedInstanceBoard::recieveNotification() - molecule " 236 236 << molid << " has disappeared."); 237 237 } … … 262 262 moleculeObservedValues.erase(iter); 263 263 ASSERT( moleculeObservedValues.find(newmoleculeId) == moleculeObservedValues.end(), 264 "Qt InstanceInformationBoard::recieveNotification() - ObservedValues for atom "264 "QtObservedInstanceBoard::recieveNotification() - ObservedValues for atom " 265 265 +toString(newmoleculeId)+" already present."); 266 266 moleculeObservedValues.insert( std::make_pair(newmoleculeId, obsvalues) ); … … 275 275 } 276 276 default: 277 ASSERT(0, "Qt InstanceInformationBoard::recieveNotification() - we cannot get here.");277 ASSERT(0, "QtObservedInstanceBoard::recieveNotification() - we cannot get here."); 278 278 break; 279 279 } … … 293 293 atomObservedValues.erase(iter); 294 294 ASSERT( atomObservedValues.find(newatomId) == atomObservedValues.end(), 295 "Qt InstanceInformationBoard::recieveNotification() - ObservedValues for atom "295 "QtObservedInstanceBoard::recieveNotification() - ObservedValues for atom " 296 296 +toString(newatomId)+" already present."); 297 297 atomObservedValues.insert( std::make_pair(newatomId, obsvalues) ); … … 306 306 } 307 307 default: 308 ASSERT(0, "Qt InstanceInformationBoard::recieveNotification() - we cannot get here.");308 ASSERT(0, "QtObservedInstanceBoard::recieveNotification() - we cannot get here."); 309 309 break; 310 310 } 311 311 } else { 312 ASSERT(0, "Qt InstanceInformationBoard::recieveNotification() - notification from unknown source.");313 } 314 } 315 316 void Qt InstanceInformationBoard::atomcountsubjectKilled(const atomId_t _atomid)312 ASSERT(0, "QtObservedInstanceBoard::recieveNotification() - notification from unknown source."); 313 } 314 } 315 316 void QtObservedInstanceBoard::atomcountsubjectKilled(const atomId_t _atomid) 317 317 { 318 318 LOG(3, "DEBUG: InformationBoard got subjectKilled() for a value of atom " << _atomid); … … 329 329 emit atomRemoved(lastremovedatomsmolecule.first, lastremovedatomsmolecule.second); 330 330 else 331 ELOG(2, "Qt InstanceInformationBoard::atomcountsubjectKilled() - id " << _atomid331 ELOG(2, "QtObservedInstanceBoard::atomcountsubjectKilled() - id " << _atomid 332 332 << " not fitting with " << lastremovedatomsmolecule); 333 333 atomsubjectKilledCount.erase(iter); … … 335 335 } 336 336 337 void Qt InstanceInformationBoard::moleculecountsubjectKilled(const moleculeId_t _molid)337 void QtObservedInstanceBoard::moleculecountsubjectKilled(const moleculeId_t _molid) 338 338 { 339 339 LOG(3, "DEBUG: InformationBoard got subjectKilled() for a value of molecule " << _molid); … … 353 353 } 354 354 355 Qt InstanceInformationBoard::ObservedValues_t356 Qt InstanceInformationBoard::getAtomObservedValues(const atomId_t _id)355 QtObservedInstanceBoard::ObservedValues_t 356 QtObservedInstanceBoard::getAtomObservedValues(const atomId_t _id) 357 357 { 358 358 ObservedValues_t returnvalues; 359 359 const atomObservedValues_t::iterator iter = atomObservedValues.find(_id); 360 360 ASSERT(iter != atomObservedValues.end(), 361 "Qt InstanceInformationBoard::getAtomObservedValues() - atom values not present for id"361 "QtObservedInstanceBoard::getAtomObservedValues() - atom values not present for id" 362 362 +toString(_id)); 363 363 if (iter->first == _id) { … … 368 368 } 369 369 370 Qt InstanceInformationBoard::ObservedValues_t371 Qt InstanceInformationBoard::getMoleculeObservedValues(const moleculeId_t _id)370 QtObservedInstanceBoard::ObservedValues_t 371 QtObservedInstanceBoard::getMoleculeObservedValues(const moleculeId_t _id) 372 372 { 373 373 ObservedValues_t returnvalues; … … 383 383 } 384 384 385 void Qt InstanceInformationBoard::returnAtomObservedValues(385 void QtObservedInstanceBoard::returnAtomObservedValues( 386 386 const atomId_t _id, 387 387 ObservedValues_t &_observedvalues) … … 394 394 std::make_pair( _id, _observedvalues) ); 395 395 ASSERT( inserter.second, 396 "Qt InstanceInformationBoard::returnAtomObservedValues() - could not insert ObservedValues for"396 "QtObservedInstanceBoard::returnAtomObservedValues() - could not insert ObservedValues for" 397 397 +toString(_id)+"."); 398 398 } else … … 400 400 } 401 401 402 void Qt InstanceInformationBoard::returnMoleculeObservedValues(402 void QtObservedInstanceBoard::returnMoleculeObservedValues( 403 403 const moleculeId_t _id, 404 404 ObservedValues_t &_observedvalues) … … 411 411 std::make_pair( _id, _observedvalues) ); 412 412 ASSERT( inserter.second, 413 "Qt InstanceInformationBoard::returnMoleculeObservedValues() - could not insert ObservedValues for"413 "QtObservedInstanceBoard::returnMoleculeObservedValues() - could not insert ObservedValues for" 414 414 +toString(_id)+"."); 415 415 } else -
src/UIElements/Qt4/InstanceBoard/QtObservedInstanceBoard.hpp
r0f7ffe r2f7988 1 1 /* 2 * Qt InstanceInformationBoard.hpp2 * QtObservedInstanceBoard.hpp 3 3 * 4 4 * Created on: Oct 17, 2015 … … 7 7 8 8 9 #ifndef QT INSTANCEINFORMATIONBOARD_HPP_10 #define QT INSTANCEINFORMATIONBOARD_HPP_9 #ifndef QTOBSERVEDINSTANCEBOARD_HPP_ 10 #define QTOBSERVEDINSTANCEBOARD_HPP_ 11 11 12 12 // include config.h … … 32 32 class GLMoleculeObject_molecule; 33 33 34 /** The Qt InstanceInformationBoard is the central class for communicating instance34 /** The QtObservedInstanceBoard is the central class for communicating instance 35 35 * creation and destruction from MoleCuilder into the QtGui realm. It should be 36 36 * thought of as an interface to allow for safe multi-threaded computing. … … 42 42 * independent of the life time. The Observer/Observable signal from the World, 43 43 * i.e. World::MoleculeInserted, is caught (directly within the same thread) by 44 * the Qt InstanceInformationBoard. Here, we instantiate all ObservedValue's needed44 * the QtObservedInstanceBoard. Here, we instantiate all ObservedValue's needed 45 45 * for this specific molecule and store them in an internal map. Next, we emit 46 46 * a Qt signal informing the QtGui part about the new molecule. 47 47 * At some later stage, the QtGui will (probably in a different thread) 48 48 * instantiate a GLMoleculeObject_molecule as a visual representation of the 49 * molecule. It requests the ObservedValues from the Qt InstanceInformationBoard49 * molecule. It requests the ObservedValues from the QtObservedInstanceBoard 50 50 * and uses these directly. 51 * The Qt InstanceInformationBoard also records all subjectKilled() signals from51 * The QtObservedInstanceBoard also records all subjectKilled() signals from 52 52 * each ObservedValue. Additionally, each class using the ObservedValues 53 * additionally informs the Qt InstanceInformationBoard when subjectKilled() was53 * additionally informs the QtObservedInstanceBoard when subjectKilled() was 54 54 * called. If subjectKilled() for each ObservedValue of a molecule and from the 55 55 * visual representation have been received, a removal Qt signal is emitted. … … 57 57 * The same holds for the atom 58 58 */ 59 class Qt InstanceInformationBoard : public QWidget, public Observer59 class QtObservedInstanceBoard : public QWidget, public Observer 60 60 { 61 61 Q_OBJECT … … 67 67 typedef std::vector<boost::any> ObservedValues_t; 68 68 69 /** Cstor of QtInstanceInformationBoard. 69 /** Cstor of QtObservedInstanceBoard. 70 * 71 * \param _parent Qt parent to automatically destroy when parent is destroyed 72 */ 73 QtObservedInstanceBoard(QWidget * _parent=0); 74 75 /** Dstor of QtObservedInstanceBoard. 70 76 * 71 77 */ 72 QtInstanceInformationBoard(QWidget * _parent=0); 73 74 /** Dstor of QtInstanceInformationBoard. 75 * 76 */ 77 ~QtInstanceInformationBoard(); 78 ~QtObservedInstanceBoard(); 78 79 79 80 // Observer functions … … 153 154 moleculeObservedValues_t moleculeObservedValues; 154 155 155 //!> stored callback function for notifying Qt InstanceInformationBoard about subjectKilled in atom156 //!> stored callback function for notifying QtObservedInstanceBoard about subjectKilled in atom 156 157 boost::function<void (atomId_t)> atomSubjectKilled; 157 //!> stored callback function for notifying Qt InstanceInformationBoard about subjectKilled in molecule158 //!> stored callback function for notifying QtObservedInstanceBoard about subjectKilled in molecule 158 159 boost::function<void (moleculeId_t)> moleculeSubjectKilled; 159 160 … … 169 170 }; 170 171 171 #endif /* QT INSTANCEINFORMATIONBOARD_HPP_ */172 #endif /* QTOBSERVEDINSTANCEBOARD_HPP_ */
Note:
See TracChangeset
for help on using the changeset viewer.