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