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
00028
00029
00030
00031
00032
00033
00034
#ifndef __QGLEXAMINERVIEWER_H_
00035
#define __QGLEXAMINERVIEWER_H_
00036
00037
00038
00040
#include <qlineedit.h>
00041
#include <qtimer.h>
00042
00043
00045
00046
00047
00049
#include "QGLViewer.h"
00050
00051
00052
00054 #define NUM_WIDGETS 13 // number of widgets to delete when
00055
00056
00057
00058
00060
class QLabel;
00061
class QSlider;
00062
class QPushButton;
00063
class QBoxLayout;
00064
class QTimer;
00065
00066
00067
00068
class QToggleButton;
00069
00070
00071 #define ZOOMSCALING 100.0 // used for translating slidervalue to real (double) value.
00072
00073
00074
00076
00105 class QGLExaminerViewer :
public QGLViewer {
00106 Q_OBJECT
00107
00108
public:
00109
00113 QGLExaminerViewer(QWidget * parent=0,
00114
const char * name=0,
const QGLWidget * shareWidget = 0,
00115 WFlags f=0,
bool viewertype=
true,
00116
const QGLFormat &format=QGLFormat::defaultFormat())
00117 :
QGLViewer(parent, name, shareWidget, f, viewertype, format)
00118 {
00119
init(viewertype);
00120
00121 };
00122
00128 QGLExaminerViewer(
const CCamera &homecam,
00129 QWidget * parent=0,
00130
const char * name=0,
const QGLWidget * shareWidget = 0,
00131 WFlags f=0,
bool viewertype=
true,
00132
const QGLFormat &format=QGLFormat::defaultFormat())
00133 :
QGLViewer(homecam, parent, name, shareWidget, f, viewertype, format)
00134 {
00135
init(viewertype);
00136
00137 };
00138
00142 QGLExaminerViewer(
const CBoundingBox3D &cBBox,
00143 QWidget * parent=0,
00144
const char * name=0,
const QGLWidget * shareWidget = 0,
00145 WFlags f=0,
bool viewertype=
true,
00146
const QGLFormat &format=QGLFormat::defaultFormat())
00147 :
QGLViewer(cBBox, parent, name, shareWidget, f, viewertype, format)
00148 {
00149
init(viewertype);
00150
00151 };
00152
00156 virtual ~QGLExaminerViewer() {};
00157
00161
virtual void setCamera(
const CCamera &Camera, CameraType which=CurrentCam);
00162
00166
virtual void setFullViewer(
bool state);
00167
00171 virtual void enableMouseEvents(
bool state) {
00172
if (
m_pqTimer->isActive())
00173
m_pqTimer->stop();
00174
00175 QGLViewer::enableMouseEvents(state);
00176 };
00177
00178
00179 signals:
00181
00183
00184
00188
void sigViewerClosed(
void);
00189
00190
00191
00192
public slots:
00194
00196
00201
void sltResetXSlider();
00202
00207
void sltResetYSlider();
00208
00214
void sltSetZoomSlider(
int scaling);
00215
00219
virtual void sltToggleStereo();
00220
00221
00222
00223
protected slots:
00225
00227
00231
virtual void sltToggleRenderMode();
00232
00233
00238
virtual void sltGoHome();
00239
00240
00245 virtual void sltSetCamera(
const CCamera &cCamera) {
00246 setCamera(cCamera);
00247 }
00248
00249
00250
private slots:
00252
00254
00260
void sltCamXRotate(
int iAngle);
00261
00267
void sltCamYRotate(
int iAngle);
00268
00272
void sltSetZoom(
int zoom_factor);
00273
00278
void sltSetZoomSlider(
double rdFovy);
00279
void sltSetZoomSlider(
const QString &qText);
00280
void sltSetZoomText(
int n);
00281
00286
void sltSaveVectors();
00287
00294
void sltCamRotStep();
00295
00299
void sltToggleDeco();
00300
00305
void sltToggleToolTips();
00306
00310 void sltToggleSpinning() {
00311 setItemChecked(
m_nSpinOnOffID, !(isItemChecked(
m_nSpinOnOffID)));
00312 };
00313
00317 void sltSwitchBehave() {
00318 setItemChecked(
m_nSwitchBehaveID, !(isItemChecked(
m_nSwitchBehaveID)));
00319
m_fOldBehave =
m_fOldBehave ?
false :
true;
00320 };
00321
00325
void sltMenuToggleRenderMode();
00326
00330 void sltTimeOut() {
m_fAnimationOn =
false; };
00331
00333
void sltSetRefreshRate();
00334
00335
00336
protected:
00338
00340
00364
virtual void keyPressEvent(QKeyEvent *event);
00365
00371
virtual void closeEvent(QCloseEvent *event);
00372
00376
virtual void ManageMouseMove(QMouseEvent *event);
00377
00381
virtual void ManageMousePress(QMouseEvent *event);
00382
00386
virtual void ManageMouseRelease(QMouseEvent *event);
00387
00389
bool eventFilter(QObject *pqObject, QEvent *pqEvent);
00390
00394
virtual void makeFullViewer();
00395
00399
virtual void makeSimpleViewer();
00400
00401
00402
private:
00404
00406
00410
void init(
bool viewertype);
00411
00412
00414
00416
00417 int m_nMousePosX,
m_nMousePosY;
00418 int m_nXDiff,
m_nYDiff;
00419
00420
00421 float m_rfXAlpha,
m_rfYAlpha;
00422
00423
00424
00425 int m_nQuadrant;
00426
00427 CV3D m_cUp,
m_cRight,
m_cDir;
00428
00429
00430 int m_nLastRotAngle;
00431
00432 bool m_fLeftButtonPressed;
00433 bool m_fMiddleButtonPressed;
00434
00435 QBoxLayout *
m_pqTopLayout;
00436
00437 QSlider *
m_pqXRot,
00438 *
m_pqYRot,
00439 *
m_pqZoom;
00440
00441 QLineEdit *
m_pqZoomText;
00442
00443 QTimer *
m_pqTimer,
00444 *
m_pqTimeOut;
00445 QWidget *
m_apqWidgets[
NUM_WIDGETS];
00446
00447 int m_nSelectionID;
00448 int m_nDecoID;
00449 int m_nTTipsID;
00450 int m_nSpinOnOffID;
00451 int m_nSwitchBehaveID;
00452 int m_nStereoID;
00453 bool m_fToolTips;
00454 bool m_fAnimationOn;
00455 bool m_fOldBehave;
00456 bool m_fShiftPressed;
00457 };
00458
00459
#endif // __QGLEXAMINERVIEWER_H_