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
00024
00025 #ifndef GLC_MOVERCONTROLLER_H_
00026 #define GLC_MOVERCONTROLLER_H_
00027
00028 #include "glc_mover.h"
00029 #include <QObject>
00030 #include <QHash>
00031 #include <QtDebug>
00032
00033 #include "../glc_config.h"
00034 #include "glc_userinput.h"
00035
00036 class QGLWidget;
00037
00040
00041
00042 class GLC_LIB_EXPORT GLC_MoverController : public QObject
00043 {
00044 Q_OBJECT
00045 public:
00047 typedef QHash<const int, GLC_Mover*> MoverHash;
00048
00050 enum MoverType
00051 {
00052 Pan= 1,
00053 Zoom= 2,
00054 TrackBall= 3,
00055 Target= 4,
00056 TurnTable= 5,
00057 Fly= 6,
00058 TSR= 7
00059 };
00060
00061 public:
00063 GLC_MoverController();
00064
00066 GLC_MoverController(const GLC_MoverController&);
00067
00069 virtual ~GLC_MoverController();
00070
00072
00074
00075 public:
00076
00078 inline bool hasActiveMover() const
00079 { return (m_ActiveMoverId != 0);}
00080
00082 inline int activeMoverId() const
00083 {return m_ActiveMoverId;}
00084
00086 inline GLC_Mover* activeMover() const
00087 {return m_MoverHash.value(m_ActiveMoverId);}
00088
00090 inline GLC_Mover* getMover(const int id) const
00091 {return m_MoverHash.value(id);}
00092
00094
00096
00098
00099 public:
00101 GLC_MoverController& operator = (const GLC_MoverController&);
00102
00104 void addMover(GLC_Mover*, const int);
00105
00107 void removeMover(const int);
00108
00110 void setActiveMover(const int id, const GLC_UserInput& userInput);
00111
00113 void setNoMover();
00114
00116 inline bool move(const GLC_UserInput& userInput)
00117 {
00118 Q_ASSERT(0 != m_ActiveMoverId);
00119 return m_MoverHash.value(m_ActiveMoverId)->move(userInput);
00120 }
00121
00123
00125
00127
00128 public:
00130 inline void drawActiveMoverRep()
00131 {
00132 if(0 != m_ActiveMoverId)
00133 {
00134 m_MoverHash.value(m_ActiveMoverId)->renderRepresentation();
00135 }
00136 }
00137
00139 signals:
00141 void repaintNeeded();
00142
00144
00146 private:
00148 int m_ActiveMoverId;
00149
00151 MoverHash m_MoverHash;
00152 };
00153
00154 #endif