2025-05-16T17:01:39

This commit is contained in:
yuntang 2025-05-16 17:01:40 +08:00
parent fe19f5ff17
commit 8fb9f878bf
28 changed files with 422 additions and 65 deletions

Binary file not shown.

View File

@ -0,0 +1,244 @@
[2025-05-16 11:10:34,571] main...
[2025-05-16 11:10:34,571] config config file existed.
[2025-05-16 11:10:34,635] setEventHandlerEnable...0
[2025-05-16 11:10:42,955] main...
[2025-05-16 11:10:42,955] config config file existed.
[2025-05-16 11:10:42,974] setEventHandlerEnable...0
[2025-05-16 11:10:49,769] clearExperimentData...
[2025-05-16 11:10:49,772] slotSendData:9
[2025-05-16 11:10:49,772] slotSendData:a5 5a 06 82 2c 00 01 28 55
[2025-05-16 11:10:49,772] start experiment,set soft into experiment mode.
[2025-05-16 11:10:52,426] clearExperimentData...
[2025-05-16 11:13:11,330] main...
[2025-05-16 11:13:11,330] config config file existed.
[2025-05-16 11:13:11,347] setEventHandlerEnable...0
[2025-05-16 11:17:08,149] main...
[2025-05-16 11:17:08,150] config config file existed.
[2025-05-16 11:17:08,169] setEventHandlerEnable...0
[2025-05-16 11:17:19,308] main...
[2025-05-16 11:17:19,309] config config file existed.
[2025-05-16 11:17:19,328] setEventHandlerEnable...0
[2025-05-16 11:17:22,413] xlsx sample weight:1
[2025-05-16 11:17:22,414] startLineIndex:11
[2025-05-16 11:17:22,414] data size:1762
[2025-05-16 11:17:22,415] startLineIndex:1780
[2025-05-16 11:17:22,415] data size:331
[2025-05-16 11:17:22,415] dataIndex:2116
[2025-05-16 11:17:22,415] Cell does not exist.
[2025-05-16 11:17:24,817] xlsx sample weight:1
[2025-05-16 11:17:24,817] startLineIndex:11
[2025-05-16 11:17:24,817] data size:814
[2025-05-16 11:17:24,817] startLineIndex:832
[2025-05-16 11:17:24,817] data size:600
[2025-05-16 11:17:24,818] startLineIndex:1439
[2025-05-16 11:17:24,818] data size:301
[2025-05-16 11:17:24,818] dataIndex:1745
[2025-05-16 11:17:24,818] Cell does not exist.
[2025-05-16 11:17:25,924] xlsx sample weight:17.2800006866455
[2025-05-16 11:17:25,924] startLineIndex:11
[2025-05-16 11:17:25,925] data size:1264
[2025-05-16 11:17:25,925] dataIndex:1280
[2025-05-16 11:17:25,925] Cell does not exist.
[2025-05-16 11:17:26,709] xlsx sample weight:13.9200000762939
[2025-05-16 11:17:26,709] startLineIndex:11
[2025-05-16 11:17:26,709] data size:1820
[2025-05-16 11:17:26,711] dataIndex:1836
[2025-05-16 11:17:26,711] ana op size:6
[2025-05-16 11:17:26,711] ao mode:1822
[2025-05-16 11:17:26,711] x1:6.236,x2:144.584
[2025-05-16 11:17:26,711] ao mode:1823
[2025-05-16 11:17:26,711] x1:6.239,x2:144.849
[2025-05-16 11:17:26,711] ao mode:1824
[2025-05-16 11:17:26,711] x1:6.243,x2:144.849
[2025-05-16 11:17:26,711] ao mode:1825
[2025-05-16 11:17:26,711] x1:6.246,x2:144.849
[2025-05-16 11:17:26,712] ao mode:1826
[2025-05-16 11:17:26,712] x1:6.25,x2:144.991
[2025-05-16 11:17:26,712] ao mode:1827
[2025-05-16 11:17:26,712] x1:6.253,x2:144.991
[2025-05-16 13:24:22,525] main...
[2025-05-16 13:24:22,526] config config file existed.
[2025-05-16 13:24:22,587] setEventHandlerEnable...0
[2025-05-16 13:24:24,999] xlsx sample weight:0
[2025-05-16 13:24:24,999] startLineIndex:11
[2025-05-16 13:24:25,000] data size:3550
[2025-05-16 13:24:25,001] dataIndex:3566
[2025-05-16 13:24:25,001] Cell does not exist.
[2025-05-16 13:24:45,510] xlsx sample weight:8.31
[2025-05-16 13:24:45,511] startLineIndex:11
[2025-05-16 13:24:45,511] data size:7279
[2025-05-16 13:24:45,515] dataIndex:7295
[2025-05-16 13:24:45,515] Cell does not exist.
[2025-05-16 13:24:47,444] xlsx sample weight:0
[2025-05-16 13:24:47,445] startLineIndex:11
[2025-05-16 13:24:47,445] data size:3550
[2025-05-16 13:24:47,446] dataIndex:3566
[2025-05-16 13:24:47,447] Cell does not exist.
[2025-05-16 13:24:48,355] xlsx sample weight:1
[2025-05-16 13:24:48,356] startLineIndex:11
[2025-05-16 13:24:48,356] data size:298
[2025-05-16 13:24:48,356] dataIndex:314
[2025-05-16 13:24:48,356] Cell does not exist.
[2025-05-16 13:24:49,205] xlsx sample weight:
[2025-05-16 13:24:49,205] dataIndex:9
[2025-05-16 13:24:49,205] Cell does not exist.
[2025-05-16 13:24:49,936] xlsx sample weight:1
[2025-05-16 13:24:49,936] startLineIndex:11
[2025-05-16 13:24:49,936] data size:814
[2025-05-16 13:24:49,937] startLineIndex:832
[2025-05-16 13:24:49,937] data size:600
[2025-05-16 13:24:49,937] startLineIndex:1439
[2025-05-16 13:24:49,938] data size:301
[2025-05-16 13:24:49,938] dataIndex:1745
[2025-05-16 13:24:49,938] Cell does not exist.
[2025-05-16 13:24:50,645] xlsx sample weight:
[2025-05-16 13:24:50,645] dataIndex:9
[2025-05-16 13:24:50,645] Cell does not exist.
[2025-05-16 13:24:51,305] xlsx sample weight:
[2025-05-16 13:24:51,305] dataIndex:9
[2025-05-16 13:24:51,307] Cell does not exist.
[2025-05-16 13:24:51,853] xlsx sample weight:
[2025-05-16 13:24:51,853] dataIndex:9
[2025-05-16 13:24:51,853] Cell does not exist.
[2025-05-16 13:24:52,463] xlsx sample weight:1
[2025-05-16 13:24:52,464] startLineIndex:11
[2025-05-16 13:24:52,464] data size:1762
[2025-05-16 13:24:52,466] startLineIndex:1780
[2025-05-16 13:24:52,466] data size:331
[2025-05-16 13:24:52,466] dataIndex:2116
[2025-05-16 13:24:52,466] Cell does not exist.
[2025-05-16 13:24:52,999] xlsx sample weight:
[2025-05-16 13:24:52,999] dataIndex:9
[2025-05-16 13:24:52,999] Cell does not exist.
[2025-05-16 13:24:53,648] xlsx sample weight:
[2025-05-16 13:24:53,648] dataIndex:9
[2025-05-16 13:24:53,648] Cell does not exist.
[2025-05-16 13:24:54,161] xlsx sample weight:1
[2025-05-16 13:24:54,161] startLineIndex:11
[2025-05-16 13:24:54,161] data size:814
[2025-05-16 13:24:54,162] startLineIndex:832
[2025-05-16 13:24:54,162] data size:600
[2025-05-16 13:24:54,162] startLineIndex:1439
[2025-05-16 13:24:54,162] data size:301
[2025-05-16 13:24:54,163] dataIndex:1745
[2025-05-16 13:24:54,163] Cell does not exist.
[2025-05-16 13:24:55,079] clearExperimentData...
[2025-05-16 14:15:09,683] main...
[2025-05-16 14:15:09,684] config config file existed.
[2025-05-16 14:15:09,708] setEventHandlerEnable...0
[2025-05-16 14:15:13,369] xlsx sample weight:8.31
[2025-05-16 14:15:13,369] startLineIndex:11
[2025-05-16 14:15:13,370] data size:7279
[2025-05-16 14:15:13,373] dataIndex:7295
[2025-05-16 14:15:13,374] Cell does not exist.
[2025-05-16 14:46:30,603] main...
[2025-05-16 14:46:30,603] config config file existed.
[2025-05-16 14:46:30,622] setEventHandlerEnable...0
[2025-05-16 14:46:36,566] xlsx sample weight:0
[2025-05-16 14:46:36,566] startLineIndex:11
[2025-05-16 14:46:36,566] data size:1256
[2025-05-16 14:46:36,567] dataIndex:1272
[2025-05-16 14:46:36,567] Cell does not exist.
[2025-05-16 14:46:37,175] xlsx sample weight:13.9200000762939
[2025-05-16 14:46:37,175] startLineIndex:11
[2025-05-16 14:46:37,176] data size:7466
[2025-05-16 14:46:37,179] dataIndex:7482
[2025-05-16 14:46:37,180] ana op size:5
[2025-05-16 14:46:37,180] ao mode:267.675
[2025-05-16 14:46:37,180] x1:5.398,x2:267.675
[2025-05-16 14:46:37,180] ao mode:267.675
[2025-05-16 14:46:37,180] x1:5.397,x2:267.675
[2025-05-16 14:46:37,180] ao mode:267.745
[2025-05-16 14:46:37,180] x1:5.397,x2:267.745
[2025-05-16 14:46:37,180] ao mode:267.745
[2025-05-16 14:46:37,180] x1:5.396,x2:267.745
[2025-05-16 14:46:37,180] ao mode:267.885
[2025-05-16 14:46:37,180] x1:5.396,x2:267.885
[2025-05-16 14:46:37,803] xlsx sample weight:13.9200000762939
[2025-05-16 14:46:37,804] startLineIndex:11
[2025-05-16 14:46:37,804] data size:1264
[2025-05-16 14:46:37,805] dataIndex:1280
[2025-05-16 14:46:37,805] Cell does not exist.
[2025-05-16 14:46:38,429] xlsx sample weight:17.2800006866455
[2025-05-16 14:46:38,434] startLineIndex:11
[2025-05-16 14:46:38,434] data size:1264
[2025-05-16 14:46:38,435] dataIndex:1280
[2025-05-16 14:46:38,450] Cell does not exist.
[2025-05-16 14:46:38,965] xlsx sample weight:13.9200000762939
[2025-05-16 14:46:38,966] startLineIndex:11
[2025-05-16 14:46:38,966] data size:1820
[2025-05-16 14:46:38,967] dataIndex:1836
[2025-05-16 14:46:38,967] ana op size:6
[2025-05-16 14:46:38,967] ao mode:1822
[2025-05-16 14:46:38,967] x1:6.236,x2:144.584
[2025-05-16 14:46:38,967] ao mode:1823
[2025-05-16 14:46:38,967] x1:6.239,x2:144.849
[2025-05-16 14:46:38,967] ao mode:1824
[2025-05-16 14:46:38,967] x1:6.243,x2:144.849
[2025-05-16 14:46:38,967] ao mode:1825
[2025-05-16 14:46:38,968] x1:6.246,x2:144.849
[2025-05-16 14:46:38,968] ao mode:1826
[2025-05-16 14:46:38,968] x1:6.25,x2:144.991
[2025-05-16 14:46:38,968] ao mode:1827
[2025-05-16 14:46:38,968] x1:6.253,x2:144.991
[2025-05-16 14:46:39,572] xlsx sample weight:17.2800006866455
[2025-05-16 14:46:39,573] startLineIndex:11
[2025-05-16 14:46:39,573] data size:1264
[2025-05-16 14:46:39,573] dataIndex:1280
[2025-05-16 14:46:39,574] Cell does not exist.
[2025-05-16 14:46:43,099] xlsx sample weight:0
[2025-05-16 14:46:43,099] startLineIndex:11
[2025-05-16 14:46:43,099] data size:3550
[2025-05-16 14:46:43,101] dataIndex:3566
[2025-05-16 14:46:43,101] Cell does not exist.
[2025-05-16 14:46:44,529] xlsx sample weight:1
[2025-05-16 14:46:44,529] startLineIndex:11
[2025-05-16 14:46:44,529] data size:298
[2025-05-16 14:46:44,529] dataIndex:314
[2025-05-16 14:46:44,529] Cell does not exist.
[2025-05-16 14:46:45,098] xlsx sample weight:
[2025-05-16 14:46:45,099] dataIndex:9
[2025-05-16 14:46:45,099] Cell does not exist.
[2025-05-16 14:46:45,745] xlsx sample weight:1
[2025-05-16 14:46:45,746] startLineIndex:11
[2025-05-16 14:46:45,746] data size:814
[2025-05-16 14:46:45,747] startLineIndex:832
[2025-05-16 14:46:45,747] data size:600
[2025-05-16 14:46:45,748] startLineIndex:1439
[2025-05-16 14:46:45,748] data size:301
[2025-05-16 14:46:45,749] dataIndex:1745
[2025-05-16 14:46:45,751] Cell does not exist.
[2025-05-16 14:46:46,484] xlsx sample weight:
[2025-05-16 14:46:46,484] dataIndex:9
[2025-05-16 14:46:46,484] Cell does not exist.
[2025-05-16 14:46:47,247] xlsx sample weight:
[2025-05-16 14:46:47,247] dataIndex:9
[2025-05-16 14:46:47,261] Cell does not exist.
[2025-05-16 14:46:47,954] xlsx sample weight:
[2025-05-16 14:46:47,954] dataIndex:9
[2025-05-16 14:46:47,954] Cell does not exist.
[2025-05-16 14:46:48,466] xlsx sample weight:1
[2025-05-16 14:46:48,476] startLineIndex:11
[2025-05-16 14:46:48,476] data size:1762
[2025-05-16 14:46:48,477] startLineIndex:1780
[2025-05-16 14:46:48,478] data size:331
[2025-05-16 14:46:48,478] dataIndex:2116
[2025-05-16 14:46:48,478] Cell does not exist.
[2025-05-16 14:46:56,422] clearExperimentData...
[2025-05-16 14:46:58,546] xlsx sample weight:0
[2025-05-16 14:46:58,546] startLineIndex:11
[2025-05-16 14:46:58,546] data size:3550
[2025-05-16 14:46:58,548] dataIndex:3566
[2025-05-16 14:46:58,548] Cell does not exist.
[2025-05-16 14:47:04,735] clearExperimentData...
[2025-05-16 14:47:05,642] xlsx sample weight:8.31
[2025-05-16 14:47:05,643] startLineIndex:11
[2025-05-16 14:47:05,643] data size:7279
[2025-05-16 14:47:05,646] dataIndex:7295
[2025-05-16 14:47:05,647] Cell does not exist.
[2025-05-16 14:47:11,343] clearExperimentData...
[2025-05-16 14:47:12,667] xlsx sample weight:8.31
[2025-05-16 14:47:12,668] startLineIndex:11
[2025-05-16 14:47:12,672] data size:7279
[2025-05-16 14:47:12,679] dataIndex:7295
[2025-05-16 14:47:12,679] Cell does not exist.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -3,12 +3,13 @@ QT += core gui serialport printsupport
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
CONFIG += c++11
#CONFIG += console
CONFIG+=precompile_header
PRECOMPILED_HEADER=stable.h
#
VERSION = 0.9.7.4
VERSION = 0.9.8
# 设置目标文件名,包含版本号
TARGET = AnalysisTool_$${VERSION}

