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 "molecule.hpp"
|
---|
21 |
|
---|
22 | #include <iosfwd>
|
---|
23 |
|
---|
24 | #include "GLMoleculeObject_bond.hpp"
|
---|
25 | #include "GLMoleculeObject_molecule.hpp"
|
---|
26 |
|
---|
27 | class atom;
|
---|
28 | class molecule;
|
---|
29 |
|
---|
30 | class QGLPainter;
|
---|
31 | class QGLSceneNode;
|
---|
32 | class QGLView;
|
---|
33 |
|
---|
34 | class GLMoleculeObject;
|
---|
35 | class GLMoleculeObject_atom;
|
---|
36 | class GLMoleculeObject_molecule;
|
---|
37 |
|
---|
38 | /** This class contains a list of all molecules in the world.
|
---|
39 | *
|
---|
40 | */
|
---|
41 | class GLWorldScene : public QObject
|
---|
42 | {
|
---|
43 | Q_OBJECT
|
---|
44 | public:
|
---|
45 | GLWorldScene(QObject *parent=0);
|
---|
46 | virtual ~GLWorldScene();
|
---|
47 |
|
---|
48 | //#if !defined(QT_OPENGL_ES_1)
|
---|
49 | // PerPixelEffect *lighting;
|
---|
50 | //#endif
|
---|
51 |
|
---|
52 | void changeMaterials(bool perPixel);
|
---|
53 | QGLSceneNode* getAtom(size_t);
|
---|
54 | QGLSceneNode* getMolecule(size_t);
|
---|
55 | QGLSceneNode* getBond(size_t, size_t);
|
---|
56 |
|
---|
57 | void initialize(QGLView *view, QGLPainter *painter) const;
|
---|
58 | void draw(QGLPainter *painter) const;
|
---|
59 |
|
---|
60 | signals:
|
---|
61 | void changed();
|
---|
62 | void changeOccured();
|
---|
63 | void pressed();
|
---|
64 | void released();
|
---|
65 | void clicked();
|
---|
66 | void clicked(atomId_t);
|
---|
67 | void doubleClicked();
|
---|
68 | void hoverChanged();
|
---|
69 |
|
---|
70 | private slots:
|
---|
71 | void atomClicked(atomId_t no);
|
---|
72 | void atomInserted(const atom *_atom);
|
---|
73 | void atomRemoved(const atom *_atom);
|
---|
74 | void moleculeInserted(const molecule *_molecule);
|
---|
75 | void moleculeRemoved(const molecule *_molecule);
|
---|
76 | void bondInserted(const bond *_bond, const GLMoleculeObject_bond::SideOfBond side);
|
---|
77 | void bondRemoved(const atomId_t leftnr, const atomId_t rightnr);
|
---|
78 |
|
---|
79 | private:
|
---|
80 | void init();
|
---|
81 |
|
---|
82 | private:
|
---|
83 | typedef std::pair< atomId_t, atomId_t> BondIds;
|
---|
84 | friend std::ostream &operator<<(std::ostream &ost, const BondIds &t);
|
---|
85 |
|
---|
86 | typedef std::map< atomId_t, GLMoleculeObject_atom* > AtomNodeMap;
|
---|
87 | typedef std::map< BondIds , GLMoleculeObject_bond* > BondNodeMap;
|
---|
88 | typedef std::map< moleculeId_t , GLMoleculeObject_molecule* > MoleculeNodeMap;
|
---|
89 | AtomNodeMap AtomsinSceneMap;
|
---|
90 | BondNodeMap BondsinSceneMap;
|
---|
91 | MoleculeNodeMap MoleculesinSceneMap;
|
---|
92 | };
|
---|
93 |
|
---|
94 | std::ostream &operator<<(std::ostream &ost, const GLWorldScene::BondIds &t);
|
---|
95 |
|
---|
96 | #endif /* GLWORLDSCENE_HPP_ */
|
---|