2001-10-04 23:12:57 +08:00
|
|
|
//C++ header - Open Scene Graph - Copyright (C) 1998-2001 Robert Osfield
|
|
|
|
//Distributed under the terms of the GNU Library General Public License (LGPL)
|
|
|
|
//as published by the Free Software Foundation.
|
|
|
|
|
2001-09-20 05:19:47 +08:00
|
|
|
#ifndef OSGUTIL_SceneViewManipulator
|
|
|
|
#define OSGUTIL_SceneViewManipulator 1
|
|
|
|
|
|
|
|
#include <osgUtil/Export>
|
|
|
|
#include <osgUtil/SceneView>
|
|
|
|
#include <osgUtil/CameraManipulator>
|
|
|
|
#include <osgUtil/StateSetManipulator>
|
|
|
|
#include <osgUtil/GUIEventAdapter>
|
|
|
|
#include <osgUtil/GUIActionAdapter>
|
|
|
|
|
|
|
|
namespace osgUtil{
|
|
|
|
|
|
|
|
class OSGUTIL_EXPORT SceneViewManipulator : public GUIEventHandler
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
SceneViewManipulator();
|
|
|
|
virtual ~SceneViewManipulator();
|
|
|
|
|
|
|
|
/** attach a scene view to the manipulator. */
|
|
|
|
virtual void setSceneView(SceneView*);
|
|
|
|
|
|
|
|
/** get the attached a scene view.*/
|
|
|
|
virtual SceneView * getSceneView();
|
|
|
|
|
|
|
|
/** get the attached a const scene view.*/
|
|
|
|
virtual const SceneView * getSceneView() const;
|
|
|
|
|
|
|
|
/** Set the camera manipulator on the object.*/
|
|
|
|
virtual void setCameraManipulator(CameraManipulator *cm) {_cm=cm;}
|
|
|
|
|
|
|
|
/** Get the camera manipulator on the object */
|
|
|
|
virtual CameraManipulator *getCameraManipulator() {return _cm.get();}
|
|
|
|
|
|
|
|
/** Get the const camera manipulator on the object */
|
|
|
|
virtual const CameraManipulator *getCameraManipulator() const {return _cm.get();}
|
|
|
|
|
|
|
|
/** Set the geostate manipulator on the object.*/
|
|
|
|
virtual void setStateSetManipulator(StateSetManipulator *cm) {_gm=cm;}
|
|
|
|
|
|
|
|
/** Get the geostate manipulator on the object */
|
|
|
|
virtual StateSetManipulator *getStateSetManipulator() { return _gm.get();}
|
|
|
|
|
|
|
|
/** Get the geostate manipulator on the object */
|
|
|
|
virtual const StateSetManipulator *getStateSetManipulator() const {return _gm.get();}
|
|
|
|
|
|
|
|
/** Handle events, return true if handled, false otherwise.*/
|
|
|
|
virtual bool handle(const GUIEventAdapter& ea,GUIActionAdapter& us);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
// Reference pointer to our scene view
|
|
|
|
osg::ref_ptr<SceneView> _sv;
|
|
|
|
|
|
|
|
osg::ref_ptr<CameraManipulator> _cm;
|
|
|
|
osg::ref_ptr<StateSetManipulator> _gm;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|