Changeset bcf9cd 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:
96e145
Parents:
23221f
git-author:
Frederik Heber <heber@…> (01/27/16 21:24:07)
git-committer:
Frederik Heber <heber@…> (02/26/16 09:46:18)
Message:

GLWorldScene places GLMoleculeObject_molecule into extra list before removal.

  • GLMoleculeObject_molecule sends signal when no atoms are left.
  • GLMoleculeObject_molecule is destroyed when signal is obtained and we have placed it in removal list before.
Location:
src/UIElements/Views/Qt4/Qt3D
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_molecule.cpp

    r23221f rbcf9cd  
    419419  delete atomObject;
    420420
     421  if (AtomsinSceneMap.empty())
     422    emit moleculeEmptied(ObservedMolecule->getMolIndex());
     423
    421424  emit changed();
    422425  emit changeOccured();
  • src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_molecule.hpp

    r23221f rbcf9cd  
    7171  void atomClicked(atomId_t no);
    7272  void moleculeClicked(moleculeId_t no);
     73  void moleculeEmptied(moleculeId_t no);
    7374  void IsSelectedChanged();
    7475
  • src/UIElements/Views/Qt4/Qt3D/GLWorldScene.cpp

    r23221f rbcf9cd  
    398398  connect (molObject, SIGNAL(atomClicked(atomId_t)), this, SLOT(atomClicked(atomId_t)));
    399399  connect (molObject, SIGNAL(moleculeClicked(moleculeId_t)), this, SLOT(moleculeClicked(moleculeId_t)));
     400  connect (molObject, SIGNAL(moleculeEmptied(moleculeId_t)), this, SLOT(moleculeEmpty(moleculeId_t)));
    400401  connect (molObject, SIGNAL(selectionChanged()), this, SIGNAL(changed()));
    401402  connect (molObject, SIGNAL(selectionChanged()), this, SIGNAL(changed()));
     
    426427  MoleculeNodeMap::iterator iter = MoleculesinSceneMap.find(_id);
    427428  if ( iter != MoleculesinSceneMap.end()) {
    428     LOG(1, "DEBUG: Removing GLMoleculeObject_molecule to id " << _id);
     429    LOG(1, "DEBUG: Removing GLMoleculeObject_molecule to id " << _id << " from scene.");
     430    RemovedMolecules.insert( std::make_pair(_id, iter->second) );
     431    MoleculesinSceneMap.erase(iter);
     432  }
     433
     434  // remove any possible state changes left
     435  {
     436    boost::recursive_mutex::scoped_lock lock(MoleculeMissedStateMap_mutex);
     437    MoleculeMissedStateMap.erase(_id);
     438  }
     439}
     440
     441void GLWorldScene::moleculeEmpty(const moleculeId_t _id)
     442{
     443  LOG(3, "INFO: GLWorldScene: Received signal moleculeEmpty for molecule "+toString(_id)+".");
     444
     445  boost::recursive_mutex::scoped_lock lock(MoleculeinSceneMap_mutex);
     446
     447  MoleculeNodeMap::iterator iter = RemovedMolecules.find(_id);
     448  if ( iter != RemovedMolecules.end()) {
     449    LOG(1, "DEBUG: Deleting GLMoleculeObject_molecule to id " << _id);
    429450    GLMoleculeObject_molecule *molObject = iter->second;
     451    RemovedMolecules.erase(iter);
    430452    molObject->disconnect();
    431     MoleculesinSceneMap.erase(iter);
    432453    delete molObject;
     454  } else {
     455    ASSERT(0,
     456        "GLWorldScene::moleculeEmpty() - molecule "+toString(_id)+" is empty that is not present.");
    433457  }
    434458
     
    478502          +toString(_newid)+" already present in MoleculesinSceneMap.");
    479503#endif
    480       LOG(1, "DEBUG: Changing GLMoleculeObject_molecule from " << _oldid << " to id " << _newid);
     504      LOG(1, "DEBUG: Changing GLMoleculeObject_molecule in MoleculesinSceneMapfrom "
     505          << _oldid << " to id " << _newid);
    481506      GLMoleculeObject_molecule* const molObject = olditer->second;
    482507      MoleculesinSceneMap.erase(olditer);
    483508      MoleculesinSceneMap[_newid] = molObject;
     509    }
     510  }
     511  {
     512    MoleculeNodeMap::iterator const olditer = RemovedMolecules.find(_oldid);
     513    if ( olditer != RemovedMolecules.end()) {
     514#ifndef NDEBUG
     515      MoleculeNodeMap::iterator const newiter = RemovedMolecules.find(_newid);
     516      ASSERT ( newiter == RemovedMolecules.end(),
     517          "GLWorldScene::moleculeIndexChanged() - molecule "
     518          +toString(_newid)+" already present in RemovedMolecules.");
     519#endif
     520      LOG(1, "DEBUG: Changing GLMoleculeObject_molecule in RemovedMolecules from "
     521          << _oldid << " to id " << _newid);
     522      GLMoleculeObject_molecule* const molObject = olditer->second;
     523      RemovedMolecules.erase(olditer);
     524      RemovedMolecules[_newid] = molObject;
    484525    }
    485526  }
  • src/UIElements/Views/Qt4/Qt3D/GLWorldScene.hpp

    r23221f rbcf9cd  
    9292  void moleculeRemoved(const moleculeId_t _id);
    9393  void moleculeSignOff(const moleculeId_t _id);
     94  void moleculeEmpty(const moleculeId_t _id);
    9495  void moleculeInserted(QtObservedMolecule::ptr);
    9596  void moleculeSignOn(QtObservedMolecule::ptr);
     
    136137  QtObservedMoleculeMap_t QtObservedMoleculeMap;
    137138
     139  //!> set of all currently removed molecules
     140  MoleculeNodeMap RemovedMolecules;
     141
    138142  //!> flag to indicate whether state map is currently worked on
    139143  boost::recursive_mutex MoleculeMissedStateMap_mutex;
Note: See TracChangeset for help on using the changeset viewer.