97 lines
2.1 KiB
C
97 lines
2.1 KiB
C
|
#pragma once
|
||
|
|
||
|
#include <map>
|
||
|
#include <QObject>
|
||
|
|
||
|
#include "scene/OsgScene.h"
|
||
|
#include "scene/OEScene.h"
|
||
|
|
||
|
//#include "../ui/chartPlot/DYTChart.h"
|
||
|
|
||
|
class WorkSpaceItem;
|
||
|
|
||
|
class WorkSpace : public QObject {
|
||
|
Q_OBJECT
|
||
|
|
||
|
public:
|
||
|
explicit WorkSpace(class OsgView* view, QObject* parent = nullptr) noexcept;
|
||
|
WorkSpace(const QString& name, QObject* parent = nullptr);
|
||
|
~WorkSpace() override = default;
|
||
|
|
||
|
inline void SetName(const QString& name) {
|
||
|
name_ = name;
|
||
|
}
|
||
|
inline const QString& GetName() const {
|
||
|
return name_;
|
||
|
}
|
||
|
inline void SetUUid(const QString& uuid) {
|
||
|
uuid_ = uuid;
|
||
|
}
|
||
|
inline const QString& GetUUid() const {
|
||
|
return uuid_;
|
||
|
}
|
||
|
// static WorkSpace* Create(const QString& name);
|
||
|
inline void SetDescribe(const QString& describe) {
|
||
|
describe_ = describe;
|
||
|
}
|
||
|
inline const QString& GetDescribe() const {
|
||
|
return describe_;
|
||
|
}
|
||
|
const std::vector<class Entity*>& GetEntities() const {
|
||
|
return entities_;
|
||
|
}
|
||
|
std::vector<class Entity*>& GetEntities() {
|
||
|
return entities_;
|
||
|
}
|
||
|
|
||
|
void ViewReize(int width, int height);
|
||
|
bool CreateScene(const std::string& scene);
|
||
|
#if USE_OCEAN
|
||
|
OsgScene* GetActiveScene() const;
|
||
|
#else
|
||
|
OEScene* GetActiveScene() const;
|
||
|
#endif
|
||
|
|
||
|
bool SetTimestep(class Timestep* timestep);
|
||
|
bool SetTimestepPath(const QString& path);
|
||
|
class Timestep* GetTimestep() const {
|
||
|
return timestep_;
|
||
|
}
|
||
|
|
||
|
bool SetLampStatus(class LampStatus* timestep);
|
||
|
bool SetLampPath(const QString& path);
|
||
|
class LampStatus* GetLampStatus() const {
|
||
|
return lampStatus_;
|
||
|
}
|
||
|
|
||
|
void AddEntity(class Entity* entity);
|
||
|
void RemoveEntity(class Entity* entity);
|
||
|
|
||
|
bool Save(const QString& path);
|
||
|
bool Save();
|
||
|
|
||
|
bool Load(const QString& dyt);
|
||
|
void Unlaod();
|
||
|
|
||
|
void Begin();
|
||
|
void OnFrame(double dt);
|
||
|
void End();
|
||
|
|
||
|
Q_SIGNALS:
|
||
|
void EntityAdded(class Entity* entity);
|
||
|
void EntityRemoved(class Entity* entity);
|
||
|
|
||
|
private:
|
||
|
QString name_;
|
||
|
QString uuid_;
|
||
|
QString describe_;
|
||
|
QString path_;
|
||
|
|
||
|
std::vector<class Entity*> entities_;
|
||
|
osg::ref_ptr<OEScene> activeScene_;
|
||
|
class OsgView* view_{ nullptr };
|
||
|
class Timestep* timestep_{ nullptr };
|
||
|
class LampStatus* lampStatus_{ nullptr };
|
||
|
};
|
||
|
|