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 __QGLEXAMINERVIEWER_H_
00028 #define __QGLEXAMINERVIEWER_H_
00029
00030
00031
00033
00034 #include <qtimer.h>
00035
00036
00038
00039
00040
00042
00043
00044
00045
00047
00048
00049
00050
00051
00053
00054 class QSlider;
00055 class QPushButton;
00056 class QBoxLayout;
00057 class QTimer;
00058
00059
00060
00061 class QToggleButton;
00062
00063
00064 #if QT_VERSION >= 300
00065 #define CHECK_PTR Q_CHECK_PTR
00066 #endif
00067
00068 #define ZOOMSCALING 100.0 // used for translating slidervalue to real (double) value.
00069
00070
00071
00073
00102 class QGLExaminerViewer : public QGLViewer {
00103 Q_OBJECT
00104
00105 public:
00106
00110 QGLExaminerViewer(QWidget * parent=0,
00111 const char * name=0, const QGLWidget * shareWidget = 0,
00112 WFlags f=0, bool viewertype=true,
00113 const QGLFormat &format=QGLFormat::defaultFormat())
00114 : QGLViewer(parent, name, shareWidget, f, viewertype, format)
00115 {
00116 init(viewertype);
00117
00118 };
00119
00125 QGLExaminerViewer(const CCamera &homecam,
00126 QWidget * parent=0,
00127 const char * name=0, const QGLWidget * shareWidget = 0,
00128 WFlags f=0, bool viewertype=true,
00129 const QGLFormat &format=QGLFormat::defaultFormat())
00130 : QGLViewer(homecam, parent, name, shareWidget, f, viewertype, format)
00131 {
00132 init(viewertype);
00133
00134 };
00135
00139 QGLExaminerViewer(const CBoundingBox3D &cBBox,
00140 QWidget * parent=0,
00141 const char * name=0, const QGLWidget * shareWidget = 0,
00142 WFlags f=0, bool viewertype=true,
00143 const QGLFormat &format=QGLFormat::defaultFormat())
00144 : QGLViewer(cBBox, parent, name, shareWidget, f, viewertype, format)
00145 {
00146 init(viewertype);
00147
00148 };
00149
00153 virtual ~QGLExaminerViewer() {};
00154
00158 virtual void setCamera(const CCamera &Camera, CameraType which=CurrentCam);
00159
00163 virtual void setFullViewer(bool state);
00164
00168 virtual void enableMouseEvents(bool state) {
00169 if (m_pqTimer->isActive())
00170 m_pqTimer->stop();
00171
00172 QGLViewer::enableMouseEvents(state);
00173 };
00174
00175
00176 signals:
00178
00180
00181
00185 void sigViewerClosed(void);
00186
00187
00188
00189 public slots:
00191
00193
00198 void sltResetXSlider();
00199
00204 void sltResetYSlider();
00205
00211 void sltSetZoomSlider(int scaling);
00212
00216 virtual void sltToggleStereo();
00217
00218
00219
00220 protected slots:
00222
00224
00228 virtual void sltToggleRenderMode();
00229
00230
00235 virtual void sltGoHome();
00236
00237
00242 virtual void sltSetCamera(const CCamera &cCamera) {
00243 setCamera(cCamera);
00244 }
00245
00246
00247 private slots:
00249
00251
00257 void sltCamXRotate(int iAngle);
00258
00264 void sltCamYRotate(int iAngle);
00265
00269 void sltSetZoom(int zoom_factor);
00270
00275 void sltSetZoomSlider(double rdFovy);
00276 void sltSetZoomSlider(const QString &qText);
00277 void sltSetZoomText(int n);
00278
00283 void sltSaveVectors();
00284
00291 void sltCamRotStep();
00292
00296 void sltToggleDeco();
00297
00302 void sltToggleToolTips();
00303
00307 void sltToggleSpinning() {
00308 setItemChecked(m_nSpinOnOffID, !(isItemChecked(m_nSpinOnOffID)));
00309 };
00310
00314 void sltSwitchBehave() {
00315 setItemChecked(m_nSwitchBehaveID, !(isItemChecked(m_nSwitchBehaveID)));
00316 m_fOldBehave = m_fOldBehave ? false : true;
00317 };
00318
00322 void sltMenuToggleRenderMode();
00323
00327 void sltTimeOut() { m_fAnimationOn = false; };
00328
00330 void sltSetRefreshRate();
00331
00332
00333 protected:
00335
00337
00361 virtual void keyPressEvent(QKeyEvent *event);
00362
00368 virtual void closeEvent(QCloseEvent *event);
00369
00373 virtual void ManageMouseMove(QMouseEvent *event);
00374
00378 virtual void ManageMousePress(QMouseEvent *event);
00379
00383 virtual void ManageMouseRelease(QMouseEvent *event);
00384
00386 bool eventFilter(QObject *pqObject, QEvent *pqEvent);
00387
00391 virtual void makeFullViewer();
00392
00396 virtual void makeSimpleViewer();
00397
00398
00399 private:
00401
00403
00407 void init(bool viewertype);
00408
00409
00411
00413
00414 int m_nMousePosX, m_nMousePosY;
00415 int m_nXDiff, m_nYDiff;
00416
00417
00418 float m_rfXAlpha, m_rfYAlpha;
00419
00420
00421
00422 int m_nQuadrant;
00423
00424 CV3D m_cUp, m_cRight, m_cDir;
00425
00426
00427 int m_nLastRotAngle;
00428
00429 bool m_fLeftButtonPressed;
00430 bool m_fMiddleButtonPressed;
00431
00432 QBoxLayout *m_pqTopLayout;
00433
00434 QSlider *m_pqXRot,
00435 *m_pqYRot,
00436 *m_pqZoom;
00437
00438 QLineEdit *m_pqZoomText;
00439
00440 QTimer *m_pqTimer,
00441 *m_pqTimeOut;
00442 QWidget *m_apqWidgets[NUM_WIDGETS];
00443
00444 int m_nSelectionID;
00445 int m_nDecoID;
00446 int m_nTTipsID;
00447 int m_nSpinOnOffID;
00448 int m_nSwitchBehaveID;
00449 int m_nStereoID;
00450 bool m_fToolTips;
00451 bool m_fAnimationOn;
00452 bool m_fOldBehave;
00453 bool m_fShiftPressed;
00454 };
00455
00456 #endif // __QGLEXAMINERVIEWER_H_