Ignore:
Timestamp:
Apr 11, 2012, 4:52:37 PM (14 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:
3e93332
Parents:
c0ed1e (diff), 3927ef (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Frederik Heber <heber@…> (04/06/12 11:59:28)
git-committer:
Frederik Heber <heber@…> (04/11/12 16:52:37)
Message:

Merge branch 'michi-track-molecules' into stable

Conflicts:

src/World.hpp

File:
1 edited

Legend:

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

    rc0ed1e r53059e  
    2525#include "GLMoleculeObject_atom.hpp"
    2626#include "GLMoleculeObject_bond.hpp"
     27#include "GLMoleculeObject_molecule.hpp"
    2728
    2829#include "CodePatterns/MemDebug.hpp"
     
    7475        Runner != molecules.end();
    7576        Runner++) {
    76       // create molecule
     77
    7778      for (molecule::const_iterator atomiter = (*Runner)->begin();
    7879          atomiter != (*Runner)->end();
     
    109110  AtomsinSceneMap.insert( make_pair(_atom->getId(), atomObject) );
    110111  connect (atomObject, SIGNAL(clicked(atomId_t)), this, SLOT(atomClicked(atomId_t)));
     112  connect (atomObject, SIGNAL(changed()), this, SIGNAL(changed()));
    111113  connect (atomObject, SIGNAL(hoverChanged()), this, SIGNAL(changed()));
     114  connect (atomObject, SIGNAL(selectionChanged()), this, SIGNAL(changed()));
    112115  connect (atomObject, SIGNAL(BondsInserted(const bond *, const GLMoleculeObject_bond::SideOfBond)), this, SLOT(bondInserted(const bond *, const GLMoleculeObject_bond::SideOfBond)));
    113116  //bondsChanged(_atom);
     
    134137}
    135138
     139/** ....
     140 *
     141 */
     142void GLWorldScene::worldSelectionChanged()
     143{
     144  LOG(3, "INFO: GLWorldScene: Received signal selectionChanged.");
     145
     146  const std::vector<molecule*> &molecules = World::getInstance().getAllMolecules();
     147
     148  if (molecules.size() > 0) {
     149    for (std::vector<molecule*>::const_iterator Runner = molecules.begin();
     150        Runner != molecules.end();
     151        Runner++) {
     152
     153      MoleculeNodeMap::iterator iter = MoleculesinSceneMap.find((*Runner)->getId());
     154      bool isSelected = World::getInstance().isSelected(*Runner);
     155
     156      // molecule selected but not in scene?
     157      if (isSelected && (iter == MoleculesinSceneMap.end())){
     158        // -> create new mesh
     159        GLMoleculeObject_molecule *molObject = new GLMoleculeObject_molecule(this, *Runner);
     160        MoleculesinSceneMap.insert( make_pair((*Runner)->getId(), molObject) );
     161        connect (molObject, SIGNAL(changed()), this, SIGNAL(changed()));
     162        connect (molObject, SIGNAL(selectionChanged()), this, SIGNAL(changed()));
     163        connect (molObject, SIGNAL(selectionChanged()), this, SIGNAL(changed()));
     164        emit changed();
     165        emit changeOccured();
     166      }
     167
     168      // molecule not selected but in scene?
     169      if (!isSelected && (iter != MoleculesinSceneMap.end())){
     170        // -> remove from scene
     171        moleculeRemoved(*Runner);
     172      }
     173
     174    }
     175  }
     176}
     177
     178/** Removes a molecule from the scene.
     179 *
     180 * @param _molecule molecule to remove
     181 */
     182void GLWorldScene::moleculeRemoved(const molecule *_molecule)
     183{
     184  LOG(3, "INFO: GLWorldScene: Received signal moleculeRemoved for molecule "+toString(_molecule->getId())+".");
     185  MoleculeNodeMap::iterator iter = MoleculesinSceneMap.find(_molecule->getId());
     186
     187  // only remove if the molecule is in the scene
     188  //  (= is selected)
     189  if (iter != MoleculesinSceneMap.end()){
     190    GLMoleculeObject_molecule *molObject = iter->second;
     191    molObject->disconnect();
     192    MoleculesinSceneMap.erase(iter);
     193    delete molObject;
     194    emit changed();
     195    emit changeOccured();
     196  }
     197}
     198
    136199/** Adds a bond to the scene.
    137200 *
     
    143206  LOG(3, "INFO: GLWorldScene::bondInserted() - Adding bond "+toString(*_bond)+".");
    144207  //LOG(4, "INFO: Currently present bonds " << BondsinSceneMap << ".");
    145   const double distance =
    146       _bond->leftatom->getPosition().distance(_bond->rightatom->getPosition())/2.;
    147208
    148209  BondIds ids;
     
    161222#endif
    162223  GLMoleculeObject_bond *bondObject =
    163       new GLMoleculeObject_bond(this, _bond, distance, side);
     224      new GLMoleculeObject_bond(this, _bond, side);
    164225  connect (
    165226      bondObject, SIGNAL(BondRemoved(const atomId_t, const atomId_t)),
    166227      this, SLOT(bondRemoved(const atomId_t, const atomId_t)));
     228  connect (bondObject, SIGNAL(changed()), this, SIGNAL(changed()));
    167229  BondsinSceneMap.insert( make_pair(ids, bondObject) );
    168230//    BondIdsinSceneMap.insert( Leftids );
Note: See TracChangeset for help on using the changeset viewer.