Changeset e29427 for src/UIElements
- Timestamp:
- Feb 26, 2016, 9:46:19 AM (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:
- 640cbd
- Parents:
- 805fdc
- git-author:
- Frederik Heber <heber@…> (02/13/16 15:43:33)
- git-committer:
- Frederik Heber <heber@…> (02/26/16 09:46:19)
- Location:
- src/UIElements/Views/Qt4/Qt3D
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_molecule.cpp
r805fdc re29427 420 420 421 421 if (AtomsinSceneMap.empty()) 422 emit moleculeEmptied(ObservedMolecule ->getMolIndex());422 emit moleculeEmptied(ObservedMolecule); 423 423 424 424 emit changed(); -
src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_molecule.hpp
r805fdc re29427 69 69 void hoverChanged(const moleculeId_t, int); 70 70 void indexChanged(GLMoleculeObject_molecule *, const moleculeId_t, const moleculeId_t); 71 void atomClicked(atomId_t no);72 void moleculeClicked(moleculeId_t no);73 void moleculeEmptied( moleculeId_t no);71 void atomClicked(atomId_t); 72 void moleculeClicked(moleculeId_t); 73 void moleculeEmptied(QtObservedMolecule::ptr); 74 74 void IsSelectedChanged(); 75 75 -
src/UIElements/Views/Qt4/Qt3D/GLWorldScene.cpp
r805fdc re29427 105 105 connect(this, SIGNAL(insertMolecule(QtObservedMolecule::ptr)), 106 106 this, SLOT(moleculeInserted(QtObservedMolecule::ptr)) ); 107 connect(this, SIGNAL(removeMolecule( const moleculeId_t)),108 this, SLOT(moleculeRemoved( const moleculeId_t)) );107 connect(this, SIGNAL(removeMolecule(QtObservedMolecule*)), 108 this, SLOT(moleculeRemoved(QtObservedMolecule*)) ); 109 109 110 110 // connect(this, SIGNAL(updated()), this, SLOT(update())); … … 197 197 { 198 198 const atomId_t atomid = _atom->getAtomIndex(); 199 const atomId_t molid = _atom->getAtomMoleculeIndex(); 199 const atomId_t atommolid = _atom->getAtomMoleculeIndex(); 200 const atomId_t molid = _mol->getMolIndex(); 201 ASSERT( molid == atommolid, 202 "GLWorldScene::moleculesAtomInserted() - atom "+toString(atomid)+" claims to belong to mol " 203 +toString(atommolid)+" but signal came from QtObservedMolecule with id " 204 +toString(molid)+"."); 200 205 LOG(3, "INFO: GLWorldScene: Received signal atomInserted for atom "+toString(atomid)+"."); 201 206 … … 216 221 // LOG(3, "INFO: GLWorldScene: Sending signal moleculesAtomInserted for atom "+toString(_atomid) 217 222 // +" to molecule in RemovedMolecules."); 218 // const MoleculeNodeMap::iterator removedmoliter = RemovedMolecules.find(molid);223 // const RemovedMoleculesMap_t::iterator removedmoliter = RemovedMolecules.find(molid); 219 224 // ASSERT( removedmoliter != RemovedMolecules.end(), 220 225 // "GLWorldScene::moleculesAtomInserted() - signal from old mol " … … 228 233 } 229 234 } else { 230 boost::recursive_mutex::scoped_lock lock(MoleculeMissedStateMap_mutex); 231 // only record missed state for molecule if (still) present but not instantiated 232 if (QtObservedMoleculeMap.count(molid)) { 233 // store signal for when it is instantiated 234 if (MoleculeMissedStateMap.count(molid) == 0) 235 MoleculeMissedStateMap.insert( std::make_pair(molid ,StateChangeMap_t()) ); 236 MoleculeMissedStateMap[molid].insert( std::make_pair(atomid, atomInsertedState) ); 237 ASSERT( QtObservedAtomMap[atomid] == _atom, 238 "GLWorldScene::moleculesAtomInserted() - atom "+toString(atomid) 239 +" inserted in molecule "+toString(molid) 240 +" which does not match atom in QtObservedAtomMap."); 241 LOG(3, "INFO: GLWorldScene: Placing atomInserted for atom " << atomid 242 << " and molecule " << molid << " into missed state map."); 235 const RemovedMoleculesMap_t::iterator removedmoliter = RemovedMolecules.find(_mol); 236 if (removedmoliter != RemovedMolecules.end()) { 237 ASSERT( 0, 238 "GLWorldScene::moleculesAtomInserted() - would need to send atomInserted to already removed molecule."); 239 } else { 240 boost::recursive_mutex::scoped_lock lock(MoleculeMissedStateMap_mutex); 241 // only record missed state for molecule if (still) present but not instantiated 242 if (QtObservedMoleculeMap.count(molid)) { 243 // store signal for when it is instantiated 244 if (MoleculeMissedStateMap.count(molid) == 0) 245 MoleculeMissedStateMap.insert( std::make_pair(molid ,StateChangeMap_t()) ); 246 MoleculeMissedStateMap[molid].insert( std::make_pair(atomid, atomInsertedState) ); 247 ASSERT( QtObservedAtomMap[atomid] == _atom, 248 "GLWorldScene::moleculesAtomInserted() - atom "+toString(atomid) 249 +" inserted in molecule "+toString(molid) 250 +" which does not match atom in QtObservedAtomMap."); 251 LOG(3, "INFO: GLWorldScene: Placing atomInserted for atom " << atomid 252 << " and molecule " << molid << " into missed state map."); 253 } 243 254 } 244 255 } … … 269 280 LOG(3, "INFO: GLWorldScene: Sending signal moleculesAtomRemoved for atom "+toString(_atomid) 270 281 +" to molecule in RemovedMolecules."); 271 const MoleculeNodeMap::iterator removedmoliter = RemovedMolecules.find(molid);282 const RemovedMoleculesMap_t::iterator removedmoliter = RemovedMolecules.find(_mol); 272 283 ASSERT( removedmoliter != RemovedMolecules.end(), 273 284 "GLWorldScene::moleculesAtomRemoved() - signal from old molecule " … … 286 297 } 287 298 } else { 288 const MoleculeNodeMap::iterator removedmoliter = RemovedMolecules.find(molid);299 const RemovedMoleculesMap_t::iterator removedmoliter = RemovedMolecules.find(_mol); 289 300 if (removedmoliter != RemovedMolecules.end()) { 290 301 ASSERT( removedmoliter != RemovedMolecules.end(), … … 345 356 disconnect(eraseiter->second.get(), SIGNAL(indexChanged(const moleculeId_t,const moleculeId_t)), 346 357 this, SLOT(moleculeIndexChanged(const moleculeId_t,const moleculeId_t)) ); 358 QtObservedMolecule * mol = eraseiter->second.get(); 347 359 QtObservedMoleculeMap.erase(eraseiter); 348 360 349 361 LOG(3, "INFO: GLWorldScene: Received signal moleculeSignOff for molecule "+toString(_id)+"."); 350 362 351 emit removeMolecule( _id);363 emit removeMolecule(mol); 352 364 } 353 365 … … 452 464 connect (molObject, SIGNAL(atomClicked(atomId_t)), this, SLOT(atomClicked(atomId_t))); 453 465 connect (molObject, SIGNAL(moleculeClicked(moleculeId_t)), this, SLOT(moleculeClicked(moleculeId_t))); 454 connect (molObject, SIGNAL(moleculeEmptied( moleculeId_t)), this, SLOT(moleculeEmpty(moleculeId_t)));466 connect (molObject, SIGNAL(moleculeEmptied(QtObservedMolecule::ptr)), this, SLOT(moleculeEmpty(QtObservedMolecule::ptr))); 455 467 connect (molObject, SIGNAL(selectionChanged()), this, SIGNAL(changed())); 456 468 connect (molObject, SIGNAL(selectionChanged()), this, SIGNAL(changed())); … … 471 483 /** Removes a molecule from the scene. 472 484 * 473 * @param _id id of molecule to remove 474 */ 475 void GLWorldScene::moleculeRemoved(const moleculeId_t _id) 476 { 477 LOG(3, "INFO: GLWorldScene: Received signal moleculeRemoved for molecule "+toString(_id)+"."); 485 * @param _mol QtObservedMolecule instance of molecule to remove 486 */ 487 void GLWorldScene::moleculeRemoved(QtObservedMolecule* _mol) 488 { 489 const moleculeId_t molid = _mol->getMolIndex(); 490 LOG(3, "INFO: GLWorldScene: Received signal moleculeRemoved for molecule "+toString(molid)+"."); 478 491 479 492 boost::recursive_mutex::scoped_lock lock(MoleculeinSceneMap_mutex); 480 493 481 MoleculeNodeMap::iterator iter = MoleculesinSceneMap.find( _id);494 MoleculeNodeMap::iterator iter = MoleculesinSceneMap.find(molid); 482 495 if ( iter != MoleculesinSceneMap.end()) { 483 LOG(1, "DEBUG: Removing GLMoleculeObject_molecule to id " << _id << " from scene.");484 RemovedMolecules.insert( std::make_pair(_ id, iter->second) );496 LOG(1, "DEBUG: Removing GLMoleculeObject_molecule to id " << molid << " from scene."); 497 RemovedMolecules.insert( std::make_pair(_mol, iter->second) ); 485 498 MoleculesinSceneMap.erase(iter); 486 499 } … … 489 502 { 490 503 boost::recursive_mutex::scoped_lock lock(MoleculeMissedStateMap_mutex); 491 MoleculeMissedStateMap.erase(_id); 492 } 493 } 494 495 void GLWorldScene::moleculeEmpty(const moleculeId_t _id) 496 { 497 LOG(3, "INFO: GLWorldScene: Received signal moleculeEmpty for molecule "+toString(_id)+"."); 504 MoleculeMissedStateMap.erase(molid); 505 } 506 } 507 508 void GLWorldScene::moleculeEmpty(QtObservedMolecule::ptr _mol) 509 { 510 const moleculeId_t molid = _mol->getMolIndex(); 511 LOG(3, "INFO: GLWorldScene: Received signal moleculeEmpty for molecule "+toString(molid)+"."); 498 512 499 513 boost::recursive_mutex::scoped_lock lock(MoleculeinSceneMap_mutex); 500 514 501 MoleculeNodeMap::iterator iter = RemovedMolecules.find(_id);515 RemovedMoleculesMap_t::iterator iter = RemovedMolecules.find(_mol.get()); 502 516 if ( iter != RemovedMolecules.end()) { 503 LOG(1, "DEBUG: Deleting GLMoleculeObject_molecule to id " << _id);517 LOG(1, "DEBUG: Deleting GLMoleculeObject_molecule to id " << molid); 504 518 GLMoleculeObject_molecule *molObject = iter->second; 505 519 RemovedMolecules.erase(iter); … … 508 522 } else { 509 523 ASSERT(0, 510 "GLWorldScene::moleculeEmpty() - molecule "+toString( _id)+" is empty that is not present.");524 "GLWorldScene::moleculeEmpty() - molecule "+toString(molid)+" is empty that is not present."); 511 525 } 512 526 … … 514 528 { 515 529 boost::recursive_mutex::scoped_lock lock(MoleculeMissedStateMap_mutex); 516 MoleculeMissedStateMap.erase( _id);530 MoleculeMissedStateMap.erase(molid); 517 531 } 518 532 … … 563 577 } 564 578 } 565 {566 MoleculeNodeMap::iterator const olditer = RemovedMolecules.find(_oldid);567 if ( olditer != RemovedMolecules.end()) {568 #ifndef NDEBUG569 MoleculeNodeMap::iterator const newiter = RemovedMolecules.find(_newid);570 ASSERT ( newiter == RemovedMolecules.end(),571 "GLWorldScene::moleculeIndexChanged() - molecule "572 +toString(_newid)+" already present in RemovedMolecules.");573 #endif574 LOG(1, "DEBUG: Changing GLMoleculeObject_molecule in RemovedMolecules from "575 << _oldid << " to id " << _newid);576 GLMoleculeObject_molecule* const molObject = olditer->second;577 RemovedMolecules.erase(olditer);578 RemovedMolecules[_newid] = molObject;579 }580 }581 579 } 582 580 -
src/UIElements/Views/Qt4/Qt3D/GLWorldScene.hpp
r805fdc re29427 85 85 void hoverChanged(const moleculeId_t, int); 86 86 void insertMolecule(QtObservedMolecule::ptr); 87 void removeMolecule( const moleculeId_t);87 void removeMolecule(QtObservedMolecule*); 88 88 89 89 private slots: 90 90 void atomClicked(atomId_t no); 91 91 void moleculeClicked(moleculeId_t no); 92 void moleculeRemoved( const moleculeId_t _id);92 void moleculeRemoved(QtObservedMolecule* _mol); 93 93 void moleculeSignOff(const moleculeId_t _id); 94 void moleculeEmpty( const moleculeId_t _id);94 void moleculeEmpty(QtObservedMolecule::ptr _mol); 95 95 void moleculeInserted(QtObservedMolecule::ptr); 96 96 void moleculeSignOn(QtObservedMolecule::ptr); … … 137 137 QtObservedMoleculeMap_t QtObservedMoleculeMap; 138 138 139 //!> map to get from QtObservedMolecule to the visual representant 140 typedef std::map< QtObservedMolecule* , GLMoleculeObject_molecule* > RemovedMoleculesMap_t; 139 141 //!> set of all currently removed molecules 140 MoleculeNodeMapRemovedMolecules;142 RemovedMoleculesMap_t RemovedMolecules; 141 143 142 144 //!> flag to indicate whether state map is currently worked on
Note:
See TracChangeset
for help on using the changeset viewer.