Changeset 534374 for src


Ignore:
Timestamp:
Aug 5, 2015, 5:32:07 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:
009e2e2
Parents:
b3a33d
git-author:
Frederik Heber <heber@…> (06/19/15 17:37:50)
git-committer:
Frederik Heber <heber@…> (08/05/15 17:32:07)
Message:

GLMoleculeObject_atom uses ObservedValue for internally representing atom's state.

  • we use internal owner as ref to Observable.
Location:
src/UIElements/Views/Qt4/Qt3D
Files:
2 edited

Legend:

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

    rb3a33d r534374  
    4444#include "CodePatterns/Observer/Notification.hpp"
    4545
     46#include <algorithm>
     47#include <boost/assign.hpp>
     48
    4649#include "Atom/atom.hpp"
    4750#include "Bond/bond.hpp"
    4851#include "Descriptors/AtomIdDescriptor.hpp"
    4952#include "Element/element.hpp"
     53#include "Element/periodentafel.hpp"
    5054#include "LinearAlgebra/Vector.hpp"
    5155#include "GLMoleculeObject_bond.hpp"
     
    5357#include "WorldTime.hpp"
    5458
     59using namespace boost::assign;
     60
     61static const Observable::channels_t getAtomBondsChannels()
     62{
     63  Observable::channels_t channels;
     64  channels += AtomObservable::BondsAdded, AtomObservable::BondsRemoved;
     65  return channels;
     66}
     67
     68// static entities
     69const Observable::channels_t
     70GLMoleculeObject_atom::AtomIndexChannels(1, AtomObservable::IndexChanged);
     71const Observable::channels_t
     72GLMoleculeObject_atom::AtomPositionChannels(1, AtomObservable::PositionChanged);
     73const Observable::channels_t
     74GLMoleculeObject_atom::AtomElementChannels(1, AtomObservable::ElementChanged);
     75const Observable::channels_t
     76GLMoleculeObject_atom::AtomBondsChannels(getAtomBondsChannels());
     77const Observable::channels_t
     78GLMoleculeObject_atom::AtomSelectionStatusChannels(World::SelectionChanged);
     79
    5580GLMoleculeObject_atom::GLMoleculeObject_atom(QGLSceneNode *mesh[], QObject *parent, const atomId_t _id) :
    5681  GLMoleculeObject(mesh, parent),
    5782  Observer(std::string("GLMoleculeObject_atom")+toString(_id)),
    58   atomicid(_id),
    59   uptodatePosition(false),
    60   uptodateElement(false)
    61 {
    62   // sign on as observer (obtain non-const instance before)
    63   const atom * const _atom = const_cast<const World &>(World::getInstance()).
    64       getAtom(AtomById(atomicid));
    65   if (_atom != NULL) {
    66     _atom->signOn(this, AtomObservable::IndexChanged);
    67     _atom->signOn(this, AtomObservable::PositionChanged);
    68     _atom->signOn(this, AtomObservable::ElementChanged);
    69     _atom->signOn(this, AtomObservable::BondsAdded);
    70   } else {
    71     ELOG(2, "Atom with id "+toString(atomicid)+" is already gone.");
    72   }
    73   World::getInstance().signOn(this, World::SelectionChanged);
    74 
    75   // set the object's id
    76   resetProperties();
    77 
    78   LOG(2, "INFO: Created sphere for atom " << atomicid << ".");
     83  atomref(getAtom(_id)),
     84  AtomIndex(
     85      atomref,
     86      boost::bind(&GLMoleculeObject_atom::updateIndex, this),
     87      "AtomIndex_"+toString(_id),
     88      _id,
     89      AtomIndexChannels),
     90  AtomPosition(
     91      atomref,
     92      boost::bind(&GLMoleculeObject_atom::updatePosition, this),
     93      "AtomPosition_"+toString(_id),
     94      updatePosition(),
     95      AtomPositionChannels),
     96  AtomElement(
     97      atomref,
     98      boost::bind(&GLMoleculeObject_atom::updateElement, this),
     99      "AtomElement"+toString(_id),
     100      updateElement(),
     101      AtomElementChannels),
     102  AtomBonds(
     103      atomref,
     104      boost::bind(&GLMoleculeObject_atom::updateBonds, this),
     105      "AtomBonds_"+toString(_id),
     106      updateBonds(),
     107      AtomBondsChannels),
     108  AtomSelectionStatus(
     109      World::getPointer(),
     110      boost::bind(&GLMoleculeObject_atom::updateSelectionStatus, this),
     111      "AtomSelectionStatus_"+toString(_id),
     112      updateSelectionStatus(),
     113      AtomSelectionStatusChannels),
     114  owner(NULL)
     115{
     116  setObjectId(_id);
     117  resetPosition();
     118  resetElement();
     119
     120  // sign On
     121  activateObserver();
     122
     123  // atomref is only used for caching the ref, it must be used elswhere
     124  const_cast<atom *&>(atomref) = NULL;
    79125
    80126  connect( this, SIGNAL(clicked()), this, SLOT(wasClicked()));
     127  connect( this, SIGNAL(idChanged()), this, SLOT(resetIndex()), Qt::QueuedConnection);
     128  connect( this, SIGNAL(elementChanged()), this, SLOT(resetElement()), Qt::QueuedConnection);
     129  connect( this, SIGNAL(positionChanged()), this, SLOT(resetPosition()), Qt::QueuedConnection);
     130  connect( this, SIGNAL(bondsChanged()), this, SLOT(resetPosition()), Qt::QueuedConnection);
     131  connect( this, SIGNAL(selectionstatusChanged()), this, SLOT(resetSelectionStatus()), Qt::QueuedConnection);
     132}
     133
     134void GLMoleculeObject_atom::activateObserver()
     135{
     136  if (atomref != NULL) {
     137    owner = static_cast<const Observable *>(atomref);
     138    owner->signOn(this, AtomObservable::IndexChanged);
     139    owner->signOn(this, AtomObservable::PositionChanged);
     140    owner->signOn(this, AtomObservable::ElementChanged);
     141    owner->signOn(this, AtomObservable::BondsAdded);
     142    owner->signOn(this, AtomObservable::BondsRemoved);
     143    World::getInstance().signOn(this, World::SelectionChanged);
     144  }
     145}
     146
     147
     148void GLMoleculeObject_atom::deactivateObserver()
     149{
     150  // sign Off
     151  if (owner != NULL) {
     152    owner->signOff(this, AtomObservable::IndexChanged);
     153    owner->signOff(this, AtomObservable::PositionChanged);
     154    owner->signOff(this, AtomObservable::ElementChanged);
     155    owner->signOff(this, AtomObservable::BondsAdded);
     156    owner->signOff(this, AtomObservable::BondsRemoved);
     157    World::getInstance().signOff(this, World::SelectionChanged);
     158    owner = NULL;
     159  }
    81160}
    82161
    83162GLMoleculeObject_atom::~GLMoleculeObject_atom()
    84163{
    85   const atom * const _atom = const_cast<const World &>(World::getInstance()).
    86       getAtom(AtomById(atomicid));
    87   if (_atom != NULL){
    88     _atom->signOff(this, AtomObservable::IndexChanged);
    89     _atom->signOff(this, AtomObservable::PositionChanged);
    90     _atom->signOff(this, AtomObservable::ElementChanged);
    91     _atom->signOff(this, AtomObservable::BondsAdded);
    92   }
    93   World::getInstance().signOff(this, World::SelectionChanged);
    94 }
    95 
    96 void GLMoleculeObject_atom::update(Observable *publisher)
    97 {
    98 #ifdef LOG_OBSERVER
    99   observerLog().addMessage() << "++ Update of Observer " << observerLog().getName(static_cast<Observer *>(this)) << " from atom "+toString(atomicid)+".";
    100 #endif
    101   resetProperties();
     164  deactivateObserver();
     165}
     166
     167void GLMoleculeObject_atom::resetIndex()
     168{
     169  const atomId_t newId = AtomIndex.get();
     170  const size_t oldId = objectId();
     171  ASSERT( newId != oldId,
     172      "GLMoleculeObject_atom::updateIndex() - index "+toString(newId)+" did not change.");
     173  LOG(4, "INFO: GLMoleculeObject_atom::resetIndex() - new index is "+toString(newId)+".");
     174  setObjectId(newId);
     175
     176  emit indexChanged(this, oldId, newId);
    102177}
    103178
    104179void GLMoleculeObject_atom::resetPosition()
    105180{
    106   const atom * const _atom = const_cast<const World &>(World::getInstance()).
    107       getAtom(AtomById(atomicid));
    108   if (_atom != NULL) {
    109     const Vector Position = _atom->getPosition();
    110     LOG(4, "INFO: GLMoleculeObject_atom::resetIndex() - new position is "+toString(Position)+".");
    111     setPosition(QVector3D(Position[0], Position[1], Position[2]));
    112   } else {
    113     ELOG(2, "Atom with id "+toString(atomicid)+" is already gone.");
    114   }
    115   uptodatePosition = true;
     181  const Vector Position = AtomPosition.get();
     182  LOG(4, "INFO: GLMoleculeObject_atom::resetIndex() - new position is "+toString(Position)+".");
     183  setPosition(QVector3D(Position[0], Position[1], Position[2]));
    116184}
    117185
     
    119187{
    120188  size_t elementno = 0;
    121   const atom * const _atom = const_cast<const World &>(World::getInstance()).
    122       getAtom(AtomById(atomicid));
    123   const element *_type = NULL;
    124   if (_atom != NULL) {
    125     _type = _atom->getType();
    126   } else {
    127     ELOG(2, "Atom with id "+toString(atomicid)+" is already gone.");
    128   }
     189  const element * const _type = World::getInstance().
     190      getPeriode()->FindElement(AtomElement.get());
    129191  if (_type != NULL) {
    130192    elementno = _type->getAtomicNumber();
     
    148210  }
    149211  setScale( radius / 4. );
    150 
    151   uptodateElement = true;
    152 }
    153 
    154 void GLMoleculeObject_atom::resetIndex()
    155 {
    156   int oldId = objectId();
    157   LOG(4, "INFO: GLMoleculeObject_atom::resetIndex() - new index is "+toString(atomicid)+".");
    158   setObjectId(atomicid);
    159 
    160   emit indexChanged(this, oldId, atomicid);
    161 }
    162 
    163 void GLMoleculeObject_atom::resetProperties()
    164 {
    165   // set position
    166   resetPosition();
    167 
    168   // set element
    169   resetElement();
    170 
    171   // set the object's id
    172   resetIndex();
    173 
    174   // selected?
    175   setSelected(World::getInstance().isAtomSelected(atomicid));
     212}
     213
     214void GLMoleculeObject_atom::resetBonds()
     215{
     216  ListOfBonds_t ListOfBonds_new = AtomBonds.get();
     217  std::sort(ListOfBonds_new.begin(), ListOfBonds_new.end());
     218  ListOfBonds_t BondsToAdd;
     219  std::set_difference(
     220      ListOfBonds_new.begin(), ListOfBonds_new.end(),
     221      ListOfBonds.begin(), ListOfBonds.end(),
     222      std::back_inserter(BondsToAdd));
     223  ListOfBonds_t BondsToRemove;
     224  std::set_difference(
     225      ListOfBonds.begin(), ListOfBonds.end(),
     226      ListOfBonds_new.begin(), ListOfBonds_new.end(),
     227      std::back_inserter(BondsToRemove));
     228  for (ListOfBonds_t::const_iterator iter = BondsToAdd.begin();
     229      iter != BondsToAdd.end();
     230      ++iter) {
     231    const GLMoleculeObject_bond::SideOfBond side = (iter->first == AtomIndex.get()) ?
     232        GLMoleculeObject_bond::left : GLMoleculeObject_bond::right;
     233    emit BondsAdded(iter->first, iter->second, side);
     234  }
     235  for (ListOfBonds_t::const_iterator iter = BondsToRemove.begin();
     236      iter != BondsToRemove.end();
     237      ++iter) {
     238    emit BondsRemoved(iter->first, iter->second);
     239  }
     240  ListOfBonds = ListOfBonds_new;
     241}
     242
     243void GLMoleculeObject_atom::resetSelectionStatus()
     244{
     245  setSelected(AtomSelectionStatus.get());
    176246}
    177247
    178248void GLMoleculeObject_atom::draw(QGLPainter *painter, const QVector4D &cameraPlane)
    179249{
    180   // hook to update prior to painting
    181   if (!uptodatePosition)
    182     resetPosition();
    183   if (!uptodateElement)
    184     resetElement();
    185 
    186250  // call old hook to do the actual paining
    187251  GLMoleculeObject::draw(painter, cameraPlane);
    188252}
    189253
     254void GLMoleculeObject_atom::wasClicked()
     255{
     256  LOG(4, "INFO: GLMoleculeObject_atom: atom " << AtomIndex.get() << " has been clicked");
     257  emit clicked(AtomIndex.get());
     258}
     259
     260const atom * const GLMoleculeObject_atom::getAtomConst(const atomId_t _id)
     261{
     262  const atom * const _atom = const_cast<const World &>(World::getInstance()).
     263      getAtom(AtomById(_id));
     264  return _atom;
     265}
     266
     267atom * const GLMoleculeObject_atom::getAtom(const atomId_t _id)
     268{
     269  atom * const _atom = World::getInstance().getAtom(AtomById(_id));
     270  return _atom;
     271}
     272
     273atomId_t GLMoleculeObject_atom::updateIndex() const
     274{
     275  const atom * const _atom = World::getInstance().lastChanged<atom>();
     276  if (_atom != NULL) {
     277    return _atom->getId();
     278  }
     279  return (atomId_t)-1;
     280}
     281
     282Vector GLMoleculeObject_atom::updatePosition() const
     283{
     284  const atom * const _atom = getAtom(AtomIndex.get());
     285  if (_atom != NULL) {
     286    return _atom->getPosition();
     287  } else {
     288    return zeroVec;
     289  }
     290}
     291
     292atomicNumber_t GLMoleculeObject_atom::updateElement() const
     293{
     294  const atom * const _atom = getAtom(AtomIndex.get());
     295  if (_atom != NULL) {
     296    return _atom->getElementNo();
     297  } else {
     298    return (atomicNumber_t)-1;
     299  }
     300}
     301
     302GLMoleculeObject_atom::ListOfBonds_t GLMoleculeObject_atom::updateBonds() const
     303{
     304  ListOfBonds_t ListOfBonds;
     305  const atom * const _atom = getAtom(AtomIndex.get());
     306  if (_atom != NULL) {
     307    // make sure position is up-to-date
     308    const BondList ListBonds = _atom->getListOfBonds();
     309    for (BondList::const_iterator iter = ListBonds.begin();
     310        iter != ListBonds.end();
     311        ++iter)
     312      ListOfBonds.insert( ListOfBonds.end(), std::make_pair(
     313          (*iter)->leftatom->getId(),
     314          (*iter)->rightatom->getId()) );
     315  } else {
     316    ELOG(2, "Atom with id "+toString(AtomIndex.get())+" is already gone.");
     317  }
     318  return ListOfBonds;
     319}
     320
     321bool GLMoleculeObject_atom::updateSelectionStatus() const
     322{
     323  const atom * const _atom = getAtom(AtomIndex.get());
     324  if (_atom != NULL) {
     325    return const_cast<const World &>(World::getInstance()).isSelected(_atom);
     326  }
     327  return false;
     328}
     329
     330void GLMoleculeObject_atom::update(Observable *publisher)
     331{
     332  ASSERT(0, "GLMoleculeObject_atom::update() - we are not signed on for global updates.");
     333}
     334
    190335void GLMoleculeObject_atom::subjectKilled(Observable *publisher)
    191336{
    192   // remove id such that we don't sign off accidentally from a different atom
    193   const_cast<atomId_t &>(atomicid) = -1;
     337  deactivateObserver();
    194338}
    195339
    196340void GLMoleculeObject_atom::recieveNotification(Observable *publisher, Notification_ptr notification)
    197341{
    198   const atom * const _atom = const_cast<const World &>(World::getInstance()).
    199       getAtom(AtomById(atomicid));
    200   if (publisher == dynamic_cast<const Observable*>(_atom)){
    201     // notofication from atom
    202 #ifdef LOG_OBSERVER
    203     observerLog().addMessage() << "++ Update of Observer "<< observerLog().getName(static_cast<Observer *>(this))
    204           << " received notification from atom " << _atom->getId() << " for channel "
    205           << notification->getChannelNo() << ".";
    206 #endif
     342  // ObservedValues have been updated before, hence convert updates to Qt's signals
     343  atom * const _atom = dynamic_cast<atom *>(publisher);
     344  if (_atom != NULL) {
    207345    switch (notification->getChannelNo()) {
     346      case AtomObservable::IndexChanged:
     347        emit idChanged();
     348        break;
     349      case AtomObservable::PositionChanged:
     350        emit positionChanged();
     351        break;
    208352      case AtomObservable::ElementChanged:
    209         uptodateElement = false;
    210         break;
    211       case AtomObservable::IndexChanged:
    212         resetIndex();
    213         break;
    214       case AtomObservable::PositionChanged:
    215         uptodatePosition = false;
     353        emit elementChanged();
    216354        break;
    217355      case AtomObservable::BondsAdded:
    218       {
    219         const atom * const _atom = const_cast<const World &>(World::getInstance()).
    220             getAtom(AtomById(atomicid));
    221         if (_atom != NULL) {
    222           // make sure position is up-to-date
    223           if (!uptodatePosition)
    224             resetPosition();
    225           ASSERT(!_atom->getListOfBonds().empty(),
    226               "GLMoleculeObject_atom::recieveNotification() - received BondsAdded but ListOfBonds is empty.");
    227           const bond::ptr _bond = *(_atom->getListOfBonds().rbegin());
    228           const GLMoleculeObject_bond::SideOfBond side = (_bond->leftatom == _atom) ?
    229               GLMoleculeObject_bond::left : GLMoleculeObject_bond::right;
    230           emit BondsInserted(_bond, side);
    231         } else {
    232           ELOG(2, "Atom with id "+toString(atomicid)+" is already gone.");
    233         }
    234         break;
    235       }
     356      case AtomObservable::BondsRemoved:
     357        emit bondsChanged();
     358        break;
    236359      default:
    237         //setProperties();
     360        ASSERT(0, "GLMoleculeObject_atom::recieveNotification() - we are not signed on to channel "
     361            +toString(notification->getChannelNo())+" of the atom.");
    238362        break;
    239363    }
    240   }else if (static_cast<World *>(publisher) == World::getPointer()) {
    241     // notification from world
    242 #ifdef LOG_OBSERVER
    243     observerLog().addMessage() << "++ Update of Observer "<< observerLog().getName(static_cast<Observer *>(this))
    244           << " received notification from world for channel "
    245           << notification->getChannelNo() << ".";
    246 #endif
     364  } else if (publisher == static_cast<World *>(World::getPointer())) {
    247365    switch (notification->getChannelNo()) {
    248366      case World::SelectionChanged:
    249         if (_atom != NULL)
    250           setSelected(World::getInstance().isSelected(_atom));
     367        emit selectionstatusChanged();
    251368        break;
    252369      default:
     370        ASSERT(0, "GLMoleculeObject_atom::recieveNotification() - we are not signed on to channel "
     371            +toString(notification->getChannelNo())+" of the World.");
    253372        break;
    254373    }
    255374  }
    256375}
    257 
    258 void GLMoleculeObject_atom::wasClicked()
    259 {
    260   LOG(4, "INFO: GLMoleculeObject_atom: atom " << atomicid << " has been clicked");
    261   emit clicked(atomicid);
    262 }
  • src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_atom.hpp

    rb3a33d r534374  
    1616#include "GLMoleculeObject.hpp"
    1717
     18#include "CodePatterns/ObservedValue.hpp"
    1819#include "CodePatterns/Observer/Observer.hpp"
     20
     21#include "LinearAlgebra/Vector.hpp"
    1922
    2023#include "Bond/bond.hpp"
     
    2427class GLWorldScene;
    2528
    26 class GLMoleculeObject_atom : public GLMoleculeObject, public Observer
     29class GLMoleculeObject_atom : public GLMoleculeObject, Observer
    2730{
    2831  Q_OBJECT
     
    4043private slots:
    4144  void wasClicked();
     45  void resetIndex();
     46  void resetElement();
     47  void resetPosition();
     48  void resetBonds();
     49  void resetSelectionStatus();
    4250
    4351signals:
    4452  void clicked(atomId_t);
    45   void BondsInserted(const bond::ptr _bond, const GLMoleculeObject_bond::SideOfBond side);
    46   void indexChanged(GLMoleculeObject_atom *ob, int oldId, int newId);
     53  void BondsAdded(const atomId_t _left, const atomId_t _right, const GLMoleculeObject_bond::SideOfBond side);
     54  void BondsRemoved(const atomId_t _left, const atomId_t _right);
     55  void indexChanged(GLMoleculeObject_atom *ob, const atomId_t oldId, const atomId_t newId);
     56  void idChanged();
     57  void positionChanged();
     58  void elementChanged();
     59  void bondsChanged();
     60  void selectionstatusChanged();
    4761
    4862private:
     
    5064  friend class GLMoleculeObject_molecule;
    5165
    52   void resetPosition();
     66  //!> typedef for list of bonds, defined by pairs of atom ids
     67  typedef std::vector< std::pair<atomId_t, atomId_t> > ListOfBonds_t;
     68
     69  static const atom * const getAtomConst(const atomId_t _id);
     70  static atom * const getAtom(const atomId_t _id);
     71
     72  atomId_t updateIndex() const;
     73  Vector updatePosition() const;
     74  atomicNumber_t updateElement() const;
     75  ListOfBonds_t updateBonds() const;
     76  bool updateSelectionStatus() const;
     77
     78  void activateObserver();
     79  void deactivateObserver();
    5380
    5481private:
    55   void resetElement();
    56   void resetIndex();
    57   void resetProperties();
    5882
    59   const atomId_t atomicid;
     83  //!> current list of bonds to compare new onw against for changes
     84  ListOfBonds_t ListOfBonds;
    6085
    61   bool uptodatePosition;
    62   bool uptodateElement;
     86  //!> temporary variable used in cstor
     87  atom * const atomref;
     88
     89  //!> cached value of the atom's id
     90  ObservedValue<atomId_t> AtomIndex;
     91  //!> cached value of the atom's position
     92  ObservedValue<Vector> AtomPosition;
     93  //!> cached value of the atom's element
     94  ObservedValue<atomicNumber_t> AtomElement;
     95  //!> cached value of the atom's id
     96  ObservedValue<ListOfBonds_t> AtomBonds;
     97  //!> cached value of the atom's selection status
     98  ObservedValue<bool> AtomSelectionStatus;
     99
     100  //!> list of channels when index needs to update
     101  static const Observable::channels_t AtomIndexChannels;
     102  //!> list of channels when position needs to update
     103  static const Observable::channels_t AtomPositionChannels;
     104  //!> list of channels when element needs to update
     105  static const Observable::channels_t AtomElementChannels;
     106  //!> list of channels when bonds needs to update
     107  static const Observable::channels_t AtomBondsChannels;
     108  //!> list of channels when selection status needs to update
     109  static const Observable::channels_t AtomSelectionStatusChannels;
     110
     111  //!> the Observable we are signed on, also indicates whether we are sign on (not NULL)
     112  const Observable *owner;
    63113};
    64114
Note: See TracChangeset for help on using the changeset viewer.