Ignore:
Timestamp:
Jan 10, 2015, 5:14:32 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:
34e7fdb
Parents:
8c001a
git-author:
Frederik Heber <heber@…> (11/05/14 22:00:40)
git-committer:
Frederik Heber <heber@…> (01/10/15 17:14:32)
Message:

GLMoleculeObject have m_visible, settable in QtMoleculeList.

  • is connected via QtMainWindow an GLWorldView, GLWorldScene.
  • i.e. molecule's atoms and bond display can now be switched on and off.
Location:
src/UIElements/Views/Qt4/Qt3D
Files:
7 edited

Legend:

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

    r8c001a r739ee9  
    8282   m_hovering = false;
    8383   m_selected = false;
     84   m_visible = true;
    8485   m_material = 0;
    8586   initStaticMaterials();
     
    328329  }
    329330}
     331
     332void GLMoleculeObject::setVisible(bool value)
     333{
     334  if (value != m_visible){
     335    m_visible = value;
     336    emit changed();
     337  }
     338}
  • src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject.hpp

    r8c001a r739ee9  
    7474   void setSelected(bool value);
    7575
     76   bool visible() const { return m_visible; }
     77   void setVisible(bool value);
     78
    7679   void initStaticMaterials();
    7780   virtual void initialize(QGLView *view, QGLPainter *painter);
     
    124127   bool m_hovering;
    125128   bool m_selected;
     129   bool m_visible;
    126130};
    127131
  • src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_molecule.cpp

    r8c001a r739ee9  
    7474  World::getInstance().signOn(this, World::SelectionChanged);
    7575  updateBoundingBox();
     76
     77  // initially, atoms and bonds should be visible
     78  m_visible = false;
    7679
    7780  init();
     
    256259void GLMoleculeObject_molecule::draw(QGLPainter *painter, const QVector4D &cameraPlane)
    257260{
    258    // Draw all of the mesh objects that we have as children.
    259   GLMoleculeObject::draw(painter, cameraPlane);
    260    foreach (QObject *obj, children()) {
    261      GLMoleculeObject *meshobj = qobject_cast<GLMoleculeObject *>(obj);
    262        if (meshobj)
    263          meshobj->draw(painter, cameraPlane);
    264    }
     261  // draw either molecule's mesh or all atoms and bonds
     262  if (m_visible) {
     263    GLMoleculeObject::draw(painter, cameraPlane);
     264  } else {
     265    // Draw all of the mesh objects that we have as children.
     266    foreach (QObject *obj, children()) {
     267      GLMoleculeObject *meshobj = qobject_cast<GLMoleculeObject *>(obj);
     268      if (meshobj)
     269        meshobj->draw(painter, cameraPlane);
     270    }
     271  }
    265272}
    266273
  • src/UIElements/Views/Qt4/Qt3D/GLWorldScene.cpp

    r8c001a r739ee9  
    286286}
    287287
     288void GLWorldScene::moleculesVisibilityChanged(const moleculeId_t _id, bool _visible)
     289{
     290  MoleculeNodeMap::iterator iter = MoleculesinSceneMap.find(_id);
     291  ASSERT( iter != MoleculesinSceneMap.end(),
     292      "GLWorldScene::moleculeInserted() - molecule's id "+toString(_id)+" is unknown.");
     293
     294  GLMoleculeObject_molecule *molObject = iter->second;
     295  molObject->setVisible(_visible);
     296
     297  emit changed();
     298  emit changeOccured();
     299}
     300
    288301/** Adds a bond to the scene.
    289302 *
  • src/UIElements/Views/Qt4/Qt3D/GLWorldScene.hpp

    r8c001a r739ee9  
    9292  void removeShape();
    9393  void update();
     94  void moleculesVisibilityChanged(const moleculeId_t _id, bool _visible);
    9495
    9596public:
  • src/UIElements/Views/Qt4/Qt3D/GLWorldView.cpp

    r8c001a r739ee9  
    9292  //connect(this, SIGNAL(changed()), this, SLOT(updateGL()));
    9393  connect(this, SIGNAL(changed()), this, SLOT(sceneChangeSignalled()));
     94  connect(this, SIGNAL(moleculesVisibilityChanged(const moleculeId_t,bool)), worldscene, SLOT(moleculesVisibilityChanged(const moleculeId_t,bool)));
    9495
    9596  // sign on to changes in the world
  • src/UIElements/Views/Qt4/Qt3D/GLWorldView.hpp

    r8c001a r739ee9  
    6464  void ShapeAdded();
    6565  void ShapeRemoved();
     66  void moleculesVisibilityChanged(const moleculeId_t,bool);
    6667
    6768protected:
Note: See TracChangeset for help on using the changeset viewer.