2025-06-13T15:55:17
This commit is contained in:
parent
4f42759df8
commit
bc9a3249c3
@ -128,6 +128,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<<"write file...";
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if(Global::_curveExperimentDataVtr.empty()){
|
if(Global::_curveExperimentDataVtr.empty()){
|
||||||
logde<<"_curveExperimentDataVtr empty...";
|
logde<<"_curveExperimentDataVtr empty...";
|
||||||
@ -250,11 +251,13 @@ void XlsxHandler::writeExperimentFile(const QString filePath)
|
|||||||
row++;
|
row++;
|
||||||
|
|
||||||
// phase data.
|
// phase data.
|
||||||
// logde<<"Global::_curveExperimentDataVtr size:"
|
QVector<Global::ExperimentData> edVtr =
|
||||||
// <<Global::_curveExperimentDataVtr.size();
|
|
||||||
|
|
||||||
const QVector<Global::ExperimentData>& edVtr =
|
|
||||||
Global::_curveExperimentDataVtr.at(i).dataVtr;
|
Global::_curveExperimentDataVtr.at(i).dataVtr;
|
||||||
|
|
||||||
|
if(Global::_smoothnessFlag){
|
||||||
|
edVtr = Global::_curveExperimentDataVtr.at(i).smoothDataVtr;
|
||||||
|
}
|
||||||
|
|
||||||
// phase data size.
|
// phase data size.
|
||||||
dataSizeRow = row;
|
dataSizeRow = row;
|
||||||
xlsx.write(row , 1, ConPhaseDataSize);
|
xlsx.write(row , 1, ConPhaseDataSize);
|
||||||
@ -289,7 +292,7 @@ void XlsxHandler::writeExperimentFile(const QString filePath)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void XlsxHandler:: appendAnalysisOperation(const QString filePath)
|
void XlsxHandler:: xlsxFileAppendAnalysisOperation(const QString filePath)
|
||||||
{
|
{
|
||||||
QXlsx::Document* xlsx = openXlsxFile(_currentFilePath);
|
QXlsx::Document* xlsx = openXlsxFile(_currentFilePath);
|
||||||
if(!xlsx){
|
if(!xlsx){
|
||||||
@ -594,15 +597,15 @@ void XlsxHandler::writeSmoothnessFile(const QString filePath)
|
|||||||
// Write phase data.
|
// Write phase data.
|
||||||
|
|
||||||
logde<<"curve file vtr size:"<<Global::_curveFileDataVtr.size();
|
logde<<"curve file vtr size:"<<Global::_curveFileDataVtr.size();
|
||||||
QVector<Global::PhaseTotalInfo>& phaseVtr =
|
QVector<Global::PhaseTotalInfo>& phaseVtr =
|
||||||
Global::_curveFileDataVtr.first().phaseTotalVtr;
|
Global::_curveFileDataVtr.first().phaseTotalVtr;
|
||||||
|
|
||||||
int dataSizeRow = 0;
|
int dataSizeRow = 0;
|
||||||
// logde<<"phase vtr size:"<<ei.phaseVtr.size();
|
// logde<<"phase vtr size:"<<ei.phaseVtr.size();
|
||||||
|
|
||||||
for(int i = 0; i < phaseVtr.size();i++){
|
for(int i = 0; i < phaseVtr.size();i++){
|
||||||
logde<<"phase index:"<<i;
|
logde<<"phase index:"<<i;
|
||||||
// const Phase& phase = ei.phaseVtr.at(i);
|
// const Phase& phase = ei.phaseVtr.at(i);
|
||||||
|
|
||||||
Phase phase = phaseVtr.at(i).phase;
|
Phase phase = phaseVtr.at(i).phase;
|
||||||
|
|
||||||
@ -693,34 +696,6 @@ void XlsxHandler::writeSmoothnessFile(const QString filePath)
|
|||||||
logde<<"Save xlsx failed.";
|
logde<<"Save xlsx failed.";
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
if(Global::_curveFileDataVtr.empty()){
|
|
||||||
// Load experiment data.
|
|
||||||
logde<<"experiment vtr size:"<<Global::_curveExperimentDataVtr.size();
|
|
||||||
for(Global::CurveExperimentData& ced:Global::_curveExperimentDataVtr){
|
|
||||||
if(_centralWidget->isCurrentCurve(ced.curve)){
|
|
||||||
logde<<"load experiment data.";
|
|
||||||
// PointCalculate::setAnalysisData(ced.dataVtr);
|
|
||||||
dataVtr = ced.dataVtr;
|
|
||||||
Global::_smoothnessFileName = ced.fileName;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
// Load xlsx file data.
|
|
||||||
for(Global::CurveFileData& cfd:Global::_curveFileDataVtr){
|
|
||||||
for(Global::PhaseTotalInfo& pti:cfd.phaseTotalVtr){
|
|
||||||
if(_centralWidget->isCurrentCurve(pti.curve)){
|
|
||||||
// PointCalculate::setAnalysisData(pti.dataVtr);
|
|
||||||
dataVtr = pti.dataVtr;
|
|
||||||
Global::_smoothnessFileName = cfd.fileName;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void XlsxHandler::writeAnalysisiFile(const QString filePath)
|
void XlsxHandler::writeAnalysisiFile(const QString filePath)
|
||||||
|
|||||||
@ -25,7 +25,7 @@ namespace XlsxHandler {
|
|||||||
void readAnalysisOperation(QXlsx::Worksheet*,int& startLineIndex,Global::CurveFileData&);
|
void readAnalysisOperation(QXlsx::Worksheet*,int& startLineIndex,Global::CurveFileData&);
|
||||||
|
|
||||||
void writeExperimentFile(const QString filePath);
|
void writeExperimentFile(const QString filePath);
|
||||||
void appendAnalysisOperation(const QString filePath);
|
void xlsxFileAppendAnalysisOperation(const QString filePath);
|
||||||
void writeAnalysisiFile(const QString filePath);
|
void writeAnalysisiFile(const QString filePath);
|
||||||
void writeAnalysisOperationDetail(QXlsx::Document*doc,const int row);
|
void writeAnalysisOperationDetail(QXlsx::Document*doc,const int row);
|
||||||
|
|
||||||
|
|||||||
10
src/global.h
10
src/global.h
@ -33,8 +33,9 @@ const double DefaultParamter = 8.177;
|
|||||||
const double OnsetAndEndSetRate = 0.01;
|
const double OnsetAndEndSetRate = 0.01;
|
||||||
|
|
||||||
//curve object name
|
//curve object name
|
||||||
const QString objectNameExperiemnt("experiment");
|
const QString ObjectNameExperiemnt("experiment");
|
||||||
//const QString objectNameSmoothness("smoothness");
|
const QString ObjectNameSmooth("smooth");
|
||||||
|
const QString Separator("___");
|
||||||
//
|
//
|
||||||
enum LanguageType{
|
enum LanguageType{
|
||||||
Chinese,
|
Chinese,
|
||||||
@ -91,8 +92,9 @@ struct ExperimentInfo{
|
|||||||
struct PhaseTotalInfo{
|
struct PhaseTotalInfo{
|
||||||
int phaseIndex; // from 1 to 6.
|
int phaseIndex; // from 1 to 6.
|
||||||
Phase phase;
|
Phase phase;
|
||||||
QVector<ExperimentData> dataVtr;
|
|
||||||
QCPCurve * curve;
|
QCPCurve * curve;
|
||||||
|
QVector<ExperimentData> dataVtr;
|
||||||
|
QVector<ExperimentData> smoothDataVtr;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CurveFileData{
|
struct CurveFileData{
|
||||||
@ -106,6 +108,7 @@ struct CurveExperimentData{
|
|||||||
QCPCurve * curve;
|
QCPCurve * curve;
|
||||||
QString fileName; // discard
|
QString fileName; // discard
|
||||||
QVector<Global::ExperimentData> dataVtr;
|
QVector<Global::ExperimentData> dataVtr;
|
||||||
|
QVector<ExperimentData> smoothDataVtr;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Soft mode.
|
// Soft mode.
|
||||||
@ -118,6 +121,7 @@ extern ExperimentInfo _experimentInfo;
|
|||||||
extern QVector<CurveExperimentData> _curveExperimentDataVtr;
|
extern QVector<CurveExperimentData> _curveExperimentDataVtr;
|
||||||
extern CurveExperimentData* _currentCurveExperimentDataPtr;
|
extern CurveExperimentData* _currentCurveExperimentDataPtr;
|
||||||
extern bool _smoothnessFlag;
|
extern bool _smoothnessFlag;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
// Smoothness data
|
// Smoothness data
|
||||||
extern QVector<CurveExperimentData> _curveSmoothnessDataVtr;
|
extern QVector<CurveExperimentData> _curveSmoothnessDataVtr;
|
||||||
|
|||||||
@ -135,6 +135,7 @@ void MainWindow::connections()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// mode
|
// mode
|
||||||
|
|
||||||
// connect(Global::instance(), &Global::sigModeModify,
|
// connect(Global::instance(), &Global::sigModeModify,
|
||||||
// _centralWidget, &CentralWidget::slotModeModify);
|
// _centralWidget, &CentralWidget::slotModeModify);
|
||||||
|
|
||||||
@ -161,7 +162,7 @@ void MainWindow::connections()
|
|||||||
connect(_specificHeatComparisonMethodForm,&SpecificHeatComparisonMethodForm::sigDrawCustomText,
|
connect(_specificHeatComparisonMethodForm,&SpecificHeatComparisonMethodForm::sigDrawCustomText,
|
||||||
_centralWidget,&CentralWidget::slotDrawCustomText);
|
_centralWidget,&CentralWidget::slotDrawCustomText);
|
||||||
|
|
||||||
//SpecificHeatComparisonMethodForm
|
// SpecificHeatComparisonMethodForm
|
||||||
connect(_eventHandler,&EventHandler::sigSetCurve,
|
connect(_eventHandler,&EventHandler::sigSetCurve,
|
||||||
_specificHeatComparisonMethodForm,
|
_specificHeatComparisonMethodForm,
|
||||||
&SpecificHeatComparisonMethodForm::slotSetCurve);
|
&SpecificHeatComparisonMethodForm::slotSetCurve);
|
||||||
@ -183,9 +184,7 @@ void MainWindow::setActionEnable(const bool flag)
|
|||||||
ui->actionStart->setEnabled(true);
|
ui->actionStart->setEnabled(true);
|
||||||
ui->actionStop->setEnabled(true);
|
ui->actionStop->setEnabled(true);
|
||||||
ui->actionRealTimeWidget->setEnabled(true);
|
ui->actionRealTimeWidget->setEnabled(true);
|
||||||
}
|
}else{
|
||||||
else
|
|
||||||
{
|
|
||||||
ui->actionNew->setEnabled(false);
|
ui->actionNew->setEnabled(false);
|
||||||
ui->actionStart->setEnabled(false);
|
ui->actionStart->setEnabled(false);
|
||||||
ui->actionStop->setEnabled(false);
|
ui->actionStop->setEnabled(false);
|
||||||
@ -200,6 +199,7 @@ void MainWindow::setSubWidgetAttribute(QWidget *widget)
|
|||||||
|
|
||||||
widget->setFixedSize(widget->geometry().width(),widget->geometry().height());
|
widget->setFixedSize(widget->geometry().width(),widget->geometry().height());
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
bool MainWindow::saveExperimentFile(const QString fileName)
|
bool MainWindow::saveExperimentFile(const QString fileName)
|
||||||
{
|
{
|
||||||
@ -273,25 +273,19 @@ bool MainWindow::saveFile(const QString fileName,const Global::Mode mode)
|
|||||||
// Save file.
|
// Save file.
|
||||||
if(mode == Global::Mode::Analysis){
|
if(mode == Global::Mode::Analysis){
|
||||||
if(Global::_curveFileDataVtr.empty()){
|
if(Global::_curveFileDataVtr.empty()){
|
||||||
logde<<"analysis experiemt data...";
|
// 分析模式下,但是文件数据为空,说明做完实验没有保存数据。
|
||||||
XlsxHandler::writeExperimentFile(filePath);
|
XlsxHandler::writeExperimentFile(filePath);
|
||||||
// XlsxHandler::writeAnalysisOperation(filePath);
|
|
||||||
}else{
|
}else{
|
||||||
logde<<"analysis xlsx data...";
|
// 分析模式下,直接保存从文件读取来的数据。
|
||||||
if(Global::_smoothnessFlag){
|
if(Global::_smoothnessFlag){
|
||||||
XlsxHandler::writeSmoothnessFile(filePath);
|
XlsxHandler::writeSmoothnessFile(filePath);
|
||||||
}else{
|
}else{
|
||||||
XlsxHandler::appendAnalysisOperation(filePath);
|
// 直接在xlsx文件的基础上添加分析数据。
|
||||||
|
XlsxHandler::xlsxFileAppendAnalysisOperation(filePath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else if(mode == Global::Mode::Experiment){
|
}else if(mode == Global::Mode::Experiment){
|
||||||
logde<<"writeFile...";
|
|
||||||
XlsxHandler::writeExperimentFile(filePath);
|
XlsxHandler::writeExperimentFile(filePath);
|
||||||
|
|
||||||
#if 0
|
|
||||||
// Clear data.
|
|
||||||
Global::clearExperimentData();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -301,17 +295,18 @@ void MainWindow::smoothness(const int level)
|
|||||||
{
|
{
|
||||||
Global::_smoothnessFlag = true;
|
Global::_smoothnessFlag = true;
|
||||||
// process data.
|
// process data.
|
||||||
QVector<Global::ExperimentData> targetDataVtr;
|
QVector<Global::ExperimentData> smoothDataVtr;
|
||||||
QString objectName;
|
QString objectName;
|
||||||
QCPCurve ** curvePtrPtr;
|
QCPCurve ** curvePtrPtr;
|
||||||
|
|
||||||
if(!Global::_curveExperimentDataVtr.empty()){
|
if(!Global::_curveExperimentDataVtr.empty()){
|
||||||
for(auto & item:Global::_curveExperimentDataVtr){
|
for(auto & item:Global::_curveExperimentDataVtr){
|
||||||
if(_centralWidget->isCurrentCurve(item.curve)){
|
if(_centralWidget->isCurrentCurve(item.curve)){
|
||||||
smoothnessDetail(level,item.dataVtr);
|
smoothDataVtr = smoothnessDetail(level,item.dataVtr);
|
||||||
|
|
||||||
targetDataVtr = item.dataVtr;
|
item.smoothDataVtr = smoothDataVtr;
|
||||||
objectName = Global::objectNameExperiemnt;
|
|
||||||
|
objectName = Global::ObjectNameExperiemnt;
|
||||||
curvePtrPtr = &item.curve;
|
curvePtrPtr = &item.curve;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -319,20 +314,12 @@ void MainWindow::smoothness(const int level)
|
|||||||
for(Global::CurveFileData &cfd :Global::_curveFileDataVtr){
|
for(Global::CurveFileData &cfd :Global::_curveFileDataVtr){
|
||||||
for(Global::PhaseTotalInfo& pti:cfd.phaseTotalVtr){
|
for(Global::PhaseTotalInfo& pti:cfd.phaseTotalVtr){
|
||||||
if(_centralWidget->isCurrentCurve(pti.curve)){
|
if(_centralWidget->isCurrentCurve(pti.curve)){
|
||||||
smoothnessDetail(level,pti.dataVtr);
|
smoothDataVtr = smoothnessDetail(level,pti.dataVtr);
|
||||||
|
|
||||||
|
pti.smoothDataVtr = smoothDataVtr;
|
||||||
|
|
||||||
targetDataVtr = pti.dataVtr;
|
|
||||||
objectName = cfd.fileName;
|
objectName = cfd.fileName;
|
||||||
curvePtrPtr = &pti.curve;
|
curvePtrPtr = &pti.curve;
|
||||||
|
|
||||||
//
|
|
||||||
#if 0
|
|
||||||
Global::ExperimentData ed;
|
|
||||||
ed.sampleTemp = 2222;
|
|
||||||
ed.dsc = 2222;
|
|
||||||
|
|
||||||
pti.dataVtr.push_back(ed);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -342,101 +329,23 @@ void MainWindow::smoothness(const int level)
|
|||||||
_centralWidget->deleteCurrentCurve();
|
_centralWidget->deleteCurrentCurve();
|
||||||
|
|
||||||
//
|
//
|
||||||
_centralWidget->addSmoothnessCurveData(targetDataVtr,objectName);
|
QString wholeObjectName = Global::ObjectNameSmooth + Global::Separator + objectName;
|
||||||
|
_centralWidget->addCurveData(smoothDataVtr,wholeObjectName);
|
||||||
|
|
||||||
*curvePtrPtr = _centralWidget->getCurrentCurve();
|
*curvePtrPtr = _centralWidget->getCurrentCurve();
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
// Get current data vtr;
|
|
||||||
QVector<Global::ExperimentData> dataVtr;
|
|
||||||
|
|
||||||
if(Global::_curveFileDataVtr.empty()){
|
|
||||||
// Load experiment data.
|
|
||||||
logde<<"experiment vtr size:"<<Global::_curveExperimentDataVtr.size();
|
|
||||||
for(Global::CurveExperimentData& ced:Global::_curveExperimentDataVtr){
|
|
||||||
if(_centralWidget->isCurrentCurve(ced.curve)){
|
|
||||||
logde<<"load experiment data.";
|
|
||||||
// PointCalculate::setAnalysisData(ced.dataVtr);
|
|
||||||
dataVtr = ced.dataVtr;
|
|
||||||
Global::_smoothnessFileName = ced.fileName;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
// Load xlsx file data.
|
|
||||||
for(Global::CurveFileData& cfd:Global::_curveFileDataVtr){
|
|
||||||
for(Global::PhaseTotalInfo& pti:cfd.phaseTotalVtr){
|
|
||||||
if(_centralWidget->isCurrentCurve(pti.curve)){
|
|
||||||
// PointCalculate::setAnalysisData(pti.dataVtr);
|
|
||||||
dataVtr = pti.dataVtr;
|
|
||||||
Global::_smoothnessFileName = cfd.fileName;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(dataVtr.empty()){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// smoothness.
|
|
||||||
Lowess::Config config;
|
|
||||||
config.smoothingFactor = level * 0.1;
|
|
||||||
config.robustnessIterations = 3;
|
|
||||||
|
|
||||||
std::vector<double> x;
|
|
||||||
std::vector<double> y;
|
|
||||||
|
|
||||||
for(Global::ExperimentData& ed:dataVtr) {
|
|
||||||
if(Global::_axisMode == Global::AxisMode::SingleY){
|
|
||||||
x.push_back(ed.sampleTemp);
|
|
||||||
}else{
|
|
||||||
x.push_back(ed.runTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
y.push_back(ed.dsc);
|
|
||||||
}
|
|
||||||
|
|
||||||
logde<<"smooth start...";
|
|
||||||
std::vector<double> yest = Lowess::smooth(x, y, config);
|
|
||||||
logde<<"smooth end...";
|
|
||||||
|
|
||||||
// Delete current curve;
|
|
||||||
_centralWidget->deleteCurrentCurve();
|
|
||||||
|
|
||||||
// Add new Curve.
|
|
||||||
QVector<Global::ExperimentData> newCurveDataVtr;
|
|
||||||
for(int i = 0; i < x.size();i++){
|
|
||||||
Global::ExperimentData ed;
|
|
||||||
if(Global::_axisMode == Global::AxisMode::SingleY){
|
|
||||||
ed.sampleTemp = x.at(i);
|
|
||||||
ed.runTime = dataVtr.at(i).runTime;
|
|
||||||
}else{
|
|
||||||
ed.runTime = x.at(i);
|
|
||||||
ed.sampleTemp = dataVtr.at(i).sampleTemp;
|
|
||||||
}
|
|
||||||
|
|
||||||
ed.dsc = yest.at(i);
|
|
||||||
ed.constantTempTime = dataVtr.at(i).constantTempTime;
|
|
||||||
|
|
||||||
newCurveDataVtr.push_back(ed);
|
|
||||||
}
|
|
||||||
_centralWidget->addSmoothnessCurveData(newCurveDataVtr);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QVector<Global::ExperimentData> MainWindow::smoothnessDetail(const int level,QVector<Global::ExperimentData>& dataVtr)
|
QVector<Global::ExperimentData> MainWindow::smoothnessDetail(const int level,const QVector<Global::ExperimentData>&dataVtr)
|
||||||
{
|
{
|
||||||
Lowess::Config config;
|
Lowess::Config config;
|
||||||
config.smoothingFactor = level * 0.1;
|
config.smoothingFactor = level * 0.01;
|
||||||
config.robustnessIterations = 3;
|
config.robustnessIterations = 3;
|
||||||
|
|
||||||
std::vector<double> x;
|
std::vector<double> x;
|
||||||
std::vector<double> y;
|
std::vector<double> y;
|
||||||
|
|
||||||
for(const Global::ExperimentData& ed:dataVtr) {
|
for(const Global::ExperimentData& ed:dataVtr){
|
||||||
if(Global::_axisMode == Global::AxisMode::SingleY){
|
if(Global::_axisMode == Global::AxisMode::SingleY){
|
||||||
x.push_back(ed.sampleTemp);
|
x.push_back(ed.sampleTemp);
|
||||||
}else{
|
}else{
|
||||||
@ -450,8 +359,8 @@ QVector<Global::ExperimentData> MainWindow::smoothnessDetail(const int level,QVe
|
|||||||
std::vector<double> yest = Lowess::smooth(x, y, config);
|
std::vector<double> yest = Lowess::smooth(x, y, config);
|
||||||
logde<<"smooth end...";
|
logde<<"smooth end...";
|
||||||
|
|
||||||
// target data vector.
|
// result data vector.
|
||||||
QVector<Global::ExperimentData> targetVtr;
|
QVector<Global::ExperimentData> resultVtr;
|
||||||
|
|
||||||
for(int i = 0; i < x.size();i++){
|
for(int i = 0; i < x.size();i++){
|
||||||
Global::ExperimentData ed;
|
Global::ExperimentData ed;
|
||||||
@ -466,13 +375,10 @@ QVector<Global::ExperimentData> MainWindow::smoothnessDetail(const int level,QVe
|
|||||||
ed.dsc = yest.at(i);
|
ed.dsc = yest.at(i);
|
||||||
ed.constantTempTime = dataVtr.at(i).constantTempTime;
|
ed.constantTempTime = dataVtr.at(i).constantTempTime;
|
||||||
|
|
||||||
targetVtr.push_back(ed);
|
resultVtr.push_back(ed);
|
||||||
}
|
}
|
||||||
|
|
||||||
dataVtr.clear();
|
return resultVtr;
|
||||||
dataVtr = targetVtr;
|
|
||||||
|
|
||||||
return targetVtr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::smoothnessExperimentData(const int level)
|
void MainWindow::smoothnessExperimentData(const int level)
|
||||||
@ -796,3 +702,40 @@ void MainWindow::on_actionSmoothness10_triggered()
|
|||||||
smoothness(10);
|
smoothness(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_actionOriginalData_triggered()
|
||||||
|
{
|
||||||
|
Global::_smoothnessFlag = false;
|
||||||
|
|
||||||
|
// process data.
|
||||||
|
QVector<Global::ExperimentData> targetDataVtr;
|
||||||
|
QString objectName;
|
||||||
|
QCPCurve ** curvePtrPtr;
|
||||||
|
|
||||||
|
if(!Global::_curveExperimentDataVtr.empty()){
|
||||||
|
for(auto & item:Global::_curveExperimentDataVtr){
|
||||||
|
if(_centralWidget->isCurrentCurve(item.curve)){
|
||||||
|
targetDataVtr = item.dataVtr;
|
||||||
|
|
||||||
|
objectName = Global::ObjectNameExperiemnt;
|
||||||
|
curvePtrPtr = &item.curve;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
for(Global::CurveFileData &cfd :Global::_curveFileDataVtr){
|
||||||
|
for(Global::PhaseTotalInfo& pti:cfd.phaseTotalVtr){
|
||||||
|
if(_centralWidget->isCurrentCurve(pti.curve)){
|
||||||
|
targetDataVtr = pti.dataVtr;
|
||||||
|
|
||||||
|
objectName = cfd.fileName;
|
||||||
|
curvePtrPtr = &pti.curve;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//
|
||||||
|
_centralWidget->deleteCurrentCurve();
|
||||||
|
|
||||||
|
_centralWidget->addCurveData(targetDataVtr,objectName);
|
||||||
|
|
||||||
|
*curvePtrPtr = _centralWidget->getCurrentCurve();
|
||||||
|
}
|
||||||
|
|||||||
@ -109,6 +109,8 @@ private slots:
|
|||||||
void on_actionSmoothness9_triggered();
|
void on_actionSmoothness9_triggered();
|
||||||
void on_actionSmoothness10_triggered();
|
void on_actionSmoothness10_triggered();
|
||||||
|
|
||||||
|
void on_actionOriginalData_triggered();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setAnalysisData();
|
void setAnalysisData();
|
||||||
void connections();
|
void connections();
|
||||||
@ -118,7 +120,7 @@ private:
|
|||||||
bool saveFile(const QString fileName,const Global::Mode);
|
bool saveFile(const QString fileName,const Global::Mode);
|
||||||
|
|
||||||
void smoothness(const int level);
|
void smoothness(const int level);
|
||||||
QVector<Global::ExperimentData> smoothnessDetail(const int level,QVector<Global::ExperimentData>&);
|
QVector<Global::ExperimentData> smoothnessDetail(const int level,const QVector<Global::ExperimentData>&);
|
||||||
void smoothnessExperimentData(const int level);
|
void smoothnessExperimentData(const int level);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@ -89,6 +89,7 @@
|
|||||||
<addaction name="actionEnthalpyCorrectionEdit"/>
|
<addaction name="actionEnthalpyCorrectionEdit"/>
|
||||||
<addaction name="actionEnthalpyCorrectionSelection"/>
|
<addaction name="actionEnthalpyCorrectionSelection"/>
|
||||||
<addaction name="menu_9"/>
|
<addaction name="menu_9"/>
|
||||||
|
<addaction name="actionOriginalData"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenu" name="menu_6">
|
<widget class="QMenu" name="menu_6">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
@ -410,6 +411,11 @@
|
|||||||
<string>10级</string>
|
<string>10级</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="actionOriginalData">
|
||||||
|
<property name="text">
|
||||||
|
<string>原始数据</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="images.qrc"/>
|
<include location="images.qrc"/>
|
||||||
|
|||||||
@ -129,13 +129,12 @@ void CentralWidget::deleteCurrentCurve()
|
|||||||
slotDelCurve(_currentCurve);
|
slotDelCurve(_currentCurve);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CentralWidget::addSmoothnessCurveData(
|
void CentralWidget::addCurveData(
|
||||||
const QVector<ExperimentData> &dataVtr,const QString objectName)
|
const QVector<ExperimentData> &dataVtr,const QString objectName)
|
||||||
{
|
{
|
||||||
PointCalculate::setAnalysisData(dataVtr);
|
PointCalculate::setAnalysisData(dataVtr);
|
||||||
|
|
||||||
// Load data.
|
// Load data.
|
||||||
// QVector<Global::ExperimentData> dataVtr;
|
|
||||||
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)
|
||||||
@ -174,8 +173,6 @@ void CentralWidget::addSmoothnessCurveData(
|
|||||||
minMaxYAxisPair.first,minMaxYAxisPair.second);
|
minMaxYAxisPair.first,minMaxYAxisPair.second);
|
||||||
_customPlot->yAxis->setRange(newYAxisPair.first ,
|
_customPlot->yAxis->setRange(newYAxisPair.first ,
|
||||||
newYAxisPair.second);
|
newYAxisPair.second);
|
||||||
//
|
|
||||||
// pti.curve = _currentCurve;
|
|
||||||
|
|
||||||
// Add analysis operation data.
|
// Add analysis operation data.
|
||||||
#if 0
|
#if 0
|
||||||
@ -189,15 +186,6 @@ void CentralWidget::addSmoothnessCurveData(
|
|||||||
|
|
||||||
// Refresh ui.
|
// Refresh ui.
|
||||||
_customPlot->replot();
|
_customPlot->replot();
|
||||||
|
|
||||||
#if 0
|
|
||||||
// Save data.
|
|
||||||
CurveExperimentData ced;
|
|
||||||
ced.curve = _currentCurve;
|
|
||||||
ced.dataVtr = dataVtr;
|
|
||||||
|
|
||||||
// Global::_curveSmoothnessDataVtr.push_back(ced);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CentralWidget::setAnalysisMode(const AnalysisMode mode)
|
void CentralWidget::setAnalysisMode(const AnalysisMode mode)
|
||||||
@ -268,7 +256,7 @@ void CentralWidget::slotRecvCommonData(const CommonData &cd)
|
|||||||
if(!_currentCurve){
|
if(!_currentCurve){
|
||||||
logde<<"_currentCurve is nullptr";
|
logde<<"_currentCurve is nullptr";
|
||||||
_currentCurve = new QCPCurve(_customPlot->xAxis, _customPlot->yAxis);
|
_currentCurve = new QCPCurve(_customPlot->xAxis, _customPlot->yAxis);
|
||||||
_currentCurve->setObjectName(Global::objectNameExperiemnt);
|
_currentCurve->setObjectName(Global::ObjectNameExperiemnt);
|
||||||
}
|
}
|
||||||
|
|
||||||
// logde<<"temp:"<<cd.sample_temp<<",dsc:"<<cd.dsc;
|
// logde<<"temp:"<<cd.sample_temp<<",dsc:"<<cd.dsc;
|
||||||
|
|||||||
@ -42,7 +42,7 @@ public:
|
|||||||
bool isCurrentCurve(QCPCurve* curve);
|
bool isCurrentCurve(QCPCurve* curve);
|
||||||
|
|
||||||
void deleteCurrentCurve();
|
void deleteCurrentCurve();
|
||||||
void addSmoothnessCurveData(const QVector<Global::ExperimentData> &,const QString objectName);
|
void addCurveData(const QVector<Global::ExperimentData> &,const QString objectName);
|
||||||
|
|
||||||
QCPCurve * getCurrentCurve(){return _currentCurve;}
|
QCPCurve * getCurrentCurve(){return _currentCurve;}
|
||||||
signals:
|
signals:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user