Compare commits
No commits in common. "fafd2902445bc39c6a5b1424579b5b8fc1cc3eb7" and "c2c88b4ebc81740868fb932204d993f2729ebd90" have entirely different histories.
fafd290244
...
c2c88b4ebc
@ -1,6 +1,5 @@
|
||||
#include "ui/Panel/CurvePanel.h"
|
||||
#include "ui/DockWidget.h"
|
||||
#include "ui/DockTitleBar.h"
|
||||
#include "common/SpdLogger.h"
|
||||
|
||||
#include <QVBoxLayout>
|
||||
@ -27,11 +26,6 @@ CurvePanel::CurvePanel(int index, const QString& filePath, QWidget* parent)
|
||||
CurvePanel::CurvePanel(int index, std::shared_ptr<FileEntryCurve> fileEntry, QWidget* parent)
|
||||
: DataPanel(index, fileEntry, parent)
|
||||
{
|
||||
m_iXMin = 0;
|
||||
m_iXMax = 0;
|
||||
m_iYMax = 0;
|
||||
m_iYMin = 0;
|
||||
|
||||
if (fileEntry) {
|
||||
LOG_INFO("Created CurvePanel {} for chart: {}", index, fileEntry->GetName().toStdString());
|
||||
// Override the title with chart name
|
||||
@ -55,9 +49,9 @@ void CurvePanel::RefreshPanel()
|
||||
OnDataPanelUpdated(fileEntry);
|
||||
}
|
||||
|
||||
//if (IsValid()) {
|
||||
// UpdateCurveDisplay();
|
||||
//}
|
||||
if (IsValid()) {
|
||||
UpdateCurveDisplay();
|
||||
}
|
||||
|
||||
LOG_INFO("Refreshed CurvePanel {}", GetIndex());
|
||||
}
|
||||
@ -305,6 +299,7 @@ void CurvePanel::UpdateCurveDisplay()
|
||||
void CurvePanel::InitUI()
|
||||
{
|
||||
initQChartView();
|
||||
|
||||
}
|
||||
|
||||
QString CurvePanel::GetTypeDisplayName() const
|
||||
@ -334,394 +329,9 @@ void CurvePanel::initQChartView() {
|
||||
curveChartView->setRenderHint(QPainter::Antialiasing);
|
||||
|
||||
QHBoxLayout* pLayout = new QHBoxLayout(this);
|
||||
pLayout->setContentsMargins(0, 0, 0, 0);
|
||||
pLayout->addWidget(curveChartView);
|
||||
}
|
||||
|
||||
void CurvePanel::OnDataPanelUpdated(FileEntryCurve* fileEntry) {
|
||||
FileEntryCurve::ChartProperties propChart = fileEntry->GetChartProperties();
|
||||
|
||||
QString strName = fileEntry->GetName();
|
||||
updateTitle(strName);
|
||||
|
||||
updateTitleAxis(propChart.xTitle, propChart.yTitle);
|
||||
updateMinMaxX(propChart.xMin, propChart.xMax, propChart.xCount);
|
||||
updateMinMaxY(propChart.yMin, propChart.yMax, propChart.yCount);
|
||||
|
||||
QString strFile = fileEntry->GetPath() + "/" + fileEntry->GetFileName();
|
||||
FileEntryCurve::CurveProperties propCurves = fileEntry->GetCurveProperties();
|
||||
if (propChart.chartType == ChartType::Wave)
|
||||
{
|
||||
updateParseWaveFile(strFile, propChart.timeParam, propCurves);
|
||||
}
|
||||
else if (propChart.chartType == ChartType::Report)
|
||||
{
|
||||
updateParseReportFile(strFile, propChart.timeParam, propCurves);
|
||||
}
|
||||
int a = 0;
|
||||
}
|
||||
|
||||
void CurvePanel::updateTitle(const QString & title)
|
||||
{
|
||||
if (nullptr != dockWidget_)
|
||||
{
|
||||
dockWidget_->setWindowTitle(title);
|
||||
}
|
||||
}
|
||||
|
||||
void CurvePanel::updateTitleAxis(const QString & xTitle, const QString & yTitle)
|
||||
{
|
||||
if (m_pAxisX)
|
||||
{
|
||||
if (!xTitle.isEmpty())
|
||||
{
|
||||
m_pAxisX->setTitleText(xTitle);
|
||||
}
|
||||
}
|
||||
if (m_pAxisY)
|
||||
{
|
||||
if (!yTitle.isEmpty())
|
||||
{
|
||||
m_pAxisY->setTitleText(yTitle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CurvePanel::updateMinMaxX(float min, float max, int count)
|
||||
{
|
||||
if (max > min)
|
||||
{
|
||||
m_iXMin = min;
|
||||
m_iXMax = max;
|
||||
|
||||
QList<QAbstractAxis*> axesX;
|
||||
axesX = curveChart->axes(Qt::Horizontal);
|
||||
QValueAxis* curAxisX = (QValueAxis*)axesX[0];
|
||||
curAxisX->setRange(m_iXMin, m_iXMax);
|
||||
|
||||
if (count > 0)
|
||||
{
|
||||
curAxisX->setTickCount(count);
|
||||
curAxisX->setLabelFormat("%d");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CurvePanel::updateMinMaxY(float min, float max, int count)
|
||||
{
|
||||
if (max > min)
|
||||
{
|
||||
m_iYMin = min;
|
||||
m_iYMax = max;
|
||||
|
||||
QList<QAbstractAxis*> axesY;
|
||||
axesY = curveChart->axes(Qt::Vertical);
|
||||
QValueAxis* curAxisY = (QValueAxis*)axesY[0];
|
||||
curAxisY->setRange(m_iYMin, m_iYMax);
|
||||
|
||||
if (count > 0)
|
||||
{
|
||||
curAxisY->setTickCount(count);
|
||||
curAxisY->setLabelFormat("%d");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CurvePanel::updateParseWaveFile(const QString& strFile, int nT, FileEntryCurve::CurveProperties listCurve)
|
||||
{
|
||||
if (strFile.isEmpty())
|
||||
{
|
||||
QMessageBox::information(nullptr, QStringLiteral("Error"), QStringLiteral("Please check Wave file path"));
|
||||
return;
|
||||
}
|
||||
|
||||
QFile file(strFile);
|
||||
if (file.open(QIODevice::ReadOnly))
|
||||
{
|
||||
for (int nI = 0; nI < listCurve.size(); nI++)
|
||||
{
|
||||
FileEntryCurve::CurveProperty propCurve = listCurve.at(nI);
|
||||
|
||||
QSplineSeries *pSeries = new QSplineSeries(this);
|
||||
pSeries->setName(propCurve.name);
|
||||
pSeries->setColor(propCurve.color);
|
||||
pSeries->setUseOpenGL(true);
|
||||
//pSeries->attachAxis(m_pAxisY);
|
||||
//pSeries->attachAxis(m_pAxisX);
|
||||
curveChart->addSeries(pSeries);
|
||||
m_seriesIDMap.insert(nI, pSeries);
|
||||
|
||||
QPen pen(propCurve.color);
|
||||
pen.setWidth(2);
|
||||
pSeries->setPen(pen);
|
||||
|
||||
QList<QAbstractAxis*> axesX;
|
||||
axesX = curveChart->axes(Qt::Horizontal);
|
||||
QValueAxis* curAxisX = (QValueAxis*)axesX[0];
|
||||
pSeries->attachAxis(curAxisX);
|
||||
|
||||
QList<QAbstractAxis*> axesY;
|
||||
axesY = curveChart->axes(Qt::Vertical);
|
||||
QValueAxis* curAxisY = (QValueAxis*)axesY[0];
|
||||
pSeries->attachAxis(curAxisY);
|
||||
}
|
||||
|
||||
bool bResetAxisX = false;
|
||||
if (m_iXMax == m_iXMin)
|
||||
{
|
||||
bResetAxisX = true;
|
||||
}
|
||||
bool bResetAxisY = false;
|
||||
if (m_iYMax == m_iYMin)
|
||||
{
|
||||
bResetAxisY = true;
|
||||
}
|
||||
|
||||
float maxY = -10000000.0;
|
||||
float minY = 10000000.0;
|
||||
|
||||
while (!file.atEnd())
|
||||
{
|
||||
QString strLine = file.readLine().simplified();
|
||||
if (!strLine.isEmpty())
|
||||
{
|
||||
QStringList listLine = strLine.split(" ");
|
||||
double t = listLine.at(nT).toDouble();
|
||||
|
||||
QMap<int, QVariantList> mapData;
|
||||
for (int nI = 0; nI < listCurve.size(); nI++)
|
||||
{
|
||||
FileEntryCurve::CurveProperty propCurve = listCurve.at(nI);
|
||||
|
||||
if (bResetAxisX)
|
||||
{
|
||||
int nMax = propCurve.data.wave.stop - propCurve.data.wave.start;
|
||||
if (m_iXMax < nMax)
|
||||
{
|
||||
m_iXMax = nMax;
|
||||
}
|
||||
}
|
||||
|
||||
QVariantList listData;
|
||||
for (int nJ = propCurve.data.wave.start; nJ < propCurve.data.wave.stop; nJ++)
|
||||
{
|
||||
double value = listLine.at(nJ).toDouble();
|
||||
listData.push_back(value);
|
||||
|
||||
if (bResetAxisY)
|
||||
{
|
||||
if (value < minY)
|
||||
{
|
||||
minY = value;
|
||||
}
|
||||
if (value > maxY)
|
||||
{
|
||||
maxY = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
mapData.insert(nI, listData);
|
||||
}
|
||||
m_dataWava.insert(t, mapData);
|
||||
}
|
||||
}
|
||||
|
||||
if (bResetAxisX)
|
||||
{
|
||||
updateMinMaxX(0, m_iXMax * 1.1, 0);
|
||||
}
|
||||
if (bResetAxisY)
|
||||
{
|
||||
updateMinMaxY(minY * 0.9, maxY * 1.1, 0);
|
||||
}
|
||||
|
||||
file.close();
|
||||
}
|
||||
}
|
||||
|
||||
void CurvePanel::updateParseReportFile(const QString & strFile, int nT, FileEntryCurve::CurveProperties listCurve)
|
||||
{
|
||||
if (strFile.isEmpty())
|
||||
{
|
||||
QMessageBox::information(nullptr, QStringLiteral("Error"), QStringLiteral("Please check data file path"));
|
||||
return;
|
||||
}
|
||||
|
||||
QFile file(strFile);
|
||||
if (file.open(QIODevice::ReadOnly))
|
||||
{
|
||||
for (int nI = 0; nI < listCurve.size(); nI++)
|
||||
{
|
||||
FileEntryCurve::CurveProperty propCurve = listCurve.at(nI);
|
||||
|
||||
QSplineSeries *pSeries = new QSplineSeries(this);
|
||||
pSeries->setName(propCurve.name);
|
||||
pSeries->setColor(propCurve.color);
|
||||
pSeries->setUseOpenGL(true);
|
||||
//pSeries->attachAxis(m_pAxisY);
|
||||
//pSeries->attachAxis(m_pAxisX);
|
||||
curveChart->addSeries(pSeries);
|
||||
m_seriesIDMap.insert(nI, pSeries);
|
||||
|
||||
QPen pen(propCurve.color);
|
||||
pen.setWidth(2);
|
||||
pSeries->setPen(pen);
|
||||
|
||||
QList<QAbstractAxis*> axesX;
|
||||
axesX = curveChart->axes(Qt::Horizontal);
|
||||
QValueAxis* curAxisX = (QValueAxis*)axesX[0];
|
||||
pSeries->attachAxis(curAxisX);
|
||||
|
||||
QList<QAbstractAxis*> axesY;
|
||||
axesY = curveChart->axes(Qt::Vertical);
|
||||
QValueAxis* curAxisY = (QValueAxis*)axesY[0];
|
||||
pSeries->attachAxis(curAxisY);
|
||||
}
|
||||
|
||||
bool bResetAxisX = false;
|
||||
if (m_iXMax == m_iXMin)
|
||||
{
|
||||
bResetAxisX = true;
|
||||
}
|
||||
bool bResetAxisY = false;
|
||||
if (m_iYMax == m_iYMin)
|
||||
{
|
||||
bResetAxisY = true;
|
||||
}
|
||||
|
||||
float maxX = -10000000.0;
|
||||
float minX = 10000000.0;
|
||||
float maxY = -10000000.0;
|
||||
float minY = 10000000.0;
|
||||
|
||||
while (!file.atEnd())
|
||||
{
|
||||
QString strLine = file.readLine().simplified();
|
||||
if (!strLine.isEmpty())
|
||||
{
|
||||
QStringList listLine = strLine.split(" ");
|
||||
double t = listLine.at(nT).toDouble();
|
||||
|
||||
QMap<int, QPointF> mapData;
|
||||
for (int nI = 0; nI < listCurve.size(); nI++)
|
||||
{
|
||||
FileEntryCurve::CurveProperty propCurve = listCurve.at(nI);
|
||||
|
||||
double x = listLine.at(propCurve.data.report.x).toDouble();
|
||||
double y = listLine.at(propCurve.data.report.y).toDouble();
|
||||
|
||||
QPointF ptData = QPointF(x, y);
|
||||
mapData.insert(nI, ptData);
|
||||
|
||||
if (bResetAxisX)
|
||||
{
|
||||
if (x < minX)
|
||||
{
|
||||
minX = x;
|
||||
}
|
||||
if (x > maxX)
|
||||
{
|
||||
maxX = x;
|
||||
}
|
||||
}
|
||||
if (bResetAxisY)
|
||||
{
|
||||
if (y < minY)
|
||||
{
|
||||
minY = y;
|
||||
}
|
||||
if (y > maxY)
|
||||
{
|
||||
maxY = y;
|
||||
}
|
||||
}
|
||||
}
|
||||
m_dataReport.insert(t, mapData);
|
||||
}
|
||||
}
|
||||
|
||||
if (bResetAxisX)
|
||||
{
|
||||
updateMinMaxX(minX * 0.9, maxX * 1.1, 0);
|
||||
}
|
||||
if (bResetAxisY)
|
||||
{
|
||||
updateMinMaxY(minY * 0.9, maxY * 1.1, 0);
|
||||
}
|
||||
|
||||
file.close();
|
||||
}
|
||||
}
|
||||
|
||||
void CurvePanel::updateWaveData(double t)
|
||||
{
|
||||
if (m_dataWava.size() > 0)
|
||||
{
|
||||
QMap< double, QMap<int, QVariantList> >::const_iterator ite = m_dataWava.lowerBound(t);
|
||||
if (ite == m_dataWava.end())
|
||||
{
|
||||
ite--;
|
||||
}
|
||||
|
||||
QMap<int, QVariantList> mapData = ite.value();
|
||||
for (QMap<int, QVariantList>::Iterator it = mapData.begin(); it != mapData.end(); it++)
|
||||
{
|
||||
int nIndex = it.key();
|
||||
QVariantList dataList = it.value();
|
||||
|
||||
QSplineSeries* pSeries = m_seriesIDMap.value(nIndex);
|
||||
if (pSeries)
|
||||
{
|
||||
pSeries->clear();
|
||||
for (int nI = 0; nI < dataList.size(); nI++)
|
||||
{
|
||||
float fY = dataList.at(nI).toFloat();
|
||||
pSeries->append(QPointF(nI, fY));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CurvePanel::updateReportData(double t)
|
||||
{
|
||||
if (m_dataReport.size() > 0)
|
||||
{
|
||||
for (QMap<int, QSplineSeries*>::Iterator itSeries = m_seriesIDMap.begin(); itSeries != m_seriesIDMap.end(); itSeries++)
|
||||
{
|
||||
QSplineSeries* pSeries = itSeries.value();
|
||||
if (pSeries)
|
||||
{
|
||||
pSeries->clear();
|
||||
}
|
||||
}
|
||||
|
||||
QMap< double, QMap<int, QPointF> >::const_iterator ite = m_dataReport.lowerBound(t);
|
||||
if (ite != m_dataReport.end())
|
||||
{
|
||||
ite++;
|
||||
}
|
||||
|
||||
for (QMap< double, QMap<int, QPointF> >::Iterator itA = m_dataReport.begin(); itA != ite; itA++)
|
||||
{
|
||||
double dTime = itA.key();
|
||||
QMap<int, QPointF> mapData = itA.value();
|
||||
for (QMap<int, QPointF>::Iterator it = mapData.begin(); it != mapData.end(); it++)
|
||||
{
|
||||
int nIndex = it.key();
|
||||
QPointF data = it.value();
|
||||
|
||||
QSplineSeries* pSeries = m_seriesIDMap.value(nIndex);
|
||||
if (pSeries)
|
||||
{
|
||||
pSeries->append(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CurvePanel::OnTimeChanged(double time)
|
||||
{
|
||||
updateWaveData(time);
|
||||
updateReportData(time);
|
||||
}
|
||||
@ -72,25 +72,12 @@ protected:
|
||||
|
||||
void OnDataPanelUpdated(FileEntryCurve* fileEntry);
|
||||
|
||||
virtual void OnTimeChanged(double time);
|
||||
|
||||
private:
|
||||
/**
|
||||
* @brief Update curve display based on chart data
|
||||
*/
|
||||
void UpdateCurveDisplay();
|
||||
|
||||
void updateTitle(const QString& title);
|
||||
void updateTitleAxis(const QString& xTitle, const QString& yTitle);
|
||||
void updateMinMaxX(float min, float max, int count);
|
||||
void updateMinMaxY(float min, float max, int count);
|
||||
|
||||
void updateParseWaveFile(const QString& strFile, int nT, FileEntryCurve::CurveProperties listCurve);
|
||||
void updateParseReportFile(const QString& strFile, int nT, FileEntryCurve::CurveProperties listCurve);
|
||||
|
||||
void updateWaveData(double t);
|
||||
void updateReportData(double t);
|
||||
|
||||
private:
|
||||
Ui::FitCurve* ui;
|
||||
FitCurveChartView* curveChartView;
|
||||
|
||||
@ -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());
|
||||
}
|
||||
@ -61,7 +61,7 @@ void DataPanel::InitUI()
|
||||
// layout->addWidget(infoLabel);
|
||||
// setLayout(layout);
|
||||
|
||||
//RefreshPanel();
|
||||
RefreshPanel();
|
||||
}
|
||||
|
||||
QString DataPanel::GenerateTitle()
|
||||
|
||||
@ -94,7 +94,6 @@ public:
|
||||
virtual void InitUI();
|
||||
|
||||
bool IsValid() const { return fileEntry_ != nullptr; }
|
||||
|
||||
signals:
|
||||
/**
|
||||
* @brief Panel close signal
|
||||
@ -108,6 +107,8 @@ protected:
|
||||
*/
|
||||
void closeEvent(QCloseEvent* event) override;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Generate panel title
|
||||
* @return Generated title
|
||||
|
||||
@ -207,18 +207,19 @@ DataPanel* DataPanelManager::CreateDataPanel(FileEntryType fileType, const QStri
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
dockWidget->setWidget(panel);
|
||||
|
||||
// Set panel's dock widget reference
|
||||
panel->SetDockWidget(dockWidget);
|
||||
//panel->InitUI();
|
||||
|
||||
auto fileEntries = currentWorkspace_->GetFileEntries(fileType);
|
||||
if (index < fileEntries.size()) {
|
||||
panel->SetFileEntry(fileEntries[index]);
|
||||
panel->InitUI();
|
||||
panel->RefreshPanel();
|
||||
}
|
||||
|
||||
dockWidget->setWidget(panel);
|
||||
|
||||
// Set panel's dock widget reference
|
||||
panel->SetDockWidget(dockWidget);
|
||||
|
||||
// Connect panel signals
|
||||
connect(panel, &DataPanel::PanelClosed, this, &DataPanelManager::OnPanelClosed);
|
||||
|
||||
@ -315,7 +316,7 @@ int DataPanelManager::FindNextAvailableIndex(FileEntryType fileType) const
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < GetMaxPanelCount(); ++i) {
|
||||
for (int i = 1; i <= GetMaxPanelCount(); ++i) {
|
||||
if (!usedIndices.contains(i)) {
|
||||
return i;
|
||||
}
|
||||
|
||||
@ -106,46 +106,67 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="chartTypeComboBox"/>
|
||||
<widget class="QComboBox" name="chartTypeComboBox">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Wave</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Report</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="xTitleLabel">
|
||||
<property name="text">
|
||||
<string>X Axis Title:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="xTitleEdit">
|
||||
<property name="placeholderText">
|
||||
<string>Enter X axis title...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="yTitleLabel">
|
||||
<property name="text">
|
||||
<string>Y Axis Title:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="yTitleEdit">
|
||||
<property name="placeholderText">
|
||||
<string>Enter Y axis title...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="timeParamLabel">
|
||||
<property name="text">
|
||||
<string>Time:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QSpinBox" name="timeParamSpinBox"/>
|
||||
</item>
|
||||
<widget class="QLabel" name="xTitleLabel">
|
||||
<property name="text">
|
||||
<string>X Axis Title:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="xTitleEdit">
|
||||
<property name="placeholderText">
|
||||
<string>Enter X axis title...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="yTitleLabel">
|
||||
<property name="text">
|
||||
<string>Y Axis Title:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="yTitleEdit">
|
||||
<property name="placeholderText">
|
||||
<string>Enter Y axis title...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="timeParamLabel">
|
||||
<property name="text">
|
||||
<string>Time Parameter:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QDoubleSpinBox" name="timeParamSpinBox">
|
||||
<property name="minimum">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>999999.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
@ -465,19 +486,16 @@
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="xValueLabel">
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>X Value:</string>
|
||||
</property>
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QDoubleSpinBox" name="xValueSpinBox">
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-999999.000000000000000</double>
|
||||
</property>
|
||||
@ -487,23 +505,23 @@
|
||||
<property name="value">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="yValueLabel">
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Y Value:</string>
|
||||
</property>
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QDoubleSpinBox" name="yValueSpinBox">
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-999999.000000000000000</double>
|
||||
</property>
|
||||
@ -513,6 +531,9 @@
|
||||
<property name="value">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
||||
@ -280,8 +280,8 @@ bool FileEntryCurve::SaveFiles(tinyxml2::XMLElement* scene, tinyxml2::XMLDocumen
|
||||
|
||||
// 根据Chart类型保存不同的属性
|
||||
if (chartProperties_.chartType == ChartType::Wave) {
|
||||
curveElement->SetAttribute("start", curve.data.wave.start);
|
||||
curveElement->SetAttribute("stop", curve.data.wave.stop);
|
||||
curveElement->SetAttribute("startPoint", curve.data.wave.start);
|
||||
curveElement->SetAttribute("endPoint", curve.data.wave.stop);
|
||||
} else if (chartProperties_.chartType == ChartType::Report) {
|
||||
curveElement->SetAttribute("x", curve.data.report.x);
|
||||
curveElement->SetAttribute("y", curve.data.report.y);
|
||||
@ -292,18 +292,18 @@ bool FileEntryCurve::SaveFiles(tinyxml2::XMLElement* scene, tinyxml2::XMLDocumen
|
||||
}
|
||||
|
||||
// FileEntryCurve ParseFiles implementation
|
||||
bool FileEntryCurve::ParseFiles(const tinyxml2::XMLElement* chartElement) {
|
||||
if (!chartElement) {
|
||||
bool FileEntryCurve::ParseFiles(const tinyxml2::XMLElement* element) {
|
||||
if (!element) {
|
||||
LOG_ERROR("Invalid XML element");
|
||||
return false;
|
||||
}
|
||||
|
||||
// 查找<chart>元素
|
||||
//const tinyxml2::XMLElement* chartElement = element->FirstChildElement("chart");
|
||||
//if (!chartElement) {
|
||||
// LOG_ERROR("No chart element found");
|
||||
// return false;
|
||||
//}
|
||||
const tinyxml2::XMLElement* chartElement = element->FirstChildElement("chart");
|
||||
if (!chartElement) {
|
||||
LOG_ERROR("No chart element found");
|
||||
return false;
|
||||
}
|
||||
|
||||
// 解析chart属性
|
||||
const char* nameAttr = chartElement->Attribute("name");
|
||||
@ -358,8 +358,8 @@ bool FileEntryCurve::ParseFiles(const tinyxml2::XMLElement* chartElement) {
|
||||
|
||||
// 根据Chart类型解析不同的属性
|
||||
if (chartProperties_.chartType == ChartType::Wave) {
|
||||
curve.data.wave.start = curveElement->IntAttribute("start", 0);
|
||||
curve.data.wave.stop = curveElement->IntAttribute("stop", 0);
|
||||
curve.data.wave.start = curveElement->IntAttribute("startPoint", 0);
|
||||
curve.data.wave.stop = curveElement->IntAttribute("endPoint", 0);
|
||||
} else if (chartProperties_.chartType == ChartType::Report) {
|
||||
curve.data.report.x = curveElement->DoubleAttribute("x", 0.0);
|
||||
curve.data.report.y = curveElement->DoubleAttribute("y", 0.0);
|
||||
|
||||
@ -119,7 +119,6 @@ public:
|
||||
struct CurveProperty {
|
||||
QString name;
|
||||
QColor color;
|
||||
|
||||
// Wave类型使用start/stop,Report类型使用x/y
|
||||
union {
|
||||
struct {
|
||||
|
||||
@ -132,32 +132,17 @@ bool WorkSpaceXMLParse::ParseFiles(const tinyxml2::XMLElement* element) {
|
||||
// Create FileEntry objects and call their ParseFiles method
|
||||
FileEntryType enumType;
|
||||
if (FileEntryTypeFromString(name, enumType)) {
|
||||
|
||||
const tinyxml2::XMLElement* chartElement = typeElement->FirstChildElement("chart");
|
||||
while (nullptr != chartElement) {
|
||||
auto fileEntry = CreateEmptyFileEntry(enumType); // Create empty FileEntry for XML parsing
|
||||
if (fileEntry) {
|
||||
// Call the FileEntry's ParseFiles method to parse detailed data
|
||||
if (fileEntry->ParseFiles(chartElement)) {
|
||||
// Add the parsed FileEntry to workspace
|
||||
workSpace_->SetFileEntry(fileEntry, false);
|
||||
}
|
||||
}
|
||||
|
||||
chartElement = chartElement->NextSiblingElement();
|
||||
}
|
||||
|
||||
// Create FileEntry objects for this type
|
||||
//for (int i = 0; i < count; ++i) {
|
||||
// auto fileEntry = CreateEmptyFileEntry(enumType); // Create empty FileEntry for XML parsing
|
||||
// if (fileEntry) {
|
||||
// // Call the FileEntry's ParseFiles method to parse detailed data
|
||||
// if (fileEntry->ParseFiles(typeElement)) {
|
||||
// // Add the parsed FileEntry to workspace
|
||||
// workSpace_->SetFileEntry(fileEntry, false);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
for (int i = 0; i < count; ++i) {
|
||||
auto fileEntry = CreateEmptyFileEntry(enumType); // Create empty FileEntry for XML parsing
|
||||
if (fileEntry) {
|
||||
// Call the FileEntry's ParseFiles method to parse detailed data
|
||||
if (fileEntry->ParseFiles(typeElement)) {
|
||||
// Add the parsed FileEntry to workspace
|
||||
workSpace_->SetFileEntry(fileEntry, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Also set file entry count for backward compatibility
|
||||
workSpace_->SetFileEntryCount(enumType, count);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user