Changeset c67518


Ignore:
Timestamp:
Apr 6, 2012, 11:57:23 AM (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:
3b229e
Parents:
42c6a47
git-author:
Michael Ankele <ankele@…> (03/30/12 14:59:47)
git-committer:
Frederik Heber <heber@…> (04/06/12 11:57:23)
Message:

GL: molecules show if they're selected (mostly dummy)

  • adden new GLMoleculeObject_molecule class (without mesh)
  • draws a cube if molecule is selected (does NOT use correct position/size yet!)
Location:
src/UIElements
Files:
2 added
8 edited

Legend:

Unmodified
Added
Removed
  • src/UIElements/Makefile.am

    r42c6a47 rc67518  
    205205        UIElements/Views/Qt4/Qt3D/GLMoleculeObject.cpp \
    206206        UIElements/Views/Qt4/Qt3D/GLMoleculeObject_atom.cpp \
    207         UIElements/Views/Qt4/Qt3D/GLMoleculeObject_bond.cpp
     207        UIElements/Views/Qt4/Qt3D/GLMoleculeObject_bond.cpp \
     208        UIElements/Views/Qt4/Qt3D/GLMoleculeObject_molecule.cpp
    208209#  UIElements/Views/Qt4/dialoglight.cpp
    209210             
     
    237238        UIElements/Views/Qt4/Qt3D/GLMoleculeObject.hpp \
    238239        UIElements/Views/Qt4/Qt3D/GLMoleculeObject_atom.hpp \
    239         UIElements/Views/Qt4/Qt3D/GLMoleculeObject_bond.hpp
     240        UIElements/Views/Qt4/Qt3D/GLMoleculeObject_bond.hpp \
     241        UIElements/Views/Qt4/Qt3D/GLMoleculeObject_molecule.hpp
    240242
    241243QTUIUI_UIFILES = \
  • src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject.cpp

    r42c6a47 rc67518  
    7878GLMoleculeObject::~GLMoleculeObject()
    7979{
    80    delete m_mesh;
    8180}
    8281
     
    234233  }
    235234}
     235
     236
     237void GLMoleculeObject::setSelected(bool value)
     238{
     239  if (value != m_selected){
     240    m_selected = value;
     241    emit selectionChanged();
     242  }
     243}
  • src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject.hpp

    r42c6a47 rc67518  
    7373
    7474   bool selected() const { return m_selected; }
    75    void setSelected(bool value) { m_selected = value; }
     75   void setSelected(bool value);
    7676
    7777   void initialize(QGLView *view, QGLPainter *painter);
  • src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_atom.cpp

    r42c6a47 rc67518  
    195195      case World::SelectionChanged:
    196196        setSelected(World::getInstance().isSelected(_atom));
    197         emit selectionChanged();
    198197        break;
    199198      default:
  • src/UIElements/Views/Qt4/Qt3D/GLWorldScene.cpp

    r42c6a47 rc67518  
    2525#include "GLMoleculeObject_atom.hpp"
    2626#include "GLMoleculeObject_bond.hpp"
     27#include "GLMoleculeObject_molecule.hpp"
    2728
    2829#include "CodePatterns/MemDebug.hpp"
     
    7475        Runner != molecules.end();
    7576        Runner++) {
     77
    7678      // create molecule
     79      moleculeInserted(*Runner);
     80
    7781      for (molecule::const_iterator atomiter = (*Runner)->begin();
    7882          atomiter != (*Runner)->end();
     
    133137  AtomsinSceneMap.erase(iter);
    134138  delete atomObject;
     139  emit changeOccured();
     140}
     141
     142/** Adds a molecule to the scene.
     143 *
     144 * @param _molecule molecule to add
     145 */
     146void GLWorldScene::moleculeInserted(const molecule*_molecule)
     147{
     148  LOG(3, "INFO: GLWorldScene: Received signal moleculeInserted for atom "+toString(_molecule->getId())+".");
     149  GLMoleculeObject_molecule *molObject = new GLMoleculeObject_molecule(this, _molecule);
     150  MoleculeNodeMap::iterator iter = MoleculesinSceneMap.find(_molecule->getId());
     151  ASSERT(iter == MoleculesinSceneMap.end(),
     152      "GLWorldScene::moleculeInserted() - same molecule "+_molecule->getName()+" added again.");
     153  MoleculesinSceneMap.insert( make_pair(_molecule->getId(), molObject) );
     154  connect (molObject, SIGNAL(changed()), this, SIGNAL(changed()));
     155  connect (molObject, SIGNAL(selectionChanged()), this, SIGNAL(changed()));
     156  connect (molObject, SIGNAL(selectionChanged()), this, SIGNAL(changed()));
     157  emit changeOccured();
     158}
     159
     160/** Removes a molecule from the scene.
     161 *
     162 * @param _molecule molecule to remove
     163 */
     164void GLWorldScene::moleculeRemoved(const molecule *_molecule)
     165{
     166  LOG(3, "INFO: GLWorldScene: Received signal moleculeRemoved for atom "+toString(_molecule->getId())+".");
     167  MoleculeNodeMap::iterator iter = MoleculesinSceneMap.find(_molecule->getId());
     168  ASSERT(iter != MoleculesinSceneMap.end(),
     169      "GLWorldScene::moleculeRemoved() - molecule "+_molecule->getName()+" not on display.");
     170  GLMoleculeObject_molecule *molObject = iter->second;
     171  molObject->disconnect();
     172  MoleculesinSceneMap.erase(iter);
     173  delete molObject;
    135174  emit changeOccured();
    136175}
  • src/UIElements/Views/Qt4/Qt3D/GLWorldScene.hpp

    r42c6a47 rc67518  
    2323
    2424#include "GLMoleculeObject_bond.hpp"
     25#include "GLMoleculeObject_molecule.hpp"
    2526
    2627class atom;
     28class molecule;
    2729
    2830class QGLPainter;
     
    3234class GLMoleculeObject;
    3335class GLMoleculeObject_atom;
     36class GLMoleculeObject_molecule;
    3437
    3538/** This class contains a list of all molecules in the world.
     
    4952  void changeMaterials(bool perPixel);
    5053  QGLSceneNode* getAtom(size_t);
     54  QGLSceneNode* getMolecule(size_t);
    5155  QGLSceneNode* getBond(size_t, size_t);
    5256
     
    6872  void atomInserted(const atom *_atom);
    6973  void atomRemoved(const atom *_atom);
     74  void moleculeInserted(const molecule *_molecule);
     75  void moleculeRemoved(const molecule *_molecule);
    7076  void bondInserted(const bond *_bond, const GLMoleculeObject_bond::SideOfBond side);
    7177  void bondRemoved(const atomId_t leftnr, const atomId_t rightnr);
     
    8086  typedef std::map< atomId_t, GLMoleculeObject_atom* > AtomNodeMap;
    8187  typedef std::map< BondIds , GLMoleculeObject_bond* > BondNodeMap;
     88  typedef std::map< moleculeId_t , GLMoleculeObject_molecule* > MoleculeNodeMap;
    8289  AtomNodeMap AtomsinSceneMap;
    8390  BondNodeMap BondsinSceneMap;
     91  MoleculeNodeMap MoleculesinSceneMap;
    8492};
    8593
  • src/UIElements/Views/Qt4/Qt3D/GLWorldView.cpp

    r42c6a47 rc67518  
    4242  connect(this, SIGNAL(atomInserted(const atom *)), worldscene, SLOT(atomInserted(const atom *)));
    4343  connect(this, SIGNAL(atomRemoved(const atom *)), worldscene, SLOT(atomRemoved(const atom *)));
     44  connect(this, SIGNAL(moleculeInserted(const molecule *)), worldscene, SLOT(moleculeInserted(const molecule *)));
     45  connect(this, SIGNAL(moleculeRemoved(const molecule *)), worldscene, SLOT(moleculeRemoved(const molecule *)));
    4446  connect(this, SIGNAL(changed()), this, SLOT(updateGL()));
    4547
     
    4951  World::getInstance().signOn(this, World::AtomRemoved);
    5052  World::getInstance().signOn(this, World::AtomPositionChanged);
     53  World::getInstance().signOn(this, World::MoleculeInserted);
     54  World::getInstance().signOn(this, World::MoleculeRemoved);
    5155}
    5256
     
    5761  World::getInstance().signOff(this, World::AtomRemoved);
    5862  World::getInstance().signOff(this, World::AtomPositionChanged);
     63  World::getInstance().signOff(this, World::MoleculeInserted);
     64  World::getInstance().signOff(this, World::MoleculeRemoved);
    5965  delete worldscene;
    6066}
     
    107113#endif
    108114      emit changed();
     115      break;
     116    }
     117    case World::MoleculeInserted:
     118    {
     119      const molecule *_molecule = World::getInstance().lastChanged<molecule>();
     120#ifdef LOG_OBSERVER
     121      observerLog().addMessage() << "++ Observer " << observerLog().getName(this) << " received notification that molecule "+toString(_molecule->getId())+" has been inserted.";
     122#endif
     123      emit moleculeInserted(_molecule);
     124      break;
     125    }
     126    case World::MoleculeRemoved:
     127    {
     128      const molecule *_molecule = World::getInstance().lastChanged<molecule>();
     129#ifdef LOG_OBSERVER
     130      observerLog().addMessage() << "++ Observer " << observerLog().getName(this) << " received notification that molecule "+toString(_molecule->getId())+" has been removed.";
     131#endif
     132      emit moleculeRemoved(_molecule);
    109133      break;
    110134    }
  • src/UIElements/Views/Qt4/Qt3D/GLWorldView.hpp

    r42c6a47 rc67518  
    4747  void atomInserted(const atom *_atom);
    4848  void atomRemoved(const atom *_atom);
     49  void moleculeInserted(const molecule *_molecule);
     50  void moleculeRemoved(const molecule *_molecule);
    4951
    5052protected:
Note: See TracChangeset for help on using the changeset viewer.