diff --git a/src/ui/MainWindow.cpp b/src/ui/MainWindow.cpp index 4988443a..8c517284 100644 --- a/src/ui/MainWindow.cpp +++ b/src/ui/MainWindow.cpp @@ -220,7 +220,7 @@ void MainWindow::InitUI() { // Restore previous UI layout if available UiLayoutManager::Restore(this, 1); - InitChartLayout(); + //InitChartLayout(); //ui->viewWidget->layout()->addWidget(qtOsgViewWidget_); qtOsgViewWidget_->LoadDefaultScene(); diff --git a/src/ui/Panel/CurvePanel.cpp b/src/ui/Panel/CurvePanel.cpp index da4713c0..0bc838b0 100644 --- a/src/ui/Panel/CurvePanel.cpp +++ b/src/ui/Panel/CurvePanel.cpp @@ -10,10 +10,17 @@ #include #include +#include "ui_FitCurve.h" + CurvePanel::CurvePanel(int index, const QString& filePath, QWidget* parent) : DataPanel(index, FileEntryType::Curve, filePath, parent) , hasChartData_(false) { + m_iXMin = 0; + m_iXMax = 0; + m_iYMax = 0; + m_iYMin = 0; + LOG_INFO("Created CurvePanel {} for file: {}", index, filePath.toStdString()); } @@ -294,25 +301,51 @@ void CurvePanel::UpdateCurveDisplay() void CurvePanel::InitUI() { - if (hasChartData_) { - UpdateCurveDisplay(); - } else { - // Create basic layout for file-based panel - QVBoxLayout* layout = new QVBoxLayout(this); - - // Add placeholder label showing panel information - QLabel* infoLabel = new QLabel(QString("Curve Panel %1\nFile: %2\n\nCurve Drawing Area\nPlease inherit this class to implement specific drawing functionality") - .arg(GetIndex()) - .arg(QFileInfo(GetFilePath()).fileName())); - infoLabel->setAlignment(Qt::AlignCenter); - infoLabel->setStyleSheet("QLabel { color: #666; font-size: 12px; padding: 20px; }"); - - layout->addWidget(infoLabel); - setLayout(layout); - } + initQChartView(); + //if (hasChartData_) { + // UpdateCurveDisplay(); + //} else { + // // Create basic layout for file-based panel + // QVBoxLayout* layout = new QVBoxLayout(this); + // + // // Add placeholder label showing panel information + // QLabel* infoLabel = new QLabel(QString("Curve Panel %1\nFile: %2\n\nCurve Drawing Area\nPlease inherit this class to implement specific drawing functionality") + // .arg(GetIndex()) + // .arg(QFileInfo(GetFilePath()).fileName())); + // infoLabel->setAlignment(Qt::AlignCenter); + // infoLabel->setStyleSheet("QLabel { color: #666; font-size: 12px; padding: 20px; }"); + // + // layout->addWidget(infoLabel); + // setLayout(layout); + //} } QString CurvePanel::GetTypeDisplayName() const { return "Curve"; +} + +void CurvePanel::initQChartView() { + curveChartView = new FitCurveChartView(this); + curveChartView->setMaximumWidth(1730); + curveChartView->setMinimumHeight(480); + + curveChart = new QChart(); + curveChart->setTheme(QChart::ChartThemeBlueIcy); + curveChart->setBackgroundRoundness(0); + curveChartView->setChart(curveChart); + + m_pAxisX = new QValueAxis; + m_pAxisX->setRange(0, 10); + m_pAxisX->setLabelsAngle(-90); + curveChart->addAxis(m_pAxisX, Qt::AlignBottom); + + m_pAxisY = new QValueAxis; + m_pAxisY->setRange(0, 10); + curveChart->addAxis(m_pAxisY, Qt::AlignLeft); + + curveChartView->setRenderHint(QPainter::Antialiasing); + + QHBoxLayout* pLayout = new QHBoxLayout(this); + pLayout->addWidget(curveChartView); } \ No newline at end of file diff --git a/src/ui/Panel/CurvePanel.h b/src/ui/Panel/CurvePanel.h index fa7752ad..f1b321b0 100644 --- a/src/ui/Panel/CurvePanel.h +++ b/src/ui/Panel/CurvePanel.h @@ -3,7 +3,11 @@ #include "DataPanel.h" #include "workspace/ChartData.h" #include +#include "ui/chartPlot/FitCurveChartView.h" +namespace Ui { + class FitCurve; +} /** * @file CurvePanel.h * @brief Curve Panel Class @@ -67,7 +71,7 @@ protected: /** * @brief Initialize UI for curve-specific layout */ - void InitUI() override; + virtual void InitUI(); /** * @brief Get type display name @@ -75,6 +79,8 @@ protected: */ QString GetTypeDisplayName() const override; + void initQChartView(); + private: /** * @brief Update curve display based on chart data @@ -84,4 +90,23 @@ private: private: std::shared_ptr chartData_; // Chart data containing curve information bool hasChartData_; // Flag indicating if chart data is available + + Ui::FitCurve* ui; + FitCurveChartView* curveChartView; + QChart* curveChart; + + bool isPressed = false; + QPoint pressedPoint; + + QValueAxis* m_pAxisX = NULL; + QValueAxis* m_pAxisY = NULL; + float m_iXMax; + float m_iXMin; + float m_iYMax; + float m_iYMin; + + QMap m_seriesIDMap; + + QMap< double, QMap > m_dataWava; + QMap< double, QMap > m_dataReport; }; \ No newline at end of file diff --git a/src/ui/Panel/DataPanel.cpp b/src/ui/Panel/DataPanel.cpp index fa90efeb..217a3f08 100644 --- a/src/ui/Panel/DataPanel.cpp +++ b/src/ui/Panel/DataPanel.cpp @@ -16,7 +16,7 @@ DataPanel::DataPanel(int index, FileEntryType fileType, const QString& filePath, , dockWidget_(nullptr) { title_ = GenerateTitle(); - InitUI(); + //InitUI(); LOG_INFO("Created DataPanel {} for {} file: {}", index_, FileEntryTypeToString(fileType_), filePath_.toStdString()); } diff --git a/src/ui/Panel/DataPanel.h b/src/ui/Panel/DataPanel.h index b75372ba..32f2404d 100644 --- a/src/ui/Panel/DataPanel.h +++ b/src/ui/Panel/DataPanel.h @@ -74,7 +74,10 @@ public: * @brief Refresh panel content (virtual function, implemented by derived classes) */ virtual void RefreshPanel() {} - + /** + * @brief Initialize UI (virtual function, derived classes implement specific layout) + */ + virtual void InitUI(); signals: /** * @brief Panel close signal @@ -88,10 +91,7 @@ protected: */ void closeEvent(QCloseEvent* event) override; - /** - * @brief Initialize UI (virtual function, derived classes implement specific layout) - */ - virtual void InitUI(); + /** * @brief Generate panel title diff --git a/src/ui/Panel/DataPanelManager.cpp b/src/ui/Panel/DataPanelManager.cpp index 46eb1b64..9826a5d5 100644 --- a/src/ui/Panel/DataPanelManager.cpp +++ b/src/ui/Panel/DataPanelManager.cpp @@ -193,6 +193,8 @@ DataPanel* DataPanelManager::CreateDataPanel(FileEntryType fileType, const QStri return nullptr; } + panel->InitUI(); + dockWidget->setWidget(panel); // Set panel's dock widget reference diff --git a/src/ui/Panel/FitCurve.ui b/src/ui/Panel/FitCurve.ui new file mode 100644 index 00000000..70c5f48a --- /dev/null +++ b/src/ui/Panel/FitCurve.ui @@ -0,0 +1,31 @@ + + + FitCurve + + + + 0 + 0 + 977 + 703 + + + + FitCurveDialog + + + + + 70 + 40 + 851 + 621 + + + + + + + + +