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