DYTSrouce/src/viewer/OsgWidget.h

59 lines
1.7 KiB
C
Raw Normal View History

2025-11-01 11:33:08 +00:00
#pragma once
2025-02-22 15:16:54 +00:00
2025-03-13 00:42:41 +00:00
#include <QTimer>
#include <osgViewer/CompositeViewer>
#include "osgqt/GraphicsWindowQt.h"
2025-02-22 15:16:54 +00:00
2025-03-13 00:42:41 +00:00
class OEScene;
2025-02-22 15:16:54 +00:00
2025-03-13 00:42:41 +00:00
class OsgWidget : public QWidget, public osgViewer::CompositeViewer {
2025-02-22 15:16:54 +00:00
Q_OBJECT
public:
2025-03-13 00:42:41 +00:00
OsgWidget(QWidget *parent = nullptr, Qt::WindowFlags f = nullptr);
2025-06-18 15:33:06 +00:00
~OsgWidget() override;
2025-03-13 00:42:41 +00:00
void Initialize(void);
2025-06-19 14:05:52 +00:00
void Uninitialize(void);
2025-03-13 00:42:41 +00:00
void LoadDefaultScene(void);
void OnLoadDyt(const QString& path);
2025-02-22 15:16:54 +00:00
signals:
2025-03-13 00:42:41 +00:00
void signalResetWorkSpace();
void signalScaleInfo(const QString&);
2025-02-22 15:16:54 +00:00
protected:
2025-03-13 00:42:41 +00:00
osgQt::GraphicsWindowQt* createGraphicsWindow( int x, int y, int w, int h,
const std::string& name="", bool windowDecoration=false );
QWidget* addViewWidget( osgQt::GraphicsWindowQt* gw);
void resizeEvent(QResizeEvent* event) override;
void paintEvent( QPaintEvent* /*event*/ ) override;
2025-10-29 00:16:25 +00:00
// 拖拽事件处理
void dragEnterEvent(QDragEnterEvent* event) override;
void dragMoveEvent(QDragMoveEvent* event) override;
void dropEvent(QDropEvent* event) override;
public slots:
/**
* @brief
* @param modelType
* @param modelName
* @param position
*/
void OnPresetModelDropped(const QString& modelType, const QString& modelName, const QPointF& position = QPointF());
2025-11-01 11:33:08 +00:00
bool ScreenToWorldCoordinate(int x, int y, double& longitude, double& latitude, double& altitude);
2025-02-22 15:16:54 +00:00
private:
2025-03-13 00:42:41 +00:00
QTimer timer_;
osg::ref_ptr<OEScene> activeScene_;
osg::ref_ptr<class OsgViewUI> viewUI_;
class WorkSpace* workspace_{ nullptr };
osg::ref_ptr<osgViewer::View> view_;
// class OsgView* view_{nullptr};
2025-02-22 15:16:54 +00:00
};
2025-03-13 00:42:41 +00:00