worldsim/3rdParts/qglviewer/qglviewer.h

00001 /****************************************************************************
00002 
00003  Copyright (C) 2002-2008 Gilles Debunne. All rights reserved.
00004 
00005  This file is part of the QGLViewer library version 2.3.10.
00006 
00007  http://www.libqglviewer.com - contact@libqglviewer.com
00008 
00009  This file may be used under the terms of the GNU General Public License 
00010  versions 2.0 or 3.0 as published by the Free Software Foundation and
00011  appearing in the LICENSE file included in the packaging of this file.
00012  In addition, as a special exception, Gilles Debunne gives you certain 
00013  additional rights, described in the file GPL_EXCEPTION in this package.
00014 
00015  libQGLViewer uses dual licensing. Commercial/proprietary software must
00016  purchase a libQGLViewer Commercial License.
00017 
00018  This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00019  WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00020 
00021 *****************************************************************************/
00022 
00023 #ifndef QGLVIEWER_QGLVIEWER_H
00024 #define QGLVIEWER_QGLVIEWER_H
00025 
00026 #include "camera.h"
00027 
00028 #if QT_VERSION >= 0x040000
00029 # include <QMap>
00030 # include <QClipboard>
00031 #else
00032 # include <qmap.h>
00033 # include <qclipboard.h>
00034 #endif
00035 
00036 class QTabWidget;
00037 
00038 namespace qglviewer {
00039     class MouseGrabber;
00040 }
00041 
00042 #if QT_VERSION >= 0x040000
00043 // Qt::ButtonState was split into Qt::KeyboardModifiers and Qt::MouseButtons in Qt 4.
00044 # define QtKeyboardModifiers Qt::KeyboardModifiers
00045 # define QtMouseButtons Qt::MouseButtons
00046 #else
00047 # define QtKeyboardModifiers Qt::ButtonState
00048 # define QtMouseButtons Qt::ButtonState
00049 #endif
00050 
00073 class QGLVIEWER_EXPORT QGLViewer : public QGLWidget
00074 {
00075     Q_OBJECT
00076 
00077 public:
00078     // Complete implementation is provided so that the constructor is defined with QT3_SUPPORT when .h is included.
00079     // (Would not be available otherwise since lib is compiled without QT3_SUPPORT).
00080 #if QT_VERSION < 0x040000 || defined QT3_SUPPORT
00081     explicit QGLViewer(QWidget* parent=NULL, const char* name=0, const QGLWidget* shareWidget=0, Qt::WFlags flags=0)
00082         : QGLWidget(parent, name, shareWidget, flags)
00083     { defaultConstructor(); }
00084 
00085     explicit QGLViewer(const QGLFormat& format, QWidget* parent=0, const char* name=0, const QGLWidget* shareWidget=0,Qt::WFlags flags=0)
00086         : QGLWidget(format, parent, name, shareWidget, flags)
00087     { defaultConstructor(); }
00088 
00089     QGLViewer(QGLContext* context, QWidget* parent, const char* name=0, const QGLWidget* shareWidget=0, Qt::WFlags flags=0)
00090 # if QT_VERSION >= 0x030200
00091         : QGLWidget(context, parent, name, shareWidget, flags) {
00092 # else
00093         // MOC_SKIP_BEGIN
00094         : QGLWidget(parent, name, shareWidget, flags) {
00095             Q_UNUSED(context);
00096             // MOC_SKIP_END
00097 # endif
00098             defaultConstructor(); }
00099 
00100 #else
00101 
00102     explicit QGLViewer(QWidget* parent=0, const QGLWidget* shareWidget=0, Qt::WFlags flags=0);
00103     explicit QGLViewer(QGLContext *context, QWidget* parent=0, const QGLWidget* shareWidget=0, Qt::WFlags flags=0);
00104     explicit QGLViewer(const QGLFormat& format, QWidget* parent=0, const QGLWidget* shareWidget=0, Qt::WFlags flags=0);
00105 #endif
00106 
00107     virtual ~QGLViewer();
00108 
00111 public:
00115     bool axisIsDrawn() const { return axisIsDrawn_; };
00119     bool gridIsDrawn() const { return gridIsDrawn_; };
00126     bool FPSIsDisplayed() const { return FPSIsDisplayed_; };
00131     bool textIsEnabled() const { return textIsEnabled_; };
00132 
00141     bool cameraIsEdited() const { return cameraIsEdited_; }
00142 
00143 
00144     public Q_SLOTS:
00146         void setAxisIsDrawn(bool draw=true) { axisIsDrawn_ = draw; Q_EMIT axisIsDrawnChanged(draw); if (updateGLOK_) updateGL(); };
00148         void setGridIsDrawn(bool draw=true) { gridIsDrawn_ = draw; Q_EMIT gridIsDrawnChanged(draw); if (updateGLOK_) updateGL(); };
00150         void setFPSIsDisplayed(bool display=true) { FPSIsDisplayed_ = display; Q_EMIT FPSIsDisplayedChanged(display); if (updateGLOK_) updateGL(); };
00152         void setTextIsEnabled(bool enable=true) { textIsEnabled_ = enable; Q_EMIT textIsEnabledChanged(enable); if (updateGLOK_) updateGL(); };
00153         void setCameraIsEdited(bool edit=true);
00154 
00156         void toggleAxisIsDrawn() { setAxisIsDrawn(!axisIsDrawn()); };
00158         void toggleGridIsDrawn() { setGridIsDrawn(!gridIsDrawn()); };
00160         void toggleFPSIsDisplayed() { setFPSIsDisplayed(!FPSIsDisplayed()); };
00162         void toggleTextIsEnabled() { setTextIsEnabled(!textIsEnabled()); };
00164         void toggleCameraIsEdited() { setCameraIsEdited(!cameraIsEdited()); };
00166 
00167 
00170 public:
00186     QColor backgroundColor() const { return backgroundColor_; };
00187 
00200     QColor foregroundColor() const { return foregroundColor_; };
00201     public Q_SLOTS:
00204         void setBackgroundColor(const QColor& color) { backgroundColor_=color; qglClearColor(color); };
00206         void setForegroundColor(const QColor& color) { foregroundColor_ = color; };
00208 
00209 
00212 public:
00224     float sceneRadius() const { return camera()->sceneRadius(); }
00233     qglviewer::Vec sceneCenter() const { return camera()->sceneCenter(); }
00234 
00235     public Q_SLOTS:
00240         virtual void setSceneRadius(float radius) { camera()->setSceneRadius(radius); }
00241 
00246         virtual void setSceneCenter(const qglviewer::Vec& center) { camera()->setSceneCenter(center); }
00247 
00255         void setSceneBoundingBox(const qglviewer::Vec& min, const qglviewer::Vec& max) { camera()->setSceneBoundingBox(min,max); }
00256 
00260         void showEntireScene() { camera()->showEntireScene(); if (updateGLOK_) updateGL(); }
00262 
00263 
00266 public:
00268     qglviewer::Camera* camera() const { return camera_; };
00269 
00280     qglviewer::ManipulatedFrame* manipulatedFrame() const { return manipulatedFrame_; };
00281 
00282     public Q_SLOTS:
00283         void setCamera(qglviewer::Camera* const camera);
00284         void setManipulatedFrame(qglviewer::ManipulatedFrame* frame);
00286 
00287 
00290 public:
00307     qglviewer::MouseGrabber* mouseGrabber() const { return mouseGrabber_; };
00308 
00309     void setMouseGrabberIsEnabled(const qglviewer::MouseGrabber* const mouseGrabber, bool enabled=true);
00319     bool mouseGrabberIsEnabled(const qglviewer::MouseGrabber* const mouseGrabber) { return !disabledMouseGrabbers_.contains(reinterpret_cast<size_t>(mouseGrabber)); };
00320     public Q_SLOTS:
00321         void setMouseGrabber(qglviewer::MouseGrabber* mouseGrabber);
00323 
00324 
00327 public:
00329     float aspectRatio() const { return static_cast<float>(width())/static_cast<float>(height()); };
00340     float currentFPS() { return f_p_s_; };
00347     bool isFullScreen() const { return fullScreen_; };
00368     bool displaysInStereo() const { return stereo_; }
00370     virtual QSize sizeHint() const { return QSize(600, 400); }
00371 
00372     public Q_SLOTS:
00373         void setFullScreen(bool fullScreen=true);
00374         void setStereoDisplay(bool stereo=true);
00376         void toggleFullScreen() { setFullScreen(!isFullScreen()); };
00378         void toggleStereoDisplay() { setStereoDisplay(!stereo_); };
00379         void toggleCameraMode();
00380 
00381 private:
00382     bool cameraIsInRevolveMode() const;
00384 
00385 
00388 public:
00389     static void drawArrow(float length=1.0f, float radius=-1.0f, int nbSubdivisions=12);
00390     static void drawArrow(const qglviewer::Vec& from, const qglviewer::Vec& to, float radius=-1.0f, int nbSubdivisions=12);
00391     static void drawAxis(float length=1.0f);
00392     static void drawGrid(float size=1.0f, int nbSubdivisions=10);
00393 
00394     virtual void startScreenCoordinatesSystem(bool upward=false) const;
00395     virtual void stopScreenCoordinatesSystem() const;
00396 
00397     void drawText(int x, int y, const QString& text, const QFont& fnt=QFont());
00398     void displayMessage(const QString& message, int delay=2000);
00399     // void draw3DText(const qglviewer::Vec& pos, const qglviewer::Vec& normal, const QString& string, GLfloat height=0.1f);
00400 
00401 protected:
00402     virtual void drawLight(GLenum light, float scale = 1.0f) const;
00403 
00404 private:
00405     void displayFPS();
00407     void drawVectorial() { paintGL(); };
00408 
00409 #ifndef DOXYGEN
00410     friend void drawVectorial(void* param);
00411 #endif
00412 
00413 
00414 
00415 #ifdef DOXYGEN
00416 
00418 public:
00420     int width() const;
00422     int height() const;
00424     virtual void updateGL();
00427     static QImage convertToGLFormat(const QImage & image);
00429     void qglColor(const QColor& color) const;
00431     void qglClearColor(const QColor& color) const;
00434     bool isValid() const;
00437     bool isSharing() const;
00440     virtual void makeCurrent();
00445     bool hasMouseTracking () const;
00446     public Q_SLOTS:
00448         virtual void resize(int width, int height);
00450         virtual void setMouseTracking(bool enable);
00451 protected:
00454     bool autoBufferSwap() const;
00455     protected Q_SLOTS:
00457         void setAutoBufferSwap(bool on);
00459 #endif
00460 
00461 
00464 public:
00465 #if QT_VERSION < 0x030000
00466     virtual QImage grabFrameBuffer(bool withAlpha=false);
00467 #endif
00468 
00477     const QString& snapshotFileName() const { return snapshotFileName_; };
00478 #ifndef DOXYGEN
00479     const QString& snapshotFilename() const;
00480 #endif
00481 
00509     const QString& snapshotFormat() const { return snapshotFormat_; };
00515     int snapshotCounter() const { return snapshotCounter_; };
00524     int snapshotQuality() { return snapshotQuality_; };
00525 
00526     // Qt 2.3 does not support double default value parameters in slots.
00527     // Remove "Q_SLOTS" from the following line to compile with Qt 2.3
00528     public Q_SLOTS:
00529     void saveSnapshot(bool automatic=true, bool overwrite=false);
00530 
00531     public Q_SLOTS:
00532     void saveSnapshot(const QString& fileName, bool overwrite=false);
00533     void setSnapshotFileName(const QString& name);
00534 
00536     void setSnapshotFormat(const QString& format) { snapshotFormat_ = format; };
00538     void setSnapshotCounter(int counter) { snapshotCounter_ = counter; };
00540     void setSnapshotQuality(int quality) { snapshotQuality_ = quality; };
00541     bool openSnapshotFormatDialog();
00542     void snapshotToClipboard();
00543 
00544 private:
00545     bool saveImageSnapshot(const QString& fileName);
00546     
00547 #ifndef DOXYGEN
00548     /* This class is used internally for screenshot that require tiling (image size size different
00549     from window size). Only in that case, is the private tileRegion_ pointer non null.
00550     It then contains the current tiled region, which is used by startScreenCoordinatesSystem
00551     to adapt the coordinate system. Not using it would result in a tiled drawing of the parts
00552     that use startScreenCoordinatesSystem. Also used by scaledFont for same purposes. */
00553     class TileRegion { public : double xMin, yMin, xMax, yMax, textScale; };
00554 #endif
00555 
00556 public:
00574     QFont scaledFont(const QFont& font) const {
00575       if (tileRegion_ == NULL)
00576         return font;
00577       else {
00578         QFont f(font);
00579         if (f.pixelSize() == -1)
00580 #if QT_VERSION >= 0x040000
00581           f.setPointSizeF(f.pointSizeF() * tileRegion_->textScale);
00582 #else
00583           f.setPointSizeFloat(f.pointSizeFloat() * tileRegion_->textScale);
00584 #endif
00585         else
00586           f.setPixelSize(f.pixelSize() * tileRegion_->textScale);
00587         return f;
00588       }
00589     }
00591 
00592 
00595 public:
00596     GLuint bufferTextureId() const;
00605     float bufferTextureMaxU() const { return bufferTextureMaxU_; };
00607     float bufferTextureMaxV() const { return bufferTextureMaxV_; };
00608     public Q_SLOTS:
00609         void copyBufferToTexture(GLint internalFormat, GLenum format=GL_NONE);
00611 
00614 public:
00623     bool animationIsStarted() const { return animationStarted_; };
00638     int animationPeriod() const { return animationPeriod_; };
00639 
00640     public Q_SLOTS:
00642         void setAnimationPeriod(int period) { animationPeriod_ = period; };
00643         virtual void startAnimation();
00644         virtual void stopAnimation();
00656         virtual void animate() { Q_EMIT animateNeeded(); };
00658         void toggleAnimation() { if (animationIsStarted()) stopAnimation(); else startAnimation(); };
00660 
00661 public:
00662 Q_SIGNALS:
00666     void viewerInitialized();
00667 
00672     void drawNeeded();
00673 
00685     void drawFinished(bool automatic);
00686 
00690     void animateNeeded();
00691 
00695     void helpRequired();
00696 
00698     void axisIsDrawnChanged(bool drawn);
00700     void gridIsDrawnChanged(bool drawn);
00702     void FPSIsDisplayedChanged(bool displayed);
00704     void textIsEnabledChanged(bool enabled);
00706     void cameraIsEditedChanged(bool edited);
00708     void stereoChanged(bool on);
00713     void pointSelected(const QMouseEvent* e);
00714 
00719     void mouseGrabberChanged(qglviewer::MouseGrabber* mouseGrabber);
00720 
00723 public:
00739     virtual QString helpString() const { return tr("No help available."); };
00740 
00741     virtual QString mouseString() const;
00742     virtual QString keyboardString() const;
00743 
00744 #ifndef DOXYGEN
00745 
00746     virtual QString mouseBindingsString () const { return mouseString(); }
00748     virtual QString shortcutBindingsString () const { return keyboardString(); }
00749 #endif
00750 
00751     public Q_SLOTS:
00752         virtual void help();
00753         virtual void aboutQGLViewer();
00754 
00755 protected:
00761     QTabWidget* helpWidget() { return helpWidget_; }
00763 
00764 
00767 protected:
00768     virtual void resizeGL(int width, int height);
00769     virtual void initializeGL();
00770 
00788     virtual void init() { Q_EMIT viewerInitialized(); };
00789 
00790     virtual void paintGL();
00791     virtual void preDraw();
00792     virtual void preDrawStereo(bool leftBuffer=true);
00793 
00809     virtual void draw() {};
00810     virtual void fastDraw();
00811     virtual void postDraw();
00813 
00816 protected:
00817     virtual void mousePressEvent(QMouseEvent *);
00818     virtual void mouseMoveEvent(QMouseEvent *);
00819     virtual void mouseReleaseEvent(QMouseEvent *);
00820     virtual void mouseDoubleClickEvent(QMouseEvent *);
00821     virtual void wheelEvent(QWheelEvent *);
00822     virtual void keyPressEvent(QKeyEvent *);
00823     virtual void timerEvent(QTimerEvent *);
00824     virtual void closeEvent(QCloseEvent *);
00826 
00829 public:
00837     int selectedName() const { return selectedObjectId_; };
00845     int selectBufferSize() const { return selectBufferSize_; };
00846 
00860     int selectRegionWidth() const { return selectRegionWidth_; };
00862     int selectRegionHeight() const { return selectRegionHeight_; };
00863 
00869     GLuint* selectBuffer() { return selectBuffer_; };
00870 
00871     public Q_SLOTS:
00872         virtual void select(const QMouseEvent* event);
00873         virtual void select(const QPoint& point);
00874 
00875         void setSelectBufferSize(int size);
00877         void setSelectRegionWidth(int width) { selectRegionWidth_ = width; };
00879         void setSelectRegionHeight(int height) { selectRegionHeight_ = height; };
00884         void setSelectedName(int id) { selectedObjectId_=id; };
00885 
00886 protected:
00887     virtual void beginSelection(const QPoint& point);
00910     virtual void drawWithNames() {};
00911     virtual void endSelection(const QPoint& point);
00919     virtual void postSelection(const QPoint& point) { Q_UNUSED(point); };
00921 
00922 
00925 protected:
00930     enum KeyboardAction { DRAW_AXIS, DRAW_GRID, DISPLAY_FPS, ENABLE_TEXT, EXIT_VIEWER,
00931         SAVE_SCREENSHOT, CAMERA_MODE, FULL_SCREEN, STEREO, ANIMATION, HELP, EDIT_CAMERA,
00932         MOVE_CAMERA_LEFT, MOVE_CAMERA_RIGHT, MOVE_CAMERA_UP, MOVE_CAMERA_DOWN,
00933         INCREASE_FLYSPEED, DECREASE_FLYSPEED, SNAPSHOT_TO_CLIPBOARD };
00934 public:
00935     int shortcut(KeyboardAction action) const;
00936 #ifndef DOXYGEN
00937     // QGLViewer 1.x
00938     int keyboardAccelerator(KeyboardAction action) const;
00939     Qt::Key keyFrameKey(int index) const;
00940     QtKeyboardModifiers playKeyFramePathStateKey() const;
00941     // QGLViewer 2.0 without Qt4 support
00942     QtKeyboardModifiers addKeyFrameStateKey() const;
00943     QtKeyboardModifiers playPathStateKey() const;
00944 #endif
00945     Qt::Key pathKey(int index) const;
00946     QtKeyboardModifiers addKeyFrameKeyboardModifiers() const;
00947     QtKeyboardModifiers playPathKeyboardModifiers() const;
00948 
00949     public Q_SLOTS:
00950         void setShortcut(KeyboardAction action, int key);
00951 #ifndef DOXYGEN
00952         void setKeyboardAccelerator(KeyboardAction action, int key);
00953 #endif
00954         void setKeyDescription(int key, QString description);
00955 
00956         // Key Frames shortcut keys
00957 #ifndef DOXYGEN
00958         // QGLViewer 1.x compatibility methods
00959         virtual void setKeyFrameKey(int index, int key);
00960         virtual void setPlayKeyFramePathStateKey(int buttonState);
00961         // QGLViewer 2.0 without Qt4 support
00962         virtual void setPlayPathStateKey(int buttonState);
00963         virtual void setAddKeyFrameStateKey(int buttonState);
00964 #endif
00965         virtual void setPathKey(int key, int index = 0);
00966         virtual void setPlayPathKeyboardModifiers(QtKeyboardModifiers modifiers);
00967         virtual void setAddKeyFrameKeyboardModifiers(QtKeyboardModifiers modifiers);
00969 
00970 
00973 protected:
00978     enum MouseHandler { CAMERA, FRAME };
00979 
00984     enum ClickAction { NO_CLICK_ACTION, ZOOM_ON_PIXEL, ZOOM_TO_FIT, SELECT, RAP_FROM_PIXEL, RAP_IS_CENTER,
00985         CENTER_FRAME, CENTER_SCENE, SHOW_ENTIRE_SCENE, ALIGN_FRAME, ALIGN_CAMERA };
00986 
00987 #ifndef DOXYGEN
00988     // So that it can be used in ManipulatedFrame and ManipulatedCameraFrame.
00989 public:
00990 #endif
00991 
00997     enum MouseAction { NO_MOUSE_ACTION,
00998         ROTATE, ZOOM, TRANSLATE,
00999         MOVE_FORWARD, LOOK_AROUND, MOVE_BACKWARD,
01000         SCREEN_ROTATE, ROLL, DRIVE,
01001         SCREEN_TRANSLATE, ZOOM_ON_REGION };
01002 
01003 #ifdef DOXYGEN
01004 public:
01005 #endif
01006 
01007     MouseAction mouseAction(int state) const;
01008     int mouseHandler(int state) const;
01009     int mouseButtonState(MouseHandler handler, MouseAction action, bool withConstraint=true) const;
01010     ClickAction clickAction(int state, bool doubleClick, QtMouseButtons buttonsBefore) const;
01011     void getClickButtonState(ClickAction action, int& state, bool& doubleClick, QtMouseButtons& buttonsBefore) const;
01012 
01013     MouseAction wheelAction(QtKeyboardModifiers modifiers) const;
01014     int wheelHandler(QtKeyboardModifiers modifiers) const;
01015     int wheelButtonState(MouseHandler handler, MouseAction action, bool withConstraint=true) const;
01016 
01017     public Q_SLOTS:
01018         void setMouseBinding(int state, MouseHandler handler, MouseAction action, bool withConstraint=true);
01019 #if QT_VERSION < 0x030000
01020         // Two slots cannot have the same name or two default parameters with Qt 2.3.
01021 public:
01022 #endif
01023     void setMouseBinding(int state, ClickAction action, bool doubleClick=false, QtMouseButtons buttonsBefore=Qt::NoButton);
01024     void setMouseBindingDescription(int state, QString description, bool doubleClick=false, QtMouseButtons buttonsBefore=Qt::NoButton);
01025 #if QT_VERSION < 0x030000
01026     public Q_SLOTS:
01027 #endif
01028         void setWheelBinding(QtKeyboardModifiers modifiers, MouseHandler handler, MouseAction action, bool withConstraint=true);
01029         void setHandlerKeyboardModifiers(MouseHandler handler, QtKeyboardModifiers modifiers);
01030 #ifndef DOXYGEN
01031         void setHandlerStateKey(MouseHandler handler, int buttonState);
01032         void setMouseStateKey(MouseHandler handler, int buttonState);
01033 #endif
01034 
01035 private:
01036     static QString mouseActionString(QGLViewer::MouseAction ma);
01037     static QString clickActionString(QGLViewer::ClickAction ca);
01039 
01040 
01043 public:
01044     QString stateFileName() const;
01045     virtual QDomElement domElement(const QString& name, QDomDocument& document) const;
01046 
01047     public Q_SLOTS:
01048         virtual void initFromDOMElement(const QDomElement& element);
01049         virtual void saveStateToFile(); // cannot be const because of QMessageBox
01050         virtual bool restoreStateFromFile();
01051 
01064         void setStateFileName(const QString& name) { stateFileName_ = name; };
01065 
01066 #ifndef DOXYGEN
01067         void saveToFile(const QString& fileName=QString::null);
01068         bool restoreFromFile(const QString& fileName=QString::null);
01069 #endif
01070 
01071 private:
01072     static void saveStateToFileForAllViewers();
01074 
01075 
01078 public:
01090 #if QT_VERSION >= 0x040000
01091     static const QList<QGLViewer*>& QGLViewerPool() { return QGLViewer::QGLViewerPool_; };
01092 #else
01093     static const QPtrList<QGLViewer>& QGLViewerPool() { return QGLViewer::QGLViewerPool_; };
01094 #endif
01095 
01096 
01104 #if QT_VERSION >= 0x040000
01105     static int QGLViewerIndex(const QGLViewer* const viewer) { return QGLViewer::QGLViewerPool_.indexOf(const_cast<QGLViewer*>(viewer)); };
01106 #else
01107     static int QGLViewerIndex(const QGLViewer* const viewer) { return QGLViewer::QGLViewerPool_.findRef(viewer); };
01108 #endif
01109 
01110 
01111 #ifndef DOXYGEN
01112 
01114 public:
01115     virtual void setVisualHintsMask(int mask, int delay = 2000);
01116     virtual void drawVisualHints();
01117 
01118     public Q_SLOTS:
01119         virtual void resetVisualHints();
01121 #endif
01122 
01123         private Q_SLOTS:
01124             // Patch for a Qt bug with fullScreen on startup
01125             void delayedFullScreen() { move(prevPos_); setFullScreen(); };
01126             void hideMessage();
01127 
01128 private:
01129     // Copy constructor and operator= are declared private and undefined
01130     // Prevents everyone from trying to use them
01131     QGLViewer(const QGLViewer& v);
01132     QGLViewer& operator=(const QGLViewer& v);
01133 
01134     // Set parameters to their default values. Called by the constructors.
01135     void defaultConstructor();
01136 
01137     void handleKeyboardAction(KeyboardAction id);
01138 
01139     // C a m e r a
01140     qglviewer::Camera* camera_;
01141     bool cameraIsEdited_;
01142     float previousCameraZClippingCoefficient_;
01143     int previousPathId_; // Double key press recognition
01144     void connectAllCameraKFIInterpolatedSignals(bool connection=true);
01145 
01146     // C o l o r s
01147     QColor backgroundColor_, foregroundColor_;
01148 
01149     // D i s p l a y    f l a g s
01150     bool axisIsDrawn_;  // world axis
01151     bool gridIsDrawn_;  // world XY grid
01152     bool FPSIsDisplayed_;   // Frame Per Seconds
01153     bool textIsEnabled_;    // drawText() actually draws text or not
01154     bool stereo_;       // stereo display
01155     bool fullScreen_;   // full screen mode
01156     QPoint prevPos_;    // Previous window position, used for full screen mode
01157 
01158     // A n i m a t i o n
01159     bool animationStarted_; // animation mode started
01160     int animationPeriod_;   // period in msecs
01161     int animationTimerId_;
01162 
01163     // F P S    d i s p l a y
01164     QTime fpsTime_;
01165     unsigned int fpsCounter_;
01166     QString fpsString_;
01167     float f_p_s_;
01168 
01169     // M e s s a g e s
01170     QString message_;
01171     bool displayMessage_;
01172     QTimer messageTimer_;
01173 
01174     // M a n i p u l a t e d    f r a m e
01175     qglviewer::ManipulatedFrame* manipulatedFrame_;
01176     bool manipulatedFrameIsACamera_;
01177 
01178     // M o u s e   G r a b b e r
01179     qglviewer::MouseGrabber* mouseGrabber_;
01180     bool mouseGrabberIsAManipulatedFrame_;
01181     bool mouseGrabberIsAManipulatedCameraFrame_;
01182     QMap<size_t, bool> disabledMouseGrabbers_;
01183 
01184     // S e l e c t i o n
01185     int selectRegionWidth_, selectRegionHeight_;
01186     int selectBufferSize_;
01187     GLuint* selectBuffer_;
01188     int selectedObjectId_;
01189 
01190     // V i s u a l   h i n t s
01191     int visualHint_;
01192 
01193     // S h o r t c u t   k e y s
01194     void setDefaultShortcuts();
01195     QString cameraPathKeysString() const;
01196     QMap<KeyboardAction, QString> keyboardActionDescription_;
01197     QMap<KeyboardAction, int> keyboardBinding_;
01198     QMap<int, QString> keyDescription_;
01199 
01200     // K e y   F r a m e s   s h o r t c u t s
01201     QMap<Qt::Key, int> pathIndex_;
01202     QtKeyboardModifiers addKeyFrameKeyboardModifiers_, playPathKeyboardModifiers_;
01203 
01204     // B u f f e r   T e x t u r e
01205     GLuint bufferTextureId_;
01206     float bufferTextureMaxU_, bufferTextureMaxV_;
01207     int bufferTextureWidth_, bufferTextureHeight_;
01208     unsigned int previousBufferTextureFormat_;
01209     int previousBufferTextureInternalFormat_;
01210 
01211 #ifndef DOXYGEN
01212     // M o u s e   a c t i o n s
01213     struct MouseActionPrivate {
01214         MouseHandler handler;
01215         MouseAction action;
01216         bool withConstraint;
01217     };
01218 
01219     // C l i c k   a c t i o n s
01220     struct ClickActionPrivate {
01221         QtKeyboardModifiers modifiers;
01222         QtMouseButtons button;
01223         bool doubleClick;
01224         QtMouseButtons buttonsBefore; // only defined when doubleClick is true
01225 
01226         // This sort order in used in mouseString() to displays sorted mouse bindings
01227         bool operator<(const ClickActionPrivate& cap) const
01228         {
01229             if (buttonsBefore != cap.buttonsBefore)
01230                 return buttonsBefore < cap.buttonsBefore;
01231             else
01232                 if (modifiers != cap.modifiers)
01233                     return modifiers < cap.modifiers;
01234                 else
01235                     if (button != cap.button)
01236                         return button < cap.button;
01237                     else
01238                         return !doubleClick && cap.doubleClick;
01239         }
01240     };
01241 #endif
01242     static QString formatClickActionPrivate(ClickActionPrivate cap);
01243 
01244     QMap<ClickActionPrivate, QString> mouseDescription_;
01245 
01246     void setDefaultMouseBindings();
01247     void performClickAction(ClickAction ca, const QMouseEvent* const e);
01248     QMap<int, MouseActionPrivate> mouseBinding_;
01249     QMap<QtKeyboardModifiers, MouseActionPrivate> wheelBinding_;
01250     QMap<ClickActionPrivate, ClickAction> clickBinding_;
01251 
01252     // S n a p s h o t s
01253     void initializeSnapshotFormats();
01254     QImage frameBufferSnapshot();
01255     QString snapshotFileName_, snapshotFormat_;
01256     int snapshotCounter_, snapshotQuality_;
01257     TileRegion* tileRegion_;
01258 
01259     // Q G L V i e w e r   p o o l
01260 #if QT_VERSION >= 0x040000
01261     static QList<QGLViewer*> QGLViewerPool_;
01262 #else
01263     static QPtrList<QGLViewer> QGLViewerPool_;
01264 #endif
01265 
01266     // S t a t e   F i l e
01267     QString stateFileName_;
01268 
01269     // H e l p   w i n d o w
01270     QTabWidget* helpWidget_;
01271 
01272     // I n t e r n a l   d e b u g
01273     bool updateGLOK_;
01274 };
01275 
01276 #endif // QGLVIEWER_QGLVIEWER_H