View File

@ -23,14 +23,15 @@ void XlsxHandler::test()
writeFile(sourceFilePath);
}
int XlsxHandler::readFile(const QString sourceFilePath, Global::CurveFileData &cfd)
int XlsxHandler::readFile(const QString filePath, Global::CurveFileData &cfd)
{
if(!QFile::exists(sourceFilePath))
if(!QFile::exists(filePath))
{
qDebug() << "xlsx file not existed:" << sourceFilePath;
qDebug() << "xlsx file not existed:" << filePath;
return 1;
}
QFileInfo fileInfo(sourceFilePath);
QFileInfo fileInfo(filePath);
// 获取文件的后缀名并转换为小写,方便比较
QString fileSuffix = fileInfo.suffix().toLower();
@ -41,9 +42,11 @@ int XlsxHandler::readFile(const QString sourceFilePath, Global::CurveFileData &c
return 2;
}
_currentFilePath = sourceFilePath;
_currentFilePath = filePath;
QXlsx::Document xlsx(sourceFilePath);
cfd.filePath = filePath;
QXlsx::Document xlsx(filePath);
QXlsx::Worksheet *workSheet = xlsx.currentWorksheet();
if(!workSheet)
@ -78,7 +81,7 @@ int XlsxHandler::readFile(const QString sourceFilePath, Global::CurveFileData &c
logde<<"dataIndex:"<<dataIndex;
readAnalysisOperation(workSheet,dataIndex);
readAnalysisOperation(workSheet,dataIndex,cfd);
return 0;
}
@ -235,8 +238,8 @@ void XlsxHandler::writeFile(const QString filePath)
row++;
// phase data.
logde<<"Global::_curveExperimentDataVtr size:"
<<Global::_curveExperimentDataVtr.size();
// logde<<"Global::_curveExperimentDataVtr size:"
// <<Global::_curveExperimentDataVtr.size();
const QVector<Global::ExperimentData>& edVtr =
Global::_curveExperimentDataVtr.at(i).dataVtr;
@ -246,10 +249,10 @@ void XlsxHandler::writeFile(const QString filePath)
xlsx.write(row , 2, edVtr.size());
row++;
logde<<"edVtr size:"<<edVtr.size();
// logde<<"edVtr size:"<<edVtr.size();
for(int index = 0;index < edVtr.size();index++){
logde<<"index :"<<index;
// logde<<"index :"<<index;
const Global::ExperimentData & ed = edVtr.at(index);
xlsx.write(row , 1, index);
@ -264,9 +267,6 @@ void XlsxHandler::writeFile(const QString filePath)
xlsx.write(phaseSizeRow , 1, ConPhaseSize);
xlsx.write(phaseSizeRow , 2, phaseCount);
// Clear data.
Global::clearExperimentData();
//
logde<<"before xlsx save as...";
if (!xlsx.saveAs(filePath)) {
@ -294,6 +294,7 @@ void XlsxHandler::writeAnalysisOperation(const QString filePath)
logde<<"lastRow:"<<index;
int row = index + 1;
QVector<AnalysisOperationRecorder::AnalysisOperation>& aoVtr =
AnalysisOperationRecorder::_ananlysisOperationVtr;
@ -392,7 +393,8 @@ QXlsx::Document* XlsxHandler::openXlsxFile(const QString& sourceFilePath) {
return xlsx;
}
void XlsxHandler::readAnalysisOperation(QXlsx::Worksheet *sheet, int &startLineIndex)
void XlsxHandler::readAnalysisOperation(
QXlsx::Worksheet *sheet, int &startLineIndex,Global::CurveFileData& cfd)
{
QXlsx::Cell *cell = sheet->cellAt(startLineIndex, 2);
if (!cell) {
@ -406,6 +408,9 @@ void XlsxHandler::readAnalysisOperation(QXlsx::Worksheet *sheet, int &startLineI
for(int i = 0;i < size; i++){
AnaOpRecorderOperation ao;
ao.filePath = cfd.filePath;
QString modeStr = sheet->cellAt(startLineIndex, 1)->value().toString();
if(modeStr == AnaOpRecorder::NumericalLabelStr){
@ -427,7 +432,7 @@ void XlsxHandler::readAnalysisOperation(QXlsx::Worksheet *sheet, int &startLineI
ao.x1 = sheet->cellAt(startLineIndex, 2)->value().toDouble();
ao.x2 = sheet->cellAt(startLineIndex, 3)->value().toDouble();
AnaOpRecorder::_ananlysisOperationVtr.push_back(ao);
cfd.analysisOperationVtr.push_back(ao);
startLineIndex++;

View File

@ -22,7 +22,7 @@ namespace XlsxHandler {
int readFile(const QString filePath,Global::CurveFileData&);
void readPhaseData(QXlsx::Worksheet*,int& startLineIndex,Global::PhaseTotalInfo&);
void readAnalysisOperation(QXlsx::Worksheet*,int& startLineIndex);
void readAnalysisOperation(QXlsx::Worksheet*,int& startLineIndex,Global::CurveFileData&);
void writeFile(const QString filePath);
void writeAnalysisOperation(const QString filePath);

View File

@ -127,10 +127,9 @@ void clearExperimentData()
{
_curveExperimentDataVtr.clear();
_currentCurveExperimentDataPtr = nullptr;
_currentPhase = -1;
}
}
#if 0

View File

@ -6,6 +6,7 @@
#include <qcustomplot.h>
#include "protocol.h"
#include "analysisoperationrecorder.h"
#if 0
enum AnalysisMode{
@ -99,10 +100,12 @@ struct PhaseTotalInfo{
QCPCurve * curve;
};
using namespace AnalysisOperationRecorder;
struct CurveFileData{
QString fileName;
QString filePath;
Global::ExperimentInfo ei;
QVector<Global::PhaseTotalInfo> phaseTotalVtr;
QVector<AnalysisOperation> analysisOperationVtr;
};
struct CurveExperimentData{
@ -121,6 +124,7 @@ extern ExperimentInfo _experimentInfo;
extern QVector<CurveExperimentData> _curveExperimentDataVtr;
extern CurveExperimentData* _currentCurveExperimentDataPtr;
// Call this function at the right time.
void clearExperimentData();
// Instrument coefficient.

View File

@ -8,5 +8,7 @@
<file>images/logo.png</file>
<file>images/logo.ico</file>
<file>images/axis.png</file>
<file>images/clear_data.png</file>
<file>images/real_time.png</file>
</qresource>
</RCC>

BIN
src/images/clear_data.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

BIN
src/images/real_time.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@ -42,12 +42,14 @@ MainWindow::MainWindow(QWidget *parent)
_rightWidget->hide();
//
ui->statusbar->showMessage("showMessage show temp message!");
// permenent show
QLabel *permenentLabel = new QLabel(this);
permenentLabel->setText("Software Ver:" + qApp->applicationVersion());
ui->statusbar->addPermanentWidget(permenentLabel);
ui->actionTimeAxisAnalysisPCTMode->setCheckable(true);
//
setSubWidgetAttribute(_expertmentSettingForm);
setSubWidgetAttribute(_specificHeatComparisonMethodForm);
@ -238,6 +240,7 @@ bool MainWindow::saveAnalysisFile(const QString fileName)
return true;
}
#endif
bool MainWindow::saveFile(const QString fileName,const Global::Mode mode)
{
QString localFileName = fileName;
@ -266,6 +269,9 @@ bool MainWindow::saveFile(const QString fileName,const Global::Mode mode)
XlsxHandler::writeAnalysisOperation(filePath);
}else if(mode == Global::Mode::Experiment){
XlsxHandler::writeFile(filePath);
// Clear data.
Global::clearExperimentData();
}
return true;
@ -332,6 +338,7 @@ void MainWindow::on_actionRealTimeWidget_triggered()
void MainWindow::slotSaveExperimentalDataMsgBox()
{
if(_manuallyStopTheExperimentFlag){
logde<<"_manuallyStopTheExperimentFlag...";
return;
}
@ -342,9 +349,11 @@ void MainWindow::slotSaveExperimentalDataMsgBox()
saveFile(Global::_experimentInfo.sampleName,Global::Mode::Experiment);
} else {
on_actionClearAllData_triggered();
// Clear data.
Global::clearExperimentData();
}
// Clear data.
logde<<"save mesg box.clearExperimentData...";
Global::clearExperimentData();
}
void MainWindow::on_actionConnectToDev_triggered()
@ -490,4 +499,5 @@ void MainWindow::on_actionAxisSetting_triggered()
void MainWindow::on_actionSaveData_triggered()
{
saveFile(Global::_experimentInfo.sampleName,Global::_mode);
_leftWidget->reloadFileName();
}

View File

@ -150,8 +150,21 @@
</property>
</action>
<action name="actionReadOnly">
<property name="checkable">
<bool>false</bool>
</property>
<property name="enabled">
<bool>false</bool>
</property>
<property name="icon">
<iconset resource="images.qrc">
<normaloff>:/images/real_time.png</normaloff>:/images/real_time.png</iconset>
</property>
<property name="text">
<string>只读数据</string>
<string>实时数据</string>
</property>
<property name="visible">
<bool>false</bool>
</property>
</action>
<action name="actionStop">
@ -202,8 +215,15 @@
</property>
</action>
<action name="actionClearAllData">
<property name="icon">
<iconset resource="images.qrc">
<normaloff>:/images/clear_data.png</normaloff>:/images/clear_data.png</iconset>
</property>
<property name="text">
<string>清除所有数据</string>
<string>清除数据</string>
</property>
<property name="toolTip">
<string>清除数据</string>
</property>
</action>
<action name="actionGlassTransition">

View File

@ -149,25 +149,11 @@ void experimentalStateSwitching(const CommonData &cd)
case DeviceRunStatus::Idle:
case DeviceRunStatus::Cooling:
Global::_mode = Global::Mode::Analysis;
break;
default:break;
}
// If phase update, add new phase data to the global param.
if(Global::_currentPhase != (int)cd.current_phase){
Global::_currentPhase = (int)cd.current_phase;
Global::CurveExperimentData ced;
Global::_curveExperimentDataVtr.push_back(ced);
Global::_currentCurveExperimentDataPtr = &Global::_curveExperimentDataVtr.last();
#if 1
Global::_currentCurveExperimentDataPtr->fileName =
Global::_experimentInfo.sampleName;
#endif
}
#if 0
logde<<"phase:"<<(int)cd.current_phase;
logde<<"run type:"<<(int)cd.run_type;

View File

@ -146,12 +146,30 @@ void SerialPort::slotReadData()
void SerialPort::updateStatus(const CommonData &cd)
{
#if 1
// logde<<"phase:"<<(int)cd.current_phase;
// logde<<"run type:"<<(int)cd.run_type;
#if 0
// logde<<"phase:"<<(int)cd.current_phase;
// logde<<"run type:"<<(int)cd.run_type;
logde<<"software mode:"<<Global::_mode;
#endif
// If phase update, add new phase data to the global param.
if(Global::_mode == Global::Mode::Experiment){
if(Global::_currentPhase != (int)cd.current_phase){
Global::_currentPhase = (int)cd.current_phase;
Global::CurveExperimentData ced;
Global::_curveExperimentDataVtr.push_back(ced);
Global::_currentCurveExperimentDataPtr = &Global::_curveExperimentDataVtr.last();
Global::_currentCurveExperimentDataPtr->fileName =
Global::_experimentInfo.sampleName;
}
}
// logde<<"_curveExperimentDataVtr size:"
// <<Global::_curveExperimentDataVtr.size();
//
updateAxis();

View File

@ -29,16 +29,17 @@ enum AnalysisMode{
#endif
struct AnalysisOperation{
QString filePath;
AnalysisMode mode;
double x1,x2;
};
// The analysis operationes by user operating.
extern QVector<AnalysisOperation> _ananlysisOperationVtr;
extern QVector<AnalysisOperation> _analysisOperationVtr;
// The analysis operationes from xlsx file.
//extern QVector<AnalysisOperation> _fileAnanlysisOperationVtr;
void addAnalysisOperation(const AnalysisOperation);
//void addAnalysisOperation(const AnalysisOperation);
void removeTheLastAnalysisOperation();
}

View File

@ -61,6 +61,8 @@ CentralWidget::CentralWidget(QWidget *parent)
connect(_eventHandler,&EventHandler::sigSendLineXCoord,
this,&CentralWidget::sigSendLineXCoord);
connect(_eventHandler,&EventHandler::sigDelCurve,
this,&CentralWidget::slotDelCurve);
setEventHandlerEnable(false);
//
@ -218,7 +220,7 @@ void CentralWidget::slotRecvCommonData(const CommonData &cd)
_currentCurve = new QCPCurve(_customPlot->xAxis, _customPlot->yAxis);
}
logde<<"temp:"<<cd.sample_temp<<",dsc:"<<cd.dsc;
// logde<<"temp:"<<cd.sample_temp<<",dsc:"<<cd.dsc;
_currentCurve->addData(index++,cd.sample_temp, cd.dsc);
@ -241,13 +243,24 @@ void CentralWidget::slotRecvCommonData(const CommonData &cd)
Global::_currentCurveExperimentDataPtr->dataVtr.push_back(ed);
Global::_currentCurveExperimentDataPtr->curve = _currentCurve;
}
#if 0
logde<<"_curveExperimentDataVtr size:"
<<Global::_curveExperimentDataVtr.size();
logde<<"_currentCurveExperimentDataPtr dataVtr size:"
<<Global::_currentCurveExperimentDataPtr->dataVtr.size();
#endif
}
void CentralWidget::slotRecvAnalysisFileName(const QString &filePath)
{
if(_analysisFilePathVtr.contains(filePath)){
return;
}else{
_analysisFilePathVtr.push_back(filePath);
}
// Read xlsx file.
Global::CurveFileData cfd;
if(XlsxHandler::readFile(filePath,cfd) != 0){
@ -255,9 +268,6 @@ void CentralWidget::slotRecvAnalysisFileName(const QString &filePath)
return;
}
QFileInfo fileInfo(filePath);
cfd.fileName = fileInfo.fileName();
for(int i = 0;i < cfd.phaseTotalVtr.size();i++){
Global::PhaseTotalInfo& pti = cfd.phaseTotalVtr[i];
@ -270,7 +280,6 @@ void CentralWidget::slotRecvAnalysisFileName(const QString &filePath)
QPointF endPoint = startEndPointPair.second;
_customPlot->xAxis->setRange(0, endPoint.x() / 3 * 4);
//QPointF peakPoint = PointCalculate::getPeakPoint();
QPair<float, float> maxMinPair = PointCalculate::getMaxMinValue();
float absY = std::abs(maxMinPair.first - maxMinPair.second);
_customPlot->yAxis->setRange(- absY * 2,absY *2);
@ -290,14 +299,16 @@ void CentralWidget::slotRecvAnalysisFileName(const QString &filePath)
_currentCurve = new QCPCurve(_customPlot->xAxis, _customPlot->yAxis);
_currentCurve->setData(tVtr, xVtr, yVtr);
_currentCurve->setSelectable(QCP::stWhole); // 设置曲线可选
_currentCurve->setSelectable(QCP::stWhole); // 设置曲线可选
_currentCurve->setLineStyle(QCPCurve::lsLine); // 线性连接
_currentCurve->setObjectName(filePath);
pti.curve = _currentCurve;
}
// Add analysis operation data.
if(AnalysisOperationRecorder::_ananlysisOperationVtr.size() > 0){
if(cfd.analysisOperationVtr.size() > 0){
for(AnaOpRecorder::AnalysisOperation& ao
:AnalysisOperationRecorder::_ananlysisOperationVtr){
loadAnalysisData(ao.mode,ao.x1,ao.x2);
@ -550,6 +561,15 @@ void CentralWidget::slotDrawCustomText(const QString str)
_customPlot->replot();
}
void CentralWidget::slotDelCurve(QCPCurve *curve)
{
if(!curve){
return;
}
}
void CentralWidget::slotGetAxisInfo()
{
QVector<AxisInfo> vtr;
@ -612,12 +632,14 @@ void CentralWidget::timerEvent(QTimerEvent *event)
#endif
}
#if 0
void CentralWidget::contextMenuEvent(QContextMenuEvent *event)
{
qDebug()<<"left menu...";
QPoint point = event->globalPos();
emit sigContextMenuShow(point);
}
#endif
void CentralWidget::glassTransitionHandle(const double x1,const double x2)
{
@ -947,6 +969,10 @@ void CentralWidget::drawText(const QPointF point, const QString text)
textLabel->setSelectedFont(font);
textLabel->setSelectable(true); // 设置为可选
// 设置文本项的位置类型为屏幕坐标比例
textLabel->position->setTypeX(QCPItemPosition::ptAxisRectRatio);
textLabel->position->setTypeY(QCPItemPosition::ptAxisRectRatio);
ItemManager::addTemporaryQCPItemText(textLabel);
// 创建指向点的线段QCPItemLine
@ -1004,8 +1030,11 @@ void CentralWidget::fillGraph(const double x1, const double x2)
void CentralWidget::clearData(const CentralWidget::ClearDataMode mode)
{
if(mode == ClearDataMode::All){
//
_analysisFilePathVtr.clear();
// Clear data.
Global::_curveExperimentDataVtr.clear();
logde<<"clearExperimentData...";
Global::clearExperimentData();
// Set lines visiable false.
_line1->setVisible(false);
@ -1044,6 +1073,9 @@ void CentralWidget::clearData(const CentralWidget::ClearDataMode mode)
ItemManager::removeItem(item);
}
}
//
AnalysisOperationRecorder::_ananlysisOperationVtr.clear();
}else if(mode == ClearDataMode::Undo){
// Clear the data of graph.
for (int i = _customPlot->plottableCount() - 1; i >= 0; --i) {
@ -1083,13 +1115,20 @@ void CentralWidget::clearData(const CentralWidget::ClearDataMode mode)
ItemManager::removeItem(item);
}
}
//
AnalysisOperationRecorder::removeTheLastAnalysisOperation();
}
_customPlot->replot();
}
void CentralWidget::loadAnalysisData(const CentralWidget::AnalysisMode mode, const double x1, const double x2)
void CentralWidget::loadAnalysisData(const AnalysisOperation ao)
{
if(Global::_mode == Global::Mode::Analysis){
}
switch (mode) {
case AnalysisMode::NumericalLabel:
{

View File

@ -12,6 +12,8 @@
#include "pointcalculate.h"
#include "localcustomplot.h"
#include "analysisoperationrecorder.h"
#include "global.h"
class CentralWidget:public QWidget
{
@ -30,13 +32,13 @@ public:
};
#endif
using AnalysisMode = Global::AnalysisMode;
// using AnalysisMode = Global::AnalysisMode;
// using AnalysisOperation = AnalysisOperationRecorder::AnalysisOperation;
CentralWidget(QWidget *parent = nullptr);
~CentralWidget();
void setAnalysisMode(const AnalysisMode);
void setAnalysisMode(const Global::AnalysisMode);
void clearAllData();
EventHandler* getEvnetHandler(){return _eventHandler;}
@ -75,17 +77,21 @@ public slots:
void slotAnalysisSettingLineXPoint(const int index,const double);
void slotDrawCustomText(const QString);
void slotDelCurve(QCPCurve*);
//
void slotGetAxisInfo();
void slotSetAxisSettings(const QVector<double>);
protected:
void timerEvent(QTimerEvent* event);
void contextMenuEvent(QContextMenuEvent *event);
// void contextMenuEvent(QContextMenuEvent *event);
private:
void glassTransitionHandle(const double x1,const double x2);
void quadraticFit(const QVector<QPointF>& points, double& a, double& b, double& c);
double derivativeAt(const double a, const double b, const double x);
PointCalculate::Line calculateLinearRegression(const QVector<double>& x, const QVector<double>& y);
PointCalculate::Line calculateLinearRegression(const QVector<double>& x,
const QVector<double>& y);
QPointF OnsetTemperaturePointHandle(const double x1,const double x2);
@ -100,9 +106,9 @@ private:
};
void clearData(const ClearDataMode);
void loadAnalysisData(const AnalysisMode,const double x1,const double x2);
void loadAnalysisData(const AnalysisOperationRecorder::AnalysisOperation);
private:
AnalysisMode _analysisMode;
AnalysisOperationRecorder::AnalysisMode _analysisMode;
LocalCustomPlot *_customPlot;
QCPCurve *_currentCurve;
EventHandler* _eventHandler;

View File

@ -159,7 +159,9 @@ void EventHandler::initMenu()
_baseLineAction = new QAction("基线",_plot);
_standardSampleAction = new QAction("标样",_plot);
_sampleAction = new QAction("样品",_plot);
_delCurveAction = new QAction("删除当前曲线",_plot);
_menu->addAction(_delCurveAction);
_menu->addAction(_specificHeatItemAction);
QMenu *specificHeatItemMenu = new QMenu(_plot);
@ -175,6 +177,9 @@ void EventHandler::initMenu()
this,&EventHandler::slotStandardSample);
connect(_sampleAction,&QAction::triggered,
this,&EventHandler::slotSample);
connect(_delCurveAction,&QAction::triggered,
this,&EventHandler::slotDelCurve);
}
bool EventHandler::isNearLine(QCPItemStraightLine *line, const QPoint &pos)
@ -221,7 +226,17 @@ void EventHandler::slotSample()
_plot->replot();
#endif
emit sigSetCurve(SpecificHeatComparisonMethodForm::CurveType::Sample,curve);
emit sigSetCurve(SpecificHeatComparisonMethodForm::CurveType::Sample,curve);
}
void EventHandler::slotDelCurve()
{
QCPCurve *curve = qobject_cast<QCPCurve *>(_plot->selectedPlottables().front());
if(!curve){
return;
}
emit sigDelCurve(curve);
}
void EventHandler::updateSelectedRegion()

View File

@ -34,6 +34,7 @@ public:
signals:
void sigSendLineXCoord(const int,const double);
void sigSetCurve(const int, QCPCurve*);
void sigDelCurve(QCPCurve*);
protected:
bool eventFilter(QObject *obj, QEvent *event) override;
private slots:
@ -41,6 +42,7 @@ private slots:
void slotStandardSample();
void slotSample();
void slotDelCurve();
private:
void initMenu();
int findClosestIndex(const QVector<double> &data, double target);
@ -56,6 +58,7 @@ private:
QMenu* _menu;
QAction* _specificHeatItemAction,*_baseLineAction,
*_standardSampleAction,*_sampleAction;
QAction* _delCurveAction;
};
#endif

View File

@ -43,8 +43,9 @@ void removeItem(QObject *obj)
for (int i = _QCPItemTextVtr.size() - 1; i >= 0; --i) {
QCPItemText *item = _QCPItemTextVtr[i];
if (item == obj) {
_QCPItemTextVtr.remove(i);
return;
// return;
}
}
@ -52,7 +53,7 @@ void removeItem(QObject *obj)
QCPItemLine *item = _QCPItemLineVtr[i];
if (item == obj) {
_QCPItemLineVtr.remove(i);
return;
// return;
}
}
@ -60,7 +61,7 @@ void removeItem(QObject *obj)
QCPGraph *item = _QCPGraphVtr[i];
if (item == obj) {
_QCPGraphVtr.remove(i);
return;
// return;
}
}

View File

@ -8,6 +8,9 @@ const QString OriginStr("origin");
const QString ConfirmStr("confirm");
const QString TemporaryStr("temporary");
const QString Separator("__");
#if 0
enum ItemAttribute{
Origin,