2025-04-17T17:31:45
This commit is contained in:
parent
56a84cdc3a
commit
588f33a25b
@ -18,6 +18,7 @@ DEFINES += QT_DEPRECATED_WARNINGS
|
|||||||
include(thirdparty\QtXlsxWriter-0.3.0\src\xlsx\qtxlsx.pri)
|
include(thirdparty\QtXlsxWriter-0.3.0\src\xlsx\qtxlsx.pri)
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
|
data/confighandler.cpp \
|
||||||
data/filemanager.cpp \
|
data/filemanager.cpp \
|
||||||
data/pointcalculate.cpp \
|
data/pointcalculate.cpp \
|
||||||
data/txthandler.cpp \
|
data/txthandler.cpp \
|
||||||
@ -46,6 +47,7 @@ SOURCES += \
|
|||||||
data/xlsxhandler.cpp
|
data/xlsxhandler.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
|
data/confighandler.h \
|
||||||
data/txthandler.h \
|
data/txthandler.h \
|
||||||
global.h \
|
global.h \
|
||||||
data/filemanager.h \
|
data/filemanager.h \
|
||||||
|
|||||||
95
src/data/confighandler.cpp
Normal file
95
src/data/confighandler.cpp
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
#include <qdebug.h>
|
||||||
|
#include <qfile.h>
|
||||||
|
#include <QJsonParseError>
|
||||||
|
#include <QJsonObject>
|
||||||
|
|
||||||
|
#include "confighandler.h"
|
||||||
|
#include "logger.h"
|
||||||
|
|
||||||
|
QMap<QString, QVariant> ConfigHandler::_configMap;
|
||||||
|
|
||||||
|
void ConfigHandler::reader()
|
||||||
|
{
|
||||||
|
// 检查文件是否已经存在
|
||||||
|
if (QFile::exists(ConConfigFilePath)) {
|
||||||
|
logde << "config config file existed. ";
|
||||||
|
}else{
|
||||||
|
writer(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 读取JSON文件
|
||||||
|
QFile file(ConConfigFilePath);
|
||||||
|
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)){
|
||||||
|
qDebug()<<"file open failed.";
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 解析JSON数据
|
||||||
|
QJsonParseError error;
|
||||||
|
QJsonDocument doc = QJsonDocument::fromJson(file.readAll(), &error);
|
||||||
|
if (error.error != QJsonParseError::NoError) {
|
||||||
|
qDebug() << "JSON解析错误:" << error.errorString();
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 读取配置项
|
||||||
|
QJsonObject obj = doc.object();
|
||||||
|
|
||||||
|
_configMap[ConInstrumentCoefficientStr] = QVariant(obj[ConInstrumentCoefficientStr].toDouble());
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConfigHandler::createDefaultFile()
|
||||||
|
{
|
||||||
|
logde<<"createDefaultFile";
|
||||||
|
|
||||||
|
// 创建一个新的 JSON 对象
|
||||||
|
QJsonObject obj;
|
||||||
|
// obj["name"] = "Alice";
|
||||||
|
// obj["age"] = 30;
|
||||||
|
// obj["city"] = "New York";
|
||||||
|
|
||||||
|
obj[ConInstrumentCoefficientStr] =
|
||||||
|
ConDefaultMap[ConInstrumentCoefficientStr].toFloat();
|
||||||
|
|
||||||
|
// 将 QJsonObject 转换为 QJsonDocument
|
||||||
|
QJsonDocument doc(obj);
|
||||||
|
|
||||||
|
// 打开文件进行写入,如果文件不存在则会自动创建文件
|
||||||
|
QFile file(ConConfigFilePath);
|
||||||
|
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||||
|
qDebug() << "无法打开文件进行写入!";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将 QJsonDocument 写入文件
|
||||||
|
file.write(doc.toJson());
|
||||||
|
file.close(); // 确保文件关闭
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConfigHandler::writer(const bool writeRealDataFlag)
|
||||||
|
{
|
||||||
|
QJsonObject obj;
|
||||||
|
|
||||||
|
const QMap<QString, QVariant> *mapPtr = &ConDefaultMap;
|
||||||
|
if(writeRealDataFlag){
|
||||||
|
mapPtr = &_configMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
obj[ConInstrumentCoefficientStr] =
|
||||||
|
(*mapPtr)[ConInstrumentCoefficientStr].toFloat();
|
||||||
|
|
||||||
|
// 将 QJsonObject 转换为 QJsonDocument
|
||||||
|
QJsonDocument doc(obj);
|
||||||
|
|
||||||
|
// 打开文件进行写入,如果文件不存在则会自动创建文件
|
||||||
|
QFile file(ConConfigFilePath);
|
||||||
|
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||||
|
qDebug() << "无法打开文件进行写入!";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将 QJsonDocument 写入文件
|
||||||
|
file.write(doc.toJson());
|
||||||
|
file.close(); // 确保文件关闭
|
||||||
|
}
|
||||||
|
|
||||||
29
src/data/confighandler.h
Normal file
29
src/data/confighandler.h
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
#ifndef JSONHANDLER_H
|
||||||
|
#define JSONHANDLER_H
|
||||||
|
|
||||||
|
#include <QtCore>
|
||||||
|
|
||||||
|
const QString ConInstrumentCoefficientStr = "InstrumentCoefficient";
|
||||||
|
|
||||||
|
namespace ConfigHandler {
|
||||||
|
void reader();
|
||||||
|
void createDefaultFile();
|
||||||
|
/**
|
||||||
|
* @brief writer
|
||||||
|
* @param writeRealDataFlag
|
||||||
|
* true:Write _configMap content.
|
||||||
|
* false:Write ConDefaultMap content.
|
||||||
|
*/
|
||||||
|
void writer(const bool writeRealDataFlag = true);
|
||||||
|
|
||||||
|
const QString ConConfigFilePath = QDir::currentPath() + "/config.json";
|
||||||
|
|
||||||
|
const QMap<QString, QVariant> ConDefaultMap = {
|
||||||
|
{ConInstrumentCoefficientStr, 1.001f},
|
||||||
|
};
|
||||||
|
|
||||||
|
extern QMap<QString, QVariant> _configMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif // JSONHANDLER_H
|
||||||
@ -502,3 +502,18 @@ QPair<float, float> PointCalculate::getMaxMinValue()
|
|||||||
|
|
||||||
return QPair<float, float>(minDsc, maxDsc);
|
return QPair<float, float>(minDsc, maxDsc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QVector<Global::ExperimentData> PointCalculate::getDataInXRange(const float x1, const float x2)
|
||||||
|
{
|
||||||
|
QVector<Global::ExperimentData> targetVtr;
|
||||||
|
for(const Global::ExperimentData &ed : _dataVtr) {
|
||||||
|
if(x1 < ed.sampleTemp && ed.sampleTemp < x2){
|
||||||
|
targetVtr.push_back(ed);
|
||||||
|
}else if (ed.sampleTemp > x2){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return targetVtr;
|
||||||
|
}
|
||||||
|
|||||||
@ -9,6 +9,7 @@ namespace PointCalculate{
|
|||||||
void setExperimentData(const QVector<Global::ExperimentData>&);
|
void setExperimentData(const QVector<Global::ExperimentData>&);
|
||||||
|
|
||||||
QPair<QPointF,QPointF> getStartAndEndPoint();
|
QPair<QPointF,QPointF> getStartAndEndPoint();
|
||||||
|
QVector<Global::ExperimentData> getDataInXRange(const float, const float);
|
||||||
|
|
||||||
void setRegionPointX(const float,const float);
|
void setRegionPointX(const float,const float);
|
||||||
QPointF getClosestPointByX(const float);
|
QPointF getClosestPointByX(const float);
|
||||||
|
|||||||
@ -67,6 +67,7 @@ struct CurveFileData{
|
|||||||
|
|
||||||
struct CurveExperimentData{
|
struct CurveExperimentData{
|
||||||
QCPCurve * curve;
|
QCPCurve * curve;
|
||||||
|
QString fileName;
|
||||||
QVector<Global::ExperimentData> dataVtr;
|
QVector<Global::ExperimentData> dataVtr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
12
src/main.cpp
12
src/main.cpp
@ -11,6 +11,7 @@
|
|||||||
#include "logger.h"
|
#include "logger.h"
|
||||||
#include "xlsxhandler.h"
|
#include "xlsxhandler.h"
|
||||||
#include "aboutform.h"
|
#include "aboutform.h"
|
||||||
|
#include "confighandler.h"
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
@ -19,7 +20,18 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Logger::instance();
|
Logger::instance();
|
||||||
logde<<"main...";
|
logde<<"main...";
|
||||||
|
//
|
||||||
|
ConfigHandler::reader();
|
||||||
|
logde<<"config,instrument coefficient:"
|
||||||
|
<<ConfigHandler::_configMap[ConInstrumentCoefficientStr].toFloat();
|
||||||
|
|
||||||
|
ConfigHandler::_configMap[ConInstrumentCoefficientStr] = 2.001f;
|
||||||
|
|
||||||
|
ConfigHandler::writer(false);
|
||||||
|
ConfigHandler::reader();
|
||||||
|
logde<<"config,instrument coefficient:"
|
||||||
|
<<ConfigHandler::_configMap[ConInstrumentCoefficientStr].toFloat();
|
||||||
|
//
|
||||||
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); // 启用高DPI缩放
|
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); // 启用高DPI缩放
|
||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
a.setWindowIcon(QIcon(":/images/logo.png"));
|
a.setWindowIcon(QIcon(":/images/logo.png"));
|
||||||
|
|||||||
@ -178,6 +178,8 @@ void MainWindow::setSubWidgetAttribute(QWidget *widget)
|
|||||||
{
|
{
|
||||||
widget->setWindowModality(Qt::ApplicationModal);
|
widget->setWindowModality(Qt::ApplicationModal);
|
||||||
widget->setWindowFlags(Qt::Dialog);
|
widget->setWindowFlags(Qt::Dialog);
|
||||||
|
|
||||||
|
widget->setFixedSize(widget->geometry().width(),widget->geometry().height());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionStop_triggered()
|
void MainWindow::on_actionStop_triggered()
|
||||||
|
|||||||
@ -9,7 +9,7 @@ AboutForm::AboutForm(QWidget *parent) :
|
|||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
setFixedSize(geometry().width(),geometry().height());
|
// setFixedSize(geometry().width(),geometry().height());
|
||||||
|
|
||||||
setWindowTitle("About");
|
setWindowTitle("About");
|
||||||
|
|
||||||
|
|||||||
@ -161,15 +161,15 @@ void CentralWidget::slotRecvCommonData(const CommonData &cd)
|
|||||||
pEdVtr->push_back(ed);
|
pEdVtr->push_back(ed);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CentralWidget::slotRecvAnalysisFileName(const QString &fileName)
|
void CentralWidget::slotRecvAnalysisFileName(const QString &filePath)
|
||||||
{
|
{
|
||||||
qDebug() << "slotRecvAnalysisFileName" << fileName;
|
qDebug() << "slotRecvAnalysisFileName" << filePath;
|
||||||
|
|
||||||
// todo.禁止重复文件添加。
|
// todo.禁止重复文件添加。
|
||||||
Global::CurveFileData cfd;
|
Global::CurveFileData cfd;
|
||||||
if(XlsxHandler::readFile(fileName,cfd) != 0){
|
if(XlsxHandler::readFile(filePath,cfd) != 0){
|
||||||
QMessageBox::warning((QWidget*)this->parent(), "warnning", "File parse error.");
|
QMessageBox::warning((QWidget*)this->parent(), "warnning", "File parse error.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i = 0;i < cfd.phaseTotalVtr.size();i++){
|
for(int i = 0;i < cfd.phaseTotalVtr.size();i++){
|
||||||
@ -189,7 +189,6 @@ void CentralWidget::slotRecvAnalysisFileName(const QString &fileName)
|
|||||||
float absY = std::abs(maxMinPair.first - maxMinPair.second);
|
float absY = std::abs(maxMinPair.first - maxMinPair.second);
|
||||||
_customPlot->yAxis->setRange(- absY * 2,absY *2);
|
_customPlot->yAxis->setRange(- absY * 2,absY *2);
|
||||||
|
|
||||||
// 设置坐标轴标签
|
|
||||||
_customPlot->yAxis->setLabel("DSC/mW");
|
_customPlot->yAxis->setLabel("DSC/mW");
|
||||||
_customPlot->xAxis->setLabel("Temp/℃");
|
_customPlot->xAxis->setLabel("Temp/℃");
|
||||||
|
|
||||||
@ -201,13 +200,15 @@ void CentralWidget::slotRecvAnalysisFileName(const QString &fileName)
|
|||||||
tVtr.push_back(index++);
|
tVtr.push_back(index++);
|
||||||
xVtr.push_back(ed.sampleTemp);
|
xVtr.push_back(ed.sampleTemp);
|
||||||
yVtr.push_back(ed.dsc);
|
yVtr.push_back(ed.dsc);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_currentCurve = new QCPCurve(_customPlot->xAxis, _customPlot->yAxis);
|
_currentCurve = new QCPCurve(_customPlot->xAxis, _customPlot->yAxis);
|
||||||
_currentCurve->setData(tVtr, xVtr, yVtr);
|
_currentCurve->setData(tVtr, xVtr, yVtr);
|
||||||
_currentCurve->setSelectable(QCP::stWhole); // 设置曲线可选
|
_currentCurve->setSelectable(QCP::stWhole); // 设置曲线可选
|
||||||
|
|
||||||
|
// Add data to global parameter.
|
||||||
|
QFileInfo fileInfo(filePath);
|
||||||
|
Global::_curveExperimentDataVtr.push_back({_currentCurve,fileInfo.fileName(),pti.dataVtr});
|
||||||
}
|
}
|
||||||
|
|
||||||
_customPlot->replot();
|
_customPlot->replot();
|
||||||
@ -573,8 +574,6 @@ void CentralWidget::drawText(const QPointF point, const QString text)
|
|||||||
|
|
||||||
void CentralWidget::fillGraph(const double x1, const double x2)
|
void CentralWidget::fillGraph(const double x1, const double x2)
|
||||||
{
|
{
|
||||||
//todo.未寻找x1\x2之间最大值。
|
|
||||||
|
|
||||||
double y1 = PointCalculate::getClosestPointByX(x1).y();
|
double y1 = PointCalculate::getClosestPointByX(x1).y();
|
||||||
double y2 = PointCalculate::getClosestPointByX(x2).y();
|
double y2 = PointCalculate::getClosestPointByX(x2).y();
|
||||||
|
|
||||||
@ -588,16 +587,24 @@ void CentralWidget::fillGraph(const double x1, const double x2)
|
|||||||
QCPGraph *mainGraph = _customPlot->addGraph();
|
QCPGraph *mainGraph = _customPlot->addGraph();
|
||||||
mainGraph->setData(xVtr, yVtr);
|
mainGraph->setData(xVtr, yVtr);
|
||||||
|
|
||||||
// 样式配置
|
|
||||||
mainGraph->setPen(QPen(Qt::red, 1));
|
mainGraph->setPen(QPen(Qt::red, 1));
|
||||||
|
|
||||||
#if 0
|
QVector<Global::ExperimentData> curveDataVtr =
|
||||||
_currentGraph->setBrush(QBrush(Qt::lightGray));
|
PointCalculate::getDataInXRange(x1,x2);
|
||||||
_currentGraph->setChannelFillGraph(mainGraph);
|
|
||||||
#endif
|
QCPGraph *fillGraph = _customPlot->addGraph();
|
||||||
|
QVector<double> fillX, fillY;
|
||||||
|
|
||||||
|
for(int i = 0;i < curveDataVtr.size();i++){
|
||||||
|
Global::ExperimentData &ed = curveDataVtr[i];
|
||||||
|
fillX<<ed.sampleTemp;
|
||||||
|
fillY<<ed.dsc;
|
||||||
|
}
|
||||||
|
fillGraph->setData(fillX, fillY);
|
||||||
|
|
||||||
|
fillGraph->setBrush(QBrush(Qt::green, Qt::SolidPattern));
|
||||||
|
fillGraph->setChannelFillGraph(mainGraph);
|
||||||
|
|
||||||
// customPlot->graph(0)->setChannelFillGraph(customPlot->graph(1));
|
|
||||||
// _customPlot->graph(1);
|
|
||||||
_customPlot->replot();
|
_customPlot->replot();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -7,6 +7,8 @@ EnthalpyDataCorrectionForm::EnthalpyDataCorrectionForm(QWidget *parent) :
|
|||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
setWindowTitle("热焓校正");
|
||||||
|
|
||||||
// ui->lineEditTheoryIn->setText("28.6");
|
// ui->lineEditTheoryIn->setText("28.6");
|
||||||
// ui->lineEditTheorySn->setText("60.5");
|
// ui->lineEditTheorySn->setText("60.5");
|
||||||
// ui->lineEditTheoryBi->setText("53.3");
|
// ui->lineEditTheoryBi->setText("53.3");
|
||||||
|
|||||||
@ -1,11 +1,19 @@
|
|||||||
#include "instrumentcoefficientform.h"
|
#include "instrumentcoefficientform.h"
|
||||||
#include "ui_instrumentcoefficientform.h"
|
#include "ui_instrumentcoefficientform.h"
|
||||||
|
#include "confighandler.h"
|
||||||
|
|
||||||
InstrumentCoefficientForm::InstrumentCoefficientForm(QWidget *parent) :
|
InstrumentCoefficientForm::InstrumentCoefficientForm(QWidget *parent) :
|
||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
ui(new Ui::InstrumentCoefficientForm)
|
ui(new Ui::InstrumentCoefficientForm)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
setWindowTitle("仪器系数");
|
||||||
|
|
||||||
|
ui->LineEditCoefficient->setText(
|
||||||
|
QString::number(
|
||||||
|
ConfigHandler::_configMap[ConInstrumentCoefficientStr].toFloat(),
|
||||||
|
'f',3));
|
||||||
}
|
}
|
||||||
|
|
||||||
InstrumentCoefficientForm::~InstrumentCoefficientForm()
|
InstrumentCoefficientForm::~InstrumentCoefficientForm()
|
||||||
@ -15,7 +23,14 @@ InstrumentCoefficientForm::~InstrumentCoefficientForm()
|
|||||||
|
|
||||||
void InstrumentCoefficientForm::on_pushButtonCalculate_clicked()
|
void InstrumentCoefficientForm::on_pushButtonCalculate_clicked()
|
||||||
{
|
{
|
||||||
|
float theory = ui->LineEditTheory->text().toFloat();
|
||||||
|
float measure = ui->LineEditActualMeasurement->text().toFloat();
|
||||||
|
|
||||||
|
float instrumentCoefficient = theory/measure;
|
||||||
|
ConfigHandler::_configMap[ConInstrumentCoefficientStr] = instrumentCoefficient;
|
||||||
|
ConfigHandler::writer();
|
||||||
|
|
||||||
|
ui->LineEditCoefficient->setText(QString::number(instrumentCoefficient,'f',3));
|
||||||
}
|
}
|
||||||
|
|
||||||
void InstrumentCoefficientForm::on_pushButtonCancel_clicked()
|
void InstrumentCoefficientForm::on_pushButtonCancel_clicked()
|
||||||
|
|||||||
@ -15,17 +15,22 @@ SpecificHeatComparisonMethodForm::SpecificHeatComparisonMethodForm(QWidget *pare
|
|||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
setWindowTitle("比热比较法");
|
||||||
|
|
||||||
_baseLineLineEdit = new QLineEdit(ui->groupBoxDataFile);
|
_baseLineLineEdit = new QLineEdit(ui->groupBoxDataFile);
|
||||||
_baseLineLabel = new QLabel(ui->groupBoxDataFile);
|
_baseLineLabel = new QLabel(ui->groupBoxDataFile);
|
||||||
_baseLineLabel->setStyleSheet("background-color: red;");
|
_baseLineLabel->setStyleSheet("background-color: red;");
|
||||||
|
_baseLineLabel->setFixedWidth(22);
|
||||||
|
|
||||||
_standardSampleLineEdit = new QLineEdit(ui->groupBoxDataFile);
|
_standardSampleLineEdit = new QLineEdit(ui->groupBoxDataFile);
|
||||||
_standardSampleLabel = new QLabel(ui->groupBoxDataFile);
|
_standardSampleLabel = new QLabel(ui->groupBoxDataFile);
|
||||||
_standardSampleLabel->setStyleSheet("background-color: green;");
|
_standardSampleLabel->setStyleSheet("background-color: green;");
|
||||||
|
_standardSampleLabel->setFixedWidth(22);
|
||||||
|
|
||||||
_sampleLineEdit = new QLineEdit(ui->groupBoxDataFile);
|
_sampleLineEdit = new QLineEdit(ui->groupBoxDataFile);
|
||||||
_sampleLabel = new QLabel(ui->groupBoxDataFile);
|
_sampleLabel = new QLabel(ui->groupBoxDataFile);
|
||||||
_sampleLabel->setStyleSheet("background-color: black;");
|
_sampleLabel->setStyleSheet("background-color: black;");
|
||||||
|
_sampleLabel->setFixedWidth(22);
|
||||||
|
|
||||||
QHBoxLayout *baseLineLayout = new QHBoxLayout;
|
QHBoxLayout *baseLineLayout = new QHBoxLayout;
|
||||||
baseLineLayout->addWidget(_baseLineLineEdit);
|
baseLineLayout->addWidget(_baseLineLineEdit);
|
||||||
@ -80,26 +85,38 @@ void SpecificHeatComparisonMethodForm::slotSetCurve(const int type, QCPCurve *c
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpecificHeatComparisonMethodForm::on_pushButtonCalculate_clicked()
|
void SpecificHeatComparisonMethodForm::showEvent(QShowEvent *event)
|
||||||
{
|
{
|
||||||
auto& curveDataVtr = Global::_curveExperimentDataVtr;
|
auto& curveDataVtr = Global::_curveExperimentDataVtr;
|
||||||
QVector<Global::ExperimentData> *baseLineDataVtr = nullptr,
|
// QVector<Global::ExperimentData> *baseLineDataVtr = nullptr,
|
||||||
*standardSampleDataVtr = nullptr,
|
// *standardSampleDataVtr = nullptr,
|
||||||
*sampleDataVtr = nullptr;
|
// *sampleDataVtr = nullptr;
|
||||||
|
|
||||||
for (auto& item : curveDataVtr) {
|
for (auto& item : curveDataVtr) {
|
||||||
if(item.curve == _baseLineCurve){
|
if(item.curve == _baseLineCurve){
|
||||||
baseLineDataVtr = &(item.dataVtr);
|
_baseLineLineEdit->setText(item.fileName);
|
||||||
|
_baseLineDataVtr = &(item.dataVtr);
|
||||||
}else if(item.curve == _standardSampleCurve){
|
}else if(item.curve == _standardSampleCurve){
|
||||||
standardSampleDataVtr = &(item.dataVtr);
|
_standardSampleLineEdit->setText(item.fileName);
|
||||||
|
_standardSampleDataVtr = &(item.dataVtr);
|
||||||
}else if(item.curve == _sampleCurve){
|
}else if(item.curve == _sampleCurve){
|
||||||
sampleDataVtr = &(item.dataVtr);
|
_sampleLineEdit->setText(item.fileName);
|
||||||
|
_sampleDataVtr = &(item.dataVtr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!baseLineDataVtr ||
|
if(!_baseLineDataVtr ||!_standardSampleDataVtr||
|
||||||
!standardSampleDataVtr||
|
!_sampleDataVtr){
|
||||||
!sampleDataVtr){
|
logde<<"Base,standard,sample not selected.";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void SpecificHeatComparisonMethodForm::on_pushButtonCalculate_clicked()
|
||||||
|
{
|
||||||
|
if(!_baseLineDataVtr ||!_standardSampleDataVtr||
|
||||||
|
!_sampleDataVtr){
|
||||||
logde<<"Base,standard,sample not selected.";
|
logde<<"Base,standard,sample not selected.";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -107,13 +124,13 @@ void SpecificHeatComparisonMethodForm::on_pushButtonCalculate_clicked()
|
|||||||
//
|
//
|
||||||
float targetTemperature = ui->LineEditTemperature->text().toFloat();
|
float targetTemperature = ui->LineEditTemperature->text().toFloat();
|
||||||
|
|
||||||
PointCalculate::setExperimentData(*baseLineDataVtr);
|
PointCalculate::setExperimentData(*_baseLineDataVtr);
|
||||||
QPointF baseLinePoint = PointCalculate::getClosestPointByX(targetTemperature);
|
QPointF baseLinePoint = PointCalculate::getClosestPointByX(targetTemperature);
|
||||||
|
|
||||||
PointCalculate::setExperimentData(*standardSampleDataVtr);
|
PointCalculate::setExperimentData(*_standardSampleDataVtr);
|
||||||
QPointF standardSamplePoint = PointCalculate::getClosestPointByX(targetTemperature);
|
QPointF standardSamplePoint = PointCalculate::getClosestPointByX(targetTemperature);
|
||||||
|
|
||||||
PointCalculate::setExperimentData(*sampleDataVtr);
|
PointCalculate::setExperimentData(*_sampleDataVtr);
|
||||||
QPointF samplePoint = PointCalculate::getClosestPointByX(targetTemperature);
|
QPointF samplePoint = PointCalculate::getClosestPointByX(targetTemperature);
|
||||||
|
|
||||||
logde<<"baseLinePoint:"<<baseLinePoint.x()<<","<<baseLinePoint.y();
|
logde<<"baseLinePoint:"<<baseLinePoint.x()<<","<<baseLinePoint.y();
|
||||||
|
|||||||
@ -6,6 +6,8 @@
|
|||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <qcustomplot.h>
|
#include <qcustomplot.h>
|
||||||
|
|
||||||
|
#include "global.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class SpecificHeatComparisonMethodForm;
|
class SpecificHeatComparisonMethodForm;
|
||||||
}
|
}
|
||||||
@ -25,6 +27,8 @@ public:
|
|||||||
};
|
};
|
||||||
public slots:
|
public slots:
|
||||||
void slotSetCurve(const int ,QCPCurve*);
|
void slotSetCurve(const int ,QCPCurve*);
|
||||||
|
protected:
|
||||||
|
void showEvent(QShowEvent *event) override;
|
||||||
private slots:
|
private slots:
|
||||||
void on_pushButtonCalculate_clicked();
|
void on_pushButtonCalculate_clicked();
|
||||||
|
|
||||||
@ -39,6 +43,11 @@ private:
|
|||||||
QLabel *_baseLineLabel,*_standardSampleLabel,*_sampleLabel;
|
QLabel *_baseLineLabel,*_standardSampleLabel,*_sampleLabel;
|
||||||
|
|
||||||
QCPCurve *_baseLineCurve,*_standardSampleCurve,*_sampleCurve;
|
QCPCurve *_baseLineCurve,*_standardSampleCurve,*_sampleCurve;
|
||||||
|
|
||||||
|
QVector<Global::ExperimentData> *_baseLineDataVtr ,
|
||||||
|
*_standardSampleDataVtr ,
|
||||||
|
*_sampleDataVtr ;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SPECIFICHEATCOMPARISONMETHODFORM_H
|
#endif // SPECIFICHEATCOMPARISONMETHODFORM_H
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user