Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ControlInterface.hh
1 #ifndef __CONTROL_INTERFACE_HH__
2 #define __CONTROL_INTERFACE_HH__
3 
4 #include <bias_config.h>
5 
6 #ifndef BIAS_HAVE_OPENGL
7 # error You need BIAS with USE_OpenGL Please recompile BIAS.
8 #endif // BUILD_GLviewer
9 
10 #include <Base/Common/W32Compat.hh>
11 #include <Base/Debug/Debug.hh>
12 #include <Base/Debug/Error.hh>
13 
14 typedef enum {
15  KEY_F1 = 0,
16  KEY_F2,
17  KEY_F3,
18  KEY_F4,
19  KEY_F5,
20  KEY_F6,
21  KEY_F7,
22  KEY_F8,
23  KEY_F9,
24  KEY_F10,
25  KEY_F11,
26  KEY_F12,
27  KEY_HOME,
28  KEY_PGUP,
29  KEY_PGDOWN,
30  KEY_UP,
31  KEY_DOWN,
32  KEY_LEFT,
33  KEY_RIGHT
34 
35 } SpecialKey;
36 
37 typedef enum {
38  NONE = 0,
39  ALT,
40  CTRL,
41  SHIFT
42 } modifiers;
43 
44 namespace BIAS {
45 
46  class BIASGLviewer_EXPORT GLProjectionParametersInterface;
47 
48  /** \class ControlInterface
49  \brief Defines the common interface used for communication between
50  rendering components.
51  All presented method return a boolean.
52  Returning false means, that the called method has not
53  reacted to the call.
54  \author bartczak
55  \ingroup g_glviewer
56  */
57  class BIASGLviewer_EXPORT ControlInterface : public BIAS::Debug
58  {
59  public:
60  /** \brief constructor */
62  {
63  listenerName_= "unnamed control listener";
64  controlledObject_=NULL;
65  };
66  /** \brief destructor */
67  virtual ~ControlInterface(){}
68 
69  /** \brief Get the name of the controller */
70  virtual std::string GetName()
71  { return listenerName_;};
72 
73  /** \brief Set the name of the controller */
74  virtual void SetName(std::string name)
75  { listenerName_=name;};
76 
77  /** \brief react to mouse wheel usage
78  * overwrite in derived class of desired*/
79  virtual bool MouseWheelUsed(double stepsize)
80  {return false;};
81 
82  /** \brief react to left mouse double click
83  * overwrite in derived class of desired*/
84  virtual bool LeftMouseDoubleClicked(int /*x*/, int /*y*/, int m)
85  { return false; };
86 
87  /** \brief react to left mouse single click
88  * overwrite in derived class of desired*/
89  virtual bool LeftMouseSingleClicked(int /*x*/, int /*y*/)
90  { return false; };
91 
92  /** \brief react to mouse movement while left button held down
93  * overwrite in derived class of desired*/
94  virtual bool LeftMouseMoved(int /*x1*/, int /*x2*/,int /*y1*/, int /*y2*/)
95  { return false; };
96 
97  /** \brief react to left mouse button down event
98  * overwrite in derived class of desired*/
99  virtual bool LeftMouseDown(int , int)
100  { return false; };
101 
102  /** \brief react to left mouse button up event
103  * overwrite in derived class of desired*/
104  virtual bool LeftMouseUp(int , int)
105  { return false; };
106 
107 
108  /** \brief react to right mouse single click event
109  * overwrite in derived class of desired*/
110  virtual bool RightMouseSingleClicked(int /*x*/, int /*y*/)
111  { return false; };
112 
113  /** \brief react to right mouse double click
114  * overwrite in derived class of desired*/
115  virtual bool RightMouseDoubleClicked(int /*x*/, int /*y*/)
116  { return false; };
117 
118  /** \brief react to mouse movement while right button held down
119  * overwrite in derived class of desired*/
120  virtual bool RightMouseMoved(int /*x1*/, int /*x2*/, int /*y1*/, int /*y2*/)
121  { return false; };
122 
123  /** \brief react to right mouse button down event
124  * overwrite in derived class of desired*/
125  virtual bool RightMouseDown(int , int)
126  { return false; };
127 
128  /** \brief react to right mouse button up event
129  * overwrite in derived class of desired*/
130  virtual bool RightMouseUp(int , int)
131  { return false; };
132 
133  /** \brief react to mouse movement while middle button held down
134  * overwrite in derived class of desired*/
135  virtual bool MiddleMouseMoved(int /*x1*/, int /*x2*/,int /*y1*/, int /*y2*/)
136  { return false; };
137 
138  /** \brief react to mouse movement while right and middle button held down
139  * overwrite in derived class of desired*/
140  virtual bool LeftAndRightMouseMoved(int /*x1*/, int /*x2*/,int /*y1*/, int /*y2*/)
141  { return false; };
142 
143  /** \brief react to middle mouse button down event
144  * overwrite in derived class of desired*/
145  virtual bool MiddleMouseDown(int , int)
146  { return false; };
147 
148  /** \brief react to middle mouse button up event
149  * overwrite in derived class of desired*/
150  virtual bool MiddleMouseUp(int , int)
151  { return false; };
152 
153  /** \brief react to mouse movement
154  * overwrite in derived class of desired*/
155  virtual bool MouseMoved(int /*x*/, int /*y*/)
156  {return false; };
157 
158  /** \brief react to mouse leaving the window
159  * overwrite in derived class of desired*/
160  virtual bool MouseLeftWindow()
161  { return false; };
162 
163  /** \brief react to press of special keys such as F1-F12, ...
164  * overwrite in derived class of desired*/
165  virtual bool SpecialKeyPressed(int /*key*/)
166  { return false; };
167 
168  /** \brief react to press of special keys such as F1-F12, ...
169  * overwrite in derived class of desired*/
170  virtual bool SpecialKeyUp(int /*key*/)
171  { return false; };
172 
173  /** \brief react to press of ascii-coded charakter plus pointer position */
174  virtual bool StandardKeyPressed(unsigned char /*key*/, int, int)
175  { return false; };
176 
177  /** \brief react to press of ascii-coded charakter plus pointer position */
178  virtual bool StandardKeyUp(unsigned char /*key*/, int, int)
179  { return false; };
180 
181  /** \brief this function is called by RenderContextBase when timer is expired
182  * Overwrite and implement to do some timer dependend processing */
183  virtual bool TimerExpired()
184  { return false; };
185 
186  /** \brief this function is called by RenderContextBase if the window is reshaped.
187  * Overwrite and implement to do some processing upon reshape */
188  virtual bool WindowReshape(int /*width*/, int /*height*/)
189  { return false; };
190 
191  /** \brief this function is called by RenderContextBase when drawing is done.
192  * Overwrite and implement to do some processing after drawing */
193  virtual bool FinishedDraw()
194  {return false;};
195 
196  /**\brief Set the camera projection parameters. Can be of type GLProjection or
197  * any from GLProjectionParametersBase derived class*/
199  if(interface_ != NULL)
200  controlledObject_ = interface_;
201  else
202  BIASWARN("Given interface is NULL");
203  };
204  /**\brief Get the camera projection parameters. Can be of type GLProjection or
205  * any from GLProjectionParametersBase derived class
206  * \return Pointer to GLProjectionParametersInterface */
208  { return controlledObject_; };
209 
210  protected:
211  /** name of listener/controller */
212  std::string listenerName_;
213  /** the camera which is controlled by this controller*/
215  };
216 
217 }//end of namespace
218 
219 #endif //__CONTROL_INTERFACE_HH__
virtual std::string GetName()
Get the name of the controller.
virtual bool SpecialKeyUp(int)
react to press of special keys such as F1-F12, ...
virtual bool LeftMouseSingleClicked(int, int)
react to left mouse single click overwrite in derived class of desired
virtual void SetName(std::string name)
Set the name of the controller.
virtual bool MouseLeftWindow()
react to mouse leaving the window overwrite in derived class of desired
BIAS::GLProjectionParametersInterface * controlledObject_
the camera which is controlled by this controller
virtual bool StandardKeyUp(unsigned char, int, int)
react to press of ascii-coded charakter plus pointer position
virtual BIAS::GLProjectionParametersInterface * GetGLProjectionParametersInterface()
Get the camera projection parameters.
virtual bool LeftMouseDoubleClicked(int, int, int m)
react to left mouse double click overwrite in derived class of desired
virtual bool MouseMoved(int, int)
react to mouse movement overwrite in derived class of desired
virtual bool RightMouseMoved(int, int, int, int)
react to mouse movement while right button held down overwrite in derived class of desired ...
virtual bool TimerExpired()
this function is called by RenderContextBase when timer is expired Overwrite and implement to do some...
virtual bool RightMouseSingleClicked(int, int)
react to right mouse single click event overwrite in derived class of desired
virtual bool StandardKeyPressed(unsigned char, int, int)
react to press of ascii-coded charakter plus pointer position
virtual bool WindowReshape(int, int)
this function is called by RenderContextBase if the window is reshaped.
virtual bool MiddleMouseMoved(int, int, int, int)
react to mouse movement while middle button held down overwrite in derived class of desired ...
Abstract interface class to handle changes in rendering parameters by controllers and in rendering co...
virtual bool FinishedDraw()
this function is called by RenderContextBase when drawing is done.
virtual bool RightMouseDown(int, int)
react to right mouse button down event overwrite in derived class of desired
virtual bool LeftMouseDown(int, int)
react to left mouse button down event overwrite in derived class of desired
virtual bool LeftMouseMoved(int, int, int, int)
react to mouse movement while left button held down overwrite in derived class of desired ...
virtual bool LeftMouseUp(int, int)
react to left mouse button up event overwrite in derived class of desired
virtual bool MouseWheelUsed(double stepsize)
react to mouse wheel usage overwrite in derived class of desired
ControlInterface()
constructor
virtual void SetGLProjectionParametersInterface(BIAS::GLProjectionParametersInterface *interface_)
Set the camera projection parameters.
virtual bool LeftAndRightMouseMoved(int, int, int, int)
react to mouse movement while right and middle button held down overwrite in derived class of desired...
virtual ~ControlInterface()
destructor
virtual bool MiddleMouseUp(int, int)
react to middle mouse button up event overwrite in derived class of desired
virtual bool MiddleMouseDown(int, int)
react to middle mouse button down event overwrite in derived class of desired
virtual bool RightMouseUp(int, int)
react to right mouse button up event overwrite in derived class of desired
virtual bool RightMouseDoubleClicked(int, int)
react to right mouse double click overwrite in derived class of desired
Defines the common interface used for communication between rendering components. ...
virtual bool SpecialKeyPressed(int)
react to press of special keys such as F1-F12, ...