Updates, from Neil Salter, to comments etc to osgGA which add better
explanations of how each of the classes operates.
This commit is contained in:
@@ -9,31 +9,40 @@
|
||||
#include <osgGA/CameraManipulator>
|
||||
#include <osgGA/GUIEventHandler>
|
||||
#include <osgGA/GUIEventHandlerVisitor>
|
||||
//#include <osgUtil/CallbackList>
|
||||
|
||||
namespace osgGA{
|
||||
|
||||
class GUIEventAdapter;
|
||||
class GUIActionAdapter;
|
||||
|
||||
/**
|
||||
KeySwitchCameraManipulator is a decorator which allows the type of camera manipulator
|
||||
being used to be switched by pressing a key. E.g. '1' for a TrackballManipultor,
|
||||
'2' for a DriveManipulator, '3' for a FlightManipulator. The manipulators available,
|
||||
and the associated switch keys, can be configured.
|
||||
*/
|
||||
class OSGGA_EXPORT KeySwitchCameraManipulator : public CameraManipulator
|
||||
{
|
||||
public:
|
||||
|
||||
// Local methods
|
||||
public:
|
||||
|
||||
/**
|
||||
Add a camera manipulator with an associated name, and a key to
|
||||
trigger the switch,
|
||||
*/
|
||||
void addCameraManipulator(int key, std::string name, CameraManipulator *cm);
|
||||
|
||||
/**
|
||||
Add a camera manipulator with an autogenerated keybinding which is '1' + previous number of camera's registerd.
|
||||
*/
|
||||
void addNumberedCameraManipulator(CameraManipulator *cm);
|
||||
|
||||
|
||||
// Overrides from CameraManipulator...
|
||||
|
||||
virtual void setCamera(osg::Camera* c) { _current->setCamera(c); }
|
||||
virtual void setCamera(osg::Camera* c) { _current->setCamera(c); }
|
||||
|
||||
virtual const osg::Camera * getCamera() const { return _current->getCamera(); }
|
||||
virtual const osg::Camera * getCamera() const { return _current->getCamera(); }
|
||||
|
||||
virtual osg::Camera * getCamera() { return _current->getCamera(); }
|
||||
virtual osg::Camera * getCamera() { return _current->getCamera(); }
|
||||
|
||||
virtual void setNode(osg::Node* n) { _current->setNode(n); }
|
||||
|
||||
@@ -47,14 +56,13 @@ class OSGGA_EXPORT KeySwitchCameraManipulator : public CameraManipulator
|
||||
|
||||
virtual bool handle(const GUIEventAdapter& ea,GUIActionAdapter& us);
|
||||
|
||||
private:
|
||||
private:
|
||||
|
||||
typedef std::pair<std::string, osg::ref_ptr<CameraManipulator> > NamedManipulator;
|
||||
typedef std::map<int, NamedManipulator> KeyManipMap;
|
||||
KeyManipMap _manips;
|
||||
|
||||
osg::ref_ptr<CameraManipulator> _current;
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user