OpenSceneGraph/include/osgGA/GUIEventHandlerVisitor
Robert Osfield 8c0d510571 Several items of work related to adding a manual creation of occluders
option to the osgoccluder demo.

First the osgGA classes have been generalised a little to better support
new GUIEventHandler subclasses.

Second osgGLUT has a new option for registering a user defined event handler,
the allows the application to add externally extra options to the osgGLUT viewer.

Third, the osgoccluder demo now works in two modes. The original create
four occluder sides to wrap an loaded model, the second an interactive
mode which allows the users to add occluders to the model by pointing
to points and pressing 'a' to add a point, the 'e' to end the occluder
polygon, polygons must be convex, planer and be defined in an anitclockwise
order.  To start the osgoccluder in this mode one simple runs it with the
'-c' option.  Run osgoccluder with no parameter to get a list of options.
2002-07-17 10:00:50 +00:00

58 lines
1.5 KiB
Plaintext

#ifndef OSGGA_GUIEVENTHANDLERVISITOR
#define OSGGA_GUIEVENTHANDLERVISITOR 1
#include <osgGA/Export>
#include <osgGA/GUIEventAdapter>
#include <osg/ref_ptr>
namespace osgGA{
// Some forward declarations
class GUIActionAdapter;
class GUIEventHandler;
class CompositeGUIEventHandler;
class CameraManipulator;
class StateSetManipulator;
/** Base class primarily for visiting GUIEventHandlers.
A Default Visitor, (Might want to make it an Extrinsic Visitor at some point).
By default, it does nothing to the things it visits. Sub classes of this Visitor
need only override visit operations for the types of object they're interested in.
*/
class OSGGA_EXPORT GUIEventHandlerVisitor
{
public:
virtual void visit(GUIEventHandler&) {}
virtual void visit(CompositeGUIEventHandler&);
virtual void visit(CameraManipulator&) {};
virtual void visit(StateSetManipulator&) {};
// Accessors
/** Get the GUI EventAdapter associated with this GUIEventHandlerVisitor */
const GUIEventAdapter *getGUIEventAdapter() { return _gea.get(); }
/** Get the GUI Action Adapter associated with this GEH Visitor */
GUIActionAdapter *getGUIActionAdapter() { return _gaa; }
protected:
GUIEventHandlerVisitor(GUIEventAdapter* in, GUIActionAdapter* out):_gea(in),_gaa(out) {}
virtual ~GUIEventHandlerVisitor() {}
private:
osg::ref_ptr<GUIEventAdapter> _gea;
GUIActionAdapter* _gaa; // Just a pointer. NOT owned by this object.
};
};
#endif