Ignore:
Timestamp:
Apr 11, 2012, 4:52:37 PM (13 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/GLWorldView.cpp

    rc0ed1e r53059e  
    2626#include "CodePatterns/MemDebug.hpp"
    2727
     28#include "Atom/AtomObserver.hpp"
     29#include "Atom/atom_observable.hpp"
    2830#include "CodePatterns/Log.hpp"
    2931#include "CodePatterns/Observer/Notification.hpp"
     
    4244  connect(this, SIGNAL(atomInserted(const atom *)), worldscene, SLOT(atomInserted(const atom *)));
    4345  connect(this, SIGNAL(atomRemoved(const atom *)), worldscene, SLOT(atomRemoved(const atom *)));
     46  connect(this, SIGNAL(worldSelectionChanged()), worldscene, SLOT(worldSelectionChanged()));
     47  connect(this, SIGNAL(moleculeRemoved(const molecule *)), worldscene, SLOT(moleculeRemoved(const molecule *)));
    4448  connect(this, SIGNAL(changed()), this, SLOT(updateGL()));
    4549
     
    4852  World::getInstance().signOn(this, World::AtomInserted);
    4953  World::getInstance().signOn(this, World::AtomRemoved);
     54  World::getInstance().signOn(this, World::MoleculeInserted);
     55  World::getInstance().signOn(this, World::MoleculeRemoved);
     56  World::getInstance().signOn(this, World::SelectionChanged);
     57  AtomObserver::getInstance().signOn(this, AtomObservable::PositionChanged);
    5058}
    5159
     
    5563  World::getInstance().signOff(this, World::AtomInserted);
    5664  World::getInstance().signOff(this, World::AtomRemoved);
     65  World::getInstance().signOff(this, World::MoleculeInserted);
     66  World::getInstance().signOff(this, World::MoleculeRemoved);
     67  World::getInstance().signOff(this, World::SelectionChanged);
     68  AtomObserver::getInstance().signOff(this, AtomObservable::PositionChanged);
    5769  delete worldscene;
    5870}
     
    7991void GLWorldView::recieveNotification(Observable *publisher, Notification_ptr notification)
    8092{
    81   switch (notification->getChannelNo()) {
    82     case World::AtomInserted:
    83     {
    84       const atom *_atom = World::getInstance().lastChanged<atom>();
    85 #ifdef LOG_OBSERVER
    86       observerLog().addMessage() << "++ Observer " << observerLog().getName(this) << " received notification that atom "+toString(_atom->getId())+" has been inserted.";
    87 #endif
    88       emit atomInserted(_atom);
    89       break;
     93  if (static_cast<World *>(publisher) == World::getPointer()) {
     94    switch (notification->getChannelNo()) {
     95      case World::AtomInserted:
     96      {
     97        const atom *_atom = World::getInstance().lastChanged<atom>();
     98  #ifdef LOG_OBSERVER
     99        observerLog().addMessage() << "++ Observer " << observerLog().getName(this) << " received notification that atom "+toString(_atom->getId())+" has been inserted.";
     100  #endif
     101        emit atomInserted(_atom);
     102        break;
     103      }
     104      case World::AtomRemoved:
     105      {
     106        const atom *_atom = World::getInstance().lastChanged<atom>();
     107  #ifdef LOG_OBSERVER
     108        observerLog().addMessage() << "++ Observer " << observerLog().getName(this) << " received notification that atom "+toString(_atom->getId())+" has been removed.";
     109  #endif
     110        emit atomRemoved(_atom);
     111        break;
     112      }
     113      case World::SelectionChanged:
     114      {
     115  #ifdef LOG_OBSERVER
     116        observerLog().addMessage() << "++ Observer " << observerLog().getName(this) << " received notification that selection has changed.";
     117  #endif
     118        emit worldSelectionChanged();
     119        break;
     120      }
     121      case World::MoleculeInserted:
     122      {
     123        const molecule *_molecule = World::getInstance().lastChanged<molecule>();
     124  #ifdef LOG_OBSERVER
     125        observerLog().addMessage() << "++ Observer " << observerLog().getName(this) << " received notification that molecule "+toString(_molecule->getId())+" has been removed.";
     126  #endif
     127        emit moleculeInserted(_molecule);
     128        break;
     129      }
     130      case World::MoleculeRemoved:
     131      {
     132        const molecule *_molecule = World::getInstance().lastChanged<molecule>();
     133  #ifdef LOG_OBSERVER
     134        observerLog().addMessage() << "++ Observer " << observerLog().getName(this) << " received notification that molecule "+toString(_molecule->getId())+" has been removed.";
     135  #endif
     136        emit moleculeRemoved(_molecule);
     137        break;
     138      }
     139      default:
     140        ASSERT(0, "GLWorldView::recieveNotification() - we cannot get here.");
     141        break;
    90142    }
    91     case World::AtomRemoved:
    92     {
    93       const atom *_atom = World::getInstance().lastChanged<atom>();
    94 #ifdef LOG_OBSERVER
    95       observerLog().addMessage() << "++ Observer " << observerLog().getName(this) << " received notification that atom "+toString(_atom->getId())+" has been removed.";
    96 #endif
    97       emit atomRemoved(_atom);
    98       break;
     143  } else if (dynamic_cast<AtomObservable *>(publisher) != NULL) {
     144    switch (notification->getChannelNo()) {
     145      case AtomObservable::PositionChanged:
     146      {
     147        const atom *_atom = dynamic_cast<const atom *>(publisher);
     148    #ifdef LOG_OBSERVER
     149        observerLog().addMessage() << "++ Observer " << observerLog().getName(this) << " received notification that atom "+toString(_atom->getId())+" has changed its position.";
     150    #endif
     151        emit changed();
     152        break;
     153      }
     154      default:
     155        ASSERT(0, "GLWorldView::recieveNotification() - we cannot get here.");
     156        break;
    99157    }
    100     default:
    101       ASSERT(0, "GLWorldView::recieveNotification() - we cannot get here.");
    102       break;
    103   }
     158  } else
     159    ASSERT(0, "GLWorldView::recieveNotification() - received notification from unknown source.");
    104160}
    105161
Note: See TracChangeset for help on using the changeset viewer.