#pragma once #include #include //#include "viewer/CameraManipulator.h" class OsgSceneManipulator; class OsgCameraManipulator : public QObject { public: explicit OsgCameraManipulator(osgGA::CameraManipulator* manipulator, QObject* parent = nullptr) noexcept; ~OsgCameraManipulator() override; void Initialize(void); void Uninitialize(void); void SetHomePosition(const osg::Vec3& eye, const osg::Vec3& center, const osg::Vec3& up); //void TrackNode(osg::Node* node); //void SetEventHandle(Core::IEventHandle* pEventHandle); //Core::IEventHandle* GetEventHandle() const; osgGA::CameraManipulator* GetManipulator(void) const; protected: private: osg::ref_ptr sceneManip_; bool initialized_{ false }; }; class OsgSceneManipulator : public osgGA::TrackballManipulator { public: OsgSceneManipulator(void); void setByMatrix(const osg::Matrixd& matrix) override; void setByInverseMatrix(const osg::Matrixd& matrix) override; osg::Matrixd getMatrix() const override; osg::Matrixd getInverseMatrix() const override; //void SetEventHandle(Core::IEventHandle* pEventHandle); //Core::IEventHandle* GetEventHandle() const; void SetSceneManipulator(OsgCameraManipulator* sceneManipulator) { sceneManipulator_ = sceneManipulator; } protected: ~OsgSceneManipulator() override; bool performMovementLeftMouseButton(const double eventTimeDelta, const double dx, const double dy) override; bool handleKeyDown(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us) override; bool handleKeyUp(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us) override; bool handleMousePush(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us) override; bool handleMouseRelease(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us) override; protected: //Core::SharePtr m_pEventHandle; OsgCameraManipulator* sceneManipulator_{ nullptr }; };