52 lines
1.5 KiB
C++
52 lines
1.5 KiB
C++
#pragma once
|
|
|
|
#include <QString>
|
|
#include <QVector>
|
|
#include <QTableWidget>
|
|
|
|
// PathLine 结构体定义(如果还没有在其他地方定义)
|
|
struct PathLine2
|
|
{
|
|
double targetYPosition;
|
|
double speedTargetYPosition;
|
|
double targetXMinPosition;
|
|
double speedTargetXMinPosition;
|
|
double targetXMaxPosition;
|
|
double speedTargetXMaxPosition;
|
|
};
|
|
|
|
class PathLineManager
|
|
{
|
|
public:
|
|
PathLineManager();
|
|
~PathLineManager();
|
|
|
|
// 从TableWidget读取PathLine数据
|
|
static QVector<PathLine2> readFromTableWidget(QTableWidget* tableWidget);
|
|
|
|
// 将PathLine数据写入TableWidget
|
|
static void writeToTableWidget(QTableWidget* tableWidget, const QVector<PathLine2>& pathLines);
|
|
|
|
// 保存PathLine到文件
|
|
static bool saveToFile(const QString& filePath, QTableWidget* tableWidget);
|
|
static bool saveToFile(const QString& filePath, const QVector<PathLine2>& pathLines);
|
|
|
|
// 从文件读取PathLine
|
|
static bool readFromFile(const QString& filePath, QTableWidget* tableWidget);
|
|
static QVector<PathLine2> readFromFile(const QString& filePath, bool* success = nullptr);
|
|
|
|
// 添加一行PathLine到TableWidget
|
|
static void addRecordLine(QTableWidget* tableWidget,
|
|
double yPos = 15.0,
|
|
double ySpeed = 1.0,
|
|
double xMinPos = 0.0,
|
|
double xMinSpeed = 1.0,
|
|
double xMaxPos = 50.0,
|
|
double xMaxSpeed = 1.0);
|
|
|
|
static double calculateTimeFromFile(const QString& filePath);
|
|
|
|
private:
|
|
static const int COLUMN_COUNT = 6;
|
|
};
|