1 | /*
|
---|
2 | * GLWorldView.hpp
|
---|
3 | *
|
---|
4 | * Created on: Auf 11, 2010
|
---|
5 | * Author: heber
|
---|
6 | */
|
---|
7 |
|
---|
8 | #ifndef GLWORLDVIEW_HPP_
|
---|
9 | #define GLWORLDVIEW_HPP_
|
---|
10 |
|
---|
11 | // include config.h
|
---|
12 | #ifdef HAVE_CONFIG_H
|
---|
13 | #include <config.h>
|
---|
14 | #endif
|
---|
15 |
|
---|
16 | #include <Qt/qwidget.h>
|
---|
17 | //#include <Qt3D/qglview.h>
|
---|
18 |
|
---|
19 | class QKeyEvent;
|
---|
20 | class GLWorldScene;
|
---|
21 | class QGLPainter;
|
---|
22 |
|
---|
23 | /** This class is the view on the 3D representation of the World, i.e. the whole
|
---|
24 | * of all molecules (consisting of atoms).
|
---|
25 | *
|
---|
26 | */
|
---|
27 | class GLWorldView : public QWidget // : public QGLView
|
---|
28 | {
|
---|
29 | Q_OBJECT
|
---|
30 | public:
|
---|
31 | GLWorldView(QWidget *parent=0);
|
---|
32 |
|
---|
33 | public slots:
|
---|
34 |
|
---|
35 | protected:
|
---|
36 | void initializeGL(QGLPainter *painter);
|
---|
37 | void paintGL(QGLPainter *painter);
|
---|
38 | void keyPressEvent(QKeyEvent *e);
|
---|
39 |
|
---|
40 | private:
|
---|
41 | GLWorldScene *worldscene;
|
---|
42 | };
|
---|
43 |
|
---|
44 |
|
---|
45 |
|
---|
46 | //#include "CodePatterns/Observer.hpp"
|
---|
47 | //#include "LinearAlgebra/Vector.hpp"
|
---|
48 | //#include "changetypes.hpp"
|
---|
49 | //
|
---|
50 | //class atom;
|
---|
51 | //class element;
|
---|
52 | //class molecule;
|
---|
53 | //
|
---|
54 | //class GLMoleculeView : public QGLWidget, public Observer
|
---|
55 | //{
|
---|
56 | // Q_OBJECT
|
---|
57 | //
|
---|
58 | //public:
|
---|
59 | //
|
---|
60 | // GLMoleculeView( QWidget* parent);
|
---|
61 | // ~GLMoleculeView();
|
---|
62 | //
|
---|
63 | //public slots:
|
---|
64 | //
|
---|
65 | // void setXRotation( int degrees );
|
---|
66 | // void setYRotation( int degrees );
|
---|
67 | // void setZRotation( int degrees );
|
---|
68 | // void setScale( int distance );
|
---|
69 | // void setLightPosition( int *light );
|
---|
70 | // void setLightDiffuse( int *light );
|
---|
71 | // void setLightAmbient( int *light );
|
---|
72 | // void createDialogLight();
|
---|
73 | // void toggleMultiViewEnabled();
|
---|
74 | //
|
---|
75 | // void init( QLabel *ptr );
|
---|
76 | // void initCoordinates(QLabel *ptr);
|
---|
77 | // void createView();
|
---|
78 | // void hearMoleculeSelected(molecule *mol);
|
---|
79 | // void hearAtomSelected(molecule *mol, atom *Walker);
|
---|
80 | // void hearMoleculeChanged(molecule *mol, enum ChangesinMolecule type);
|
---|
81 | // void hearAtomChanged(molecule *mol, atom *Walker, enum ChangesinAtom type);
|
---|
82 | // void hearElementChanged(element *Runner, enum ChangesinElement type);
|
---|
83 | // void hearMoleculeAdded(molecule *mol);
|
---|
84 | // void hearAtomAdded(molecule *mol, atom *Walker);
|
---|
85 | // void hearMoleculeRemoved(molecule *mol);
|
---|
86 | // void hearAtomRemoved(molecule *mol, atom *Walker);
|
---|
87 | //
|
---|
88 | //signals:
|
---|
89 | // void notifyMoleculeSelected( molecule *mol );
|
---|
90 | // void notifyAtomSelected( molecule *mol, atom *Walker );
|
---|
91 | // void notifyMoleculeChanged( molecule *mol, enum ChangesinMolecule type );
|
---|
92 | // void notifyAtomChanged( molecule *mol, atom *Walker, enum ChangesinAtom type );
|
---|
93 | // void notifyElementChanged( element *Runner, enum ChangesinElement type );
|
---|
94 | // void notifyMoleculeAdded( molecule *mol);
|
---|
95 | // void notifyElementAdded( element *Runner);
|
---|
96 | // void notifyAtomAdded( molecule *mol, atom *Walker );
|
---|
97 | // void notifyMoleculeRemoved( molecule *mol );
|
---|
98 | // void notifyAtomRemoved( molecule *mol, atom *Walker );
|
---|
99 | //
|
---|
100 | //protected:
|
---|
101 | //
|
---|
102 | // void initializeGL();
|
---|
103 | // void paintGL();
|
---|
104 | // void resizeGL( int w, int h );
|
---|
105 | // void makeSphere(const Vector &x, double radius, const unsigned char color[3]);
|
---|
106 | // void makeCylinder(const Vector &x, const Vector &y, double radius, double height, const unsigned char color[3]);
|
---|
107 | // void mousePressEvent(QMouseEvent* event);
|
---|
108 | // void mouseReleaseEvent(QMouseEvent* event);
|
---|
109 | //
|
---|
110 | //public:
|
---|
111 | //
|
---|
112 | // /** Update function as we are an Observer.
|
---|
113 | // *
|
---|
114 | // * @param publisher ref to Observable
|
---|
115 | // */
|
---|
116 | // void update(Observable *publisher);
|
---|
117 | //
|
---|
118 | // /**
|
---|
119 | // * This method is called when a special named change
|
---|
120 | // * of the Observable occured
|
---|
121 | // */
|
---|
122 | // void recieveNotification(Observable *publisher, Notification_ptr notification);
|
---|
123 | //
|
---|
124 | // /**
|
---|
125 | // * This method is called when the observed object is destroyed.
|
---|
126 | // */
|
---|
127 | // void subjectKilled(Observable *publisher);
|
---|
128 | //
|
---|
129 | //
|
---|
130 | //private:
|
---|
131 | //
|
---|
132 | // typedef std::map< size_t, node > AtomNodeMap;
|
---|
133 | // typedef std::map< std::pair< size_t, size_t> , node > BondNodeMap;
|
---|
134 | // typedef std::map< size_t, QGLMaterial *> ElementMaterialMap;
|
---|
135 | //
|
---|
136 | // ElementMaterialMap ElementNoMaterialMap;
|
---|
137 | // AtomNodeMap AtomsinSceneMap;
|
---|
138 | // BondNodeMap BondsinSceneMap;
|
---|
139 | //
|
---|
140 | // QGLMaterial* getMaterial(size_t);
|
---|
141 | // QGLSceneNode* getAtom(size_t);
|
---|
142 | // QGLSceneNode* getBond(size_t, size_t);
|
---|
143 | //
|
---|
144 | // // old stuff
|
---|
145 | //
|
---|
146 | // GLuint object; // call list for the scene to be rendered
|
---|
147 | // GLfloat xRot, yRot, zRot, scale; // rotation angles and scaling (zoom)
|
---|
148 | // Vector position; //!< position of observer
|
---|
149 | // Vector view; //!< point along line of view
|
---|
150 | // Vector top; //!< giving upwards direction
|
---|
151 | // Vector X,Y,Z; //!< vectors defining the coordinate system
|
---|
152 | // int width; //!< width of window
|
---|
153 | // int height; //!< height of window
|
---|
154 | //
|
---|
155 | // QLabel *StatusBar; //!< pointer to status bar for messages
|
---|
156 | // QLabel *CoordinatesBar; //!< pointer to coordinates bar for view port
|
---|
157 | //
|
---|
158 | // GLfloat LightPosition[4]; //!< Light Position
|
---|
159 | // GLfloat LightDiffuse[4]; //!< Diffuse Light Values
|
---|
160 | // GLfloat LightAmbient[4]; //!< Ambient Light Values
|
---|
161 | //
|
---|
162 | // QPoint LeftButtonPos; //!< mouse position on mousePressEvent for LeftButton
|
---|
163 | // QPoint MiddleButtonPos; //!< mouse position on mousePressEvent for MidButton
|
---|
164 | // QPoint RightButtonPos; //!< mouse position on mousePressEvent for RightButton
|
---|
165 | //
|
---|
166 | // unsigned char SelectionColor[3] ; //!< highlight color
|
---|
167 | //
|
---|
168 | // bool isSignaller;
|
---|
169 | //
|
---|
170 | // bool MultiViewEnabled; //!< if true, split screen into four parts with additional xy,xz,yz views
|
---|
171 | //};
|
---|
172 |
|
---|
173 | #endif /* GLWORLDVIEW_HPP_ */
|
---|