source: src/UIElements/Views/Qt4/Qt3D/GLWorldScene.hpp@ 50246c

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
Last change on this file since 50246c was bd6768, checked in by Frederik Heber <heber@…>, 9 years ago

GLWorldScene now properly reassigns parents of GLMoleculeObjects.

  • this is important for atoms and bonds such that they disappear when their associated molecule is visualized as a tesselated surface.
  • Property mode set to 100644
File size: 3.9 KB
Line 
1/*
2 * GLWorldScene.hpp
3 *
4 * This is based on the Qt3D example "teaservice", specifically parts of teaservice.cpp.
5 *
6 * Created on: Aug 17, 2011
7 * Author: heber
8 */
9
10#ifndef GLWORLDSCENE_HPP_
11#define GLWORLDSCENE_HPP_
12
13// include config.h
14#ifdef HAVE_CONFIG_H
15#include <config.h>
16#endif
17
18#include <Qt/qobject.h>
19
20#include <iosfwd>
21
22#include <boost/thread/recursive_mutex.hpp>
23
24#include "Bond/bond.hpp"
25#include "GLMoleculeObject_bond.hpp"
26#include "GLMoleculeObject_molecule.hpp"
27#include "types.hpp"
28
29#include "UIElements/Qt4/InstanceBoard/QtObservedAtom.hpp"
30#include "UIElements/Qt4/InstanceBoard/QtObservedBond.hpp"
31#include "UIElements/Qt4/InstanceBoard/QtObservedMolecule.hpp"
32
33class Shape;
34
35class QGLPainter;
36class QGLSceneNode;
37class QGLView;
38
39class GLMoleculeObject;
40class GLMoleculeObject_atom;
41class GLMoleculeObject_molecule;
42class GLMoleculeObject_shape;
43
44class QtObservedInstanceBoard;
45
46/** This class contains a list of all molecules in the world.
47 *
48 */
49class GLWorldScene : public QObject
50{
51 Q_OBJECT
52public:
53 GLWorldScene(
54 QtObservedInstanceBoard * _board,
55 QObject *parent=0);
56 virtual ~GLWorldScene();
57
58//#if !defined(QT_OPENGL_ES_1)
59// PerPixelEffect *lighting;
60//#endif
61
62 void changeMaterials(bool perPixel);
63 QGLSceneNode* getAtom(size_t);
64 QGLSceneNode* getMolecule(size_t);
65 QGLSceneNode* getBond(size_t, size_t);
66
67 void initialize(QGLView *view, QGLPainter *painter) const;
68 void draw(QGLPainter *painter, const QVector4D &cameraPlane) const;
69
70 enum SelectionModeType{
71 SelectAtom,
72 SelectMolecule
73 };
74 void setSelectionMode(SelectionModeType mode);
75
76signals:
77 void changed();
78// void updated();
79 void changeOccured();
80 void pressed();
81 void released();
82 void clicked();
83 void clicked(atomId_t);
84 void doubleClicked();
85 void hoverChanged(const atomId_t);
86 void hoverChanged(const moleculeId_t, int);
87 void atomConnected(QtObservedAtom::ptr);
88 void bondConnected(QtObservedBond::ptr);
89
90private slots:
91
92 void clickAtom(atomId_t no);
93 void connectAtom(QtObservedAtom::ptr);
94 void insertAtom(QtObservedAtom::ptr);
95 void removeAtom(ObservedValue_Index_t _atomid);
96
97 void connectBond(QtObservedBond::ptr);
98 void insertBond(QtObservedBond::ptr);
99 void removeBond(ObservedValue_Index_t _bondid);
100
101 void clickMolecule(moleculeId_t no);
102 void insertMolecule(QtObservedMolecule::ptr);
103 void removeMolecule(ObservedValue_Index_t _molid);
104
105 void setSelectionModeAtom();
106 void setSelectionModeMolecule();
107
108 void addShape(const std::string &_name);
109 void removeShape(const std::string &_name);
110// void update();
111 void moleculesVisibilityChanged(ObservedValue_Index_t _id, bool _visible);
112 void hoverChangedSignalled(GLMoleculeObject *ob);
113
114 void reparentAtom();
115 void reparentBondLeft();
116 void reparentBondRight();
117
118public:
119 void updateSelectedShapes();
120
121private:
122
123 //!> id of atom hovered over
124 atomId_t hoverAtomId;
125
126 typedef std::map< ObservedValue_Index_t , GLMoleculeObject_molecule* > MoleculeNodeMap;
127 typedef std::map< ObservedValue_Index_t, GLMoleculeObject_atom* > AtomNodeMap;
128 typedef std::multimap< ObservedValue_Index_t, GLMoleculeObject_bond* > BondNodeMap;
129 typedef std::map< std::string , GLMoleculeObject_shape* > ShapeNodeMap;
130
131 //!> typedef for storing the current parent to each node in scene
132 typedef std::map<ObservedValue_Index_t, QObject *> AtomNodeParentMap_t;
133 typedef std::map<ObservedValue_Index_t, std::vector<QObject *> > BondNodeParentMap_t;
134
135 //!> mutex to ascertain atomic access to NodeParentMaps
136 boost::recursive_mutex AtomNodeParentMap_mutex;
137 boost::recursive_mutex BondNodeParentMap_mutex;
138
139 AtomNodeMap AtomsinSceneMap;
140 BondNodeMap BondsinSceneMap;
141 MoleculeNodeMap MoleculesinSceneMap;
142 ShapeNodeMap ShapesinSceneMap;
143 AtomNodeParentMap_t AtomNodeParentMap;
144 BondNodeParentMap_t BondNodeParentMap;
145
146 SelectionModeType selectionMode;
147
148 QtObservedInstanceBoard * board;
149};
150
151#endif /* GLWORLDSCENE_HPP_ */
Note: See TracBrowser for help on using the repository browser.