- Timestamp:
- Oct 6, 2011, 3:06:16 PM (13 years ago)
- 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:
- 029bb4
- Parents:
- 907636
- git-author:
- Frederik Heber <heber@…> (08/26/11 16:26:42)
- git-committer:
- Frederik Heber <heber@…> (10/06/11 15:06:16)
- Location:
- src/UIElements/Views/Qt4/Qt3D
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_atom.cpp
r907636 r06ebf5 28 28 #include "CodePatterns/Assert.hpp" 29 29 30 #include "atom.hpp"31 30 #include "element.hpp" 32 31 #include "LinearAlgebra/Vector.hpp" … … 42 41 } 43 42 44 GLMoleculeObject_atom::GLMoleculeObject_atom(QObject *parent, const atom * _atom) :45 GLMoleculeObject(createAtom(parent), parent) 43 GLMoleculeObject_atom::GLMoleculeObject_atom(QObject *parent, const atom *atomref) : 44 GLMoleculeObject(createAtom(parent), parent), _atom(atomref) 46 45 { 47 46 const Vector Position = _atom->getPosition(); … … 68 67 69 68 std::cout << "Created sphere at " << Position << " with elementno " << elementno << "." << endl; 69 70 connect( this, SIGNAL(clicked()), this, SLOT(wasClicked())); 70 71 } 72 73 void GLMoleculeObject_atom::wasClicked() 74 { 75 qDebug("GLMoleculeObject_atom: atom %d has been clicked", _atom->getId()); 76 emit clicked(_atom->getId()); 77 } -
src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_atom.hpp
r907636 r06ebf5 16 16 #include "GLMoleculeObject.hpp" 17 17 18 class atom; 18 #include "atom.hpp" 19 19 20 20 class GLMoleculeObject_atom : public GLMoleculeObject 21 21 { 22 22 Q_OBJECT 23 23 public: 24 GLMoleculeObject_atom(QObject *parent, const atom *atomref); 25 ~GLMoleculeObject_atom() {} 24 GLMoleculeObject_atom(QObject *parent, const atom *atomref); 25 ~GLMoleculeObject_atom() {} 26 27 private slots: 28 void wasClicked(); 29 30 signals: 31 void clicked(atomId_t); 26 32 27 33 private: 28 atom *_atom;34 const atom *_atom; 29 35 }; 30 36 -
src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_bond.cpp
r907636 r06ebf5 48 48 } 49 49 50 GLMoleculeObject_bond::GLMoleculeObject_bond(QObject *parent, bond *_bond, double distance, enum SideOfBond side) :51 GLMoleculeObject(createBond(parent, distance), parent) 50 GLMoleculeObject_bond::GLMoleculeObject_bond(QObject *parent, const bond *bondref, double distance, enum SideOfBond side) : 51 GLMoleculeObject(createBond(parent, distance), parent), _bond(bondref) 52 52 { 53 53 Vector Position; -
src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_bond.hpp
r907636 r06ebf5 20 20 class GLMoleculeObject_bond : public GLMoleculeObject 21 21 { 22 22 Q_OBJECT 23 23 public: 24 24 enum SideOfBond { left, right }; 25 25 26 GLMoleculeObject_bond(QObject *parent,bond *bondref, double distance, enum SideOfBond side);27 26 GLMoleculeObject_bond(QObject *parent, const bond *bondref, double distance, enum SideOfBond side); 27 ~GLMoleculeObject_bond() {} 28 28 29 29 30 30 private: 31 bond *_bond;31 const bond *_bond; 32 32 }; 33 33 -
src/UIElements/Views/Qt4/Qt3D/GLMoleculeScene.cpp
r907636 r06ebf5 42 42 GLMoleculeObject_atom *atomObject= new GLMoleculeObject_atom(this, *atomiter); 43 43 AtomsinMoleculeMap.insert( make_pair((*atomiter)->getId(), atomObject) ); 44 connect (atomObject, SIGNAL(clicked(atomId_t)), this, SLOT(atomClicked(atomId_t))); 44 45 45 46 // create its bonds … … 83 84 GLMoleculeObject *meshobj = qobject_cast<GLMoleculeObject *>(obj); 84 85 if (meshobj) 85 86 meshobj->initialize(view, painter); 86 87 } 87 88 } … … 93 94 GLMoleculeObject *meshobj = qobject_cast<GLMoleculeObject *>(obj); 94 95 if (meshobj) 95 96 meshobj->draw(painter); 96 97 } 97 98 } 98 99 100 void GLMoleculeScene::atomClicked(atomId_t no) 101 { 102 qDebug("GLMoleculeScene: atom %d has been clicked inside molecule %d", no, mol->getId()); 103 emit clicked(no, mol->getId()); 104 } -
src/UIElements/Views/Qt4/Qt3D/GLMoleculeScene.hpp
r907636 r06ebf5 19 19 #include <Qt3D/qglpainter.h> 20 20 21 class molecule; 21 #include "atom.hpp" 22 #include "molecule.hpp" 23 22 24 class QGLView; 23 25 class GLMoleculeObject_atom; … … 30 32 class GLMoleculeScene : public QObject 31 33 { 32 34 Q_OBJECT 33 35 public: 34 35 36 explicit GLMoleculeScene(QObject *parent, molecule *_mol); 37 virtual ~GLMoleculeScene(); 36 38 37 virtual void initialize(QGLView *view, QGLPainter *painter); 38 virtual void draw(QGLPainter *painter); 39 virtual void initialize(QGLView *view, QGLPainter *painter); 40 virtual void draw(QGLPainter *painter); 41 42 private slots: 43 void atomClicked(atomId_t no); 44 45 signals: 46 void pressed(); 47 void released(); 48 void clicked(); 49 void clicked(atomId_t, moleculeId_t); 50 void doubleClicked(); 51 void hoverChanged(); 39 52 40 53 private: -
src/UIElements/Views/Qt4/Qt3D/GLWorldScene.cpp
r907636 r06ebf5 57 57 GLMoleculeScene * const molObject = new GLMoleculeScene(this, *Runner); 58 58 MoleculeSceneList.push_back(molObject); 59 connect (molObject, SIGNAL(clicked(atomId_t, moleculeId_t)), this, SLOT(molClicked(atomId_t, moleculeId_t))); 59 60 } 60 61 } … … 79 80 } 80 81 } 81 //82 ///** create an atom object in the scene.83 // * \param molObject Object of the molecule in the scene to set as parent84 // * \param _atom ref to the atom to create85 // */86 //void GLWorldScene::makeAtom(GLMoleculeObject *&molObject, const atom *&_atom)87 //{88 // // create object (hand over getMaterial as callback function)89 // GLMoleculeObject_atom *newatom = new GLMoleculeObject_atom(molObject, _atom, &getMaterial);90 //91 // // connect signal92 // connect(newatom, SIGNAL(hoverChanged()), this, SIGNAL(changed()));93 //94 // // add to nodes map95 // AtomsinSceneMap.insert( make_pair(_atom->getId(), newatom) );96 //}97 //98 ///** Create a bond object in the scene.99 // * \param molObject Object of the molecule in the scene to set as parent100 // * \param _bond ref to the bond to create101 // */102 //void GLWorldScene::makeCylinder(GLMoleculeObject *&molObject, const bond *_bond)103 // //const Vector &x, const Vector &y, double radius, double height, const size_t elementno)104 //{105 // // create object106 // QGLMoleculeObject_bond *newbond = new QGLMoleculeObject_bond(molObject, _bond, &getMaterial)107 //108 // // nothing to connect here109 //110 // // add to nodes map111 // BondsinSceneMap.insert(112 // make_pair(113 // make_pair(114 // _bond->leftatom->getId(),115 // _bond->rightatom->getId()116 // ),117 // newatom) );118 //}119 //120 //121 //122 //QGLSceneNode* GLMoleculeView::getAtom(size_t no)123 //{124 // // first some sensibility checks125 // ASSERT(World::getInstance().getAtom(AtomById(no)) != NULL,126 // "GLMoleculeView::getAtom() - desired atom "127 // +toString(no)+" not present in the World.");128 // ASSERT(AtomsinSceneMap.find(no) != AtomsinSceneMap.end(),129 // "GLMoleculeView::getAtom() - desired atom "130 // +toString(no)+" not present in the AtomsinSceneMap.");131 //132 // return AtomsinSceneMap[no];133 //}134 //135 //QGLSceneNode* GLMoleculeView::getBond(size_t leftno, size_t rightno)136 //{137 // // first some sensibility checks138 // ASSERT(World::getInstance().getAtom(AtomById(leftno)) != NULL,139 // "GLMoleculeView::getAtom() - desired atom "140 // +toString(leftno)+" of bond not present in the World.");141 // ASSERT(World::getInstance().getAtom(AtomById(rightno)) != NULL,142 // "GLMoleculeView::getAtom() - desired atom "143 // +toString(rightno)+" of bond not present in the World.");144 // ASSERT(AtomsinSceneMap.find(leftno) != AtomsinSceneMap.end(),145 // "GLMoleculeView::getAtom() - desired atom "146 // +toString(leftno)+" of bond not present in the AtomsinSceneMap.");147 // ASSERT(AtomsinSceneMap.find(rightno) != AtomsinSceneMap.end(),148 // "GLMoleculeView::getAtom() - desired atom "149 // +toString(rightno)+" of bond not present in the AtomsinSceneMap.");150 // ASSERT(leftno == rightno,151 // "GLMoleculeView::getAtom() - bond must not be between the same atom: "152 // +toString(leftno)+" == "+toString(rightno)+".");153 //154 // // then return with smaller index first155 // if (leftno > rightno)156 // return AtomsinSceneMap[ make_pair(rightno, leftno) ];157 // else158 // return AtomsinSceneMap[ make_pair(leftno, rightno) ];159 //}160 82 161 void GLWorldScene:: atomClicked()83 void GLWorldScene::molClicked(atomId_t atom_no, moleculeId_t mol_no) 162 84 { 163 qDebug(" atom clicked");85 qDebug("WorldScene: atom %d of molecule %d has been clicked", atom_no, mol_no); 164 86 } -
src/UIElements/Views/Qt4/Qt3D/GLWorldScene.hpp
r907636 r06ebf5 17 17 18 18 #include <Qt/qobject.h> 19 20 #include "atom.hpp" 21 #include "molecule.hpp" 19 22 20 23 class QGLPainter; … … 52 55 53 56 private slots: 54 void atomClicked();57 void molClicked(atomId_t atom_no, moleculeId_t mol_no); 55 58 56 59 private: -
src/UIElements/Views/Qt4/Qt3D/GLWorldView.hpp
r907636 r06ebf5 26 26 class GLWorldView : public QGLView 27 27 { 28 28 Q_OBJECT 29 29 public: 30 31 30 GLWorldView(QWidget *parent=0); 31 virtual ~GLWorldView(); 32 32 33 33 public slots: 34 34 35 35 protected: 36 37 38 36 void initializeGL(QGLPainter *painter); 37 void paintGL(QGLPainter *painter); 38 void keyPressEvent(QKeyEvent *e); 39 39 40 40 private: 41 41 GLWorldScene *worldscene; 42 42 }; 43 43
Note:
See TracChangeset
for help on using the changeset viewer.