PickHandler.hpp 1.2 KB

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