2025-10-12 14:14:16 +00:00
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
|
|
#include <QString>
|
2025-10-26 07:55:41 +00:00
|
|
|
|
#include <QColor>
|
2025-10-12 14:14:16 +00:00
|
|
|
|
|
|
|
|
|
|
enum class FileEntryType {
|
|
|
|
|
|
Curve,
|
|
|
|
|
|
Surface,
|
|
|
|
|
|
Table,
|
|
|
|
|
|
Light
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
inline const char* FileEntryTypeToString(FileEntryType t) {
|
|
|
|
|
|
switch (t) {
|
|
|
|
|
|
case FileEntryType::Curve: return "curve";
|
|
|
|
|
|
case FileEntryType::Surface: return "surface";
|
|
|
|
|
|
case FileEntryType::Table: return "table";
|
|
|
|
|
|
case FileEntryType::Light: return "light";
|
|
|
|
|
|
}
|
|
|
|
|
|
return "unknown";
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline bool FileEntryTypeFromString(const char* s, FileEntryType& out) {
|
|
|
|
|
|
if (!s) return false;
|
|
|
|
|
|
if (0 == strcmp(s, "curve")) { out = FileEntryType::Curve; return true; }
|
|
|
|
|
|
if (0 == strcmp(s, "surface")) { out = FileEntryType::Surface; return true; }
|
|
|
|
|
|
if (0 == strcmp(s, "table")) { out = FileEntryType::Table; return true; }
|
|
|
|
|
|
if (0 == strcmp(s, "light")) { out = FileEntryType::Light; return true; }
|
|
|
|
|
|
return false;
|
2025-10-26 07:55:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class FileEntryCurve;
|
|
|
|
|
|
|
|
|
|
|
|
class FileEntry {
|
|
|
|
|
|
public:
|
|
|
|
|
|
virtual ~FileEntry() = default;
|
|
|
|
|
|
|
|
|
|
|
|
FileEntryType GetType() const { return type_; }
|
|
|
|
|
|
void SetType(FileEntryType type) { type_ = type; }
|
|
|
|
|
|
|
|
|
|
|
|
void SetPath(const QString& path);
|
|
|
|
|
|
QString GetPath() const { return path_; }
|
|
|
|
|
|
|
|
|
|
|
|
void SetFileNanme(const QString& fileNmae) { fileName_ = fileNmae; }
|
|
|
|
|
|
const QString& GetFileName() const { return fileName_; }
|
|
|
|
|
|
|
|
|
|
|
|
void SetName(const QString& name) { name_ = name; }
|
|
|
|
|
|
QString GetName() const { return name_; }
|
|
|
|
|
|
|
|
|
|
|
|
virtual FileEntryCurve* AsCurve() { return nullptr; }
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
FileEntryType type_;
|
|
|
|
|
|
QString path_;
|
|
|
|
|
|
QString fileName_;
|
|
|
|
|
|
QString name_;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// Factory functions for creating FileEntry objects
|
|
|
|
|
|
std::shared_ptr<FileEntry> CreateFileEntry(FileEntryType type, const QString& filePath);
|
|
|
|
|
|
std::shared_ptr<FileEntryCurve> CreateFileEntryCurve(const QString& filePath);
|
|
|
|
|
|
std::shared_ptr<FileEntry> CreateFileEntrySurface(const QString& filePath);
|
|
|
|
|
|
std::shared_ptr<FileEntry> CreateFileEntryTable(const QString& filePath);
|
|
|
|
|
|
std::shared_ptr<FileEntry> CreateFileEntryLight(const QString& filePath);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class FileEntryCurve : public FileEntry {
|
|
|
|
|
|
public:
|
|
|
|
|
|
struct ChartProperties {
|
|
|
|
|
|
int xCount;
|
|
|
|
|
|
QString xTitle;
|
|
|
|
|
|
QString yTitle;
|
|
|
|
|
|
double xMin;
|
|
|
|
|
|
double xMax;
|
|
|
|
|
|
double yMin;
|
|
|
|
|
|
double yMax;
|
|
|
|
|
|
double timeParam;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct CurveProperty {
|
|
|
|
|
|
QString name;
|
|
|
|
|
|
QColor color;
|
|
|
|
|
|
int start;
|
|
|
|
|
|
int stop;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
using CurveProperties = QList<CurveProperty>;
|
|
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
FileEntryCurve() { type_ = FileEntryType::Curve; }
|
|
|
|
|
|
|
|
|
|
|
|
void SetChartProperties(const ChartProperties& props) { chartProperties_ = props; }
|
|
|
|
|
|
const ChartProperties& GetChartProperties() const { return chartProperties_; }
|
|
|
|
|
|
|
|
|
|
|
|
void AddCurveProperty(const CurveProperty& prop) { curveProperties_.append(prop); }
|
|
|
|
|
|
void RemoveCurveProperty(int index) { curveProperties_.removeAt(index); }
|
|
|
|
|
|
const CurveProperties& GetCurveProperties() const { return curveProperties_; }
|
|
|
|
|
|
|
|
|
|
|
|
FileEntryCurve* AsCurve() override { return this; }
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
ChartProperties chartProperties_;
|
|
|
|
|
|
CurveProperties curveProperties_;
|
|
|
|
|
|
};
|