Jafar
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
View3D.hpp
00001 /* $Id$ */
00002 
00003 #ifndef _OSG_VIEW_HPP_
00004 #define _OSG_VIEW_HPP_
00005 
00006 #include <QGLWidget>
00007 
00008 #include <osgViewer/Viewer>
00009 
00010 namespace osgViewer {
00011   class GraphicsWindow;
00012 }
00013 namespace osgGA {
00014   class GUIEventAdapter;
00015   class KeySwitchMatrixManipulator;
00016 }
00017 
00018 namespace jafar {
00019   namespace image {
00020     class Image;
00021   }
00022   namespace viewer3d {
00023 
00029     class View3D : public QGLWidget, public osgViewer::Viewer
00030     {
00031       Q_OBJECT
00032       public:
00033         enum CameraMode {
00034           CAMERA_PERSPECTIVE,
00035           CAMERA_ORTHO
00036         };
00037       public:
00038         View3D( QWidget * parent = 0, const QGLWidget * shareWidget = 0, Qt::WindowFlags f = 0 );
00039         virtual ~View3D();
00043         void setBackgroundColor(double r, double g, double b, double a = 1.0);
00044       public slots:
00045         void setManipulatorIndex( int _index );
00046         void setCameraMode( int _index );
00047         void setDistance( double _distance );
00048       public:
00052         image::Image snapshot();
00069         void saveSnapshot( const std::string& _fileName);
00096         void startMovie( const std::string& _fileNamePrefix, const std::string& _fileNameSuffix, int _interval, int _startIndex = 0, unsigned int _digits = 5 );
00100         void stopMovie();
00104         bool isMovieRunning() const;
00105       public slots:
00109         void stepMovie();
00110       signals:
00114         void movieFrameNextIndex( int _index );
00115       protected:
00116         void init();
00117 
00118         virtual void paintGL();
00119         virtual void resizeGL( int width, int height );
00120         virtual void keyPressEvent( QKeyEvent* event );
00121         virtual void keyReleaseEvent( QKeyEvent* event );
00122         virtual void mousePressEvent( QMouseEvent* event );
00123         virtual void mouseReleaseEvent( QMouseEvent* event );
00124         virtual void mouseMoveEvent( QMouseEvent* event );
00125       private:
00126         osgGA::GUIEventAdapter* transferKeyModifier( QKeyEvent* event );
00127         int qtKeyToOsgCode( QKeyEvent* event );
00128       private slots:
00129         void timeout();
00130       signals:
00131         void cameraPositionChanged();
00132       private:
00133         struct Private;
00134         Private* const d;
00135     };
00136   }
00137 }
00138 
00139 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on Wed Oct 15 2014 00:37:29 for Jafar by doxygen 1.7.6.1
LAAS-CNRS