source: src/UIElements/Views/Qt4/Qt3D/GLWorldScene.hpp@ 96f14a

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 96f14a was 96f14a, checked in by Frederik Heber <heber@…>, 9 years ago

Modified all GLMoleculeObjects and GLWorldScene to the new QtObservedBond.

  • GLWorldScene transmits bondInserted/bondRemoved similarly to those for the atoms to the molecule if aLready present and otherwise into the MissedStateMap.
  • Property mode set to 100644
File size: 5.1 KB
RevLine 
[907636]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
[2ad1ec]20#include <iosfwd>
21
[73b13c]22#include <boost/thread/recursive_mutex.hpp>
23
[88c8ec]24#include "Bond/bond.hpp"
[2ad1ec]25#include "GLMoleculeObject_bond.hpp"
[c67518]26#include "GLMoleculeObject_molecule.hpp"
[3e93332]27#include "types.hpp"
[2ad1ec]28
[1b07b1]29#include "UIElements/Qt4/InstanceBoard/QtObservedAtom.hpp"
[96f14a]30#include "UIElements/Qt4/InstanceBoard/QtObservedBond.hpp"
[1b07b1]31#include "UIElements/Qt4/InstanceBoard/QtObservedMolecule.hpp"
32
[f75491]33class Shape;
[7188b1]34
[907636]35class QGLPainter;
36class QGLSceneNode;
37class QGLView;
38
39class GLMoleculeObject;
40class GLMoleculeObject_atom;
[c67518]41class GLMoleculeObject_molecule;
[284551]42class GLMoleculeObject_shape;
[907636]43
[2f7988]44class QtObservedInstanceBoard;
[15c8a9]45
[907636]46/** This class contains a list of all molecules in the world.
47 *
48 */
49class GLWorldScene : public QObject
50{
51 Q_OBJECT
52public:
[15c8a9]53 GLWorldScene(
[2f7988]54 QtObservedInstanceBoard * _board,
[15c8a9]55 QObject *parent=0);
[907636]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);
[c67518]64 QGLSceneNode* getMolecule(size_t);
[907636]65 QGLSceneNode* getBond(size_t, size_t);
66
67 void initialize(QGLView *view, QGLPainter *painter) const;
[72a4c1]68 void draw(QGLPainter *painter, const QVector4D &cameraPlane) const;
[907636]69
[6966b7]70 enum SelectionModeType{
71 SelectAtom,
72 SelectMolecule
73 };
74 void setSelectionMode(SelectionModeType mode);
75
[907636]76signals:
77 void changed();
[f714763]78// void updated();
[65487f]79 void changeOccured();
[7188b1]80 void pressed();
81 void released();
82 void clicked();
83 void clicked(atomId_t);
84 void doubleClicked();
[704d59]85 void hoverChanged(const atomId_t);
86 void hoverChanged(const moleculeId_t, int);
[8281cc]87 void insertMolecule(QtObservedMolecule::ptr);
[e29427]88 void removeMolecule(QtObservedMolecule*);
[907636]89
90private slots:
[7188b1]91 void atomClicked(atomId_t no);
[9a7ef9]92 void moleculeClicked(moleculeId_t no);
[e29427]93 void moleculeRemoved(QtObservedMolecule* _mol);
94 void moleculeEmpty(QtObservedMolecule::ptr _mol);
[1b07b1]95 void moleculeInserted(QtObservedMolecule::ptr);
[8281cc]96 void moleculeSignOn(QtObservedMolecule::ptr);
[96f14a]97 void moleculeSignOff(ObservedValue_Index_t _id);
[f91ef6]98 void moleculesAtomRemoved(ObservedValue_Index_t _atomid, QtObservedMolecule * _mol);
[96e145]99 void moleculesAtomInserted(QtObservedAtom::ptr, QtObservedMolecule *_mol);
[96f14a]100 void moleculesBondRemoved(ObservedValue_Index_t _bondid, QtObservedMolecule * _mol);
101 void moleculesBondInserted(QtObservedBond::ptr, QtObservedMolecule *_mol);
[f91ef6]102 void atomRemoved(ObservedValue_Index_t _atomid);
[1b07b1]103 void atomInserted(QtObservedAtom::ptr);
[96f14a]104 void bondRemoved(ObservedValue_Index_t _bondid);
105 void bondInserted(QtObservedBond::ptr);
106 void bondsMoleculeChanged(moleculeId_t _oldid, moleculeId_t _newid);
[6966b7]107 void setSelectionModeAtom();
108 void setSelectionModeMolecule();
[07136a]109 void addShape(const std::string &_name);
110 void removeShape(const std::string &_name);
[f714763]111// void update();
[f91ef6]112 void moleculesVisibilityChanged(ObservedValue_Index_t _id, bool _visible);
[284551]113
114public:
[85c36d]115 void updateSelectedShapes();
[907636]116
[2ad1ec]117private:
118
[f91ef6]119 typedef std::map< ObservedValue_Index_t , GLMoleculeObject_molecule* > MoleculeNodeMap;
[284551]120 typedef std::map< std::string , GLMoleculeObject_shape* > ShapeNodeMap;
[c67518]121 MoleculeNodeMap MoleculesinSceneMap;
[284551]122 ShapeNodeMap ShapesinSceneMap;
[7cf0eb]123 //!> flag to indicate whether state map is currently worked on
124 boost::recursive_mutex MoleculeinSceneMap_mutex;
[bca99d]125
[9c259e]126 //!> enumeration of all possible changes molecule might have missed before instantiation
127 enum StateChangeType {
128 atomInsertedState,
129 atomRemovedState,
[96f14a]130 bondInsertedState,
131 bondRemovedState,
[9c259e]132 MAX_StateChangeType
133 };
[f91ef6]134 typedef std::map< ObservedValue_Index_t, QtObservedAtom::ptr> QtObservedAtomMap_t;
[96f14a]135 typedef std::map< ObservedValue_Index_t, QtObservedBond::ptr> QtObservedBondMap_t;
[f91ef6]136 typedef std::map< ObservedValue_Index_t, QtObservedMolecule::ptr> QtObservedMoleculeMap_t;
137 typedef std::multimap< ObservedValue_Index_t, StateChangeType> StateChangeMap_t;
[96f14a]138 typedef std::map< ObservedValue_Index_t, StateChangeMap_t> MissedStateMap_t;
[9c259e]139 //!> map of all missed state changes
[96f14a]140 MissedStateMap_t MoleculeMissedStateMap;
[1b07b1]141 //!> map to contain all QtObservedAtom that have not been instantiated so far
142 QtObservedAtomMap_t QtObservedAtomMap;
[96f14a]143 //!> map to contain all QtObservedBond that have not been instantiated so far
144 QtObservedBondMap_t QtObservedBondMap;
[8281cc]145 //!> map to contain all QtObservedMolecule that have not been instantiated so far
146 QtObservedMoleculeMap_t QtObservedMoleculeMap;
[59f1bc]147
[e29427]148 //!> map to get from QtObservedMolecule to the visual representant
149 typedef std::map< QtObservedMolecule* , GLMoleculeObject_molecule* > RemovedMoleculesMap_t;
[bcf9cd]150 //!> set of all currently removed molecules
[e29427]151 RemovedMoleculesMap_t RemovedMolecules;
[4a187d]152 //!> set of all currently empty molecules (about to be removed)
153 RemovedMoleculesMap_t EmptyMolecules;
[bcf9cd]154
[73b13c]155 //!> flag to indicate whether state map is currently worked on
156 boost::recursive_mutex MoleculeMissedStateMap_mutex;
[9c259e]157
[6966b7]158 SelectionModeType selectionMode;
[15c8a9]159
[2f7988]160 QtObservedInstanceBoard * board;
[907636]161};
162
163#endif /* GLWORLDSCENE_HPP_ */
Note: See TracBrowser for help on using the repository browser.