//C++ header - Open Scene Graph - Copyright (C) 1998-2002 Robert Osfield //Distributed under the terms of the GNU Library General Public License (LGPL) //as published by the Free Software Foundation. #ifndef OSGGA_CAMERAMANIPULATOR #define OSGGA_CAMERAMANIPULATOR 1 #include #include #include #include #include #include namespace osgGA{ /** CameraManipulator is an abstract base class defining the interface, and a certain amount of default functionality, for classes which wish to control OSG cameras in response to GUI events. */ class OSGGA_EXPORT CameraManipulator : public GUIEventHandler { public: /** Attach a camera to the manipulator to be used for specifying view.*/ virtual void setCamera(osg::Camera*); /** Get the attached camera.*/ virtual const osg::Camera * getCamera() const; /** Get the attached camera.*/ virtual osg::Camera * getCamera(); /** Attach a node to the manipulator, automatically detaching any previously attached node. setNode(NULL) detaches previous nodes. May be ignored by manipulators which do not require a reference model. */ virtual void setNode(osg::Node*) {} /** Return const node if attached.*/ virtual const osg::Node* getNode() const { return NULL; } /** Return node if attached.*/ virtual osg::Node* getNode() { return NULL; } /** Move the camera to the default position. May be ignored by manipulators if home functionality is not appropriate. */ virtual void home(const GUIEventAdapter& ,GUIActionAdapter&) {} /** Start/restart the manipulator. FIXME: what does this actually mean? Provide examples. */ virtual void init(const GUIEventAdapter& ,GUIActionAdapter&) {} /** Handle events, return true if handled, false otherwise. */ virtual bool handle(const GUIEventAdapter& ea,GUIActionAdapter& us); /** Handle visitations */ virtual void accept(GUIEventHandlerVisitor& v) { v.visit(*this); } protected: CameraManipulator(); virtual ~CameraManipulator(); // Reference pointer to a camera osg::ref_ptr _camera; }; } #endif