2025-09-28T17:19:30
This commit is contained in:
parent
f22e46dba4
commit
e1e7bc984f
BIN
experiment_data/sample_data/new_2025_09_28_08_41_26.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_08_41_26.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_08_49_55.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_08_49_55.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_08_51_43.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_08_51_43.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_08_51_58.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_08_51_58.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_08_52_02.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_08_52_02.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_08_52_48.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_08_52_48.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_08_54_03.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_08_54_03.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_08_57_26.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_08_57_26.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_09_30_38.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_09_30_38.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_10_01_26.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_10_01_26.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_10_29_10.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_10_29_10.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_11_12_10.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_11_12_10.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_11_16_53.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_11_16_53.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_11_25_00.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_11_25_00.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_11_28_02.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_11_28_02.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_11_40_25.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_11_40_25.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_11_40_47.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_11_40_47.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_11_41_10.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_11_41_10.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_11_45_16.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_11_45_16.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_13_08_30.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_13_08_30.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_13_09_25.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_13_09_25.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_13_10_25.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_13_10_25.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_13_11_14.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_13_11_14.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_13_11_27.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_13_11_27.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_13_11_50.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_13_11_50.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_13_12_52.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_13_12_52.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_13_13_09.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_13_13_09.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_13_13_26.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_13_13_26.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_13_36_16.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_13_36_16.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_13_36_29.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_13_36_29.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_13_40_31.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_13_40_31.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_13_59_00.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_13_59_00.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_14_02_51.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_14_02_51.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_14_04_38.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_14_04_38.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_14_09_15.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_14_09_15.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_14_20_10.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_14_20_10.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_14_23_52.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_14_23_52.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_14_24_47.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_14_24_47.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_14_25_04.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_14_25_04.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_14_27_53.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_14_27_53.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_15_26_27.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_15_26_27.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_15_27_08.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_15_27_08.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_15_27_41.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_15_27_41.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_15_28_04.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_15_28_04.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_15_28_30.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_15_28_30.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_15_28_53.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_15_28_53.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_15_29_50.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_15_29_50.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_15_30_27.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_15_30_27.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_15_31_15.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_15_31_15.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_15_31_41.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_15_31_41.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_15_32_29.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_15_32_29.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_15_33_16.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_15_33_16.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_15_37_58.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_15_37_58.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_15_52_33.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_15_52_33.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_15_53_08.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_15_53_08.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_15_53_25.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_15_53_25.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/new_2025_09_28_16_03_50.xlsx
Normal file
BIN
experiment_data/sample_data/new_2025_09_28_16_03_50.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/~$new_2025_09_28_15_29_50.xlsx
Normal file
BIN
experiment_data/sample_data/~$new_2025_09_28_15_29_50.xlsx
Normal file
Binary file not shown.
@ -147,7 +147,7 @@ void XlsxHandler::readPhaseData(QXlsx::Worksheet *workSheet, int &startLineIndex
|
|||||||
}
|
}
|
||||||
|
|
||||||
void XlsxHandler::writeExperimentFile(const QString filePath) {
|
void XlsxHandler::writeExperimentFile(const QString filePath) {
|
||||||
logde << "write file...";
|
logde << "writeExperimentFile...";
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if(Global::_curveExperimentDataVtr.empty()){
|
if(Global::_curveExperimentDataVtr.empty()){
|
||||||
@ -293,9 +293,12 @@ void XlsxHandler::writeExperimentFile(const QString filePath) {
|
|||||||
// logde<<"edVtr size:"<<edVtr.size();
|
// logde<<"edVtr size:"<<edVtr.size();
|
||||||
|
|
||||||
for (int index = 0; index < edVtr.size(); index++) {
|
for (int index = 0; index < edVtr.size(); index++) {
|
||||||
// logde<<"index :"<<index;
|
|
||||||
const Global::ExperimentData &ed = edVtr.at(index);
|
const Global::ExperimentData &ed = edVtr.at(index);
|
||||||
|
// 跳过运行时间为0 的数据
|
||||||
|
if(ed.runTime == 0){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
//
|
||||||
xlsx.write(row, 1, index);
|
xlsx.write(row, 1, index);
|
||||||
xlsx.write(row, 2, ed.runTime);
|
xlsx.write(row, 2, ed.runTime);
|
||||||
xlsx.write(row, 3, ed.sampleTemp);
|
xlsx.write(row, 3, ed.sampleTemp);
|
||||||
@ -667,6 +670,8 @@ void XlsxHandler::writeSmoothnessFile(const QString filePath) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void XlsxHandler::writeXlsxFile(const QString filePath) {
|
void XlsxHandler::writeXlsxFile(const QString filePath) {
|
||||||
|
logde<<"write xlsx file...";
|
||||||
|
|
||||||
if (Global::_curveFileDataVtr.empty()) {
|
if (Global::_curveFileDataVtr.empty()) {
|
||||||
logde << "curve file data vtr empty...";
|
logde << "curve file data vtr empty...";
|
||||||
return;
|
return;
|
||||||
|
@ -418,11 +418,13 @@ void MainWindow::startExperiment() {
|
|||||||
_centralWidget->startExperiment();
|
_centralWidget->startExperiment();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::startExperimentByDeviceInfo()
|
void MainWindow::startExperimentByDeviceInfo() {
|
||||||
{
|
|
||||||
Global::_mode = Global::Mode::Experiment;
|
Global::_mode = Global::Mode::Experiment;
|
||||||
_manuallyStopTheExperimentFlag = false;
|
_manuallyStopTheExperimentFlag = false;
|
||||||
_centralWidget->startExperiment();
|
_centralWidget->startExperiment();
|
||||||
|
|
||||||
|
// 实验开始,清除上一个实验所有数据。
|
||||||
|
Global::clearExperimentData();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionStop_triggered() {
|
void MainWindow::on_actionStop_triggered() {
|
||||||
@ -500,7 +502,10 @@ void MainWindow::slotSaveExperimentalDataMsgBox() {
|
|||||||
// auto save file.
|
// auto save file.
|
||||||
logde << "slotSaveExperimentalDataMsgBox saveFile ...";
|
logde << "slotSaveExperimentalDataMsgBox saveFile ...";
|
||||||
QString finalFileName;
|
QString finalFileName;
|
||||||
if (saveFile(Global::_experimentInfo.sampleName, Global::Mode::Experiment, finalFileName, true)) {
|
if (saveFile(Global::_experimentInfo.sampleName,
|
||||||
|
Global::Mode::Experiment,
|
||||||
|
finalFileName,
|
||||||
|
true)) {
|
||||||
_leftWidget->reloadFileName();
|
_leftWidget->reloadFileName();
|
||||||
|
|
||||||
QString str = QString("%1 文件保存成功。").arg(finalFileName);
|
QString str = QString("%1 文件保存成功。").arg(finalFileName);
|
||||||
@ -526,6 +531,8 @@ void MainWindow::on_actionConnectToDev_triggered() {
|
|||||||
logde << "connect to device...";
|
logde << "connect to device...";
|
||||||
|
|
||||||
if (SerialPort::instance()->isOpen()) {
|
if (SerialPort::instance()->isOpen()) {
|
||||||
|
logde << "close device.";
|
||||||
|
|
||||||
SerialPort::instance()->closeSp();
|
SerialPort::instance()->closeSp();
|
||||||
|
|
||||||
ui->actionConnectToDev->setIcon(QIcon(":/images/connect.png"));
|
ui->actionConnectToDev->setIcon(QIcon(":/images/connect.png"));
|
||||||
@ -537,29 +544,25 @@ void MainWindow::on_actionConnectToDev_triggered() {
|
|||||||
slotUpdateStatusbarMsg(str);
|
slotUpdateStatusbarMsg(str);
|
||||||
showMesgBox(str);
|
showMesgBox(str);
|
||||||
} else {
|
} else {
|
||||||
|
logde << "open device.";
|
||||||
|
|
||||||
if (SerialPort::instance()->openSp()) {
|
if (SerialPort::instance()->openSp()) {
|
||||||
|
|
||||||
logde << "open serial port success. 1";
|
|
||||||
|
|
||||||
setActionEnable(true);
|
setActionEnable(true);
|
||||||
// Global::instance()->setMode(Global::Mode::ConnectedToDev);
|
// Global::instance()->setMode(Global::Mode::ConnectedToDev);
|
||||||
Global::_mode = Global::Mode::ConnectedToDev;
|
Global::_mode = Global::Mode::ConnectedToDev;
|
||||||
|
|
||||||
logde << "open serial port success. 2";
|
|
||||||
|
|
||||||
QByteArray ba = DataParser::inquirePhaseInfo();
|
QByteArray ba = DataParser::inquirePhaseInfo();
|
||||||
SerialPort::instance()->sendData(ba);
|
SerialPort::instance()->sendData(ba);
|
||||||
|
|
||||||
ui->actionConnectToDev->setIcon(QIcon(":/images/disconnect.png"));
|
ui->actionConnectToDev->setIcon(QIcon(":/images/disconnect.png"));
|
||||||
ui->actionConnectToDev->setText("断开连接");
|
ui->actionConnectToDev->setText("断开连接");
|
||||||
|
|
||||||
logde << "open serial port.";
|
|
||||||
//
|
//
|
||||||
logde << "open serial port success. 3";
|
|
||||||
|
|
||||||
QString str("设备已连接。");
|
QString str("设备已连接。");
|
||||||
slotUpdateStatusbarMsg(str);
|
slotUpdateStatusbarMsg(str);
|
||||||
showMesgBox(str);
|
showMesgBox(str);
|
||||||
|
|
||||||
|
logde << "open serial port success. ";
|
||||||
} else {
|
} else {
|
||||||
// QMessageBox::warning(this, "warnning", "Serial Port open failed.");
|
// QMessageBox::warning(this, "warnning", "Serial Port open failed.");
|
||||||
showMesgBox("设备打开失败。");
|
showMesgBox("设备打开失败。");
|
||||||
@ -590,6 +593,11 @@ void MainWindow::on_actionPeakSynthesisAnalysis_triggered() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionClearAllData_triggered() {
|
void MainWindow::on_actionClearAllData_triggered() {
|
||||||
|
// 实验过程中,不允许清除数据。
|
||||||
|
if(Global::_mode == Global::Mode::Experiment) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
slotUpdateStatusbarMsg("");
|
slotUpdateStatusbarMsg("");
|
||||||
|
|
||||||
_rightWidget->hide();
|
_rightWidget->hide();
|
||||||
|
@ -79,31 +79,26 @@ SerialPort *SerialPort::instance() {
|
|||||||
SerialPort::~SerialPort() {
|
SerialPort::~SerialPort() {
|
||||||
logde << "serialport destructor.";
|
logde << "serialport destructor.";
|
||||||
|
|
||||||
if (_sp && _sp->isOpen()) {
|
closeSp();
|
||||||
_sp->clear();
|
|
||||||
_sp->close();
|
|
||||||
}
|
|
||||||
delete _sp;
|
delete _sp;
|
||||||
_sp = nullptr;
|
_sp = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SerialPort::timerEvent(QTimerEvent *event) {
|
|
||||||
}
|
|
||||||
|
|
||||||
void SerialPort::slotReadData() {
|
void SerialPort::slotReadData() {
|
||||||
QByteArray ba = _sp->readAll();
|
QByteArray ba = _sp->readAll();
|
||||||
if (ba.size() == 0) {
|
if (ba.size() == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 1
|
||||||
QString hexData = ba.toHex(' '); // ' ' 作为分隔符,可选参数
|
QString hexData = ba.toHex(' '); // ' ' 作为分隔符,可选参数
|
||||||
logde << "receive info (hex):" << hexData.toStdString();
|
logde << "receive info (hex):" << hexData.toStdString();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SerialPortProtocol *spp = (SerialPortProtocol *)ba.data();
|
SerialPortProtocol *spp = (SerialPortProtocol *)ba.data();
|
||||||
if (FRANE_HEAD != spp->head) {
|
if (FRANE_HEAD != spp->head) {
|
||||||
qDebug() << "Data header error.";
|
logde << "Data header error.";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,6 +157,26 @@ void SerialPort::updateStatus(const CommonData &cd) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 判断是否根据下位机数据,切换软件实验模式。
|
||||||
|
static Global::Mode preMode = Global::Mode::Analysis;
|
||||||
|
bool sendSaveSignalFlag = false;
|
||||||
|
if (Global::_mode != preMode) {
|
||||||
|
if (preMode == Global::Mode::Experiment
|
||||||
|
&& Global::_mode == Global::Mode::Analysis) {
|
||||||
|
sendSaveSignalFlag = true;
|
||||||
|
} else if (preMode == Global::Mode::Analysis
|
||||||
|
&& Global::_mode == Global::Mode::Experiment) {
|
||||||
|
|
||||||
|
// 根据下位机数据,软件进入实验模式,开始实验。
|
||||||
|
logde << "start experiment, accord to device data...";
|
||||||
|
logde << "---------------------";
|
||||||
|
|
||||||
|
emit sigStartExperiment();
|
||||||
|
}
|
||||||
|
|
||||||
|
preMode = Global::_mode;
|
||||||
|
}
|
||||||
|
|
||||||
// If phase update, add new phase data to the global param.
|
// If phase update, add new phase data to the global param.
|
||||||
if (Global::_mode == Global::Mode::Experiment) {
|
if (Global::_mode == Global::Mode::Experiment) {
|
||||||
if (Global::_currentPhase != (int)cd.current_phase) {
|
if (Global::_currentPhase != (int)cd.current_phase) {
|
||||||
@ -174,6 +189,7 @@ void SerialPort::updateStatus(const CommonData &cd) {
|
|||||||
ced.phaseIndex = cd.current_phase;
|
ced.phaseIndex = cd.current_phase;
|
||||||
|
|
||||||
Global::_curveExperimentDataVtr.push_back(ced);
|
Global::_curveExperimentDataVtr.push_back(ced);
|
||||||
|
|
||||||
Global::_currentCurveExperimentDataPtr =
|
Global::_currentCurveExperimentDataPtr =
|
||||||
&Global::_curveExperimentDataVtr.last();
|
&Global::_curveExperimentDataVtr.last();
|
||||||
|
|
||||||
@ -219,7 +235,7 @@ void SerialPort::updateStatus(const CommonData &cd) {
|
|||||||
|
|
||||||
emit sigUpdateStatusbarMsg(msg);
|
emit sigUpdateStatusbarMsg(msg);
|
||||||
|
|
||||||
#if 1
|
#if 0
|
||||||
// If save experiment data.
|
// If save experiment data.
|
||||||
static Global::Mode preMode = Global::Mode::Analysis;
|
static Global::Mode preMode = Global::Mode::Analysis;
|
||||||
bool sendSaveSignalFlag = false;
|
bool sendSaveSignalFlag = false;
|
||||||
@ -229,18 +245,22 @@ void SerialPort::updateStatus(const CommonData &cd) {
|
|||||||
sendSaveSignalFlag = true;
|
sendSaveSignalFlag = true;
|
||||||
} else if (preMode == Global::Mode::Analysis
|
} else if (preMode == Global::Mode::Analysis
|
||||||
&& Global::_mode == Global::Mode::Experiment) {
|
&& Global::_mode == Global::Mode::Experiment) {
|
||||||
logde<<"update status accord to device data...";
|
|
||||||
logde<<"--------------------------------------";
|
// 根据下位机数据,软件进入实验模式,开始实验。
|
||||||
|
logde << "start experiment, accord to device data...";
|
||||||
|
logde << "---------------------";
|
||||||
|
|
||||||
emit sigStartExperiment();
|
emit sigStartExperiment();
|
||||||
}
|
}
|
||||||
|
|
||||||
preMode = Global::_mode;
|
preMode = Global::_mode;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// 弹出保存数据对话框。
|
||||||
if (sendSaveSignalFlag && !Global::_OITAutoAnalysisModeFlag) {
|
if (sendSaveSignalFlag && !Global::_OITAutoAnalysisModeFlag) {
|
||||||
emit sigSaveExperimentalDataMsgBox();
|
emit sigSaveExperimentalDataMsgBox();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SerialPort::commonDataParser(const int dataLength, const u16 addr,
|
void SerialPort::commonDataParser(const int dataLength, const u16 addr,
|
||||||
@ -338,9 +358,15 @@ void SerialPort::commonDataParser(const int dataLength, const u16 addr,
|
|||||||
|
|
||||||
bool SerialPort::openSp() {
|
bool SerialPort::openSp() {
|
||||||
logde << "openSp 1";
|
logde << "openSp 1";
|
||||||
|
closeSp();
|
||||||
|
QThread::msleep(100);
|
||||||
|
|
||||||
|
#if 0
|
||||||
if (_sp != nullptr && _sp->isOpen()) {
|
if (_sp != nullptr && _sp->isOpen()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
logde << "openSp 2";
|
logde << "openSp 2";
|
||||||
foreach (const QSerialPortInfo &info, QSerialPortInfo::availablePorts()) {
|
foreach (const QSerialPortInfo &info, QSerialPortInfo::availablePorts()) {
|
||||||
u16 pid = info.productIdentifier();
|
u16 pid = info.productIdentifier();
|
||||||
|
@ -28,8 +28,6 @@ public:
|
|||||||
bool openSp();
|
bool openSp();
|
||||||
bool isOpen(){return _sp->isOpen();}
|
bool isOpen(){return _sp->isOpen();}
|
||||||
bool closeSp();
|
bool closeSp();
|
||||||
protected:
|
|
||||||
void timerEvent(QTimerEvent *event);
|
|
||||||
signals:
|
signals:
|
||||||
void sigSendCommonData(const CommonData &);
|
void sigSendCommonData(const CommonData &);
|
||||||
void sigSendCommonDataToRealDataForm(const CommonData &);
|
void sigSendCommonDataToRealDataForm(const CommonData &);
|
||||||
|
@ -19,12 +19,10 @@ using AnaOpRecorderOperation = AnalysisOperationRecorder::AnalysisOperation;
|
|||||||
using namespace Global;
|
using namespace Global;
|
||||||
|
|
||||||
CentralWidget::CentralWidget(QWidget *parent)
|
CentralWidget::CentralWidget(QWidget *parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent), _customPlot(new LocalCustomPlot(this))
|
||||||
,_customPlot(new LocalCustomPlot(this))
|
|
||||||
// ,_customPlot(new QCustomPlot(this))
|
// ,_customPlot(new QCustomPlot(this))
|
||||||
,_analysisMode(AnalysisMode::Null)
|
,
|
||||||
,_currentCurve(nullptr)
|
_analysisMode(AnalysisMode::Null), _currentCurve(nullptr) {
|
||||||
{
|
|
||||||
setMouseTracking(true);
|
setMouseTracking(true);
|
||||||
|
|
||||||
setStyleSheet("background-color: lightgray;");
|
setStyleSheet("background-color: lightgray;");
|
||||||
@ -99,12 +97,10 @@ CentralWidget::CentralWidget(QWidget *parent)
|
|||||||
// startTimer(300);
|
// startTimer(300);
|
||||||
}
|
}
|
||||||
|
|
||||||
CentralWidget::~CentralWidget()
|
CentralWidget::~CentralWidget() {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CentralWidget::switchAxisMode()
|
void CentralWidget::switchAxisMode() {
|
||||||
{
|
|
||||||
if (Global::_mode != Global::Mode::Analysis) {
|
if (Global::_mode != Global::Mode::Analysis) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -120,8 +116,7 @@ void CentralWidget::switchAxisMode()
|
|||||||
uiLoadXlsxFileData();
|
uiLoadXlsxFileData();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CentralWidget::isCurrentCurve(QCPCurve *curve)
|
bool CentralWidget::isCurrentCurve(QCPCurve *curve) {
|
||||||
{
|
|
||||||
return _currentCurve == curve;
|
return _currentCurve == curve;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,8 +133,7 @@ void CentralWidget::deleteAllExperimentCurve()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
QCPCurve *CentralWidget::addCurveData(
|
QCPCurve *CentralWidget::addCurveData(
|
||||||
const QVector<ExperimentData> &dataVtr,const QString objectName)
|
const QVector<ExperimentData> &dataVtr, const QString objectName) {
|
||||||
{
|
|
||||||
logde << "addCurveData...";
|
logde << "addCurveData...";
|
||||||
logde << "data vtr size:" << dataVtr.size();
|
logde << "data vtr size:" << dataVtr.size();
|
||||||
|
|
||||||
@ -148,8 +142,7 @@ QCPCurve* CentralWidget::addCurveData(
|
|||||||
// Load data.
|
// Load data.
|
||||||
QVector<double> tVtr, xVtr, yVtr;
|
QVector<double> tVtr, xVtr, yVtr;
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for (const Global::ExperimentData &ed : dataVtr)
|
for (const Global::ExperimentData &ed : dataVtr) {
|
||||||
{
|
|
||||||
tVtr.push_back(index++);
|
tVtr.push_back(index++);
|
||||||
if (_axisMode == AxisMode::SingleY) {
|
if (_axisMode == AxisMode::SingleY) {
|
||||||
xVtr.push_back(ed.sampleTemp);
|
xVtr.push_back(ed.sampleTemp);
|
||||||
@ -205,8 +198,7 @@ QCPCurve* CentralWidget::addCurveData(
|
|||||||
return _currentCurve;
|
return _currentCurve;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CentralWidget::startExperiment()
|
void CentralWidget::startExperiment() {
|
||||||
{
|
|
||||||
if (Global::_experimentOITFlag) {
|
if (Global::_experimentOITFlag) {
|
||||||
setAxisMode(Global::AxisMode::DoubleY);
|
setAxisMode(Global::AxisMode::DoubleY);
|
||||||
} else {
|
} else {
|
||||||
@ -223,8 +215,7 @@ void CentralWidget::startExperiment()
|
|||||||
_customPlot->replot();
|
_customPlot->replot();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CentralWidget::setVerticalLineRange(const double x1, const double x2)
|
void CentralWidget::setVerticalLineRange(const double x1, const double x2) {
|
||||||
{
|
|
||||||
_line1->point1->setCoords(x1, _line1->point1->coords().y());
|
_line1->point1->setCoords(x1, _line1->point1->coords().y());
|
||||||
_line1->point2->setCoords(x1, _line1->point2->coords().y());
|
_line1->point2->setCoords(x1, _line1->point2->coords().y());
|
||||||
|
|
||||||
@ -234,8 +225,7 @@ void CentralWidget::setVerticalLineRange(const double x1, const double x2)
|
|||||||
slotAnalysisSettingConfirm();
|
slotAnalysisSettingConfirm();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CentralWidget::setAnalysisMode(const AnalysisMode mode)
|
void CentralWidget::setAnalysisMode(const AnalysisMode mode) {
|
||||||
{
|
|
||||||
_analysisMode = mode;
|
_analysisMode = mode;
|
||||||
|
|
||||||
if (mode == AnalysisMode::Null) {
|
if (mode == AnalysisMode::Null) {
|
||||||
@ -267,10 +257,8 @@ void CentralWidget::setAnalysisMode(const AnalysisMode mode)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void CentralWidget::slotModeModify(const Global::Mode mode)
|
void CentralWidget::slotModeModify(const Global::Mode mode) {
|
||||||
{
|
if (Global::Mode::Experiment == mode) {
|
||||||
if (Global::Mode::Experiment == mode)
|
|
||||||
{
|
|
||||||
#if 0
|
#if 0
|
||||||
if (_customPlot->graphCount() > 0 && _currentGraph)
|
if (_customPlot->graphCount() > 0 && _currentGraph)
|
||||||
{
|
{
|
||||||
@ -288,20 +276,24 @@ void CentralWidget::slotModeModify(const Global::Mode mode)
|
|||||||
// 设置坐标轴范围,以便我们可以看到全部数据
|
// 设置坐标轴范围,以便我们可以看到全部数据
|
||||||
_customPlot->xAxis->setRange(0, 400);
|
_customPlot->xAxis->setRange(0, 400);
|
||||||
_customPlot->yAxis->setRange(-20, 20);
|
_customPlot->yAxis->setRange(-20, 20);
|
||||||
}
|
} else if (Global::Mode::Analysis == mode) {
|
||||||
else if (Global::Mode::Analysis == mode)
|
|
||||||
{
|
|
||||||
qDebug() << "file close...";
|
qDebug() << "file close...";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CentralWidget::slotRecvCommonData(const CommonData &cd)
|
void CentralWidget::slotRecvCommonData(const CommonData &cd) {
|
||||||
{
|
logde << "slotRecvCommonData, cd:" << cd.add_run_time;
|
||||||
|
|
||||||
// Record data.
|
// Record data.
|
||||||
if (!Global::_currentCurveExperimentDataPtr) {
|
if (!Global::_currentCurveExperimentDataPtr) {
|
||||||
loger << "_currentCurveExperimentDataPtr is nullptr.Soft exit.";
|
loger << "_currentCurveExperimentDataPtr is nullptr.Soft exit.";
|
||||||
exit(0);
|
exit(0);
|
||||||
} else {
|
} else {
|
||||||
|
// 跳过运行时间为0 的数据
|
||||||
|
if (cd.add_run_time == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//
|
||||||
Global::ExperimentData ed;
|
Global::ExperimentData ed;
|
||||||
ed.dsc = cd.dsc;
|
ed.dsc = cd.dsc;
|
||||||
ed.sampleTemp = cd.sample_temp;
|
ed.sampleTemp = cd.sample_temp;
|
||||||
@ -309,7 +301,8 @@ void CentralWidget::slotRecvCommonData(const CommonData &cd)
|
|||||||
ed.constantTempTime = cd.add_constan_temp_time;
|
ed.constantTempTime = cd.add_constan_temp_time;
|
||||||
|
|
||||||
if (Global::_currentCurveExperimentDataPtr->dataVtr.empty()) {
|
if (Global::_currentCurveExperimentDataPtr->dataVtr.empty()) {
|
||||||
logde<<"change phase, index:"<<Global::_currentCurveExperimentDataPtr->phaseIndex;
|
logde << "change phase, index:"
|
||||||
|
<< Global::_currentCurveExperimentDataPtr->phaseIndex;
|
||||||
_currentCurve = nullptr;
|
_currentCurve = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -357,8 +350,7 @@ void CentralWidget::slotRecvCommonData(const CommonData &cd)
|
|||||||
_customPlot->replot();
|
_customPlot->replot();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CentralWidget::slotRecvAnalysisFileName(const QString &filePath)
|
void CentralWidget::slotRecvAnalysisFileName(const QString &filePath) {
|
||||||
{
|
|
||||||
if (_analysisFilePathVtr.contains(filePath)) {
|
if (_analysisFilePathVtr.contains(filePath)) {
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
@ -378,8 +370,7 @@ void CentralWidget::slotRecvAnalysisFileName(const QString &filePath)
|
|||||||
uiLoadXlsxFileData();
|
uiLoadXlsxFileData();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CentralWidget::slotAnalysisSettingApply()
|
void CentralWidget::slotAnalysisSettingApply() {
|
||||||
{
|
|
||||||
// Set the analysis data corresponding current curve.
|
// Set the analysis data corresponding current curve.
|
||||||
if (!_currentCurve) {
|
if (!_currentCurve) {
|
||||||
logde << "failed. current curve is nullptr.";
|
logde << "failed. current curve is nullptr.";
|
||||||
@ -472,8 +463,7 @@ void CentralWidget::slotAnalysisSettingApply()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CentralWidget::slotAnalysisSettingConfirm()
|
void CentralWidget::slotAnalysisSettingConfirm() {
|
||||||
{
|
|
||||||
ItemManager::confirm();
|
ItemManager::confirm();
|
||||||
|
|
||||||
slotAnalysisSettingApply();
|
slotAnalysisSettingApply();
|
||||||
@ -486,16 +476,14 @@ void CentralWidget::slotAnalysisSettingConfirm()
|
|||||||
emit sigRightDockWidgetHide();
|
emit sigRightDockWidgetHide();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CentralWidget::slotAnalysisSettingUndo()
|
void CentralWidget::slotAnalysisSettingUndo() {
|
||||||
{
|
|
||||||
clearData(ClearDataMode::Undo);
|
clearData(ClearDataMode::Undo);
|
||||||
|
|
||||||
_x1Record = 0.0;
|
_x1Record = 0.0;
|
||||||
_x2Record = 0.0;
|
_x2Record = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CentralWidget::slotAnalysisSettingCancel()
|
void CentralWidget::slotAnalysisSettingCancel() {
|
||||||
{
|
|
||||||
clearData(ClearDataMode::Undo);
|
clearData(ClearDataMode::Undo);
|
||||||
|
|
||||||
setAnalysisMode(AnalysisMode::Null);
|
setAnalysisMode(AnalysisMode::Null);
|
||||||
@ -506,13 +494,10 @@ void CentralWidget::slotAnalysisSettingCancel()
|
|||||||
emit sigRightDockWidgetHide();
|
emit sigRightDockWidgetHide();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CentralWidget::slotAnalysisSettingLineXPoint(const int index, const double)
|
void CentralWidget::slotAnalysisSettingLineXPoint(const int index, const double) {
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CentralWidget::slotDrawCustomText(const QString str)
|
void CentralWidget::slotDrawCustomText(const QString str) {
|
||||||
{
|
|
||||||
QCPItemText *customLegendItem = new QCPItemText(_customPlot);
|
QCPItemText *customLegendItem = new QCPItemText(_customPlot);
|
||||||
customLegendItem->position->setTypeX(QCPItemPosition::ptAbsolute);
|
customLegendItem->position->setTypeX(QCPItemPosition::ptAbsolute);
|
||||||
customLegendItem->position->setTypeY(QCPItemPosition::ptAbsolute);
|
customLegendItem->position->setTypeY(QCPItemPosition::ptAbsolute);
|
||||||
@ -533,8 +518,7 @@ void CentralWidget::slotDrawCustomText(const QString str)
|
|||||||
_customPlot->replot();
|
_customPlot->replot();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CentralWidget::slotDelCurve(QCPCurve *curve)
|
void CentralWidget::slotDelCurve(QCPCurve *curve) {
|
||||||
{
|
|
||||||
if (!curve) {
|
if (!curve) {
|
||||||
logde << "current curve is nullptr.";
|
logde << "current curve is nullptr.";
|
||||||
return;
|
return;
|
||||||
@ -545,8 +529,7 @@ void CentralWidget::slotDelCurve(QCPCurve *curve)
|
|||||||
deleteCurveByObjectName(curve->objectName());
|
deleteCurveByObjectName(curve->objectName());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CentralWidget::slotGetAxisInfo()
|
void CentralWidget::slotGetAxisInfo() {
|
||||||
{
|
|
||||||
QVector<AxisInfo> vtr;
|
QVector<AxisInfo> vtr;
|
||||||
|
|
||||||
auto func = [&](QCPAxis *axis) {
|
auto func = [&](QCPAxis *axis) {
|
||||||
@ -565,8 +548,7 @@ void CentralWidget::slotGetAxisInfo()
|
|||||||
emit sigGetAxisInfoWithData(vtr);
|
emit sigGetAxisInfoWithData(vtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CentralWidget::slotSetAxisSettings(const QVector<double>vtr)
|
void CentralWidget::slotSetAxisSettings(const QVector<double> vtr) {
|
||||||
{
|
|
||||||
_customPlot->xAxis->setRange(vtr.at(0), vtr.at(1));
|
_customPlot->xAxis->setRange(vtr.at(0), vtr.at(1));
|
||||||
_customPlot->yAxis->setRange(vtr.at(2), vtr.at(3));
|
_customPlot->yAxis->setRange(vtr.at(2), vtr.at(3));
|
||||||
|
|
||||||
@ -577,8 +559,7 @@ void CentralWidget::slotSetAxisSettings(const QVector<double>vtr)
|
|||||||
_customPlot->replot();
|
_customPlot->replot();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CentralWidget::timerEvent(QTimerEvent *event)
|
void CentralWidget::timerEvent(QTimerEvent *event) {
|
||||||
{
|
|
||||||
_customPlot->replot();
|
_customPlot->replot();
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
@ -607,8 +588,7 @@ void CentralWidget::timerEvent(QTimerEvent *event)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void CentralWidget::slotSelectionChangedByUser()
|
void CentralWidget::slotSelectionChangedByUser() {
|
||||||
{
|
|
||||||
// 获取所有被选中的绘图对象
|
// 获取所有被选中的绘图对象
|
||||||
QList<QCPAbstractPlottable *> selectedPlottables = _customPlot->selectedPlottables();
|
QList<QCPAbstractPlottable *> selectedPlottables = _customPlot->selectedPlottables();
|
||||||
|
|
||||||
@ -622,8 +602,7 @@ void CentralWidget::slotSelectionChangedByUser()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CentralWidget::uiLoadXlsxFileData()
|
void CentralWidget::uiLoadXlsxFileData() {
|
||||||
{
|
|
||||||
#if 1
|
#if 1
|
||||||
// Set axis.
|
// Set axis.
|
||||||
_customPlot->yAxis->setVisible(true);
|
_customPlot->yAxis->setVisible(true);
|
||||||
@ -658,8 +637,7 @@ void CentralWidget::uiLoadXlsxFileData()
|
|||||||
// Load data.
|
// Load data.
|
||||||
QVector<double> tVtr, tempVtr, timeVtr, dscVtr;
|
QVector<double> tVtr, tempVtr, timeVtr, dscVtr;
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for (Global::ExperimentData &ed : pti.dataVtr)
|
for (Global::ExperimentData &ed : pti.dataVtr) {
|
||||||
{
|
|
||||||
tVtr.push_back(index++);
|
tVtr.push_back(index++);
|
||||||
#if 0
|
#if 0
|
||||||
if(_axisMode == AxisMode::SingleY){
|
if(_axisMode == AxisMode::SingleY){
|
||||||
@ -755,8 +733,7 @@ void CentralWidget::uiLoadXlsxFileData()
|
|||||||
<< cfd.analysisOperationVtr.size();
|
<< cfd.analysisOperationVtr.size();
|
||||||
|
|
||||||
if (!cfd.analysisOperationVtr.empty()) {
|
if (!cfd.analysisOperationVtr.empty()) {
|
||||||
for(AnaOpRecorder::AnalysisOperation& ao
|
for (AnaOpRecorder::AnalysisOperation &ao : cfd.analysisOperationVtr) {
|
||||||
:cfd.analysisOperationVtr){
|
|
||||||
calculateAnalysisResult(ao.mode, ao.x1, ao.x2, cfd.filePath);
|
calculateAnalysisResult(ao.mode, ao.x1, ao.x2, cfd.filePath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -766,8 +743,7 @@ void CentralWidget::uiLoadXlsxFileData()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void CentralWidget::glassTransitionHandle(const double x1,const double x2,const QString objectName)
|
void CentralWidget::glassTransitionHandle(const double x1, const double x2, const QString objectName) {
|
||||||
{
|
|
||||||
QVector<double> tickPositions = _customPlot->xAxis->tickVector();
|
QVector<double> tickPositions = _customPlot->xAxis->tickVector();
|
||||||
double step = tickPositions.at(1) - tickPositions.at(0);
|
double step = tickPositions.at(1) - tickPositions.at(0);
|
||||||
logde << "glassTransitionHandle step:" << step;
|
logde << "glassTransitionHandle step:" << step;
|
||||||
@ -867,7 +843,6 @@ void CentralWidget::glassTransitionHandle(const double x1,const double x2,const
|
|||||||
|
|
||||||
targetX = it.key();
|
targetX = it.key();
|
||||||
targetLine = it.value();
|
targetLine = it.value();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1001,8 +976,7 @@ PointCalculate::Line CentralWidget::calculateLinearRegression(const QVector<doub
|
|||||||
return line;
|
return line;
|
||||||
}
|
}
|
||||||
|
|
||||||
QPointF CentralWidget::onsetTemperaturePointHandle(const double x1,const double x2)
|
QPointF CentralWidget::onsetTemperaturePointHandle(const double x1, const double x2) {
|
||||||
{
|
|
||||||
Global::ExperimentData ed = PointCalculate::findOnSetDataByTemperature(x1, x2);
|
Global::ExperimentData ed = PointCalculate::findOnSetDataByTemperature(x1, x2);
|
||||||
|
|
||||||
if (Global::_axisMode == Global::AxisMode::SingleY) {
|
if (Global::_axisMode == Global::AxisMode::SingleY) {
|
||||||
@ -1012,8 +986,7 @@ QPointF CentralWidget::onsetTemperaturePointHandle(const double x1,const double
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QPointF CentralWidget::endSetTemperaturePointHandle(const double x1, const double x2)
|
QPointF CentralWidget::endSetTemperaturePointHandle(const double x1, const double x2) {
|
||||||
{
|
|
||||||
Global::ExperimentData ed = PointCalculate::findEndSetDataByTemperature(x1, x2);
|
Global::ExperimentData ed = PointCalculate::findEndSetDataByTemperature(x1, x2);
|
||||||
|
|
||||||
if (Global::_axisMode == Global::AxisMode::SingleY) {
|
if (Global::_axisMode == Global::AxisMode::SingleY) {
|
||||||
@ -1051,8 +1024,7 @@ double CentralWidget::derivativeAt(const double a, const double b, const double
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CentralWidget::setEventHandlerEnable(const bool flag)
|
void CentralWidget::setEventHandlerEnable(const bool flag) {
|
||||||
{
|
|
||||||
logde << "setEventHandlerEnable..." << flag;
|
logde << "setEventHandlerEnable..." << flag;
|
||||||
|
|
||||||
// line visiable func
|
// line visiable func
|
||||||
@ -1094,8 +1066,7 @@ void CentralWidget::setEventHandlerEnable(const bool flag)
|
|||||||
_customPlot->replot();
|
_customPlot->replot();
|
||||||
}
|
}
|
||||||
|
|
||||||
QPointF CentralWidget::getTheCoordinatesOfTheTextBox(const QPointF point)
|
QPointF CentralWidget::getTheCoordinatesOfTheTextBox(const QPointF point) {
|
||||||
{
|
|
||||||
double xMax = _customPlot->xAxis->range().upper;
|
double xMax = _customPlot->xAxis->range().upper;
|
||||||
double xMin = _customPlot->xAxis->range().lower;
|
double xMin = _customPlot->xAxis->range().lower;
|
||||||
|
|
||||||
@ -1110,8 +1081,7 @@ QPointF CentralWidget::getTheCoordinatesOfTheTextBox(const QPointF point)
|
|||||||
return QPointF(point.x() + distance, point.y());
|
return QPointF(point.x() + distance, point.y());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CentralWidget::drawText(const QPointF point, const QString text,const QString objectName)
|
void CentralWidget::drawText(const QPointF point, const QString text, const QString objectName) {
|
||||||
{
|
|
||||||
QPointF textBoxPoint = getTheCoordinatesOfTheTextBox(point);
|
QPointF textBoxPoint = getTheCoordinatesOfTheTextBox(point);
|
||||||
|
|
||||||
// 创建标注文字(QCPItemText)
|
// 创建标注文字(QCPItemText)
|
||||||
@ -1145,8 +1115,7 @@ void CentralWidget::drawText(const QPointF point, const QString text,const QStri
|
|||||||
_customPlot->replot();
|
_customPlot->replot();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CentralWidget::fillGraph(const double x1, const double x2,const QString objectName)
|
void CentralWidget::fillGraph(const double x1, const double x2, const QString objectName) {
|
||||||
{
|
|
||||||
Global::ExperimentData x1Ed = PointCalculate::getClosestDataByTemperature(x1);
|
Global::ExperimentData x1Ed = PointCalculate::getClosestDataByTemperature(x1);
|
||||||
Global::ExperimentData x2Ed = PointCalculate::getClosestDataByTemperature(x2);
|
Global::ExperimentData x2Ed = PointCalculate::getClosestDataByTemperature(x2);
|
||||||
QVector<double> xVtr, yVtr;
|
QVector<double> xVtr, yVtr;
|
||||||
@ -1206,8 +1175,7 @@ void CentralWidget::fillGraph(const double x1, const double x2,const QString obj
|
|||||||
_customPlot->replot();
|
_customPlot->replot();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CentralWidget::clearData(const CentralWidget::ClearDataMode mode)
|
void CentralWidget::clearData(const CentralWidget::ClearDataMode mode) {
|
||||||
{
|
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case ClearDataMode::All:
|
case ClearDataMode::All:
|
||||||
_analysisFilePathVtr.clear();
|
_analysisFilePathVtr.clear();
|
||||||
@ -1230,8 +1198,7 @@ void CentralWidget::clearData(const CentralWidget::ClearDataMode mode)
|
|||||||
// ui
|
// ui
|
||||||
clearAllUiData();
|
clearAllUiData();
|
||||||
break;
|
break;
|
||||||
case ClearDataMode::Undo:
|
case ClearDataMode::Undo: {
|
||||||
{
|
|
||||||
// Clear the data of graph.
|
// Clear the data of graph.
|
||||||
for (int i = _customPlot->plottableCount() - 1; i >= 0; --i) {
|
for (int i = _customPlot->plottableCount() - 1; i >= 0; --i) {
|
||||||
QCPAbstractPlottable *plottable = _customPlot->plottable(i);
|
QCPAbstractPlottable *plottable = _customPlot->plottable(i);
|
||||||
@ -1273,16 +1240,15 @@ void CentralWidget::clearData(const CentralWidget::ClearDataMode mode)
|
|||||||
|
|
||||||
//
|
//
|
||||||
AnalysisOperationRecorder::removeTheLastAnalysisOperation();
|
AnalysisOperationRecorder::removeTheLastAnalysisOperation();
|
||||||
}
|
} break;
|
||||||
|
default:
|
||||||
break;
|
break;
|
||||||
default:break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_customPlot->replot();
|
_customPlot->replot();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CentralWidget::clearAllUiData()
|
void CentralWidget::clearAllUiData() {
|
||||||
{
|
|
||||||
// Clear the data of graph.
|
// Clear the data of graph.
|
||||||
for (int i = _customPlot->plottableCount() - 1; i >= 0; --i) {
|
for (int i = _customPlot->plottableCount() - 1; i >= 0; --i) {
|
||||||
QCPAbstractPlottable *plottable = _customPlot->plottable(i);
|
QCPAbstractPlottable *plottable = _customPlot->plottable(i);
|
||||||
@ -1315,8 +1281,7 @@ void CentralWidget::clearAllUiData()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CentralWidget::deleteCurveByObjectName(const QString objectName)
|
void CentralWidget::deleteCurveByObjectName(const QString objectName) {
|
||||||
{
|
|
||||||
for (int i = _analysisFilePathVtr.size() - 1; i >= 0; --i) {
|
for (int i = _analysisFilePathVtr.size() - 1; i >= 0; --i) {
|
||||||
if (_analysisFilePathVtr[i].startsWith(objectName)) {
|
if (_analysisFilePathVtr[i].startsWith(objectName)) {
|
||||||
_analysisFilePathVtr.removeAt(i); // 从后往前删除避免索引错乱
|
_analysisFilePathVtr.removeAt(i); // 从后往前删除避免索引错乱
|
||||||
@ -1370,14 +1335,12 @@ void CentralWidget::deleteCurveByObjectName(const QString objectName)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CentralWidget::calculateAnalysisResult(
|
void CentralWidget::calculateAnalysisResult(
|
||||||
const AnalysisMode mode,const double x1,const double x2,const QString objectName)
|
const AnalysisMode mode, const double x1, const double x2, const QString objectName) {
|
||||||
{
|
|
||||||
logde << "calculateAnalysisResult...";
|
logde << "calculateAnalysisResult...";
|
||||||
logde << "x1,x2:" << x1 << "," << x2;
|
logde << "x1,x2:" << x1 << "," << x2;
|
||||||
|
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case AnalysisMode::NumericalLabel:
|
case AnalysisMode::NumericalLabel: {
|
||||||
{
|
|
||||||
QPointF selectPoint;
|
QPointF selectPoint;
|
||||||
QString str;
|
QString str;
|
||||||
if (_axisMode == AxisMode::SingleY) {
|
if (_axisMode == AxisMode::SingleY) {
|
||||||
@ -1442,8 +1405,7 @@ void CentralWidget::calculateAnalysisResult(
|
|||||||
//
|
//
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AnalysisMode::PeakSynthesisAnalysis:
|
case AnalysisMode::PeakSynthesisAnalysis: {
|
||||||
{
|
|
||||||
logde << "PeakSynthesisAnalysis...";
|
logde << "PeakSynthesisAnalysis...";
|
||||||
|
|
||||||
fillGraph(x1, x2, objectName);
|
fillGraph(x1, x2, objectName);
|
||||||
@ -1499,8 +1461,7 @@ void CentralWidget::calculateAnalysisResult(
|
|||||||
selectedPointsPair.second.x());
|
selectedPointsPair.second.x());
|
||||||
|
|
||||||
drawText(peakPoint, str, objectName);
|
drawText(peakPoint, str, objectName);
|
||||||
}
|
} else if (Global::_displayTimeValue) {
|
||||||
else if(Global::_displayTimeValue){
|
|
||||||
double peakPointTime = PointCalculate::obtainTimeValueBasedOnTemperatureValue(peakPoint.x());
|
double peakPointTime = PointCalculate::obtainTimeValueBasedOnTemperatureValue(peakPoint.x());
|
||||||
double startPointTime = PointCalculate::obtainTimeValueBasedOnTemperatureValue(startEndPointPair.first.x());
|
double startPointTime = PointCalculate::obtainTimeValueBasedOnTemperatureValue(startEndPointPair.first.x());
|
||||||
double endPointTime = PointCalculate::obtainTimeValueBasedOnTemperatureValue(startEndPointPair.second.x());
|
double endPointTime = PointCalculate::obtainTimeValueBasedOnTemperatureValue(startEndPointPair.second.x());
|
||||||
@ -1525,8 +1486,7 @@ void CentralWidget::calculateAnalysisResult(
|
|||||||
//
|
//
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AnalysisMode::GlassTransition:
|
case AnalysisMode::GlassTransition: {
|
||||||
{
|
|
||||||
glassTransitionHandle(x1, x2, objectName);
|
glassTransitionHandle(x1, x2, objectName);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -1605,8 +1565,7 @@ void CentralWidget::drawOITLine(
|
|||||||
const Global::ExperimentData startData,
|
const Global::ExperimentData startData,
|
||||||
const Global::ExperimentData endData,
|
const Global::ExperimentData endData,
|
||||||
const int step,
|
const int step,
|
||||||
const QString objectName)
|
const QString objectName) {
|
||||||
{
|
|
||||||
logde << "step:" << step;
|
logde << "step:" << step;
|
||||||
|
|
||||||
double localStep = static_cast<double>(step) / 5 / 2;
|
double localStep = static_cast<double>(step) / 5 / 2;
|
||||||
@ -1666,8 +1625,7 @@ void CentralWidget::drawOITLine(
|
|||||||
_customPlot->replot();
|
_customPlot->replot();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CentralWidget::setAxisMode(AxisMode mode)
|
void CentralWidget::setAxisMode(AxisMode mode) {
|
||||||
{
|
|
||||||
if (_axisMode != mode) {
|
if (_axisMode != mode) {
|
||||||
_axisMode = mode;
|
_axisMode = mode;
|
||||||
|
|
||||||
@ -1786,23 +1744,20 @@ void CentralWidget::peakSynthesisSingleAxisY(const double x1, const double x2,co
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void CentralWidget::clearAllData()
|
void CentralWidget::clearAllData() {
|
||||||
{
|
|
||||||
_customPlot->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom | QCP::iSelectPlottables);
|
_customPlot->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom | QCP::iSelectPlottables);
|
||||||
|
|
||||||
Global::_mode = Global::Mode::Analysis;
|
Global::_mode = Global::Mode::Analysis;
|
||||||
clearData(ClearDataMode::All);
|
clearData(ClearDataMode::All);
|
||||||
}
|
}
|
||||||
|
|
||||||
QPixmap CentralWidget::getPixMap()
|
QPixmap CentralWidget::getPixMap() {
|
||||||
{
|
|
||||||
_customPlot->replot();
|
_customPlot->replot();
|
||||||
QApplication::processEvents();
|
QApplication::processEvents();
|
||||||
return _customPlot->toPixmap();
|
return _customPlot->toPixmap();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CentralWidget::slotAxisModify(const float temp)
|
void CentralWidget::slotAxisModify(const float temp) {
|
||||||
{
|
|
||||||
logde << "slotAxisModify...";
|
logde << "slotAxisModify...";
|
||||||
|
|
||||||
_customPlot->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom | QCP::iSelectPlottables);
|
_customPlot->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom | QCP::iSelectPlottables);
|
||||||
@ -1812,6 +1767,3 @@ void CentralWidget::slotAxisModify(const float temp)
|
|||||||
_customPlot->xAxis->setRange(0, value);
|
_customPlot->xAxis->setRange(0, value);
|
||||||
_customPlot->yAxis->setRange(-5, 5);
|
_customPlot->yAxis->setRange(-5, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -661,9 +661,9 @@ void ExperimentSettingForm::slotPhaseCheck() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ExperimentSettingForm::slotRecvPhaseInfo(const QByteArray &ba) {
|
void ExperimentSettingForm::slotRecvPhaseInfo(const QByteArray &ba) {
|
||||||
logde << "----------------------- recv";
|
logde << "recv phase info ----------------------- ";
|
||||||
|
|
||||||
#if 0
|
#if 1
|
||||||
QString hexData = ba.toHex(' '); // ' ' 作为分隔符,可选参数
|
QString hexData = ba.toHex(' '); // ' ' 作为分隔符,可选参数
|
||||||
qDebug() << "slotRecvPhaseInfo hex:" << hexData;
|
qDebug() << "slotRecvPhaseInfo hex:" << hexData;
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user