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.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified 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
Note: See TracChangeset for help on using the changeset viewer.