Changeset 5a9e34 for src/UIElements/Qt4/InstanceBoard
- Timestamp:
- Feb 12, 2016, 11:15:40 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:
- 367489
- Parents:
- fe493f
- git-author:
- Frederik Heber <heber@…> (01/20/16 20:02:22)
- git-committer:
- Frederik Heber <heber@…> (02/12/16 23:15:40)
- Location:
- src/UIElements/Qt4/InstanceBoard
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/UIElements/Qt4/InstanceBoard/QtObservedMolecule.cpp
rfe493f r5a9e34 59 59 channels += 60 60 molecule::AtomInserted, 61 molecule::AtomMoved, 61 62 molecule::AtomRemoved, 62 63 molecule::FormulaChanged, … … 76 77 } 77 78 79 static const Observable::channels_t getAllCenterChannels() 80 { 81 Observable::channels_t channels; 82 channels += 83 molecule::AtomInserted, 84 molecule::AtomMoved, 85 molecule::AtomRemoved; 86 return channels; 87 } 88 78 89 // static instances 79 90 const Observable::channels_t QtObservedMolecule::AtomCountChannels(getAllAtomCountChannels()); 91 const Observable::channels_t QtObservedMolecule::BondCountChannels(getAllAtomCountChannels()); 80 92 const Observable::channels_t QtObservedMolecule::BoundingBoxChannels(1, molecule::BoundingBoxChanged); 81 93 const Observable::channels_t QtObservedMolecule::FormulaStringChannels(1, molecule::FormulaChanged); 94 const Observable::channels_t QtObservedMolecule::CenterChannels(getAllCenterChannels()); 82 95 const Observable::channels_t QtObservedMolecule::IndexChannels(1, molecule::IndexChanged); 83 96 const Observable::channels_t QtObservedMolecule::NameChannels(1, molecule::MoleculeNameChanged); 97 const Observable::channels_t QtObservedMolecule::NonHydrogenCountChannels(1, molecule::FormulaChanged); 84 98 85 99 QtObservedMolecule::QtObservedMolecule( … … 146 160 147 161 board.markObservedMoleculeAsDisconnected(getMolIndex()); 162 163 emit moleculeRemoved(); 148 164 } 149 165 } … … 168 184 emit atomcountChanged(); 169 185 emit atomInserted(_id); 186 emit bondcountChanged(); 187 emit boundingboxChanged(); 188 emit centerChanged(); 189 emit tesselationhullChanged(); 190 break; 191 } 192 case molecule::AtomMoved: 193 { 194 emit boundingboxChanged(); 195 emit centerChanged(); 196 emit tesselationhullChanged(); 170 197 break; 171 198 } … … 175 202 emit atomcountChanged(); 176 203 emit atomRemoved(_id); 204 emit bondcountChanged(); 205 emit boundingboxChanged(); 206 emit centerChanged(); 207 emit tesselationhullChanged(); 177 208 break; 178 209 } … … 189 220 { 190 221 emit formulaChanged(); 222 emit nononhydrogenChanged(); 191 223 break; 192 224 } … … 267 299 const boost::function<int ()> AtomCountUpdater( 268 300 boost::bind(&QtObservedMolecule::updateAtomCount, MolIndexGetter)); 301 const boost::function<int ()> BondCountUpdater( 302 boost::bind(&QtObservedMolecule::updateBondCount, MolIndexGetter)); 303 const boost::function<Vector ()> MolCenterUpdater( 304 boost::bind(&QtObservedMolecule::updateCenter, MolIndexGetter)); 269 305 const boost::function<std::string ()> MolFormulaUpdater( 270 306 boost::bind(&QtObservedMolecule::updateFormulaString, MolIndexGetter)); 271 307 const boost::function<std::string ()> MolNameUpdater( 272 308 boost::bind(&QtObservedMolecule::updateName, MolIndexGetter)); 309 const boost::function<int ()> NonHydrogenCountUpdater( 310 boost::bind(&QtObservedMolecule::updateNonHydrogenCount, MolIndexGetter)); 273 311 const boost::function<molecule::BoundingBoxInfo ()> BoundingBoxUpdater( 274 312 boost::bind(&QtObservedMolecule::updateBoundingBox, MolIndexGetter)); … … 282 320 _subjectKilled, 283 321 MolIndexGetter); 322 _ObservedValues[BondCount] = new ObservedValue_wCallback<int, moleculeId_t>( 323 _molref, 324 BondCountUpdater, 325 "MoleculeBondCount_"+toString(_molid), 326 BondCountUpdater(), 327 BondCountChannels, 328 _subjectKilled, 329 MolIndexGetter); 284 330 _ObservedValues[BoundingBox] = new ObservedValue_wCallback<molecule::BoundingBoxInfo, moleculeId_t>( 285 331 _molref, … … 298 344 _subjectKilled, 299 345 MolIndexGetter); 346 _ObservedValues[MolCenter] = new ObservedValue_wCallback<Vector, moleculeId_t>( 347 _molref, 348 MolCenterUpdater, 349 "MoleculeCenter_"+toString(_molid), 350 MolCenterUpdater(), 351 CenterChannels, 352 _subjectKilled, 353 MolIndexGetter); 300 354 _ObservedValues[MolName] = new ObservedValue_wCallback<std::string, moleculeId_t>( 301 355 _molref, … … 306 360 _subjectKilled, 307 361 MolIndexGetter); 362 _ObservedValues[NonHydrogenCount] = new ObservedValue_wCallback<int, moleculeId_t>( 363 _molref, 364 NonHydrogenCountUpdater, 365 "MoleculeNonHydrogenCount_"+toString(_molid), 366 NonHydrogenCountUpdater(), 367 NonHydrogenCountChannels, 368 _subjectKilled, 369 MolIndexGetter); 308 370 } 309 371 … … 313 375 delete boost::any_cast<ObservedValue_wCallback<moleculeId_t> *>(_ObservedValues[MolIndex]); 314 376 delete boost::any_cast<ObservedValue_wCallback<int, moleculeId_t> *>(_ObservedValues[AtomCount]); 377 delete boost::any_cast<ObservedValue_wCallback<int, moleculeId_t> *>(_ObservedValues[BondCount]); 315 378 delete boost::any_cast<ObservedValue_wCallback<std::string, moleculeId_t> *>(_ObservedValues[FormulaString]); 379 delete boost::any_cast<ObservedValue_wCallback<Vector, moleculeId_t> *>(_ObservedValues[MolCenter]); 316 380 delete boost::any_cast<ObservedValue_wCallback<molecule::BoundingBoxInfo, moleculeId_t> *>(_ObservedValues[BoundingBox]); 317 381 delete boost::any_cast<ObservedValue_wCallback<std::string, moleculeId_t> *>(_ObservedValues[MolName]); 382 delete boost::any_cast<ObservedValue_wCallback<int, moleculeId_t> *>(_ObservedValues[NonHydrogenCount]); 318 383 _ObservedValues.clear(); 319 384 } … … 329 394 } 330 395 396 int QtObservedMolecule::updateBondCount( 397 const boost::function<const moleculeId_t ()> &_getMolIndex) 398 { 399 const molecule * const mol = getMolecule(_getMolIndex()); 400 if (mol != NULL) 401 return mol->getBondCount(); 402 else 403 return (int)0; 404 } 405 331 406 molecule::BoundingBoxInfo QtObservedMolecule::updateBoundingBox( 332 407 const boost::function<const moleculeId_t ()> &_getMolIndex) … … 349 424 } 350 425 426 Vector QtObservedMolecule::updateCenter( 427 const boost::function<const moleculeId_t ()> &_getMolIndex) 428 { 429 const molecule * const mol = getMolecule(_getMolIndex()); 430 if (mol != NULL) 431 return mol->DetermineCenterOfAll(); 432 else 433 return zeroVec; 434 } 435 351 436 moleculeId_t QtObservedMolecule::updateIndex() 352 437 { … … 364 449 } 365 450 451 int QtObservedMolecule::updateNonHydrogenCount( 452 const boost::function<const moleculeId_t ()> &_getMolIndex) 453 { 454 const molecule * const mol = getMolecule(_getMolIndex()); 455 if (mol != NULL) 456 return mol->getNoNonHydrogen(); 457 else 458 return (int)0; 459 } 460 366 461 int QtObservedMolecule::getAtomCount() const 367 462 { … … 369 464 } 370 465 466 int QtObservedMolecule::getBondCount() const 467 { 468 return boost::any_cast<ObservedValue_wCallback<int, moleculeId_t> *>(ObservedValues[BondCount])->get(); 469 } 470 371 471 std::string QtObservedMolecule::getMolFormula() const 372 472 { … … 374 474 } 375 475 476 Vector QtObservedMolecule::getMolCenter() const 477 { 478 return boost::any_cast<ObservedValue_wCallback<Vector, moleculeId_t> *>(ObservedValues[MolCenter])->get(); 479 } 480 376 481 moleculeId_t QtObservedMolecule::getMolIndex() const 377 482 { … … 384 489 } 385 490 491 int QtObservedMolecule::getNonHydrogenCount() const 492 { 493 return boost::any_cast<ObservedValue_wCallback<int, moleculeId_t> *>(ObservedValues[NonHydrogenCount])->get(); 494 } 495 386 496 molecule::BoundingBoxInfo QtObservedMolecule::getBoundingBox() const 387 497 { -
src/UIElements/Qt4/InstanceBoard/QtObservedMolecule.hpp
rfe493f r5a9e34 22 22 #include "CodePatterns/Observer/Observable.hpp" 23 23 #include "CodePatterns/Observer/Observer.hpp" 24 25 #include "LinearAlgebra/Vector.hpp" 24 26 25 27 #include "molecule.hpp" … … 84 86 int getAtomCount() const; 85 87 88 /** Getter to molecule bond count contained in \a ObservedValues. 89 * 90 * \return molecule's bond count 91 */ 92 int getBondCount() const; 93 94 /** Getter to molecule center contained in \a ObservedValues. 95 * 96 * \return molecule's center 97 */ 98 Vector getMolCenter() const; 99 86 100 /** Getter to molecule index contained in \a ObservedValues. 87 101 * … … 101 115 */ 102 116 std::string getMolFormula() const; 117 118 /** Getter to molecule non-hydrogen atom count contained in \a ObservedValues. 119 * 120 * \return molecule's non-hydrogen atom count 121 */ 122 int getNonHydrogenCount() const; 103 123 104 124 /** Getter to molecule's bounding box contained in \a ObservedValues. … … 112 132 signals: 113 133 void atomcountChanged(); 134 void bondcountChanged(); 114 135 void formulaChanged(); 115 136 void indexChanged(); 116 137 void nameChanged(); 138 void nononhydrogenChanged(); 139 void centerChanged(); 117 140 void tesselationhullChanged(); 118 141 void boundingboxChanged(); 119 142 void atomInserted(const atomId_t); 120 143 void atomRemoved(const atomId_t); 144 void moleculeRemoved(); 121 145 122 146 private: … … 128 152 static int updateAtomCount( 129 153 const boost::function<const moleculeId_t ()> &_getMolIndex); 154 static int updateBondCount( 155 const boost::function<const moleculeId_t ()> &_getMolIndex); 130 156 static molecule::BoundingBoxInfo updateBoundingBox( 131 157 const boost::function<const moleculeId_t ()> &_getMolIndex); 132 158 static std::string updateFormulaString( 159 const boost::function<const moleculeId_t ()> &_getMolIndex); 160 static Vector updateCenter( 133 161 const boost::function<const moleculeId_t ()> &_getMolIndex); 134 162 static moleculeId_t updateIndex(); 135 163 static std::string updateName( 136 164 const boost::function<const moleculeId_t ()> &_getMolIndex); 165 static int updateNonHydrogenCount( 166 const boost::function<const moleculeId_t ()> &_getMolIndex); 137 167 138 168 //!> list of channels when atom count needs to update 139 169 static const Observable::channels_t AtomCountChannels; 170 //!> list of channels when bond count needs to update 171 static const Observable::channels_t BondCountChannels; 140 172 //!> list of channels when bounding box needs to update 141 173 static const Observable::channels_t BoundingBoxChannels; 142 174 //!> list of channels when formula needs to update 143 175 static const Observable::channels_t FormulaStringChannels; 176 //!> list of channels when the center needs to update 177 static const Observable::channels_t CenterChannels; 144 178 //!> list of channels when the index needs to update 145 179 static const Observable::channels_t IndexChannels; 146 180 //!> list of channels when the name needs to update 147 181 static const Observable::channels_t NameChannels; 182 //!> list of channels when the name needs to update 183 static const Observable::channels_t NonHydrogenCountChannels; 148 184 149 185 private: … … 154 190 //!> contains the current molecule's atom count 155 191 AtomCount, 192 //!> contains the current molecule's number of bonds 193 BondCount, 194 //!> contains newest version of the bounding box on request 195 BoundingBox, 156 196 //!> contains the current molecule's formula 157 197 FormulaString, 198 //!> contains the current molecule's center 199 MolCenter, 158 200 //!> contains the current molecule index 159 201 MolIndex, 160 202 //!> contains the current molecule name 161 203 MolName, 162 //!> contains newest version of the bounding box on request163 BoundingBox,204 //!> contains the current molecule's non-hydrogen atom count 205 NonHydrogenCount, 164 206 //!> gives the size of the enumeration 165 207 MAX_ObservedTypes
Note:
See TracChangeset
for help on using the changeset viewer.