Ignore:
Timestamp:
Jul 25, 2015, 1:01:44 PM (10 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:
9b56f0a
Parents:
9737db
git-author:
Frederik Heber <heber@…> (06/17/15 16:59:19)
git-committer:
Frederik Heber <heber@…> (07/25/15 13:01:44)
Message:

Extracted signing on to molecule into activateObserver.

  • is called by GLWorldScene after all "missed" signals have been emitted.
File:
1 edited

Legend:

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

    r9737db r73b13c  
    7070using namespace MoleCuilder;
    7171
    72 GLWorldScene::GLWorldScene(QObject *parent)
    73    : QObject(parent)
     72GLWorldScene::GLWorldScene(QObject *parent) :
     73    QObject(parent),
     74    selectionMode(SelectAtom)
    7475{
    7576  int sphereDetails[] = {5, 3, 2, 0};
     
    228229  LOG(3, "INFO: GLWorldScene: Received signal atomInserted for atom "+toString(_atomid)+".");
    229230
     231  boost::recursive_mutex::scoped_lock lock(MoleculeMissedStateMap_mutex);
     232
    230233  // check of molecule is already present
    231234  if (MoleculesinSceneMap.count(_molid) != 0) {
     
    248251  LOG(3, "INFO: GLWorldScene: Received signal atomRemoved for atom "+toString(_atomid)+".");
    249252
     253  boost::recursive_mutex::scoped_lock lock(MoleculeMissedStateMap_mutex);
     254
    250255  // check of molecule is already present
    251256  if (MoleculesinSceneMap.count(_molid) != 0) {
     
    276281  MoleculesinSceneMap.insert( make_pair(_id, molObject) );
    277282
    278   // now handle all state changes that came up before the instantiation
    279   if (MoleculeMissedStateMap.count(_id) != 0) {
     283  // now handle all state changes that came up before the instantiation7
     284  while (MoleculeMissedStateMap.count(_id) != 0) {
    280285    ASSERT( !MoleculeMissedStateMap[_id].empty(),
    281286        "GLWorldScene::moleculeInserted() - we have an empty state change map for molecule with id "
    282287        +toString(_id));
     288    boost::recursive_mutex::scoped_lock lock(MoleculeMissedStateMap_mutex);
    283289    for (StateChangeMap_t::iterator iter = MoleculeMissedStateMap[_id].begin();
    284290        !MoleculeMissedStateMap[_id].empty();
     
    297303            "GLWorldScene::moleculeInserted() - more atomRemoved states than atomInserted for atom "
    298304            +toString(iter->first));
    299         if (StateChangeAmounts[atomInsertedState] > StateChangeAmounts[atomRemovedState])
     305        if (StateChangeAmounts[atomInsertedState] > StateChangeAmounts[atomRemovedState]) {
     306          LOG(1, "INFO: invoking atomInserted for atom " << iter->first);
    300307          QMetaObject::invokeMethod(molObject,        // pointer to a QObject
    301308                                    "atomInserted",       // member name (no parameters here)
    302309                                    Qt::DirectConnection,     // connection type
    303310                                    Q_ARG(const atomId_t, iter->first));     // parameters
     311        } else {
     312          LOG(1, "INFO: Atom " << iter->first << " has been inserted and removed already.");
     313        }
    304314      } else {
    305315        // can only be an insertion
     
    311321            break;
    312322          case atomInsertedState:
     323            LOG(1, "INFO: invoking atomInserted for atom " << iter->first);
    313324            QMetaObject::invokeMethod(molObject,        // pointer to a QObject
    314325                                      "atomInserted",       // member name (no parameters here)
     
    329340  }
    330341
     342  // now let the molObject sign on to molecule
     343  molObject->activateObserver();
     344
    331345  connect (molObject, SIGNAL(changed()), this, SIGNAL(changed()));
    332346  connect (molObject, SIGNAL(changeOccured()), this, SIGNAL(changeOccured()));
     
    359373
    360374  // remove any possible state changes left
    361   MoleculeMissedStateMap.erase(_id);
     375  {
     376    boost::recursive_mutex::scoped_lock lock(MoleculeMissedStateMap_mutex);
     377    MoleculeMissedStateMap.erase(_id);
     378  }
    362379
    363380  emit changed();
Note: See TracChangeset for help on using the changeset viewer.