00001 /******************************************************************************* 00002 * SensorDataGLWidget.h 00003 * 00004 * (C) 2006 AG Aktives Sehen <agas@uni-koblenz.de> 00005 * Universitaet Koblenz-Landau 00006 * 00007 * Additional information: 00008 * $Id: SensorDataGLWidget.h 44313 2011-04-06 22:46:28Z agas $ 00009 *******************************************************************************/ 00010 00011 #ifndef SENSORDATAGLWIDGET_H 00012 #define SENSORDATAGLWIDGET_H 00013 00014 #include <QtOpenGL> 00015 #include <vector> 00016 #include <QRgb> 00017 00018 #include <set> 00019 #include <map> 00020 00021 //#include "GUI/RobbieWidget/RobbieGLWidget.h" 00022 //#include "Architecture/Profiler/Timer.h" 00023 00024 #include "Vec.h" 00025 #include "Mat.h" 00026 //#include "Workers/SceneGraph/SceneGraph.h" 00027 00028 #include "PainterPlugin.h" 00029 00037 class SensorDataGLWidget : public QGLWidget 00038 { 00039 00040 Q_OBJECT 00041 00042 public: 00043 00049 SensorDataGLWidget ( QWidget *parent = 0 ); 00050 00054 ~SensorDataGLWidget(); 00055 00056 void addPainter ( PainterPlugin *painter ); 00057 00058 PainterPlugin* getPainter( std::string p) { return m_PaintersMap[p]; } 00059 00060 00061 public slots: 00062 00064 void setBgColor ( float r, float g, float b, float a = 0.0 ); 00065 00069 void performCameraMove(); // float deltaPhi ); 00070 00072 //virtual void processMessage ( Message* message ); 00073 00075 void followNode( const QString& nodeName ); 00076 00078 void setCameraRotation( float rotationY, float rotationZ ); 00079 00080 void setLookAt( BaseLib::Math::Vec3d lookAt ); 00081 00082 protected: 00083 00088 void initializeGL(); 00089 00096 void resizeGL ( int w, int h ); 00097 00105 void paintGL(); 00106 00112 void mousePressEvent ( QMouseEvent* event ); 00113 00121 void mouseMoveEvent ( QMouseEvent* event ); 00122 00128 void wheelEvent ( QWheelEvent* event ); 00129 00131 virtual QSize minimumSizeHint() const; 00132 00134 virtual QSize sizeHint() const; 00135 00136 private: 00137 00138 void setProjectionMatrix(); 00139 00140 //SceneGraph m_SceneGraph; // TODO 00141 bool m_SceneGraphInitialized; 00142 00144 std::string m_LookAtNode; 00145 00147 BaseLib::Math::Vec3d m_LookAt; // TODO 00148 00150 float m_CameraRotationZ; 00151 float m_CameraRotationY; 00152 float m_CameraDistance; 00153 00154 float m_CameraOpeningAngle; 00155 00157 float m_CameraTurnStartTime; 00158 int m_CameraTurning; 00159 QTimer* m_RedrawTimer; 00160 00162 QPoint m_MousePosOld; 00163 00164 // Timer m_Timer; TODO 00165 00166 std::list<PainterPlugin*> m_Painters; 00167 std::map<std::string, PainterPlugin*> m_PaintersMap; 00168 00169 bool m_CameraImageMode; 00170 00171 int m_ViewportWidth; 00172 int m_ViewportHeight; 00173 00174 bool m_ForceRedraw; 00175 00176 static int WidgetCounter; 00177 }; 00178 #endif