Ignore:
Timestamp:
Aug 5, 2015, 5:32:08 PM (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:
20f9b5
Parents:
3e52834
git-author:
Frederik Heber <heber@…> (06/21/15 12:16:19)
git-committer:
Frederik Heber <heber@…> (08/05/15 17:32:08)
Message:

GLMoleculeObject_molecule uses ObservedValue for internally representing atom's state.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_molecule.hpp

    r3e52834 r6c16a0  
    1616#include "GLMoleculeObject.hpp"
    1717
     18#include <Qt3D/qgeometrydata.h>
     19
     20#include "CodePatterns/Cacheable.hpp"
    1821#include "CodePatterns/Observer/Observer.hpp"
     22#include "CodePatterns/ObservedValue.hpp"
    1923
    2024#include "GLMoleculeObject_bond.hpp"
     
    3438  virtual ~GLMoleculeObject_molecule();
    3539
    36   void updateBoundingBox();
    37 
    3840  // Observer functions
    3941  void update(Observable *publisher);
     
    5153      const enum GLMoleculeObject_bond::SideOfBond side);
    5254
    53   void selected(const bool _isSelected)
    54   { isSelected = _isSelected; }
    55 
    5655signals:
    5756  void changed();
     
    5958  void hoverChanged(const atomId_t);
    6059  void hoverChanged(const moleculeId_t, int);
     60  void indexChanged(GLMoleculeObject_molecule *, const moleculeId_t, const moleculeId_t);
    6161  void atomClicked(atomId_t no);
    6262  void moleculeClicked(moleculeId_t no);
     63  void TesselationHullChanged();
     64  void BoundingBoxChanged();
     65  void IsSelectedChanged();
     66  void AtomInserted(const atomId_t _id);
     67  void AtomRemoved(const atomId_t _id);
     68  void IdChanged();
    6369
    6470private slots:
     
    6975  void atomInserted(const atomId_t _id);
    7076  void atomRemoved(const atomId_t _id);
    71   void bondInserted(const bond::ptr _bond, const GLMoleculeObject_bond::SideOfBond side);
     77  void bondInserted(const atomId_t, const atomId_t, const GLMoleculeObject_bond::SideOfBond side);
    7278  void bondRemoved(const atomId_t leftnr, const atomId_t rightnr);
    7379  void hoverChangedSignalled(GLMoleculeObject *ob);
    74   void changeAtomId(GLMoleculeObject_atom *, int, int);
     80  void changeAtomId(GLMoleculeObject_atom *, const atomId_t, const atomId_t);
    7581
    7682  void setVisible(bool value);
    7783
    7884  void activateObserver();
     85  void deactivateObserver();
     86
     87  void resetTesselationHull();
     88  void resetIsSelected();
     89  void resetBoundingBox();
     90  void resetAtoms();
     91  void resetIndex();
     92
     93private:
     94  static const molecule * const getMolecule(const moleculeId_t _id);
    7995
    8096private:
     
    85101  void addAtomBonds(const atom *_atom);
    86102
    87   void updateTesselationHull();
     103  //!> typedef for the internal set of atoms
     104  typedef std::set<atomId_t> atoms_t;
    88105
    89   //!> states whether selection box is additionally drawn or not
    90   bool isSelected;
    91   bool isBoundingBoxUptodate;
     106  /** Structure for the required information on the bounding box.
     107   *
     108   */
     109  struct BoundingBoxInfo {
     110    //!> position of center
     111    Vector position;
     112    //!> radius of sphere
     113    double radius;
     114  };
    92115
    93   //!> whether we are signed on to the associated molecule
    94   bool isSignedOn;
     116  /** Structure for the required information on the tesselation hull.
     117   *
     118   */
     119  struct TesselationHullInfo {
     120  };
    95121
    96   const moleculeId_t moleculeid;
     122  QGeometryData updateTesselationHull() const;
     123  bool updateIsSelected() const;
     124  BoundingBoxInfo updateBoundingBox() const;
     125  atoms_t updateAtoms();
     126  moleculeId_t updateIndex() const;
    97127
    98   bool TesselationHullUptodate;
     128  //!> the Observable we are signed on, also indicates whether we are sign on (not NULL)
     129  const Observable * owner;
     130
     131  //!> internal variable for caching molecule ref in cstor
     132  const molecule * const molref;
     133
     134  //!> list of channels when contained atoms needs to update
     135  static const Observable::channels_t AtomsChannels;
     136  //!> list of channels when tesselation hull needs to update
     137  static const Observable::channels_t HullChannels;
     138  //!> list of channels when selection status needs to update
     139  static const Observable::channels_t SelectionStatusChannels;
     140  //!> list of channels when bounding box needs to update
     141  static const Observable::channels_t BoundingBoxChannels;
     142  //!> list of channels when the index needs to update
     143  static const Observable::channels_t IndexChannels;
     144
     145  boost::function<moleculeId_t ()> MolIndexUpdater;
     146  boost::function<QGeometryData ()> TesselationHullUpdater;
     147  boost::function<bool ()> IsSelectedUpdater;
     148  boost::function<BoundingBoxInfo ()> BoundingBoxUpdater;
     149  boost::function<atoms_t ()> PresentAtomsUpdater;
     150
     151  //!> contains the current molecule index
     152  ObservedValue<moleculeId_t> MolIndex;
     153  //!> contains current version of the tesselation hull on request
     154  Cacheable<QGeometryData> TesselationHull;
     155  //!> contains newest version of the selection status
     156  ObservedValue<bool> isSelected;
     157  //!> contains newest version of the bounding box on request
     158  ObservedValue<BoundingBoxInfo> BoundingBox;
     159  //!> contains the current live set of atoms for the molecule
     160  ObservedValue<atoms_t> PresentAtoms;
     161
     162  //!> contains the set of atoms displayed
     163  atoms_t DisplayedAtoms;
    99164
    100165  typedef std::map< atomId_t, GLMoleculeObject_atom* > AtomNodeMap;
Note: See TracChangeset for help on using the changeset viewer.