Compare commits
8 Commits
e693562387
...
87091abf12
| Author | SHA1 | Date | |
|---|---|---|---|
| 87091abf12 | |||
| 18963d4dea | |||
| b79754b443 | |||
| 71444e3a41 | |||
| bbb9323e09 | |||
| e69d916779 | |||
| 2240f02a62 | |||
| 1eb367d265 |
@ -1440,6 +1440,14 @@
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>FitCurve</name>
|
||||
<message>
|
||||
<location filename="../ui/Panel/FitCurve.ui" line="14"/>
|
||||
<source>FitCurveDialog</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>FitCurveChartView</name>
|
||||
<message>
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -10,10 +10,17 @@
|
||||
#include <QCheckBox>
|
||||
#include <QHBoxLayout>
|
||||
|
||||
#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());
|
||||
}
|
||||
|
||||
@ -298,22 +305,23 @@ 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
|
||||
@ -321,5 +329,31 @@ QString CurvePanel::GetTypeDisplayName() const
|
||||
return "Curve";
|
||||
}
|
||||
|
||||
void CurvePanel::OnDataPanelUpdated(FileEntryCurve* fileEntry) {
|
||||
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);
|
||||
}
|
||||
|
||||
void CurvePanel::OnDataPanelUpdated(FileEntryCurve* fileEntry) {
|
||||
int a = 0;
|
||||
}
|
||||
|
||||
@ -4,7 +4,11 @@
|
||||
#include "workspace/ChartData.h"
|
||||
#include "workspace/FileEntry.h"
|
||||
#include <memory>
|
||||
#include "ui/chartPlot/FitCurveChartView.h"
|
||||
|
||||
namespace Ui {
|
||||
class FitCurve;
|
||||
}
|
||||
/**
|
||||
* @file CurvePanel.h
|
||||
* @brief Curve Panel Class
|
||||
@ -68,7 +72,7 @@ protected:
|
||||
/**
|
||||
* @brief Initialize UI for curve-specific layout
|
||||
*/
|
||||
void InitUI() override;
|
||||
virtual void InitUI();
|
||||
|
||||
/**
|
||||
* @brief Get type display name
|
||||
@ -76,6 +80,9 @@ protected:
|
||||
*/
|
||||
QString GetTypeDisplayName() const override;
|
||||
|
||||
|
||||
void initQChartView();
|
||||
|
||||
void OnDataPanelUpdated(FileEntryCurve* fileEntry);
|
||||
|
||||
private:
|
||||
@ -87,4 +94,23 @@ private:
|
||||
private:
|
||||
std::shared_ptr<BaseChartData> 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<int, QSplineSeries*> m_seriesIDMap;
|
||||
|
||||
QMap< double, QMap<int, QVariantList> > m_dataWava;
|
||||
QMap< double, QMap<int, QPointF> > m_dataReport;
|
||||
};
|
||||
@ -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());
|
||||
}
|
||||
|
||||
@ -80,7 +80,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
|
||||
@ -94,10 +97,7 @@ protected:
|
||||
*/
|
||||
void closeEvent(QCloseEvent* event) override;
|
||||
|
||||
/**
|
||||
* @brief Initialize UI (virtual function, derived classes implement specific layout)
|
||||
*/
|
||||
virtual void InitUI();
|
||||
|
||||
|
||||
/**
|
||||
* @brief Generate panel title
|
||||
|
||||
@ -193,6 +193,8 @@ DataPanel* DataPanelManager::CreateDataPanel(FileEntryType fileType, const QStri
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//panel->InitUI();
|
||||
|
||||
auto fileEntries = currentWorkspace_->GetFileEntries(fileType);
|
||||
if (index < fileEntries.size()) {
|
||||
panel->SetFileEntry(fileEntries[index]);
|
||||
|
||||
31
src/ui/Panel/FitCurve.ui
Normal file
31
src/ui/Panel/FitCurve.ui
Normal file
@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>FitCurve</class>
|
||||
<widget class="QDialog" name="FitCurve">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>977</width>
|
||||
<height>703</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>FitCurveDialog</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="horizontalLayoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>70</x>
|
||||
<y>40</y>
|
||||
<width>851</width>
|
||||
<height>621</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="chartLayout"/>
|
||||
</widget>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@ -107,21 +107,42 @@ void TargetListWgt::updateParseFile(const QString & strFile, int nT, QVariantLis
|
||||
double t = listLine.at(nT).toDouble();
|
||||
|
||||
QMap<int, QVariantList> mapData;
|
||||
for (int nI = 0; nI < listCurve.size(); nI++)
|
||||
if (listCurve.size() == 0)
|
||||
{
|
||||
QVariantMap mapCurve = listCurve.at(nI).toMap();
|
||||
QString strData = mapCurve.value("Data").toString();
|
||||
QStringList listData = strData.split(",");
|
||||
|
||||
QVariantList varList;
|
||||
for (int nJ = 0; nJ < listData.size(); nJ++)
|
||||
int nCount = ui.tableWidget->columnCount();
|
||||
int nRow = (listLine.size() - 1) / nCount;
|
||||
for (int nI = 0; nI < nRow; nI++)
|
||||
{
|
||||
int nIndex = listData.at(nJ).toInt();
|
||||
double data = listLine.at(nIndex).toDouble();
|
||||
varList.push_back(data);
|
||||
int nBegin = nT + 1 + nI * nCount;
|
||||
QVariantList varList;
|
||||
for (int nJ = 0; nJ < nCount; nJ++)
|
||||
{
|
||||
int nIndex = nBegin + nJ;
|
||||
double data = listLine.at(nIndex).toDouble();
|
||||
varList.push_back(data);
|
||||
}
|
||||
mapData.insert(nI, varList);
|
||||
}
|
||||
mapData.insert(nI, varList);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int nI = 0; nI < listCurve.size(); nI++)
|
||||
{
|
||||
QVariantMap mapCurve = listCurve.at(nI).toMap();
|
||||
QString strData = mapCurve.value("Data").toString();
|
||||
QStringList listData = strData.split(",");
|
||||
|
||||
QVariantList varList;
|
||||
for (int nJ = 0; nJ < listData.size(); nJ++)
|
||||
{
|
||||
int nIndex = listData.at(nJ).toInt();
|
||||
double data = listLine.at(nIndex).toDouble();
|
||||
varList.push_back(data);
|
||||
}
|
||||
mapData.insert(nI, varList);
|
||||
}
|
||||
}
|
||||
|
||||
m_dataTable.insert(t, mapData);
|
||||
}
|
||||
}
|
||||
|
||||
@ -19,8 +19,18 @@ struct CurveColorData : public BaseCurveData {
|
||||
};
|
||||
|
||||
struct CurveData : public CurveColorData {
|
||||
double start;
|
||||
double stop;
|
||||
int start;
|
||||
int stop;
|
||||
int x;
|
||||
int y;
|
||||
|
||||
CurveData()
|
||||
{
|
||||
start = 0;
|
||||
stop = 0;
|
||||
x = 0;
|
||||
y = 0;
|
||||
}
|
||||
};
|
||||
|
||||
struct TableCurveData : public CurveColorData {
|
||||
@ -59,6 +69,7 @@ public:
|
||||
double yMin;
|
||||
double yMax;
|
||||
int xCount;
|
||||
int yCount;
|
||||
QList<CurveData> curves;
|
||||
|
||||
FileEntryType getType() const override { return FileEntryType::Curve; }
|
||||
|
||||
@ -133,34 +133,37 @@ bool WorkSpaceXMLParse::ParseFiles(const tinyxml2::XMLElement* element) {
|
||||
|
||||
// Parse curve-specific attributes
|
||||
if (const char* chartName = chartElement->Attribute("name")) {
|
||||
curveChart->name = QString::fromLocal8Bit(chartName);
|
||||
curveChart->name = QString(chartName);
|
||||
}
|
||||
if (const char* path = chartElement->Attribute("path")) {
|
||||
curveChart->path = QString::fromLocal8Bit(path);
|
||||
curveChart->path = QString(path);
|
||||
}
|
||||
if (const char* xTitle = chartElement->Attribute("xTitle")) {
|
||||
curveChart->xTitle = QString::fromLocal8Bit(xTitle);
|
||||
curveChart->xTitle = QString(xTitle);
|
||||
}
|
||||
if (const char* yTitle = chartElement->Attribute("yTitle")) {
|
||||
curveChart->yTitle = QString::fromLocal8Bit(yTitle);
|
||||
curveChart->yTitle = QString(yTitle);
|
||||
}
|
||||
if (const char* xMin = chartElement->Attribute("xMin")) {
|
||||
curveChart->xMin = QString::fromLocal8Bit(xMin).toDouble();
|
||||
curveChart->xMin = QString(xMin).toDouble();
|
||||
}
|
||||
if (const char* xMax = chartElement->Attribute("xMax")) {
|
||||
curveChart->xMax = QString::fromLocal8Bit(xMax).toDouble();
|
||||
curveChart->xMax = QString(xMax).toDouble();
|
||||
}
|
||||
if (const char* yMin = chartElement->Attribute("yMin")) {
|
||||
curveChart->yMin = QString::fromLocal8Bit(yMin).toDouble();
|
||||
curveChart->yMin = QString(yMin).toDouble();
|
||||
}
|
||||
if (const char* yMax = chartElement->Attribute("yMax")) {
|
||||
curveChart->yMax = QString::fromLocal8Bit(yMax).toDouble();
|
||||
curveChart->yMax = QString(yMax).toDouble();
|
||||
}
|
||||
if (const char* xCount = chartElement->Attribute("xCount")) {
|
||||
curveChart->xCount = QString::fromLocal8Bit(xCount).toInt();
|
||||
curveChart->xCount = QString(xCount).toInt();
|
||||
}
|
||||
if (const char* yCount = chartElement->Attribute("yCount")) {
|
||||
curveChart->yCount = QString(yCount).toInt();
|
||||
}
|
||||
if (const char* t = chartElement->Attribute("t")) {
|
||||
curveChart->t = QString::fromLocal8Bit(t);
|
||||
curveChart->t = QString(t);
|
||||
}
|
||||
|
||||
// Parse curve elements
|
||||
@ -169,17 +172,23 @@ bool WorkSpaceXMLParse::ParseFiles(const tinyxml2::XMLElement* element) {
|
||||
CurveData curveData;
|
||||
|
||||
if (const char* curveName = curveElement->Attribute("name")) {
|
||||
curveData.name = QString::fromLocal8Bit(curveName);
|
||||
curveData.name = QString(curveName);
|
||||
}
|
||||
if (const char* color = curveElement->Attribute("color")) {
|
||||
curveData.color = QString::fromLocal8Bit(color);
|
||||
curveData.color = QString(color);
|
||||
}
|
||||
if (const char* start = curveElement->Attribute("start")) {
|
||||
curveData.start = QString::fromLocal8Bit(start).toDouble();
|
||||
curveData.start = QString(start).toInt();
|
||||
}
|
||||
if (const char* stop = curveElement->Attribute("stop")) {
|
||||
curveData.stop = QString::fromLocal8Bit(stop).toDouble();
|
||||
curveData.stop = QString(stop).toInt();
|
||||
}
|
||||
if (const char* stop = curveElement->Attribute("x")) {
|
||||
curveData.x = QString(stop).toInt();
|
||||
}
|
||||
if (const char* stop = curveElement->Attribute("y")) {
|
||||
curveData.y = QString(stop).toInt();
|
||||
}
|
||||
|
||||
curveChart->curves.append(curveData);
|
||||
curveElement = curveElement->NextSiblingElement("curve");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user