Changeset 20f9b5 for src


Ignore:
Timestamp:
Aug 5, 2015, 5:32:08 PM (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:
88846b
Parents:
6c16a0
git-author:
Frederik Heber <heber@…> (07/20/15 08:35:41)
git-committer:
Frederik Heber <heber@…> (08/05/15 17:32:08)
Message:

GLWorldScene propagates changed mol id to GLMoleculeObject_molecule.

  • GLWorldScene must emit MoleculeRemoved on last subjectKlled().
  • GLWorldScene has internal RemovalMolecule in case moleculeRemoved comes prior to moleculeInserted.
Location:
src/UIElements/Views/Qt4/Qt3D
Files:
3 edited

Legend:

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

    r6c16a0 r20f9b5  
    223223  ASSERT( iter == MoleculesinSceneMap.end(),
    224224      "GLWorldScene::moleculeInserted() - molecule's id "+toString(_id)+" already present.");
     225
     226  // check whether molecule is still present
     227  if (RemovalMolecules.count(_id) != 0) {
     228    RemovalMolecules.erase(_id);
     229    return;
     230  }
     231  if (const_cast<const World &>(World::getInstance()).getMolecule(MoleculeById(_id)) == NULL)
     232    return;
    225233
    226234  // add new object
     
    301309  connect (molObject, SIGNAL(hoverChanged(const atomId_t)), this, SIGNAL(hoverChanged(const atomId_t)));
    302310  connect (molObject, SIGNAL(hoverChanged(const moleculeId_t, int)), this, SIGNAL(hoverChanged(const moleculeId_t, int)));
     311  connect (molObject, SIGNAL(indexChanged(GLMoleculeObject_molecule *, const moleculeId_t, const moleculeId_t)), this, SLOT(changeMoleculeId(GLMoleculeObject_molecule *, const moleculeId_t, const moleculeId_t)));
    303312
    304313  emit changed();
     
    314323  LOG(3, "INFO: GLWorldScene: Received signal moleculeRemoved for molecule "+toString(_id)+".");
    315324  MoleculeNodeMap::iterator iter = MoleculesinSceneMap.find(_id);
    316   ASSERT( iter != MoleculesinSceneMap.end(),
    317       "GLWorldScene::moleculeInserted() - molecule's id "+toString(_id)+" is unknown.");
    318 
    319   GLMoleculeObject_molecule *molObject = iter->second;
    320   molObject->disconnect();
    321   MoleculesinSceneMap.erase(iter);
    322   delete molObject;
     325  if ( iter == MoleculesinSceneMap.end())
     326    RemovalMolecules.insert(_id);
     327  else {
     328
     329    GLMoleculeObject_molecule *molObject = iter->second;
     330    molObject->disconnect();
     331    MoleculesinSceneMap.erase(iter);
     332    delete molObject;
    323333
    324334  // remove any possible state changes left
     
    328338  }
    329339
    330   emit changed();
    331   emit changeOccured();
     340    emit changed();
     341    emit changeOccured();
     342  }
    332343}
    333344
     
    415426  setSelectionMode(SelectMolecule);
    416427}
     428
     429void GLWorldScene::changeMoleculeId(
     430    GLMoleculeObject_molecule *ob,
     431    const moleculeId_t oldId,
     432    const moleculeId_t newId)
     433{
     434  LOG(3, "INFO: GLWorldScene - change molecule id " << oldId << " to " << newId << ".");
     435
     436  {
     437    // Remove from map.
     438    MoleculeNodeMap::iterator iter = MoleculesinSceneMap.find(oldId);
     439    ASSERT(iter != MoleculesinSceneMap.end(),
     440        "GLWorldScene::changeMoleculeId() - molecule with old id "+toString(oldId)+" not on display.");
     441    ASSERT(iter->second == ob,
     442        "GLWorldScene::changeMoleculeId() - molecule with id "
     443        +toString(oldId)+" does not match with object in MoleculesinSceneMap.");
     444    MoleculesinSceneMap.erase(iter);
     445
     446    // Reinsert with new id.
     447    {
     448      MoleculeNodeMap::iterator iter = MoleculesinSceneMap.find(newId);
     449      ASSERT(iter == MoleculesinSceneMap.end(),
     450            "GLWorldScene::changeMoleculeId() -  moleculewith new id "+toString(newId)+" already known.");
     451    }
     452    MoleculesinSceneMap.insert( make_pair(newId, ob) );
     453  }
     454
     455  {
     456    // Remove and re-insert from map if present.
     457    MoleculeMissedStateMap_t::iterator iter = MoleculeMissedStateMap.find(oldId);
     458    if (iter != MoleculeMissedStateMap.end()) {
     459      StateChangeMap_t changemap = iter->second;
     460      MoleculeMissedStateMap.erase(iter);
     461      MoleculeMissedStateMap.insert( std::make_pair(newId, changemap) );
     462    }
     463  }
     464}
  • src/UIElements/Views/Qt4/Qt3D/GLWorldScene.hpp

    r6c16a0 r20f9b5  
    9393  void update();
    9494  void moleculesVisibilityChanged(const moleculeId_t _id, bool _visible);
     95  void changeMoleculeId(GLMoleculeObject_molecule *, const moleculeId_t, const moleculeId_t);
    9596
    9697public:
     
    9899
    99100private:
     101
     102  typedef std::set<moleculeId_t> RemovalMolecule_t;
     103  //!> list of molecule ids whose moleculeRemoved we have received but who have not been inserted yet
     104  RemovalMolecule_t RemovalMolecules;
    100105
    101106  typedef std::map< moleculeId_t , GLMoleculeObject_molecule* > MoleculeNodeMap;
  • src/UIElements/Views/Qt4/Qt3D/GLWorldView.cpp

    r6c16a0 r20f9b5  
    9292  connect(this, SIGNAL(atomRemoved(const moleculeId_t, const atomId_t)), worldscene, SLOT(atomRemoved(const moleculeId_t, const atomId_t)), Qt::DirectConnection);
    9393  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(moleculeInserted(const moleculeId_t)), Qt::DirectConnection);
    9495  connect(this, SIGNAL(moleculeRemoved(const moleculeId_t)), worldscene, SLOT(moleculeRemoved(const moleculeId_t)), Qt::DirectConnection);
    95   connect(this, SIGNAL(moleculeInserted(const moleculeId_t)), worldscene, SLOT(moleculeInserted(const moleculeId_t)), Qt::DirectConnection);
    9696  //connect(this, SIGNAL(changed()), this, SLOT(updateGL()));
    9797  connect(this, SIGNAL(changed()), this, SLOT(sceneChangeSignalled()));
Note: See TracChangeset for help on using the changeset viewer.