2025-01-04 04:12:51 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
|
|
|
|
|
|
#include <osgViewer/View>
|
|
|
|
|
#include <QWidget>
|
|
|
|
|
|
|
|
|
|
class OsgCameraManipulator;
|
2025-01-12 17:35:51 +00:00
|
|
|
class OsgViewUI;
|
2025-01-04 04:12:51 +00:00
|
|
|
|
|
|
|
|
class OsgView : public QObject {
|
|
|
|
|
public:
|
|
|
|
|
OsgView(QObject* parent = nullptr) noexcept;
|
|
|
|
|
~OsgView();
|
|
|
|
|
|
|
|
|
|
void InitGraphiceWindow(int x, int y, int width, int height,
|
|
|
|
|
WId windowHandle, const char* name = "",
|
|
|
|
|
bool windowDecoration = false);
|
|
|
|
|
void InitView(osgViewer::View* pView);
|
|
|
|
|
osgViewer::View* GetView(void) const;
|
|
|
|
|
void Resize(int x, int y, int width, int height);
|
|
|
|
|
void MouseMotion(int x, int y);
|
|
|
|
|
void MousePress(int x, int y, unsigned int button);
|
|
|
|
|
void MouseRelease(int x, int y, unsigned int button);
|
|
|
|
|
void MouseWheel(int wheel);
|
|
|
|
|
void KeyPress(QKeyEvent* keyInput);
|
|
|
|
|
void KeyRelease(QKeyEvent* keyInput);
|
|
|
|
|
void SetKeyModifiers(int mask);
|
|
|
|
|
|
|
|
|
|
void Initialize(OsgCameraManipulator* cameraManipulator);
|
|
|
|
|
void Uninitialize(void);
|
|
|
|
|
|
2025-01-12 17:35:51 +00:00
|
|
|
OsgViewUI* GetViewUI(void) const { return viewUI_; }
|
|
|
|
|
|
2025-01-04 04:12:51 +00:00
|
|
|
bool SetCameraManipulator(OsgCameraManipulator* cameraManipulator);
|
|
|
|
|
OsgCameraManipulator* GetCameraManipulator(void) const {
|
|
|
|
|
return cameraManipulator_;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
osgGA::EventQueue* GetEventQueue() const;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
osg::ref_ptr<osg::GraphicsContext> graphiceWindow_;
|
|
|
|
|
osg::ref_ptr<osgViewer::View> view_;
|
2025-01-12 17:35:51 +00:00
|
|
|
osg::ref_ptr<OsgViewUI> viewUI_;
|
2025-01-04 04:12:51 +00:00
|
|
|
OsgCameraManipulator* cameraManipulator_{ nullptr };
|
|
|
|
|
bool initialized_{ false };
|
|
|
|
|
};
|