Changeset 96e145 for src/UIElements


Ignore:
Timestamp:
Feb 26, 2016, 9:46:18 AM (9 years ago)
Author:
Frederik Heber <heber@…>
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:
92af1b
Parents:
bcf9cd
git-author:
Frederik Heber <heber@…> (01/27/16 21:29:01)
git-committer:
Frederik Heber <heber@…> (02/26/16 09:46:18)
Message:

AtomInserted/Removed of QtObservedMolecule sends ptr as unique key.

  • this is used to associate the atom with the right molecule. This is needed in case when the molecule is deleted and a new one with the same id is created. If signals are delayed, we need to know which atomInserted/Removed signal to associated with which GLMoleculeObject_molecule.
Location:
src/UIElements
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/UIElements/Qt4/InstanceBoard/QtObservedMolecule.cpp

    rbcf9cd r96e145  
    227227        QtObservedAtom::ptr _atom = board.getObservedAtom(_id);
    228228        emit atomcountChanged();
    229         emit atomInserted(_atom);
     229        emit atomInserted(_atom, this);
    230230        emit bondcountChanged();
    231231        emit boundingboxChanged();
     
    245245        const atomId_t _id = _molecule->lastChangedAtomId();
    246246        emit atomcountChanged();
    247         emit atomRemoved(_id);
     247        emit atomRemoved(_id, this);
    248248        emit bondcountChanged();
    249249        emit boundingboxChanged();
  • src/UIElements/Qt4/InstanceBoard/QtObservedMolecule.hpp

    rbcf9cd r96e145  
    149149  void tesselationhullChanged();
    150150  void boundingboxChanged();
    151   void atomInserted(QtObservedAtom::ptr);
    152   void atomRemoved(const atomId_t);
     151  void atomInserted(QtObservedAtom::ptr, QtObservedMolecule *);
     152  void atomRemoved(const atomId_t, QtObservedMolecule *);
    153153  void moleculeRemoved();
    154154  void selectedChanged();
  • src/UIElements/Views/Qt4/Qt3D/GLWorldScene.cpp

    rbcf9cd r96e145  
    194194 * @param _atom atom to insert
    195195 */
    196 void GLWorldScene::moleculesAtomInserted(QtObservedAtom::ptr _atom)
     196void GLWorldScene::moleculesAtomInserted(QtObservedAtom::ptr _atom, QtObservedMolecule * _mol)
    197197{
    198198  const atomId_t atomid = _atom->getAtomIndex();
     
    202202  // check of molecule is already present
    203203  boost::recursive_mutex::scoped_lock lock(MoleculeinSceneMap_mutex);
    204   MoleculeNodeMap::iterator moliter = MoleculesinSceneMap.find(molid);
     204  const MoleculeNodeMap::iterator moliter = MoleculesinSceneMap.find(molid);
    205205  if (moliter != MoleculesinSceneMap.end()) {
    206     LOG(3, "INFO: GLWorldScene: Sending signal moleculesAtomInserted for atom "+toString(atomid)+".");
    207     QMetaObject::invokeMethod(moliter->second,        // pointer to a QObject
    208                               "atomInserted",       // member name (no parameters here)
    209                               Qt::QueuedConnection,     // connection type
    210                               Q_ARG(QtObservedAtom::ptr, _atom));     // parameters
     206    // check that it is the right molecule
     207    QtObservedMolecule::ptr &checkmol = moliter->second->ObservedMolecule;
     208    if (checkmol.get() == _mol) {
     209      LOG(3, "INFO: GLWorldScene: Sending signal moleculesAtomInserted for atom "+toString(atomid)+".");
     210      QMetaObject::invokeMethod(moliter->second,        // pointer to a QObject
     211                                "atomInserted",       // member name (no parameters here)
     212                                Qt::QueuedConnection,     // connection type
     213                                Q_ARG(QtObservedAtom::ptr, _atom));     // parameters
     214    } else {
     215      // relay atomRemoved to GLMoleculeObject_molecule in RemovedMolecules
     216//      LOG(3, "INFO: GLWorldScene: Sending signal moleculesAtomInserted for atom "+toString(_atomid)
     217//          +" to molecule in RemovedMolecules.");
     218//      const MoleculeNodeMap::iterator removedmoliter = RemovedMolecules.find(molid);
     219//      ASSERT( removedmoliter != RemovedMolecules.end(),
     220//          "GLWorldScene::moleculesAtomInserted() - signal from old mol "
     221//          +toString(molid)+", but not present in RemovedMolecules");
     222//      QMetaObject::invokeMethod(removedmoliter->second,        // pointer to a QObject
     223//                                "atomInserted ",       // member name (no parameters here)
     224//                                Qt::QueuedConnection,     // connection type
     225//                                Q_ARG(QtObservedAtom::ptr, _atom));     // parameters
     226      ASSERT( 0,
     227          "GLWorldScene::moleculesAtomInserted() - would need to send atomInserted to already removed molecule.");
     228    }
    211229  } else {
    212230    boost::recursive_mutex::scoped_lock lock(MoleculeMissedStateMap_mutex);
     
    231249 * @param _atomid atom to remove
    232250 */
    233 void GLWorldScene::moleculesAtomRemoved(const atomId_t _atomid)
     251void GLWorldScene::moleculesAtomRemoved(const atomId_t _atomid, QtObservedMolecule * _mol)
    234252{
    235253  LOG(3, "INFO: GLWorldScene: Received signal atomRemoved for atom "+toString(_atomid)+".");
     
    241259    // check of molecule is already present
    242260    boost::recursive_mutex::scoped_lock lock(MoleculeinSceneMap_mutex);
    243     MoleculeNodeMap::iterator moliter = MoleculesinSceneMap.find(molid);
     261    const MoleculeNodeMap::iterator moliter = MoleculesinSceneMap.find(molid);
    244262    if (moliter != MoleculesinSceneMap.end()) {
    245       LOG(3, "INFO: GLWorldScene: Sending signal moleculesAtomRemoved for atom "+toString(_atomid)+".");
    246       QMetaObject::invokeMethod(moliter->second,        // pointer to a QObject
    247                                 "atomRemoved",       // member name (no parameters here)
    248                                 Qt::QueuedConnection,     // connection type
    249                                 Q_ARG(const atomId_t, _atomid));     // parameters
     263      QtObservedMolecule::ptr &checkmol = moliter->second->ObservedMolecule;
     264      if (checkmol.get() == _mol) {
     265        LOG(3, "INFO: GLWorldScene: Sending signal moleculesAtomRemoved for atom "+toString(_atomid)+".");
     266        QMetaObject::invokeMethod(moliter->second,        // pointer to a QObject
     267                                  "atomRemoved",       // member name (no parameters here)
     268                                  Qt::QueuedConnection,     // connection type
     269                                  Q_ARG(const atomId_t, _atomid));     // parameters
     270      } else {
     271        // relay atomRemoved to GLMoleculeObject_molecule in RemovedMolecules
     272        LOG(3, "INFO: GLWorldScene: Sending signal moleculesAtomRemoved for atom "+toString(_atomid)
     273            +" to molecule in RemovedMolecules.");
     274        const MoleculeNodeMap::iterator removedmoliter = RemovedMolecules.find(molid);
     275        ASSERT( removedmoliter != RemovedMolecules.end(),
     276            "GLWorldScene::moleculesAtomRemoved() - signal from old mol "
     277            +toString(molid)+", but not present in RemovedMolecules");
     278        QMetaObject::invokeMethod(removedmoliter->second,        // pointer to a QObject
     279                                  "atomRemoved",       // member name (no parameters here)
     280                                  Qt::QueuedConnection,     // connection type
     281                                  Q_ARG(const atomId_t, _atomid));     // parameters
     282      }
    250283    } else {
    251284      boost::recursive_mutex::scoped_lock lock(MoleculeMissedStateMap_mutex);
     
    267300  // sign on to QtObservedMolecule to get atomInserted/..Removed signals from same
    268301  // source as GLMoleculeObject_molecule would
    269   connect(_mol.get(), SIGNAL(atomInserted(QtObservedAtom::ptr)),
    270       this, SLOT(moleculesAtomInserted(QtObservedAtom::ptr)) );
    271   connect(_mol.get(), SIGNAL(atomRemoved(const atomId_t)),
    272       this, SLOT(moleculesAtomRemoved(const atomId_t)) );
     302  connect(_mol.get(), SIGNAL(atomInserted(QtObservedAtom::ptr, QtObservedMolecule *)),
     303      this, SLOT(moleculesAtomInserted(QtObservedAtom::ptr, QtObservedMolecule *)) );
     304  connect(_mol.get(), SIGNAL(atomRemoved(const atomId_t, QtObservedMolecule *)),
     305      this, SLOT(moleculesAtomRemoved(const atomId_t, QtObservedMolecule *)) );
    273306  const moleculeId_t molid = _mol->getMolIndex();
    274307  ASSERT( QtObservedMoleculeMap.find(molid) == QtObservedMoleculeMap.end(),
  • src/UIElements/Views/Qt4/Qt3D/GLWorldScene.hpp

    rbcf9cd r96e145  
    9696  void moleculeSignOn(QtObservedMolecule::ptr);
    9797  void moleculeIndexChanged(const moleculeId_t _oldid, const moleculeId_t _newid);
    98   void moleculesAtomRemoved(const atomId_t _atomid);
    99   void moleculesAtomInserted(QtObservedAtom::ptr);
     98  void moleculesAtomRemoved(const atomId_t _atomid, QtObservedMolecule * _mol);
     99  void moleculesAtomInserted(QtObservedAtom::ptr, QtObservedMolecule *_mol);
    100100  void atomRemoved(const atomId_t _atomid);
    101101  void atomInserted(QtObservedAtom::ptr);
Note: See TracChangeset for help on using the changeset viewer.