Changeset 0f7ffe for src/UIElements/Views
- 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:
- 2f7988
- Parents:
- 8d5fbf1
- git-author:
- Frederik Heber <heber@…> (01/25/16 09:09:33)
- git-committer:
- Frederik Heber <heber@…> (02/12/16 23:15:07)
- Location:
- src/UIElements/Views/Qt4/Qt3D
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_molecule.cpp
r8d5fbf1 r0f7ffe 183 183 connect (this, SIGNAL(IdChanged()), this, SLOT(resetIndex()), Qt::QueuedConnection); 184 184 connect (this, SIGNAL(AtomInserted(const atomId_t)), this, SLOT(atomInserted(const atomId_t)), Qt::QueuedConnection); 185 connect (this, SIGNAL(AtomInserted(const atomId_t)), this, SLOT(resetAtoms()), Qt::QueuedConnection);186 connect (this, SIGNAL(AtomRemoved(const atomId_t)), this, SLOT(resetAtoms()), Qt::QueuedConnection);187 185 connect (this, SIGNAL(AtomRemoved(const atomId_t)), this, SLOT(atomRemoved(const atomId_t)), Qt::QueuedConnection); 186 if (board != NULL) { 187 connect(board, SIGNAL(atomInserted(const atomId_t)), 188 this, SLOT(atomInserted(const atomId_t))); 189 connect(board, SIGNAL(atomRemoved(const atomId_t)), 190 this, SLOT(atomRemoved(const atomId_t))); 191 } 188 192 189 193 connect( this, SIGNAL(clicked()), this, SLOT(wasClicked())); … … 345 349 void GLMoleculeObject_molecule::resetTesselationHull() 346 350 { 347 if (!TesselationHull.isValid()) 351 // only when Observable still lives so far, we may check on Cacheable::isValid 352 if ((owner != NULL) && (!TesselationHull.isValid())) 348 353 updateMesh(createMoleculeMesh(*TesselationHull)); 349 354 } -
src/UIElements/Views/Qt4/Qt3D/GLWorldScene.cpp
r8d5fbf1 r0f7ffe 113 113 GLMoleculeObject::cleanMaterialMap(); 114 114 } 115 116 ///** Update the WorldScene with molecules and atomsfrom World.117 // *118 // * This function should be called after e.g. WorldTime::TimeChanged was119 // * received or after another molecule has been loaded.120 // *121 // */122 //void GLWorldScene::update()123 //{124 // const std::vector<const molecule *> &molecules =125 // const_cast<const World &>(World::getInstance()).getAllMolecules();126 //127 // for (std::vector<const molecule*>::const_iterator moliter = molecules.begin();128 // moliter != molecules.end();129 // moliter++) {130 // boost::recursive_mutex::scoped_lock lock(MoleculeinSceneMap_mutex);131 // // check whether molecule already exists132 // const moleculeId_t molid = (*moliter)->getId();133 // const bool mol_present = MoleculesinSceneMap.count(molid);134 // if (!mol_present)135 // moleculeInserted((*moliter)->getId());136 // }137 //138 // boost::recursive_mutex::scoped_lock lock(MoleculeinSceneMap_mutex);139 // MoleculeNodeMap::iterator iter = MoleculesinSceneMap.begin();140 // for (;iter != MoleculesinSceneMap.end();) {141 // const moleculeId_t molid = iter->first;142 // const molecule * const mol = const_cast<const World &>(World::getInstance()).143 // getMolecule(MoleculeById(molid));144 // const bool mol_absent = (mol == NULL);145 // // step on to next molecule before possibly removing entry and invalidating iter146 // ++iter;147 // if (mol_absent)148 // moleculeRemoved(molid);149 // }150 //151 //}152 115 153 116 void GLWorldScene::atomClicked(atomId_t no) … … 350 313 connect (molObject, SIGNAL(hoverChanged(const moleculeId_t, int)), this, SIGNAL(hoverChanged(const moleculeId_t, int))); 351 314 connect (molObject, SIGNAL(hoverChanged(const moleculeId_t, int)), this, SIGNAL(hoverChanged(const moleculeId_t, int))); 352 connect(board, SIGNAL(atomInserted(const atomId_t)),353 molObject, SLOT(atomInserted(const atomId_t)));354 connect(board, SIGNAL(atomRemoved(const atomId_t)),355 molObject, SLOT(atomRemoved(const atomId_t)));356 315 357 316 emit changed(); -
src/UIElements/Views/Qt4/Qt3D/GLWorldView.cpp
r8d5fbf1 r0f7ffe 102 102 // sign on to changes in the world 103 103 World::getInstance().signOn(this); 104 World::getInstance().signOn(this, World::MoleculeInserted);105 104 World::getInstance().signOn(this, World::SelectionChanged); 106 105 // WorldTime::getInstance().signOn(this, WorldTime::TimeChanged); … … 117 116 GLWorldView::~GLWorldView() 118 117 { 119 // remove me from all observed molecules120 for (ObservedMolecules_t::iterator iter = ObservedMolecules.begin();121 !ObservedMolecules.empty();122 iter = ObservedMolecules.begin())123 signOffFromMolecule(*iter);124 125 118 QSettings settings; 126 119 settings.beginGroup("WorldView"); … … 131 124 132 125 World::getInstance().signOff(this); 133 World::getInstance().signOff(this, World::MoleculeInserted);134 126 World::getInstance().signOff(this, World::SelectionChanged); 135 127 // WorldTime::getInstance().signOff(this, WorldTime::TimeChanged); … … 335 327 } 336 328 337 void GLWorldView::signOnToMolecule(const molecule *_mol)338 {339 ASSERT( _mol != NULL,340 "GLWorldView::signOnToMolecule() - molecule ref is NULL.");341 _mol->signOn(this, molecule::AtomInserted);342 _mol->signOn(this, molecule::AtomRemoved);343 344 ObservedMolecules.insert(const_cast<molecule *>(_mol));345 }346 347 void GLWorldView::signOffFromMolecule(const molecule *_mol)348 {349 ObservedMolecules_t::const_iterator iter = ObservedMolecules.find(350 const_cast<molecule *>(_mol));351 ASSERT( iter != ObservedMolecules.end(),352 "GLWorldView::signOffFromMolecule() - molecule "+toString(_mol)353 +" gave subjectKilled we are not signed on.");354 // LOG(1, "INFO: Erasing " << mol << " from ObservedMolecules.");355 ObservedMolecules.erase(iter);356 357 ASSERT( _mol != NULL,358 "GLWorldView::signOffFromMolecule() - molecule ref is NULL.");359 _mol->signOff(this, molecule::AtomInserted);360 _mol->signOff(this, molecule::AtomRemoved);361 }362 363 329 /** 364 330 * The observable can tell when it dies. … … 366 332 void GLWorldView::subjectKilled(Observable *publisher) 367 333 { 368 molecule * mol = static_cast<molecule *>(publisher); 369 370 // std::copy(ObservedMolecules.begin(), ObservedMolecules.end(), 371 // std::ostream_iterator<molecule *>(std::cout, "\n")); 372 373 if (mol != NULL) { 374 ObservedMolecules.erase(mol); 375 // 376 // // sign off 377 // signOffFromMolecule(mol); 378 379 // emit removed signal 380 const moleculeId_t _id = mol->getId(); 381 emit moleculeRemoved(_id); 382 } 334 // world never dies 383 335 } 384 336 … … 398 350 #endif 399 351 emit worldSelectionChanged(); 400 break;401 }402 case World::MoleculeInserted:403 {404 const moleculeId_t _id = const_cast<const World &>(World::getInstance()).lastChangedMolId();405 #ifdef LOG_OBSERVER406 observerLog().addMessage() << "++ Observer " << observerLog().getName(static_cast<Observer *>(this)) << " received notification that molecule "+toString(_id)+" has been inserted.";407 #endif408 const molecule * const _molecule = const_cast<const World &>(World::getInstance()).409 getMolecule(MoleculeById(_id));410 if (_molecule != NULL) {411 signOnToMolecule(_molecule);412 413 emit moleculeInserted(_id);414 }415 352 break; 416 353 } … … 432 369 default: 433 370 ASSERT(0, "GLWorldView::recieveNotification() - we cannot get here for WorldTime."); 434 break;435 }436 } else if (dynamic_cast<molecule *>(publisher) != NULL) {437 const molecule * mol = const_cast<const molecule * const>(dynamic_cast<molecule *>(publisher));438 const moleculeId_t molid = mol->getId();439 const atomId_t atomid = mol->lastChangedAtomId();440 switch (notification->getChannelNo()) {441 case molecule::AtomInserted:442 {443 #ifdef LOG_OBSERVER444 observerLog().addMessage() << "++ Observer " << observerLog().getName(static_cast<Observer *>(this))445 << " received notification that atom "+toString(atomid)+" has been inserted into molecule "+toString(molid)+".";446 #endif447 emit atomInserted(molid, atomid);448 break;449 }450 case World::AtomRemoved:451 {452 #ifdef LOG_OBSERVER453 observerLog().addMessage() << "++ Observer " << observerLog().getName(static_cast<Observer *>(this))454 << " received notification that atom "+toString(atomid)+" has been removed from molecule "+toString(molid)+".";455 #endif456 emit atomRemoved(molid, atomid);457 break;458 }459 default:460 ASSERT(0, "GLWorldView::recieveNotification() - we cannot get here for molecule.");461 371 break; 462 372 } -
src/UIElements/Views/Qt4/Qt3D/GLWorldView.hpp
r8d5fbf1 r0f7ffe 66 66 void changed(); 67 67 void TimeChanged(); 68 void atomInserted(const moleculeId_t _molid, const atomId_t _atomid);69 void atomRemoved(const moleculeId_t _molid, const atomId_t _atomid);70 void moleculeInserted(const moleculeId_t _id);71 void moleculeRemoved(const moleculeId_t _id);72 68 void worldSelectionChanged(); 73 69 void hoverChanged(const atomId_t _id); … … 116 112 void setDomainStatus(const bool status); 117 113 118 void signOnToMolecule(const molecule *_mol);119 void signOffFromMolecule(const molecule *_mol);120 121 114 private: 122 115 … … 138 131 139 132 double defaultEyeSeparation; 140 141 typedef std::multiset<molecule *> ObservedMolecules_t;142 //!> sorted list of molecules we are sign on to143 ObservedMolecules_t ObservedMolecules;144 133 }; 145 134
Note:
See TracChangeset
for help on using the changeset viewer.