Ignore:
Timestamp:
Feb 12, 2016, 11:15:06 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:
47f0e4
Parents:
026bef
git-author:
Frederik Heber <heber@…> (10/17/15 15:42:17)
git-committer:
Frederik Heber <heber@…> (02/12/16 23:15:06)
Message:

Added QtInstanceInformationBoard that handles ObservedValues through the QtGui interface.

  • this is meant as a instantiator of all ObservedValue's needed by QtGui for representing information from the World. The ObservedValue's are instantiated separately w.r.t. to the instance for the visual representation. This is light-weight and can be performed in the same thread, while the visual representation's instantiation can be done elsewhere and there we just need to access the ready ObservedValue's that exist as long as they are needed by the QtGui.
Location:
src/UIElements/Views/Qt4/Qt3D
Files:
6 edited

Legend:

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

    r026bef r15c8a9  
    2929
    3030class GLWorldScene;
     31class QtInstanceInformationBoard;
    3132
    3233class GLMoleculeObject_atom : public GLMoleculeObject, Observer
     
    108109
    109110private:
     111  friend class QtInstanceInformationBoard;
    110112  /** Observed Values **/
    111113
  • src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_molecule.hpp

    r026bef r15c8a9  
    3434class GLMoleculeObject_atom;
    3535class GLWorldScene;
     36class QtInstanceInformationBoard;
    3637
    3738class GLMoleculeObject_molecule : public GLMoleculeObject, public Observer
     
    147148
    148149private:
     150  friend class QtInstanceInformationBoard;
    149151  /** Observed Values **/
    150152
  • src/UIElements/Views/Qt4/Qt3D/GLWorldScene.cpp

    r026bef r15c8a9  
    4949#include "UIElements/Views/Qt4/Qt3D/GLMoleculeObject_shape.hpp"
    5050
     51#include "UIElements/Views/Qt4/QtInstanceInformationBoard.hpp"
    5152#include "UIElements/Views/Qt4/QtSelectionChangedAgent.hpp"
    5253
     
    7273using namespace MoleCuilder;
    7374
    74 GLWorldScene::GLWorldScene(QObject *parent) :
    75     QObject(parent),
    76     selectionMode(SelectAtom)
     75GLWorldScene::GLWorldScene(
     76    QtInstanceInformationBoard * _board,
     77    QObject *parent) :
     78  QObject(parent),
     79  selectionMode(SelectAtom),
     80  board(_board)
    7781{
    7882  int sphereDetails[] = {5, 3, 2, 0};
     
    9094    GLMoleculeObject::meshCylinder[i]->setOption(QGLSceneNode::CullBoundingBox, true);
    9195  }
     96  connect(board, SIGNAL(moleculeIndexChanged(const moleculeId_t, const moleculeId_t)),
     97      this, SLOT(moleculeIndexChanged(const moleculeId_t, const moleculeId_t)));
     98  connect(board, SIGNAL(moleculeInserted(const moleculeId_t)),
     99      this, SLOT(moleculeInserted(const moleculeId_t)));
     100  connect(board, SIGNAL(moleculeRemoved(const moleculeId_t)),
     101      this, SLOT(moleculeRemoved(const moleculeId_t)));
     102  connect(board, SIGNAL(moleculeIndexChanged(const moleculeId_t, const moleculeId_t)),
     103      this, SLOT(moleculeIndexChanged(const moleculeId_t, const moleculeId_t)));
    92104
    93105//  connect(this, SIGNAL(updated()), this, SLOT(update()));
     
    359371}
    360372
     373void GLWorldScene::moleculeIndexChanged(const moleculeId_t _oldid, const moleculeId_t _newid)
     374{
     375  MoleculeNodeMap::iterator iter = MoleculesinSceneMap.find(_oldid);
     376  if ( iter == MoleculesinSceneMap.end()) {
     377    RemovalMolecule_t::iterator removeiter =
     378        RemovalMolecules.find(_oldid);
     379    ASSERT( removeiter != RemovalMolecules.end(),
     380        "GLWorldScene::moleculeIndexChanged() - cannot find id "+toString(_oldid)+" in any map.");
     381    RemovalMolecules.erase(removeiter);
     382    RemovalMolecules.insert(_newid);
     383  } else {
     384    LOG(1, "DEBUG: Changing GLMoleculeObject_molecule from " << _oldid << " to id " << _newid);
     385    GLMoleculeObject_molecule* molObject = iter->second;
     386    MoleculesinSceneMap.erase(iter);
     387    MoleculesinSceneMap.insert(
     388        std::make_pair( _newid, molObject) );
     389  }
     390}
     391
    361392void GLWorldScene::moleculesVisibilityChanged(const moleculeId_t _id, bool _visible)
    362393{
     
    506537  boost::recursive_mutex::scoped_lock lock(MoleculeinSceneMap_mutex);
    507538  MoleculeNodeMap::iterator iter = MoleculesinSceneMap.find(_molid);
     539  // use direct connection as it's lightweight and we avoid index change troubles
    508540  if (iter != MoleculesinSceneMap.end())
    509541    QMetaObject::invokeMethod(iter->second,        // pointer to a QObject
    510542                            "AtomSelected",       // member name (no parameters here)
    511                             Qt::QueuedConnection,     // connection type
     543                            Qt::DirectConnection,     // connection type
    512544                            Q_ARG(const atomId_t, _id));     // parameters
    513545  else
     
    520552  boost::recursive_mutex::scoped_lock lock(MoleculeinSceneMap_mutex);
    521553  MoleculeNodeMap::iterator iter = MoleculesinSceneMap.find(_molid);
     554  // use direct connection as it's lightweight and we avoid index change troubles
    522555  if (iter != MoleculesinSceneMap.end())
    523556    QMetaObject::invokeMethod(iter->second,        // pointer to a QObject
    524557                            "AtomUnselected",       // member name (no parameters here)
    525                             Qt::QueuedConnection,     // connection type
     558                            Qt::DirectConnection,     // connection type
    526559                            Q_ARG(const atomId_t, _id));     // parameters
    527560  else
  • src/UIElements/Views/Qt4/Qt3D/GLWorldScene.hpp

    r026bef r15c8a9  
    4141class QtSelectionChangedAgent;
    4242
     43class QtInstanceInformationBoard;
     44
    4345/** This class contains a list of all molecules in the world.
    4446 *
     
    4850  Q_OBJECT
    4951public:
    50   GLWorldScene(QObject *parent=0);
     52  GLWorldScene(
     53      QtInstanceInformationBoard * _board,
     54      QObject *parent=0);
    5155  virtual ~GLWorldScene();
    5256
     
    8892  void moleculeRemoved(const moleculeId_t _id);
    8993  void moleculeInserted(const moleculeId_t _id);
     94  void moleculeIndexChanged(const moleculeId_t _oldid, const moleculeId_t _newid);
    9095  void atomRemoved(const moleculeId_t _molid, const atomId_t _atomid);
    9196  void atomInserted(const moleculeId_t _molid, const atomId_t _atomid);
     
    133138
    134139  SelectionModeType selectionMode;
     140
     141  QtInstanceInformationBoard * board;
    135142};
    136143
  • src/UIElements/Views/Qt4/Qt3D/GLWorldView.cpp

    r026bef r15c8a9  
    6565#include "WorldTime.hpp"
    6666
    67 GLWorldView::GLWorldView(QWidget *parent)
    68   : QGLView(parent), Observer("GLWorldView"), worldscene(NULL), changesPresent(false), needsRedraw(false)
    69 {
    70   worldscene = new GLWorldScene(this);
     67GLWorldView::GLWorldView(
     68    QtInstanceInformationBoard * _board,
     69    QWidget *parent) :
     70  QGLView(parent),
     71  Observer("GLWorldView"),
     72  worldscene(NULL),
     73  changesPresent(false),
     74  needsRedraw(false)
     75{
     76  worldscene = new GLWorldScene(_board, this);
    7177
    7278  setOption(QGLView::ObjectPicking, true);
  • src/UIElements/Views/Qt4/Qt3D/GLWorldView.hpp

    r026bef r15c8a9  
    2828class QtSelectionChangedAgent;
    2929
     30class QtInstanceInformationBoard;
     31
    3032/** This class is the view on the 3D representation of the World, i.e. the whole
    3133 * of all molecules (consisting of atoms).
     
    3638  Q_OBJECT
    3739public:
    38   GLWorldView(QWidget *parent=0);
     40  GLWorldView(
     41      QtInstanceInformationBoard * _board,
     42      QWidget *parent=0);
    3943  virtual ~GLWorldView();
    4044
Note: See TracChangeset for help on using the changeset viewer.