You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
1.1 KiB
65 lines
1.1 KiB
|
|
#ifndef CSCI_SIMULATION_SERVICE_H
|
|
#define CSCI_SIMULATION_SERVICE_H
|
|
|
|
#include <QObject>
|
|
#include <QTimer>
|
|
#include <QDateTime>
|
|
#include "simulation_task.h"
|
|
#include "../include/code/err_code.h"
|
|
|
|
enum SimulationCommand { START, STOP , PAUSE, RESUME, EXPEDITE, RETARD };
|
|
|
|
class SimulationService : public QObject{
|
|
|
|
Q_OBJECT
|
|
|
|
private:
|
|
|
|
bool _run; // 运行开关
|
|
|
|
QTimer *_timer; // 定时器
|
|
|
|
int _landform; // 地形
|
|
|
|
int _weather; //天气
|
|
|
|
int _interval; // 步长
|
|
|
|
QDateTime _startTime; // 开始时间
|
|
|
|
QDateTime _endTime; // 结束时间
|
|
|
|
QList<SimulationTask *> _tasks;
|
|
|
|
private:
|
|
SimulationService();
|
|
~SimulationService() override;
|
|
|
|
public:
|
|
void set(int landform, int weather, int interval, const QDateTime& startTime,const QDateTime& endTime);
|
|
|
|
void addTask(const SimulationTask& task);
|
|
|
|
void start();
|
|
|
|
void pause();
|
|
|
|
void end();
|
|
|
|
void clear();
|
|
|
|
public:
|
|
static SimulationService* ins();
|
|
|
|
public: signals:
|
|
void boost();
|
|
|
|
public slots:
|
|
void compute();
|
|
|
|
};
|
|
|
|
|
|
#endif //CSCI_SIMULATION_SERVICE_H
|