Go to the documentation of this file.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
00026
00027 #ifndef GLVIEWER_WIDGET_H
00028 #define GLVIEWER_WIDGET_H
00029
00030 #include "GLViewer.h"
00031
00032 #include <QtOpenGL>
00033
00034 class QFile;
00035
00036 class GLViewer_ViewPort2d;
00037 class GLViewer_CoordSystem;
00038
00043 class GLVIEWER_API GLViewer_Widget : public QGLWidget
00044 {
00045 Q_OBJECT
00046
00047 public:
00049
00051 GLViewer_Widget( QWidget* theParent, const char* theName = 0 );
00052
00054 ~GLViewer_Widget();
00055
00057
00058 GLViewer_ViewPort2d* getViewPort() const { return myViewPort; }
00060 GLint getWidth() const { return myWidth; }
00062 GLint getHeight() const { return myHeight; }
00063
00065
00066 void getScale( GLfloat& xScale,
00067 GLfloat& yScale,
00068 GLfloat& zScale );
00070 void setScale( GLfloat xScale,
00071 GLfloat yScale,
00072 GLfloat zScaleGLfloat );
00073
00075 void getPan( GLfloat& xPan, GLfloat& yPan, GLfloat& zPan );
00077 void setPan( GLfloat xPan, GLfloat yPan, GLfloat zPan );
00078
00080
00081 GLfloat getRotationAngle() const { return myRotationAnglePrev; }
00083
00084 void setRotationAngle( GLfloat a ) { myRotationAnglePrev = a; }
00085
00087 void getRotationStart( GLfloat& rotationStartX,
00088 GLfloat& rotationStartY,
00089 GLfloat& rotationStartZ );
00091 void setRotationStart( GLfloat rotationStartX,
00092 GLfloat rotationStartY,
00093 GLfloat rotationStartZ );
00095 void getRotation( GLfloat& rotationAngle,
00096 GLfloat& rotationCenterX,
00097 GLfloat& rotationCenterY,
00098 GLfloat& rotationCenterZ );
00100 void setRotation( GLfloat, GLfloat, GLfloat, GLfloat );
00101
00103 void setBackground( QString theFileName );
00104
00106 void addToolTip( QString theTTText, QRect theTTRect );
00108 void removeToolTip();
00109
00111
00116 virtual void translateBackgroundToPS( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aPSCS );
00117
00119
00120 void exportRepaint();
00121
00122 #ifdef WIN32
00123
00124
00125
00132 virtual void translateBackgroundToEMF( HDC dc, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aEMFCS );
00133 #endif
00134
00135 private:
00137 void getBackgroundRectInViewerCS( double& left, double& top, double& right, double& bottom );
00138
00139 protected:
00140
00142 virtual void initializeGL();
00144
00145 virtual void paintGL();
00147 virtual void resizeGL( int, int );
00148
00149
00150 virtual void paintEvent( QPaintEvent* );
00151 virtual void mouseMoveEvent( QMouseEvent* );
00152 virtual void mousePressEvent( QMouseEvent* );
00153 virtual void mouseReleaseEvent( QMouseEvent* );
00154
00155
00156 virtual void enterEvent( QEvent* );
00157
00158 virtual void leaveEvent( QEvent* );
00159
00160 virtual bool event ( QEvent* );
00161
00162 private:
00164 GLint myWidth;
00166 GLint myHeight;
00167
00169 GLfloat myXScale;
00171 GLfloat myYScale;
00173
00174 GLfloat myZScale;
00175
00177 GLfloat myXPan;
00179 GLfloat myYPan;
00181
00182 GLfloat myZPan;
00183
00184 GLfloat myRotationStartX;
00185 GLfloat myRotationStartY;
00186 GLfloat myRotationStartZ;
00187 GLfloat myRotationAngle;
00188 GLfloat myRotationCenterX;
00189 GLfloat myRotationCenterY;
00190 GLfloat myRotationCenterZ;
00191 GLfloat myRotationAnglePrev;
00192
00193 GLboolean myStart;
00194 GLViewer_ViewPort2d* myViewPort;
00195
00197 bool isLoadBackground;
00199 QString myBackgroundFile;
00201 GLuint texName;
00203 int myIW;
00205 int myIH;
00207 int myBackgroundSize;
00208
00209 QRect myToolTipRect;
00210
00212 bool isExportMode;
00213 };
00214
00215 #endif // GLVIEWER_WIDGET_H