DYTSrouce/src/workspace/WorkSpace.h

165 lines
3.6 KiB
C
Raw Normal View History

2025-01-04 04:12:51 +00:00
#pragma once
#include <map>
#include <QObject>
2025-01-05 18:18:16 +00:00
#include <osgEarth/Viewpoint>
2025-01-04 04:12:51 +00:00
#include "scene/OsgScene.h"
#include "scene/OEScene.h"
2025-01-05 13:49:36 +00:00
#include "config.h"
#include "common/SpdLogger.h"
2025-01-04 04:12:51 +00:00
//#include "../ui/chartPlot/DYTChart.h"
class WorkSpaceItem;
class WorkSpace : public QObject {
Q_OBJECT
public:
2025-01-05 13:49:36 +00:00
explicit WorkSpace(QObject* parent = nullptr) noexcept;
WorkSpace(const QString& path, QObject* parent = nullptr);
2025-01-04 04:12:51 +00:00
~WorkSpace() override = default;
inline void SetName(const QString& name) {
name_ = name;
}
inline const QString& GetName() const {
return name_;
}
2025-01-05 11:12:18 +00:00
inline const QString& GetPath() const {
return path_;
}
2025-01-05 15:12:58 +00:00
const QString GetDir() const;
2025-01-04 04:12:51 +00:00
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_;
}
2025-01-07 15:45:23 +00:00
inline void SetSimMatlab(const QString& path) {
simMatlabPath_ = path;
}
inline const QString GetSimMatlab() const {
return simMatlabPath_;
}
inline void SetMatlabParam(const QString& path) {
matlabParamPath_ = path;
}
inline const QString GetMatlabParam() const {
return matlabParamPath_;
}
inline void SetWavePath(const QString& path) {
waveFile_ = path;
}
inline const QString GetWavePath() const {
return waveFile_;
}
inline void SetReportPath(const QString& path) {
reportFile_ = path;
}
inline const QString GetReportPath() const {
return reportFile_;
}
inline void SetRDPath(const QString& path) {
rdFile_ = path;
}
inline const QString GetRDPath() const {
return rdFile_;
}
2025-01-05 18:18:16 +00:00
inline void SetHomeViewpoint(const osgEarth::Viewpoint& viewpoint) {
homeViewpoint_ = viewpoint;
2025-06-17 18:05:47 +00:00
homeViewpoint_.setHeading(0.0); // Ensure heading is set to 0.0
2025-01-05 18:18:16 +00:00
}
inline const osgEarth::Viewpoint& GetHomeViewpoint() const {
return homeViewpoint_;
}
2025-01-04 04:12:51 +00:00
const std::vector<class Entity*>& GetEntities() const {
return entities_;
}
std::vector<class Entity*>& GetEntities() {
return entities_;
}
2025-04-21 00:20:00 +00:00
void SetActiveScene(OEScene* scene);
2025-01-04 04:12:51 +00:00
2025-01-05 13:49:36 +00:00
OEScene* GetActiveScene() const {
dyt_check(nullptr != scene_);
return scene_;
}
2025-01-04 04:12:51 +00:00
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);
2025-06-17 18:05:47 +00:00
bool TrackEntity(class Entity* entity);
void UntrackEntity();
2025-06-18 15:33:06 +00:00
class Entity* GetTrackEntity() const {
return trackedEntity_;
}
2025-01-04 04:12:51 +00:00
bool Save(const QString& path);
bool Save();
bool Load(const QString& dyt);
void Unlaod();
void Begin();
void OnFrame(double dt);
void End();
2025-01-05 11:12:18 +00:00
void OnLoaded();
2025-01-04 04:12:51 +00:00
Q_SIGNALS:
void EntityAdded(class Entity* entity);
void EntityRemoved(class Entity* entity);
2025-01-05 11:12:18 +00:00
void TimestepChanged(class Timestep* timestep);
void LampStatusChanged(class LampStatus* lampStatus);
2025-01-04 04:12:51 +00:00
private:
QString name_;
QString uuid_;
QString describe_;
QString path_;
2025-01-07 15:45:23 +00:00
QString simMatlabPath_;
QString waveFile_;
QString reportFile_;
QString rdFile_;
QString matlabParamPath_;
2025-01-05 18:18:16 +00:00
osgEarth::Viewpoint homeViewpoint_;
2025-01-04 04:12:51 +00:00
2025-01-05 03:33:33 +00:00
bool leaded_{ false };
2025-01-04 04:12:51 +00:00
std::vector<class Entity*> entities_;
2025-01-05 13:49:36 +00:00
OEScene* scene_{ nullptr };
2025-01-04 04:12:51 +00:00
class Timestep* timestep_{ nullptr };
class LampStatus* lampStatus_{ nullptr };
2025-06-17 18:05:47 +00:00
class Entity* trackedEntity_{ nullptr };
2025-01-04 04:12:51 +00:00
};