Changeset 7cf0eb for src/UIElements
- Timestamp:
- Feb 12, 2016, 11:15:04 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:
- e25448
- Parents:
- 4ab5dc
- git-author:
- Frederik Heber <heber@…> (10/16/15 08:58:31)
- git-committer:
- Frederik Heber <heber@…> (02/12/16 23:15:04)
- Location:
- src/UIElements/Views/Qt4/Qt3D
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/UIElements/Views/Qt4/Qt3D/GLWorldScene.cpp
r4ab5dc r7cf0eb 90 90 GLMoleculeObject::meshCylinder[i]->setOption(QGLSceneNode::CullBoundingBox, true); 91 91 } 92 connect(this, SIGNAL(moleculePreparedInserted(const moleculeId_t)), this, SLOT(moleculeInserted(const moleculeId_t))); 93 connect(this, SIGNAL(moleculePreparedRemoved(const moleculeId_t)), this, SLOT(moleculeRemoved(const moleculeId_t))); 92 94 93 95 // connect(this, SIGNAL(updated()), this, SLOT(update())); … … 217 219 } 218 220 219 /** Inserts a molecule into the scene. 221 /** Prepres insertion of a molecule into the scene. 222 * 223 * This function takes up the insertion information, i.e. a molecule has been 224 * inserted and its id, and takes some immediate action (writing id into a map). 225 * But the request is then transmitted indirectly (i.e. not necessarily being 226 * processed in the same thread). Hence, we first take the request via a direction 227 * connection in the thread where the actual World::createMolecule() was called. 228 * However, the creation of the visual representation must occur in the thread 229 * who also contains GLWorldScene and GLWorldView and all further parents. 230 * 231 * That's the reason why we split here into moleculePrepareInserted and 232 * moleculeInserted. 220 233 * 221 234 * @param _mol molecule to insert 222 235 */ 223 void GLWorldScene::moleculeInserted(const moleculeId_t _id) 224 { 225 LOG(3, "INFO: GLWorldScene: Received signal moleculeInserted for molecule "+toString(_id)+"."); 236 void GLWorldScene::moleculePrepareInserted(const moleculeId_t _id) 237 { 238 LOG(3, "INFO: GLWorldScene: Received signal moleculePrepareInserted for molecule "+toString(_id)+"."); 239 240 boost::recursive_mutex::scoped_lock lock(MoleculeinSceneMap_mutex); 241 226 242 MoleculeNodeMap::const_iterator iter = MoleculesinSceneMap.find(_id); 227 243 ASSERT( iter == MoleculesinSceneMap.end(), 228 244 "GLWorldScene::moleculeInserted() - molecule's id "+toString(_id)+" already present."); 245 246 emit moleculePreparedInserted(_id); 247 } 248 249 /** Inserts a molecule into the scene. 250 * 251 * \sa moleculePrepareInserted() 252 * 253 * @param _mol molecule to insert 254 */ 255 void GLWorldScene::moleculeInserted(const moleculeId_t _id) 256 { 257 boost::recursive_mutex::scoped_lock lock(MoleculeinSceneMap_mutex); 229 258 230 259 // check whether molecule is still present … … 233 262 return; 234 263 } 235 if (const_cast<const World &>(World::getInstance()).getMolecule(MoleculeById(_id)) == NULL) 264 if (const_cast<const World &>(World::getInstance()).getMolecule(MoleculeById(_id)) == NULL) { 265 ELOG(2, "Molecule with id " << _id << " has disappeared."); 236 266 return; 267 } 237 268 238 269 // add new object … … 319 350 } 320 351 321 /** Removes a molecule from the scene. 352 /** Prepares removing a molecule from the scene. 353 * 354 * \sa moleculePrepareInserted() 322 355 * 323 356 * @param _id id of molecule to remove 324 357 */ 325 void GLWorldScene::moleculeRemoved(const moleculeId_t _id) 326 { 327 LOG(3, "INFO: GLWorldScene: Received signal moleculeRemoved for molecule "+toString(_id)+"."); 358 void GLWorldScene::moleculePrepareRemoved(const moleculeId_t _id) 359 { 360 LOG(3, "INFO: GLWorldScene: Received signal moleculePrepareRemoved for molecule "+toString(_id)+"."); 361 362 boost::recursive_mutex::scoped_lock lock(MoleculeinSceneMap_mutex); 363 328 364 MoleculeNodeMap::iterator iter = MoleculesinSceneMap.find(_id); 329 365 if ( iter == MoleculesinSceneMap.end()) 330 366 RemovalMolecules.insert(_id); 331 else { 332 333 GLMoleculeObject_molecule *molObject = iter->second; 334 molObject->disconnect(); 335 MoleculesinSceneMap.erase(iter); 336 delete molObject; 367 368 emit moleculePreparedRemoved(_id); 369 } 370 371 /** Removes a molecule from the scene. 372 * 373 * * \sa moleculePrepareRemoved() 374 * 375 * @param _id id of molecule to remove 376 */ 377 void GLWorldScene::moleculeRemoved(const moleculeId_t _id) 378 { 379 boost::recursive_mutex::scoped_lock lock(MoleculeinSceneMap_mutex); 380 381 MoleculeNodeMap::iterator iter = MoleculesinSceneMap.find(_id); 382 GLMoleculeObject_molecule *molObject = iter->second; 383 molObject->disconnect(); 384 MoleculesinSceneMap.erase(iter); 385 delete molObject; 337 386 338 387 // remove any possible state changes left … … 342 391 } 343 392 344 emit changed(); 345 emit changeOccured(); 346 } 393 emit changed(); 394 emit changeOccured(); 347 395 } 348 396 -
src/UIElements/Views/Qt4/Qt3D/GLWorldScene.hpp
r4ab5dc r7cf0eb 82 82 void hoverChanged(const atomId_t); 83 83 void hoverChanged(const moleculeId_t, int); 84 void moleculePreparedInserted(const moleculeId_t _id); 85 void moleculePreparedRemoved(const moleculeId_t _id); 84 86 85 87 private slots: 86 88 void atomClicked(atomId_t no); 87 89 void moleculeClicked(moleculeId_t no); 90 void moleculePrepareRemoved(const moleculeId_t _id); 91 void moleculePrepareInserted(const moleculeId_t _id); 88 92 void moleculeRemoved(const moleculeId_t _id); 89 93 void moleculeInserted(const moleculeId_t _id); … … 116 120 MoleculeNodeMap MoleculesinSceneMap; 117 121 ShapeNodeMap ShapesinSceneMap; 122 //!> flag to indicate whether state map is currently worked on 123 boost::recursive_mutex MoleculeinSceneMap_mutex; 118 124 119 125 //!> enumeration of all possible changes molecule might have missed before instantiation -
src/UIElements/Views/Qt4/Qt3D/GLWorldView.cpp
r4ab5dc r7cf0eb 92 92 connect(this, SIGNAL(atomRemoved(const moleculeId_t, const atomId_t)), worldscene, SLOT(atomRemoved(const moleculeId_t, const atomId_t)), Qt::DirectConnection); 93 93 connect(this, SIGNAL(atomInserted(const moleculeId_t, const atomId_t)), worldscene, SLOT(atomInserted(const moleculeId_t, const atomId_t)), Qt::DirectConnection); 94 connect(this, SIGNAL(moleculeInserted(const moleculeId_t)), worldscene, SLOT(molecule Inserted(const moleculeId_t)), Qt::DirectConnection);95 connect(this, SIGNAL(moleculeRemoved(const moleculeId_t)), worldscene, SLOT(molecule Removed(const moleculeId_t)), Qt::DirectConnection);94 connect(this, SIGNAL(moleculeInserted(const moleculeId_t)), worldscene, SLOT(moleculePrepareInserted(const moleculeId_t)), Qt::DirectConnection); 95 connect(this, SIGNAL(moleculeRemoved(const moleculeId_t)), worldscene, SLOT(moleculePrepareRemoved(const moleculeId_t)), Qt::DirectConnection); 96 96 //connect(this, SIGNAL(changed()), this, SLOT(updateGL())); 97 97 connect(this, SIGNAL(changed()), this, SLOT(sceneChangeSignalled()));
Note:
See TracChangeset
for help on using the changeset viewer.