Ignore:
Timestamp:
Jun 23, 2015, 6:29:02 AM (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:
466934
Parents:
c13b91
git-author:
Frederik Heber <heber@…> (05/20/15 17:37:52)
git-committer:
Frederik Heber <heber@…> (06/23/15 06:29:02)
Message:

GLWorldScene::moleculeInserted() gets moleculeId_t as param.

  • we must not use pointers to instances outside the Qt world as parameters.
  • we add NULL into MoleculesInSceneMap for moleculeRemoved to remove the entry.
Location:
src/UIElements/Views/Qt4/Qt3D
Files:
4 edited

Legend:

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

    rc13b91 ref3013  
    113113      moliter++) {
    114114    // create molecule objects in scene
    115     moleculeInserted(*moliter);
     115    moleculeInserted((*moliter)->getId());
    116116  }
    117117}
     
    134134    const bool mol_present = MoleculesinSceneMap.count(molid);
    135135    if (!mol_present)
    136       moleculeInserted(*moliter);
     136      moleculeInserted((*moliter)->getId());
    137137  }
    138138}
     
    260260 * @param _mol molecule to insert
    261261 */
    262 void GLWorldScene::moleculeInserted(const molecule * _mol)
    263 {
    264   LOG(3, "INFO: GLWorldScene: Received signal moleculeRemoved for molecule "+toString(_mol->getId())+".");
    265   MoleculeNodeMap::const_iterator iter = MoleculesinSceneMap.find(_mol->getId());
     262void GLWorldScene::moleculeInserted(const moleculeId_t _id)
     263{
     264  LOG(3, "INFO: GLWorldScene: Received signal moleculeRemoved for molecule "+toString(_id)+".");
     265  MoleculeNodeMap::const_iterator iter = MoleculesinSceneMap.find(_id);
    266266  ASSERT( iter == MoleculesinSceneMap.end(),
    267       "GLWorldScene::moleculeInserted() - molecule's id "+toString(_mol->getId())+" already present.");
     267      "GLWorldScene::moleculeInserted() - molecule's id "+toString(_id)+" already present.");
    268268
    269269  // add new object
    270   GLMoleculeObject_molecule *molObject = new GLMoleculeObject_molecule(GLMoleculeObject::meshEmpty, this, _mol);
    271   MoleculesinSceneMap.insert( make_pair(_mol->getId(), molObject) );
    272   connect (molObject, SIGNAL(changed()), this, SIGNAL(changed()));
    273   connect (molObject, SIGNAL(changeOccured()), this, SIGNAL(changeOccured()));
    274   connect (molObject, SIGNAL(atomClicked(atomId_t)), this, SLOT(atomClicked(atomId_t)));
    275   connect (molObject, SIGNAL(moleculeClicked(moleculeId_t)), this, SLOT(moleculeClicked(moleculeId_t)));
    276   connect (molObject, SIGNAL(changeAtomId(GLMoleculeObject_atom *, int, int)), this, SLOT(changeAtomId(GLMoleculeObject_atom *, int, int)));
    277   connect (molObject, SIGNAL(selectionChanged()), this, SIGNAL(changed()));
    278   connect (molObject, SIGNAL(selectionChanged()), this, SIGNAL(changed()));
    279   connect (molObject, SIGNAL(hoverChanged(const atom &)), this, SIGNAL(hoverChanged(const atom &)));
    280   connect (molObject, SIGNAL(hoverChanged(const molecule &, int)), this, SIGNAL(hoverChanged(const molecule &, int)));
    281   emit changed();
    282   emit changeOccured();
     270  const molecule *_mol = World::getInstance().getMolecule(MoleculeById(_id));
     271  if (_mol != NULL) {
     272    GLMoleculeObject_molecule *molObject = new GLMoleculeObject_molecule(GLMoleculeObject::meshEmpty, this, _mol);
     273    MoleculesinSceneMap.insert( make_pair(_id, molObject) );
     274    connect (molObject, SIGNAL(changed()), this, SIGNAL(changed()));
     275    connect (molObject, SIGNAL(changeOccured()), this, SIGNAL(changeOccured()));
     276    connect (molObject, SIGNAL(atomClicked(atomId_t)), this, SLOT(atomClicked(atomId_t)));
     277    connect (molObject, SIGNAL(moleculeClicked(moleculeId_t)), this, SLOT(moleculeClicked(moleculeId_t)));
     278    connect (molObject, SIGNAL(changeAtomId(GLMoleculeObject_atom *, int, int)), this, SLOT(changeAtomId(GLMoleculeObject_atom *, int, int)));
     279    connect (molObject, SIGNAL(selectionChanged()), this, SIGNAL(changed()));
     280    connect (molObject, SIGNAL(selectionChanged()), this, SIGNAL(changed()));
     281    connect (molObject, SIGNAL(hoverChanged(const atom &)), this, SIGNAL(hoverChanged(const atom &)));
     282    connect (molObject, SIGNAL(hoverChanged(const molecule &, int)), this, SIGNAL(hoverChanged(const molecule &, int)));
     283    emit changed();
     284    emit changeOccured();
     285  } else {
     286    // the molecule is already gone, we add it nonetheless as null object as
     287    // lateron moleculeRemoved wants to erase it.
     288    ELOG(1, "GLWorldScene::moleculeInserted() - added null object for not present mol id " << _id);
     289    GLMoleculeObject_molecule *molObject = NULL;
     290    MoleculesinSceneMap.insert( make_pair(_id, molObject) );
     291  }
    283292}
    284293
  • src/UIElements/Views/Qt4/Qt3D/GLWorldScene.hpp

    rc13b91 ref3013  
    8484  void moleculeClicked(moleculeId_t no);
    8585  void moleculeRemoved(const moleculeId_t _id);
    86   void moleculeInserted(const molecule * _mol);
     86  void moleculeInserted(const moleculeId_t _id);
    8787  void worldSelectionChanged();
    8888  void bondInserted(const bond::ptr _bond, const GLMoleculeObject_bond::SideOfBond side);
  • src/UIElements/Views/Qt4/Qt3D/GLWorldView.cpp

    rc13b91 ref3013  
    9191  connect(this, SIGNAL(worldSelectionChanged()), worldscene, SLOT(worldSelectionChanged()));
    9292  connect(this, SIGNAL(moleculeRemoved(const moleculeId_t)), worldscene, SLOT(moleculeRemoved(const moleculeId_t)));
    93   connect(this, SIGNAL(moleculeInserted(const molecule *)), worldscene, SLOT(moleculeInserted(const molecule *)));
     93  connect(this, SIGNAL(moleculeInserted(const moleculeId_t)), worldscene, SLOT(moleculeInserted(const moleculeId_t)));
    9494  //connect(this, SIGNAL(changed()), this, SLOT(updateGL()));
    9595  connect(this, SIGNAL(changed()), this, SLOT(sceneChangeSignalled()));
     
    348348      case World::MoleculeInserted:
    349349      {
    350         const molecule * _mol = World::getInstance().lastChanged<molecule>();
     350        const moleculeId_t _id = World::getInstance().lastChanged<molecule>()->getId();
    351351  #ifdef LOG_OBSERVER
    352         observerLog().addMessage() << "++ Observer " << observerLog().getName(static_cast<Observer *>(this)) << " received notification that molecule "+toString(_mol->getId())+" has been removed.";
     352        observerLog().addMessage() << "++ Observer " << observerLog().getName(static_cast<Observer *>(this)) << " received notification that molecule "+toString(_id)+" has been removed.";
    353353  #endif
    354         emit moleculeInserted(_mol);
     354        emit moleculeInserted(_id);
    355355        break;
    356356      }
  • src/UIElements/Views/Qt4/Qt3D/GLWorldView.hpp

    rc13b91 ref3013  
    5959  void changed();
    6060  void TimeChanged();
    61   void moleculeInserted(const molecule * _mol);
     61  void moleculeInserted(const moleculeId_t _id);
    6262  void moleculeRemoved(const moleculeId_t _id);
    6363  void worldSelectionChanged();
Note: See TracChangeset for help on using the changeset viewer.