GLC_lib  2.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
glc_movercontroller.h
Go to the documentation of this file.
1 /****************************************************************************
2 
3  This file is part of the GLC-lib library.
4  Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
5  http://glc-lib.sourceforge.net
6 
7  GLC-lib is free software; you can redistribute it and/or modify
8  it under the terms of the GNU Lesser General Public License as published by
9  the Free Software Foundation; either version 3 of the License, or
10  (at your option) any later version.
11 
12  GLC-lib is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU Lesser General Public License for more details.
16 
17  You should have received a copy of the GNU Lesser General Public License
18  along with GLC-lib; if not, write to the Free Software
19  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 
21  *****************************************************************************/
22 
24 
25 #ifndef GLC_MOVERCONTROLLER_H_
26 #define GLC_MOVERCONTROLLER_H_
27 
28 #include "glc_mover.h"
29 #include <QObject>
30 #include <QHash>
31 #include <QtDebug>
32 
33 #include "../glc_config.h"
34 #include "glc_userinput.h"
35 
36 class QGLWidget;
37 
40 
41 
42 class GLC_LIB_EXPORT GLC_MoverController : public QObject
43 {
44  Q_OBJECT
45 public:
47  typedef QHash<const int, GLC_Mover*> MoverHash;
48 
50  enum MoverType
51  {
52  Pan= 1,
53  Zoom= 2,
54  TrackBall= 3,
55  Target= 4,
56  TurnTable= 5,
57  Fly= 6,
58  TSR= 7
59  };
60 
61 public:
64 
67 
69  virtual ~GLC_MoverController();
70 
72 
74 
75 public:
76 
78  inline bool hasActiveMover() const
79  { return (m_ActiveMoverId != 0);}
80 
82  inline int activeMoverId() const
83  {return m_ActiveMoverId;}
84 
86  inline GLC_Mover* activeMover() const
87  {return m_MoverHash.value(m_ActiveMoverId);}
88 
90  inline GLC_Mover* getMover(const int id) const
91  {return m_MoverHash.value(id);}
92 
94 
96 
98 
99 public:
101  GLC_MoverController& operator = (const GLC_MoverController&);
102 
104  void addMover(GLC_Mover*, const int);
105 
107  void removeMover(const int);
108 
110  void setActiveMover(const int id, const GLC_UserInput& userInput);
111 
113  void setNoMover();
114 
116  inline bool move(const GLC_UserInput& userInput)
117  {
118  Q_ASSERT(0 != m_ActiveMoverId);
119  return m_MoverHash.value(m_ActiveMoverId)->move(userInput);
120  }
121 
123 
125 
127 
128 public:
130  inline void drawActiveMoverRep()
131  {
132  if(0 != m_ActiveMoverId)
133  {
134  m_MoverHash.value(m_ActiveMoverId)->renderRepresentation();
135  }
136  }
137 
139 signals:
141  void repaintNeeded();
142 
144 // Private Members
146 private:
149 
152 };
153 
154 #endif /* GLC_MOVERCONTROLLER_H_ */

©2005-2013 Laurent Ribon