67 lines
1.2 KiB
C++
67 lines
1.2 KiB
C++
#pragma once
|
|
|
|
#include <vector>
|
|
|
|
#include <QObject>
|
|
#include <QString>
|
|
|
|
class WorkSpace;
|
|
|
|
class Timestep : public QObject {
|
|
Q_OBJECT
|
|
public:
|
|
enum class PlayStatus : uint8_t {
|
|
PS_Started,
|
|
PS_Stoped,
|
|
PS_Suspended,
|
|
};
|
|
|
|
public:
|
|
explicit Timestep(const std::vector<double>& steps, const QString& path, WorkSpace* parent = nullptr) noexcept;
|
|
~Timestep() override = default;
|
|
|
|
static Timestep* Load(const QString& path, WorkSpace* workSpace = nullptr);
|
|
|
|
const std::vector<double>& GetSteps() const {
|
|
return steps_;
|
|
}
|
|
const QString& GetPath() const {
|
|
return path_;
|
|
}
|
|
|
|
void GetRange(double& minTime, double& maxTime, double& step);
|
|
void Update(double dt);
|
|
double GetCurrent() const {
|
|
return current_;
|
|
}
|
|
|
|
bool IsPause();
|
|
bool IsStoped();
|
|
void Start();
|
|
void Resume();
|
|
void Pause();
|
|
void Stop();
|
|
|
|
void Up();
|
|
void Down();
|
|
|
|
Q_SIGNALS:
|
|
void StatusChanged(int);
|
|
void StepChanged(double);
|
|
void TimeChanged(double);
|
|
|
|
|
|
private:
|
|
std::vector<double> steps_;
|
|
QString path_;
|
|
double current_{ 0.0 };
|
|
double maxTime_{ 0.0 };
|
|
double currentStep_{ 1.0 };
|
|
double currentSpeed = { 1.0 };
|
|
|
|
|
|
PlayStatus playStatus_{ PlayStatus::PS_Stoped };
|
|
WorkSpace* workSpace_{ nullptr };
|
|
};
|
|
|