#pragma once #include #include #include "app/Singleton.h" #include "ui/chartPlot/DYTChart.h" #include "ui/Table/targetlistwgt.h" class WorkSpace; class WorkSpaceManager : public QObject, public Singleton { Q_OBJECT public: explicit WorkSpaceManager(QObject* parent = nullptr); ~WorkSpaceManager(); void OnDestory(); bool Contains(const QString& name) const; WorkSpace* LoadDyt(const QString& dyt, class OsgView* view); WorkSpace* GetOrCreate(const QString& path); void SetCurrent(WorkSpace* workspace); WorkSpace* GetCurrent() const { return current_; } bool SetDYTChart2D(class DYTChart* curveChart) { if (!curveChart) { return false; } curveChart2D_ = curveChart; return true; } class DYTChart* GetDYTChart2D() const { return curveChart2D_; } bool SetDYTChart2DLg(class DYTChart* curveChart) { if (!curveChart) { return false; } curveChart2DLg_ = curveChart; return true; } class DYTChart* GetDYTChart2DLg() const { return curveChart2DLg_; } bool SetDYTChart3D(class DYTChart* curveChart) { if (!curveChart) { return false; } curveChart3D_ = curveChart; return true; } class DYTChart* GetDYTChart3D() const { return curveChart3D_; } bool SetTargetListWgt(class TargetListWgt* targetListTable) { if (!targetListTable) { return false; } targetListTable_ = targetListTable; return true; } class TargetListWgt* GetTargetListWgt() const { return targetListTable_; } void OnFrame(); signals: void WorkSpaceChanged(WorkSpace*); private: std::unordered_map workSpaces_; WorkSpace* current_{ nullptr }; int64_t lastTime_{ 0 }; class DYTChart* curveChart2D_{ nullptr }; class DYTChart* curveChart2DLg_{ nullptr }; class DYTChart* curveChart3D_{ nullptr }; class TargetListWgt* targetListTable_{ nullptr }; };