PickHandler.hpp 1.1 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 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. bool _addNewPoints = true;
  22. bool _clickStartedOnElement = false;
  23. OSGWidget* _osgWidget;
  24. double _optiTrackSteamVRLength;
  25. int _selectedPoint = -1;
  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. void invalidateTrackPointColors();
  32. };