glc_movercontroller.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00026
00027 #ifndef GLC_MOVERCONTROLLER_H_
00028 #define GLC_MOVERCONTROLLER_H_
00029
00030 #include "glc_mover.h"
00031 #include <QObject>
00032 #include <QHash>
00033 #include <QtDebug>
00034
00035 #include "../glc_config.h"
00036
00037 class QGLWidget;
00038 class QMouseEvent;
00039
00042
00043
00044 class GLC_LIB_EXPORT GLC_MoverController : public QObject
00045 {
00046 Q_OBJECT
00047 public:
00049 typedef QHash<const int, GLC_Mover*> MoverHash;
00050
00052 enum MoverType
00053 {
00054 Pan= 1,
00055 Zoom= 2,
00056 TrackBall= 3,
00057 Target= 4,
00058 TurnTable= 5,
00059 Fly= 6
00060 };
00061
00062 public:
00064 GLC_MoverController();
00065
00067 GLC_MoverController(const GLC_MoverController&);
00068
00070 virtual ~GLC_MoverController();
00071
00073
00075
00076 public:
00077
00079 inline bool hasActiveMover() const
00080 { return (m_ActiveMoverId != 0);}
00081
00083 inline int activeMoverId() const
00084 {return m_ActiveMoverId;}
00085
00087 inline GLC_Mover* activeMover() const
00088 {return m_MoverHash.value(m_ActiveMoverId);}
00089
00091
00093
00095
00096 public:
00098 GLC_MoverController& operator = (const GLC_MoverController&);
00099
00101 void addMover(GLC_Mover*, const int);
00102
00104 void removeMover(const int);
00105
00107 void setActiveMover(const int id, QMouseEvent * e);
00108
00110 void setNoMover();
00111
00113 inline bool move(QMouseEvent * e)
00114 {
00115 Q_ASSERT(0 != m_ActiveMoverId);
00116 return m_MoverHash.value(m_ActiveMoverId)->move(e);
00117 }
00118
00120
00122
00124
00125 public:
00127 inline void drawActiveMoverRep()
00128 {
00129 if(0 != m_ActiveMoverId)
00130 {
00131 m_MoverHash.value(m_ActiveMoverId)->glExecute();
00132 }
00133 }
00134
00136 signals:
00138 void repaintNeeded();
00139
00141
00143 private:
00145 int m_ActiveMoverId;
00146
00148 MoverHash m_MoverHash;
00149 };
00150
00151 #endif