00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef GCU_GL_VIEW_H
00026 #define GCU_GL_VIEW_H
00027
00028 #include "macros.h"
00029 #include "matrix.h"
00030 #include <gtk/gtkwidget.h>
00031 #include <libgnomeprint/gnome-print.h>
00032 #include <map>
00033
00034 extern double DefaultPsi, DefaultTheta, DefaultPhi;
00035
00036 using namespace std;
00037
00038 namespace gcu {
00039
00040 class GLDocument;
00041
00047 class GLView
00048 {
00049 public:
00051
00056 GLView (GLDocument* pDoc);
00058
00061 virtual ~GLView ();
00062
00066 GtkWidget *GetWidget () {return m_pWidget;}
00070 void Init ();
00074 void Reshape ();
00078 void Draw ();
00085 bool OnPressed (GdkEventButton *event);
00094 bool OnMotion (GdkEventMotion *event);
00099 void Update ();
00107 void SetRotation (double psi, double theta, double phi);
00115 void Print (GnomePrintContext *pc, gdouble width, gdouble height);
00126 void SaveAsImage (string const &filename, char const *type, map<string, string>& options, unsigned width, unsigned height);
00127
00128 private:
00135 void Rotate (gdouble x, gdouble y);
00136
00137 protected:
00141 GtkWidget *m_pWidget;
00145 unsigned m_nGLList;
00146
00147 private:
00148 bool m_bInit;
00149 Matrix m_Euler;
00150 double m_Height, m_Width, m_Near, m_Far;
00151 double m_Lastx, m_Lasty;
00152
00153
00163 GCU_PROP (double, Angle)
00173 GCU_PROP (double, Psi)
00183 GCU_PROP (double, Phi)
00193 GCU_PROP (double, Theta)
00203 GCU_PROP (float, Red)
00213 GCU_PROP (float, Green)
00223 GCU_PROP (float, Blue)
00240 GCU_PROP (float, Alpha)
00244 GCU_RO_PROP (GLDocument *, Doc)
00251 GCU_PROT_PROP (double, Radius);
00252 };
00253
00254 }
00255
00256 #endif // GCU_GL_VIEW_H