PickEventHandler 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2018 Robert Osfield
  2. *
  3. * This library is open source and may be redistributed and/or modified under
  4. * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
  5. * (at your option) any later version. The full license is in LICENSE file
  6. * included with this distribution, and on the openscenegraph.org website.
  7. *
  8. * This library is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * OpenSceneGraph Public License for more details.
  12. */
  13. #ifndef PICKEVENTHANDLER
  14. #define PICKEVENTHANDLER 1
  15. #include <osg/StateSet>
  16. #include <osg/Point>
  17. #include <osgGA/GUIEventHandler>
  18. #include <osgPresentation/SlideEventHandler>
  19. namespace osgPresentation
  20. {
  21. class OSGPRESENTATION_EXPORT PickEventHandler : public osgGA::GUIEventHandler
  22. {
  23. public:
  24. PickEventHandler(osgPresentation::Operation operation, const JumpData& jumpData=JumpData());
  25. PickEventHandler(const std::string& str, osgPresentation::Operation operation, const JumpData& jumpData=JumpData());
  26. PickEventHandler(const osgPresentation::KeyPosition& keyPos, const JumpData& jumpData=JumpData());
  27. void setOperation(osgPresentation::Operation operation) { _operation = operation; }
  28. osgPresentation::Operation getOperation() const { return _operation; }
  29. void setCommand(const std::string& str) { _command = str; }
  30. const std::string& getCommand() const { return _command; }
  31. void setKeyPosition(const osgPresentation::KeyPosition& keyPos) { _keyPos = keyPos; }
  32. const osgPresentation::KeyPosition& getKeyPosition() const { return _keyPos; }
  33. void setJumpData(const JumpData& jumpData) { _jumpData = jumpData; }
  34. const JumpData& getJumpData() const { return _jumpData; }
  35. virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& aa, osg::Object* object, osg::NodeVisitor* nv);
  36. virtual void getUsage(osg::ApplicationUsage& usage) const;
  37. void doOperation();
  38. std::string _command;
  39. osgPresentation::KeyPosition _keyPos;
  40. osgPresentation::Operation _operation;
  41. JumpData _jumpData;
  42. std::set<osg::Drawable*> _drawablesOnPush;
  43. };
  44. }
  45. #endif