PickHandler.hpp 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. #pragma once
  2. // Include modules
  3. #include "MainWindow.hpp"
  4. #include "OSGWidget.hpp"
  5. // Include dependencies
  6. #include <osgGA/GUIEventHandler>
  7. class PickHandler: public osgGA::GUIEventHandler {
  8. public:
  9. PickHandler(OSGWidget* osgWidget, osg::ref_ptr<osg::Group> root);
  10. osg::Node* getPickerRoot();
  11. virtual bool handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa);
  12. void setTrackingSystem(ActiveTrackingSystem activeTrackingSystem);
  13. void setSelection(bool addNewPoints);
  14. void updateRenderer();
  15. //protected:
  16. private:
  17. osg::ref_ptr<osg::Switch> _selectionSwitch;
  18. osg::ref_ptr<osg::MatrixTransform> _selectionTranslateGroup;
  19. osg::ref_ptr<osg::MatrixTransform> _selectionRotateGroup;
  20. osg::ref_ptr<osg::MatrixTransform> _selectionMoveToEndGroup;
  21. ActiveTrackingSystem _activeTrackingSystem = OptiTrack;
  22. bool _addNewPoints = true;
  23. bool _clickStartedOnElement = false;
  24. OSGWidget* _osgWidget;
  25. double _optiTrackSteamVRLength;
  26. void moveTo(osg::Vec3f position);
  27. void rotateToNormalVector(osg::Vec3f normal);
  28. void removeAllShapes();
  29. void setVisibility(bool mode);
  30. void addPoint(osg::Vec3 point, osg::Vec3 normal);
  31. };