Robot Simulator of the Robotics Group for Self-Organization of Control  0.8.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
lpzhelphandler.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005-2011 LpzRobots development team *
3  * Georg Martius <georg dot martius at web dot de> *
4  * Frank Guettler <guettler at informatik dot uni-leipzig dot de *
5  * Frank Hesse <frank at nld dot ds dot mpg dot de> *
6  * Ralf Der <ralfder at mis dot mpg dot de> *
7  * *
8  * This program is free software; you can redistribute it and/or modify *
9  * it under the terms of the GNU General Public License as published by *
10  * the Free Software Foundation; either version 2 of the License, or *
11  * (at your option) any later version. *
12  * *
13  * This program is distributed in the hope that it will be useful, *
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16  * GNU General Public License for more details. *
17  * *
18  * You should have received a copy of the GNU General Public License *
19  * along with this program; if not, write to the *
20  * Free Software Foundation, Inc., *
21  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
22  * *
23  ***************************************************************************/
24 
25 #ifndef LPZHELPHANDLER_H
26 #define LPZHELPHANDLER_H
27 
28 #include <osgViewer/ViewerEventHandlers>
29 
30 namespace lpzrobots {
31 
32 
33 /** Event handler for adding on screen help to Viewers.*/
34 class LpzHelpHandler : public osgGA::GUIEventHandler
35 {
36  public:
37 
38  LpzHelpHandler(osg::ApplicationUsage* au=0);
39 
40  void setApplicationUsage(osg::ApplicationUsage* au) { _applicationUsage = au; }
41  osg::ApplicationUsage* getApplicationUsage() { return _applicationUsage.get(); }
42  const osg::ApplicationUsage* getApplicationUsage() const { return _applicationUsage.get(); }
43 
46 
47  void reset();
48 
49  osg::Camera* getCamera() { return _camera.get(); }
50  const osg::Camera* getCamera() const { return _camera.get(); }
51 
52  bool handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa);
53 
54  /** Get the keyboard and mouse usage of this manipulator.*/
55  virtual void getUsage(osg::ApplicationUsage& usage) const;
56 
57  protected:
58 
59  void setUpHUDCamera(osgViewer::ViewerBase* viewer);
60 
61  void setUpScene(osgViewer::ViewerBase* viewer);
62 
63  osg::ref_ptr<osg::ApplicationUsage> _applicationUsage;
64 
66 
68 
70  osg::ref_ptr<osg::Camera> _camera;
71  osg::ref_ptr<osg::Switch> _switch;
72 
73 };
74 
75 }
76 #endif
const osg::ApplicationUsage * getApplicationUsage() const
Definition: lpzhelphandler.h:42
Event handler for adding on screen help to Viewers.
Definition: lpzhelphandler.h:34
int _keyEventTogglesOnScreenHelp
Definition: lpzhelphandler.h:65
osg::ref_ptr< osg::ApplicationUsage > _applicationUsage
Definition: lpzhelphandler.h:63
void setApplicationUsage(osg::ApplicationUsage *au)
Definition: lpzhelphandler.h:40
osg::ref_ptr< osg::Camera > _camera
Definition: lpzhelphandler.h:70
void reset()
Definition: lpzhelphandler.cpp:69
void setUpScene(osgViewer::ViewerBase *viewer)
Definition: lpzhelphandler.cpp:146
const osg::Camera * getCamera() const
Definition: lpzhelphandler.h:50
bool _initialized
Definition: lpzhelphandler.h:69
bool handle(const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa)
Definition: lpzhelphandler.cpp:75
int getKeyEventTogglesOnScreenHelp() const
Definition: lpzhelphandler.h:45
bool _helpEnabled
Definition: lpzhelphandler.h:67
virtual void getUsage(osg::ApplicationUsage &usage) const
Get the keyboard and mouse usage of this manipulator.
Definition: lpzhelphandler.cpp:243
osg::ApplicationUsage * getApplicationUsage()
Definition: lpzhelphandler.h:41
LpzHelpHandler(osg::ApplicationUsage *au=0)
Definition: lpzhelphandler.cpp:57
void setKeyEventTogglesOnScreenHelp(int key)
Definition: lpzhelphandler.h:44
osg::ref_ptr< osg::Switch > _switch
Definition: lpzhelphandler.h:71
osg::Camera * getCamera()
Definition: lpzhelphandler.h:49
void setUpHUDCamera(osgViewer::ViewerBase *viewer)
Definition: lpzhelphandler.cpp:117