/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2005 Robert Osfield * * This library is open source and may be redistributed and/or modified under * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #ifndef OSGPRODUCER_VIEWEREVENTHANDLER #define OSGPRODUCER_VIEWEREVENTHANDLER 1 #include #include namespace osgProducer { class OSGPRODUCER_EXPORT ViewerEventHandler : public osgGA::GUIEventHandler { public: ViewerEventHandler(OsgCameraGroup* cg); virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& aa); virtual void accept(osgGA::GUIEventHandlerVisitor& gehv); /** Get the keyboard and mouse usage of this manipulator.*/ virtual void getUsage(osg::ApplicationUsage& usage) const; OsgCameraGroup* getOsgCameraGroup() { return _cg; } const OsgCameraGroup* getOsgCameraGroup() const { return _cg; } void setWriteNodeFileName(const std::string& filename) { _writeNodeFileName = filename; } const std::string& getWriteNodeFileName() const { return _writeNodeFileName; } void setDisplayHelp(bool displayHelp) { _displayHelp = displayHelp; } bool getDisplayHelp() const { return _displayHelp; } enum FrameStatsMode { NO_STATS = 0, FRAME_RATE = 1, CAMERA_STATS = 2 }; void setFrameStatsMode(FrameStatsMode mode); FrameStatsMode getFrameStatsMode() { return _frameStatsMode; } void setWriteImageOnNextFrame(bool writeImageOnNextFrame); void setWriteImageFileName(const std::string& filename); const std::string& getWriteImageFileName() const { return _writeImageFileName; } protected: osgProducer::OsgCameraGroup* _cg; std::string _writeNodeFileName; bool _displayHelp; FrameStatsMode _frameStatsMode; bool _firstTimeTogglingFullScreen; class StatsAndHelpDrawCallback; StatsAndHelpDrawCallback* _statsAndHelpDrawCallback; class SnapImageDrawCallback; typedef std::vector SnapImageDrawCallbackList; SnapImageDrawCallbackList _snapImageDrawCallbackList; std::string _writeImageFileName; }; } #endif