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 #include <string>
00034
00035 extern double DefaultPsi, DefaultTheta, DefaultPhi;
00036
00037 namespace gcu {
00038
00039 class GLDocument;
00040
00046 class GLView
00047 {
00048 public:
00050
00055 GLView (GLDocument* pDoc);
00057
00060 virtual ~GLView ();
00061
00065 GtkWidget *GetWidget () {return m_pWidget;}
00069 void Init ();
00073 void Reshape ();
00077 void Draw ();
00084 bool OnPressed (GdkEventButton *event);
00093 bool OnMotion (GdkEventMotion *event);
00098 void Update ();
00106 void SetRotation (double psi, double theta, double phi);
00114 void Print (GnomePrintContext *pc, gdouble width, gdouble height);
00125 void SaveAsImage (std::string const &filename, char const *type, std::map<std::string, std::string>& options, unsigned width, unsigned height);
00126
00127 private:
00134 void Rotate (gdouble x, gdouble y);
00144 GdkPixbuf *BuildPixbuf (unsigned width, unsigned height);
00145
00146 protected:
00150 GtkWidget *m_pWidget;
00151
00152 private:
00153 bool m_bInit;
00154 Matrix m_Euler;
00155 double m_Height, m_Width, m_Near, m_Far;
00156 double m_Lastx, m_Lasty;
00157
00158
00168 GCU_PROP (double, Angle)
00178 GCU_PROP (double, Psi)
00188 GCU_PROP (double, Phi)
00198 GCU_PROP (double, Theta)
00208 GCU_PROP (float, Red)
00218 GCU_PROP (float, Green)
00228 GCU_PROP (float, Blue)
00245 GCU_PROP (float, Alpha)
00249 GCU_RO_PROP (GLDocument *, Doc)
00256 GCU_PROT_PROP (double, Radius);
00257 };
00258
00259 }
00260
00261 #endif // GCU_GL_VIEW_H