PickHandler.hpp 1012 B

123456789101112131415161718192021222324252627282930
  1. #pragma once
  2. #include "StoreHandler.hpp"
  3. #include "OpenScadRenderer.hpp"
  4. #include "ThreeMFWriter.hpp"
  5. #include <osgGA/GUIEventHandler>
  6. class PickHandler: public osgGA::GUIEventHandler {
  7. public:
  8. PickHandler(StoreHandler* storeHandler, OpenScadRenderer* openScadRenderer, ThreeMFWriter* threeMFWriter, osg::ref_ptr<osg::Node> axesNode);
  9. osg::Node* getOrCreateSelectionCylinder();
  10. virtual bool handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa);
  11. void moveTo(osg::Vec3f position);
  12. void rotateToNormalVector(osg::Vec3f normal);
  13. void setVisibility(bool mode);
  14. protected:
  15. osg::ref_ptr<osg::Switch> _selectionSwitch;
  16. osg::ref_ptr<osg::MatrixTransform> _selectionTranslateGroup;
  17. osg::ref_ptr<osg::MatrixTransform> _selectionRotateGroup;
  18. osg::ref_ptr<osg::MatrixTransform> _selectionMoveToEndGroup;
  19. bool isSelection = true;
  20. private:
  21. StoreHandler* _storeHandler;
  22. OpenScadRenderer* _openScadRenderer;
  23. ThreeMFWriter* _threeMFWriter;
  24. osg::ref_ptr<osg::Node> _axesNode;
  25. };