74 lines
2.5 KiB
C++
74 lines
2.5 KiB
C++
#include "DataPanelFactory.h"
|
|
#include "DataPanel.h"
|
|
#include "CurvePanel.h"
|
|
#include "common/SpdLogger.h"
|
|
|
|
// Forward declarations for future panel types
|
|
// #include "SurfacePanel.h"
|
|
// #include "TablePanel.h"
|
|
// #include "LightPanel.h"
|
|
|
|
DataPanel* DataPanelFactory::CreatePanel(FileEntryType fileType, int index, const QString& filePath, QWidget* parent)
|
|
{
|
|
switch (fileType) {
|
|
case FileEntryType::Curve:
|
|
// For now, create CurvePanel which should inherit from DataPanel
|
|
// TODO: Update CurvePanel to inherit from DataPanel
|
|
return new CurvePanel(index, filePath, parent);
|
|
|
|
case FileEntryType::Surface:
|
|
// TODO: Implement SurfacePanel
|
|
LOG_WARN("SurfacePanel not implemented yet, creating base DataPanel");
|
|
return new DataPanel(index, fileType, filePath, parent);
|
|
|
|
case FileEntryType::Table:
|
|
// TODO: Implement TablePanel
|
|
LOG_WARN("TablePanel not implemented yet, creating base DataPanel");
|
|
return new DataPanel(index, fileType, filePath, parent);
|
|
|
|
case FileEntryType::Light:
|
|
// TODO: Implement LightPanel
|
|
LOG_WARN("LightPanel not implemented yet, creating base DataPanel");
|
|
return new DataPanel(index, fileType, filePath, parent);
|
|
|
|
default:
|
|
LOG_ERROR("Unsupported file type: {}", static_cast<int>(fileType));
|
|
return nullptr;
|
|
}
|
|
}
|
|
|
|
DataPanel* DataPanelFactory::CreatePanelWithChartData(FileEntryType type, int index, std::shared_ptr<FileEntryCurve> fileEntry, QWidget* parent)
|
|
{
|
|
// Currently only CurvePanel supports ChartData
|
|
// In the future, other panel types may also support chart data
|
|
return new CurvePanel(index, fileEntry, parent);
|
|
}
|
|
|
|
bool DataPanelFactory::IsTypeSupported(FileEntryType fileType)
|
|
{
|
|
switch (fileType) {
|
|
case FileEntryType::Curve:
|
|
case FileEntryType::Surface:
|
|
case FileEntryType::Table:
|
|
case FileEntryType::Light:
|
|
return true;
|
|
default:
|
|
return false;
|
|
}
|
|
}
|
|
|
|
QString DataPanelFactory::GetTypeDisplayName(FileEntryType fileType)
|
|
{
|
|
switch (fileType) {
|
|
case FileEntryType::Curve:
|
|
return "Curve";
|
|
case FileEntryType::Surface:
|
|
return "Surface";
|
|
case FileEntryType::Table:
|
|
return "Table";
|
|
case FileEntryType::Light:
|
|
return "Light";
|
|
default:
|
|
return "Unknown";
|
|
}
|
|
} |