2025-05-20T17:30:02
This commit is contained in:
parent
d7443a3e19
commit
81d4b13cbd
Binary file not shown.
@ -9,7 +9,7 @@ CONFIG+=precompile_header
|
|||||||
PRECOMPILED_HEADER=stable.h
|
PRECOMPILED_HEADER=stable.h
|
||||||
|
|
||||||
#
|
#
|
||||||
VERSION = 0.9.8.3
|
VERSION = 0.9.9
|
||||||
# 设置目标文件名,包含版本号
|
# 设置目标文件名,包含版本号
|
||||||
TARGET = AnalysisTool_$${VERSION}
|
TARGET = AnalysisTool_$${VERSION}
|
||||||
|
|
||||||
|
|||||||
@ -77,8 +77,14 @@ int XlsxHandler::readFile(const QString filePath, Global::CurveFileData &cfd)
|
|||||||
|
|
||||||
readPhaseData(workSheet, dataIndex, phaseTotal);
|
readPhaseData(workSheet, dataIndex, phaseTotal);
|
||||||
phaseTotalVtr.push_back(phaseTotal);
|
phaseTotalVtr.push_back(phaseTotal);
|
||||||
|
|
||||||
|
// print
|
||||||
|
logde<<"index:"<<i<<",phase cut off temp:"<<phaseTotal.phase.cutoff_temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logde<<"index:"<<cfd.phaseTotalVtr.first().phaseIndex
|
||||||
|
<<",phase cut off temp:"<<cfd.phaseTotalVtr.first().phase.cutoff_temp;
|
||||||
|
|
||||||
logde<<"dataIndex:"<<dataIndex;
|
logde<<"dataIndex:"<<dataIndex;
|
||||||
|
|
||||||
readAnalysisOperation(workSheet,dataIndex,cfd);
|
readAnalysisOperation(workSheet,dataIndex,cfd);
|
||||||
@ -96,6 +102,7 @@ void XlsxHandler::readPhaseData(QXlsx::Worksheet *workSheet, int &startLineIndex
|
|||||||
|
|
||||||
logde<<"startLineIndex:"<<startLineIndex;
|
logde<<"startLineIndex:"<<startLineIndex;
|
||||||
|
|
||||||
|
phaseTotal.phase.onoff = 1;
|
||||||
phaseTotal.phase.cutoff_temp = workSheet->cellAt(startLineIndex++, 2)->value().toDouble();
|
phaseTotal.phase.cutoff_temp = workSheet->cellAt(startLineIndex++, 2)->value().toDouble();
|
||||||
phaseTotal.phase.temp_flow = workSheet->cellAt(startLineIndex++, 2)->value().toDouble();
|
phaseTotal.phase.temp_flow = workSheet->cellAt(startLineIndex++, 2)->value().toDouble();
|
||||||
phaseTotal.phase.constant_temp_time_min = (uint16_t)(workSheet->cellAt(startLineIndex++, 2)->value().toInt());
|
phaseTotal.phase.constant_temp_time_min = (uint16_t)(workSheet->cellAt(startLineIndex++, 2)->value().toInt());
|
||||||
|
|||||||
@ -29,7 +29,7 @@ const QString TemperatureStr("temperature");
|
|||||||
const QString RateStr("rate");
|
const QString RateStr("rate");
|
||||||
|
|
||||||
//
|
//
|
||||||
const double DefaultParamter = 1.0;
|
const double DefaultParamter = 8.177;
|
||||||
|
|
||||||
//
|
//
|
||||||
#if 0
|
#if 0
|
||||||
|
|||||||
@ -15,6 +15,8 @@
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
|
||||||
|
system("chcp 65001");
|
||||||
QTextCodec *codec = QTextCodec::codecForName("UTF-8");
|
QTextCodec *codec = QTextCodec::codecForName("UTF-8");
|
||||||
QTextCodec::setCodecForLocale(codec);
|
QTextCodec::setCodecForLocale(codec);
|
||||||
|
|
||||||
@ -22,6 +24,7 @@ int main(int argc, char *argv[])
|
|||||||
logde<<"main...";
|
logde<<"main...";
|
||||||
//
|
//
|
||||||
ConfigHandler::reader();
|
ConfigHandler::reader();
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
logde<<"config,instrument coefficient:"
|
logde<<"config,instrument coefficient:"
|
||||||
<<ConfigHandler::_configMap.value(ConInstrumentCoefficientStr).toFloat();
|
<<ConfigHandler::_configMap.value(ConInstrumentCoefficientStr).toFloat();
|
||||||
@ -42,6 +45,8 @@ int main(int argc, char *argv[])
|
|||||||
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); // 启用高DPI缩放
|
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); // 启用高DPI缩放
|
||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
|
|
||||||
|
logde<<"version:"<<a.applicationVersion().toStdString();
|
||||||
|
|
||||||
QIcon icon;
|
QIcon icon;
|
||||||
icon.addFile(":/images/logo.ico", QSize(16, 16));
|
icon.addFile(":/images/logo.ico", QSize(16, 16));
|
||||||
icon.addFile(":/images/logo.ico", QSize(32, 32));
|
icon.addFile(":/images/logo.ico", QSize(32, 32));
|
||||||
|
|||||||
@ -17,5 +17,16 @@ void removeTheLastAnalysisOperation()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void removeAnalysisOperationByObjectName(const QString objectName)
|
||||||
|
{
|
||||||
|
for (auto it = _analysisOperationVtr.begin(); it != _analysisOperationVtr.end(); ) {
|
||||||
|
if (it->filePath == objectName) {
|
||||||
|
it = _analysisOperationVtr.erase(it);
|
||||||
|
} else {
|
||||||
|
++it;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//QVector<AnalysisOperation> _fileAnanlysisOperationVtr;
|
//QVector<AnalysisOperation> _fileAnanlysisOperationVtr;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -37,6 +37,8 @@ extern QVector<AnalysisOperation> _analysisOperationVtr;
|
|||||||
//void addAnalysisOperation(const AnalysisOperation);
|
//void addAnalysisOperation(const AnalysisOperation);
|
||||||
void removeTheLastAnalysisOperation();
|
void removeTheLastAnalysisOperation();
|
||||||
|
|
||||||
|
void removeAnalysisOperationByObjectName(const QString objectName);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -64,6 +64,9 @@ CentralWidget::CentralWidget(QWidget *parent)
|
|||||||
connect(_eventHandler,&EventHandler::sigDelCurve,
|
connect(_eventHandler,&EventHandler::sigDelCurve,
|
||||||
this,&CentralWidget::slotDelCurve);
|
this,&CentralWidget::slotDelCurve);
|
||||||
|
|
||||||
|
connect(_customPlot, &QCustomPlot::selectionChangedByUser,
|
||||||
|
this,&CentralWidget::slotSelectionChangedByUser);
|
||||||
|
|
||||||
setEventHandlerEnable(false);
|
setEventHandlerEnable(false);
|
||||||
//
|
//
|
||||||
#if 0
|
#if 0
|
||||||
@ -144,8 +147,6 @@ void CentralWidget::switchAxisMode()
|
|||||||
|
|
||||||
_customPlot->yAxis2->setVisible(false);
|
_customPlot->yAxis2->setVisible(false);
|
||||||
|
|
||||||
// logde<<"graph count:"<<_customPlot->plottableCount();
|
|
||||||
|
|
||||||
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);
|
||||||
if (auto curve = dynamic_cast<QCPCurve*>(plottable)) {
|
if (auto curve = dynamic_cast<QCPCurve*>(plottable)) {
|
||||||
@ -271,8 +272,6 @@ void CentralWidget::slotRecvAnalysisFileName(const QString &filePath)
|
|||||||
for(int i = 0;i < cfd.phaseTotalVtr.size();i++){
|
for(int i = 0;i < cfd.phaseTotalVtr.size();i++){
|
||||||
Global::PhaseTotalInfo& pti = cfd.phaseTotalVtr[i];
|
Global::PhaseTotalInfo& pti = cfd.phaseTotalVtr[i];
|
||||||
|
|
||||||
// logde<<"data Vtr size:"<<pti.dataVtr.size();
|
|
||||||
|
|
||||||
PointCalculate::setExperimentData(pti.dataVtr);
|
PointCalculate::setExperimentData(pti.dataVtr);
|
||||||
|
|
||||||
QPair<QPointF,QPointF>startEndPointPair = PointCalculate::getStartAndEndPoint();
|
QPair<QPointF,QPointF>startEndPointPair = PointCalculate::getStartAndEndPoint();
|
||||||
@ -311,7 +310,7 @@ void CentralWidget::slotRecvAnalysisFileName(const QString &filePath)
|
|||||||
if(cfd.analysisOperationVtr.size() > 0){
|
if(cfd.analysisOperationVtr.size() > 0){
|
||||||
for(AnaOpRecorder::AnalysisOperation& ao
|
for(AnaOpRecorder::AnalysisOperation& ao
|
||||||
:cfd.analysisOperationVtr){
|
:cfd.analysisOperationVtr){
|
||||||
loadAnalysisData(ao.mode,ao.x1,ao.x2);
|
loadAnalysisData(ao.mode,ao.x1,ao.x2,filePath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Refresh ui.
|
// Refresh ui.
|
||||||
@ -335,7 +334,7 @@ void CentralWidget::slotAnalysisSettingApply()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
loadAnalysisData(_analysisMode,x1,x2);
|
loadAnalysisData(_analysisMode,x1,x2,_currentCurve->objectName());
|
||||||
|
|
||||||
if(Global::_mode == Global::Mode::Analysis){
|
if(Global::_mode == Global::Mode::Analysis){
|
||||||
AnalysisOperation ao;
|
AnalysisOperation ao;
|
||||||
@ -414,7 +413,9 @@ void CentralWidget::slotDelCurve(QCPCurve *curve)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logde<<"deltel curve object name:"<<curve->objectName().toStdString();
|
||||||
|
|
||||||
|
deleteCurve(curve->objectName());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CentralWidget::slotGetAxisInfo()
|
void CentralWidget::slotGetAxisInfo()
|
||||||
@ -479,6 +480,28 @@ void CentralWidget::timerEvent(QTimerEvent *event)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CentralWidget::slotSelectionChangedByUser()
|
||||||
|
{
|
||||||
|
// 获取所有被选中的绘图对象
|
||||||
|
QList<QCPAbstractPlottable*> selectedPlottables = _customPlot->selectedPlottables();
|
||||||
|
|
||||||
|
// 遍历选中的绘图对象
|
||||||
|
for (QCPAbstractPlottable* plottable : selectedPlottables) {
|
||||||
|
// 检查是否是 QCPCurve
|
||||||
|
if (QCPCurve* curve = dynamic_cast<QCPCurve*>(plottable)) {
|
||||||
|
qDebug() << "Selected Curve:" << curve->objectName();
|
||||||
|
logde<<curve->objectName().toStdString();
|
||||||
|
_currentCurve = curve; // 更新当前选中的曲线
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果没有选中的曲线
|
||||||
|
if (selectedPlottables.isEmpty()) {
|
||||||
|
qDebug() << "No curve selected";
|
||||||
|
_currentCurve = nullptr; // 清空当前选中的曲线
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
void CentralWidget::contextMenuEvent(QContextMenuEvent *event)
|
void CentralWidget::contextMenuEvent(QContextMenuEvent *event)
|
||||||
{
|
{
|
||||||
@ -488,7 +511,7 @@ void CentralWidget::contextMenuEvent(QContextMenuEvent *event)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void CentralWidget::glassTransitionHandle(const double x1,const double x2)
|
void CentralWidget::glassTransitionHandle(const double x1,const double x2,const QString objectName)
|
||||||
{
|
{
|
||||||
QPointF point1 = PointCalculate::getClosestPointByX(x1);
|
QPointF point1 = PointCalculate::getClosestPointByX(x1);
|
||||||
QPointF point2 = PointCalculate::getClosestPointByX(x2);
|
QPointF point2 = PointCalculate::getClosestPointByX(x2);
|
||||||
@ -523,7 +546,7 @@ void CentralWidget::glassTransitionHandle(const double x1,const double x2)
|
|||||||
QCPGraph *lineGraph1 = _customPlot->addGraph();
|
QCPGraph *lineGraph1 = _customPlot->addGraph();
|
||||||
lineGraph1->setData(xVtr, yVtr);
|
lineGraph1->setData(xVtr, yVtr);
|
||||||
|
|
||||||
ItemManager::addTemporaryQCPGraph(lineGraph1);
|
ItemManager::addTemporaryQCPGraph(lineGraph1,objectName);
|
||||||
|
|
||||||
QPen pen;
|
QPen pen;
|
||||||
pen.setColor(Qt::darkGreen);
|
pen.setColor(Qt::darkGreen);
|
||||||
@ -554,7 +577,7 @@ void CentralWidget::glassTransitionHandle(const double x1,const double x2)
|
|||||||
lineGraph2->setData(xVtr2, yVtr2);
|
lineGraph2->setData(xVtr2, yVtr2);
|
||||||
lineGraph2->setPen(pen);
|
lineGraph2->setPen(pen);
|
||||||
|
|
||||||
ItemManager::addTemporaryQCPGraph(lineGraph2);
|
ItemManager::addTemporaryQCPGraph(lineGraph2,objectName);
|
||||||
|
|
||||||
_customPlot->replot();
|
_customPlot->replot();
|
||||||
#endif
|
#endif
|
||||||
@ -644,7 +667,7 @@ void CentralWidget::glassTransitionHandle(const double x1,const double x2)
|
|||||||
lineGraph3->setData(xVtr, yVtr);
|
lineGraph3->setData(xVtr, yVtr);
|
||||||
lineGraph3->setPen(pen);
|
lineGraph3->setPen(pen);
|
||||||
|
|
||||||
ItemManager::addTemporaryQCPGraph(lineGraph3);
|
ItemManager::addTemporaryQCPGraph(lineGraph3,objectName);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
_customPlot->replot();
|
_customPlot->replot();
|
||||||
@ -800,7 +823,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)
|
void CentralWidget::drawText(const QPointF point, const QString text,const QString objectName)
|
||||||
{
|
{
|
||||||
QPointF textBoxPoint = getTheCoordinatesOfTheTextBox(point);
|
QPointF textBoxPoint = getTheCoordinatesOfTheTextBox(point);
|
||||||
|
|
||||||
@ -820,7 +843,7 @@ void CentralWidget::drawText(const QPointF point, const QString text)
|
|||||||
textLabel->position->setTypeX(QCPItemPosition::ptAxisRectRatio);
|
textLabel->position->setTypeX(QCPItemPosition::ptAxisRectRatio);
|
||||||
textLabel->position->setTypeY(QCPItemPosition::ptAxisRectRatio);
|
textLabel->position->setTypeY(QCPItemPosition::ptAxisRectRatio);
|
||||||
|
|
||||||
ItemManager::addTemporaryQCPItemText(textLabel);
|
ItemManager::addTemporaryQCPItemText(textLabel,objectName);
|
||||||
|
|
||||||
// 创建指向点的线段(QCPItemLine)
|
// 创建指向点的线段(QCPItemLine)
|
||||||
QCPItemLine *arrow = new QCPItemLine(_customPlot);
|
QCPItemLine *arrow = new QCPItemLine(_customPlot);
|
||||||
@ -829,13 +852,13 @@ void CentralWidget::drawText(const QPointF point, const QString text)
|
|||||||
arrow->setHead(QCPLineEnding::esSpikeArrow); // 添加箭头
|
arrow->setHead(QCPLineEnding::esSpikeArrow); // 添加箭头
|
||||||
arrow->setPen(QPen(Qt::red, 1));
|
arrow->setPen(QPen(Qt::red, 1));
|
||||||
|
|
||||||
ItemManager::addTemporaryQCPItemLine(arrow);
|
ItemManager::addTemporaryQCPItemLine(arrow,objectName);
|
||||||
|
|
||||||
// 重绘图表以显示文本标签和箭头
|
// 重绘图表以显示文本标签和箭头
|
||||||
_customPlot->replot();
|
_customPlot->replot();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CentralWidget::fillGraph(const double x1, const double x2)
|
void CentralWidget::fillGraph(const double x1, const double x2,const QString objectName)
|
||||||
{
|
{
|
||||||
double y1 = PointCalculate::getClosestPointByX(x1).y();
|
double y1 = PointCalculate::getClosestPointByX(x1).y();
|
||||||
double y2 = PointCalculate::getClosestPointByX(x2).y();
|
double y2 = PointCalculate::getClosestPointByX(x2).y();
|
||||||
@ -868,8 +891,8 @@ void CentralWidget::fillGraph(const double x1, const double x2)
|
|||||||
fillGraph->setBrush(QBrush(Qt::green, Qt::SolidPattern));
|
fillGraph->setBrush(QBrush(Qt::green, Qt::SolidPattern));
|
||||||
fillGraph->setChannelFillGraph(mainGraph);
|
fillGraph->setChannelFillGraph(mainGraph);
|
||||||
|
|
||||||
ItemManager::addTemporaryQCPGraph(mainGraph);
|
ItemManager::addTemporaryQCPGraph(mainGraph,objectName);
|
||||||
ItemManager::addTemporaryQCPGraph(fillGraph);
|
ItemManager::addTemporaryQCPGraph(fillGraph,objectName);
|
||||||
|
|
||||||
_customPlot->replot();
|
_customPlot->replot();
|
||||||
}
|
}
|
||||||
@ -970,7 +993,58 @@ void CentralWidget::clearData(const CentralWidget::ClearDataMode mode)
|
|||||||
_customPlot->replot();
|
_customPlot->replot();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CentralWidget::loadAnalysisData(const AnalysisMode mode,const double x1,const double x2)
|
void CentralWidget::deleteCurve(const QString objectName)
|
||||||
|
{
|
||||||
|
_analysisFilePathVtr.removeOne(objectName);
|
||||||
|
|
||||||
|
ItemManager::removeItemsByObjectName(objectName);
|
||||||
|
|
||||||
|
AnalysisOperationRecorder::removeAnalysisOperationByObjectName(objectName);
|
||||||
|
|
||||||
|
// Clear the data of graph.
|
||||||
|
for (int i = _customPlot->plottableCount() - 1; i >= 0; --i) {
|
||||||
|
QCPAbstractPlottable* plottable = _customPlot->plottable(i);
|
||||||
|
if (auto curve = dynamic_cast<QCPCurve*>(plottable)) {
|
||||||
|
logde<<"clear data,curve object Name:"<<curve->objectName().toStdString();
|
||||||
|
if(curve->objectName().contains(objectName)){
|
||||||
|
_customPlot->removePlottable(curve);
|
||||||
|
|
||||||
|
ItemManager::removeItem(curve);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clear graph on plot.
|
||||||
|
for (int i = _customPlot->graphCount() - 1; i >= 0; --i) {
|
||||||
|
QCPGraph *graph = _customPlot->graph(i);
|
||||||
|
logde<<"clear data,graph object Name:"<<graph->objectName().toStdString();
|
||||||
|
if(graph && graph->objectName().contains(objectName)){
|
||||||
|
_customPlot->removeGraph(graph);
|
||||||
|
|
||||||
|
ItemManager::removeItem(graph);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete items.
|
||||||
|
QList<QCPAbstractItem *> itemsToKeep;
|
||||||
|
itemsToKeep << _line1 << _line2;
|
||||||
|
|
||||||
|
for (int i = _customPlot->itemCount() - 1; i >= 0; --i) {
|
||||||
|
QCPAbstractItem *item = _customPlot->item(i);
|
||||||
|
logde<<"item data,graph object Name:"<<item->objectName().toStdString();
|
||||||
|
if(item && !itemsToKeep.contains(item)
|
||||||
|
&& item->objectName().contains(objectName)){
|
||||||
|
_customPlot->removeItem(item);
|
||||||
|
|
||||||
|
ItemManager::removeItem(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_customPlot->replot();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CentralWidget::loadAnalysisData(
|
||||||
|
const AnalysisMode mode,const double x1,const double x2,const QString objectName)
|
||||||
{
|
{
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case AnalysisMode::NumericalLabel:
|
case AnalysisMode::NumericalLabel:
|
||||||
@ -986,7 +1060,7 @@ void CentralWidget::loadAnalysisData(const AnalysisMode mode,const double x1,con
|
|||||||
|
|
||||||
QString str = PointCalculate::textFormatNumbericalLabel(selectPoint);
|
QString str = PointCalculate::textFormatNumbericalLabel(selectPoint);
|
||||||
|
|
||||||
drawText(selectPoint,str);
|
drawText(selectPoint,str,objectName);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1009,14 +1083,14 @@ void CentralWidget::loadAnalysisData(const AnalysisMode mode,const double x1,con
|
|||||||
str = PointCalculate::textFormatEndPoint(point);
|
str = PointCalculate::textFormatEndPoint(point);
|
||||||
}
|
}
|
||||||
|
|
||||||
drawText(point,str);
|
drawText(point,str,objectName);
|
||||||
|
|
||||||
//
|
//
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AnalysisMode::PeakSynthesisAnalysis:
|
case AnalysisMode::PeakSynthesisAnalysis:
|
||||||
{
|
{
|
||||||
fillGraph(x1,x2);
|
fillGraph(x1,x2,objectName);
|
||||||
|
|
||||||
PointCalculate::setRegionPointX(x1,x2);
|
PointCalculate::setRegionPointX(x1,x2);
|
||||||
|
|
||||||
@ -1054,14 +1128,14 @@ void CentralWidget::loadAnalysisData(const AnalysisMode mode,const double x1,con
|
|||||||
peakPointTime,
|
peakPointTime,
|
||||||
startPointTime,
|
startPointTime,
|
||||||
endPointTime);
|
endPointTime);
|
||||||
drawText(peakPoint,str);
|
drawText(peakPoint,str,objectName);
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
str = PointCalculate::textFormatPeakPoint(enthalpyValue,
|
str = PointCalculate::textFormatPeakPoint(enthalpyValue,
|
||||||
peakPoint.x(),
|
peakPoint.x(),
|
||||||
startEndPointPair.first.x(),
|
startEndPointPair.first.x(),
|
||||||
startEndPointPair.second.x());
|
startEndPointPair.second.x());
|
||||||
drawText(peakPoint,str);
|
drawText(peakPoint,str,objectName);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -1069,7 +1143,7 @@ void CentralWidget::loadAnalysisData(const AnalysisMode mode,const double x1,con
|
|||||||
}
|
}
|
||||||
case AnalysisMode::GlassTransition:
|
case AnalysisMode::GlassTransition:
|
||||||
{
|
{
|
||||||
glassTransitionHandle(x1,x2);
|
glassTransitionHandle(x1,x2,objectName);
|
||||||
|
|
||||||
//
|
//
|
||||||
break;
|
break;
|
||||||
@ -1085,7 +1159,7 @@ void CentralWidget::loadAnalysisData(const AnalysisMode mode,const double x1,con
|
|||||||
|
|
||||||
QPointF point = OnsetTemperaturePointHandle(x1,x2);
|
QPointF point = OnsetTemperaturePointHandle(x1,x2);
|
||||||
QString str = QString::number(point.x(),'f',3);
|
QString str = QString::number(point.x(),'f',3);
|
||||||
drawText(point,str);
|
drawText(point,str,objectName);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1097,6 +1171,8 @@ void CentralWidget::loadAnalysisData(const AnalysisMode mode,const double x1,con
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void CentralWidget::clearAllData()
|
void CentralWidget::clearAllData()
|
||||||
{
|
{
|
||||||
clearData(ClearDataMode::All);
|
clearData(ClearDataMode::All);
|
||||||
|
|||||||
@ -71,8 +71,10 @@ public slots:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
void timerEvent(QTimerEvent* event);
|
void timerEvent(QTimerEvent* event);
|
||||||
|
private slots:
|
||||||
|
void slotSelectionChangedByUser();
|
||||||
private:
|
private:
|
||||||
void glassTransitionHandle(const double x1,const double x2);
|
void glassTransitionHandle(const double x1,const double x2,const QString objectName);
|
||||||
void quadraticFit(const QVector<QPointF>& points, double& a, double& b, double& c);
|
void quadraticFit(const QVector<QPointF>& points, double& a, double& b, double& c);
|
||||||
double derivativeAt(const double a, const double b, const double x);
|
double derivativeAt(const double a, const double b, const double x);
|
||||||
PointCalculate::Line calculateLinearRegression(const QVector<double>& x,
|
PointCalculate::Line calculateLinearRegression(const QVector<double>& x,
|
||||||
@ -82,16 +84,18 @@ private:
|
|||||||
|
|
||||||
void setEventHandlerEnable(const bool);
|
void setEventHandlerEnable(const bool);
|
||||||
QPointF getTheCoordinatesOfTheTextBox(const QPointF point);
|
QPointF getTheCoordinatesOfTheTextBox(const QPointF point);
|
||||||
void drawText(const QPointF,const QString);
|
void drawText(const QPointF,const QString,const QString objectName = "");
|
||||||
void fillGraph(const double x1,const double x2);
|
void fillGraph(const double x1,const double x2,const QString objectName);
|
||||||
|
|
||||||
enum ClearDataMode{
|
enum ClearDataMode{
|
||||||
All,
|
All,
|
||||||
Undo
|
Undo
|
||||||
};
|
};
|
||||||
void clearData(const ClearDataMode);
|
void clearData(const ClearDataMode);
|
||||||
|
void deleteCurve(const QString);
|
||||||
|
|
||||||
|
void loadAnalysisData(const AnalysisMode mode,const double x1,const double x2,const QString objectName);
|
||||||
|
|
||||||
void loadAnalysisData(const AnalysisMode mode,const double x1,const double x2);
|
|
||||||
private:
|
private:
|
||||||
AnalysisOperationRecorder::AnalysisMode _analysisMode;
|
AnalysisOperationRecorder::AnalysisMode _analysisMode;
|
||||||
LocalCustomPlot *_customPlot;
|
LocalCustomPlot *_customPlot;
|
||||||
|
|||||||
@ -17,13 +17,8 @@ class EventHandler : public QObject
|
|||||||
public:
|
public:
|
||||||
EventHandler(QCustomPlot *plot, QCPItemStraightLine *line1, QCPItemStraightLine *line2,
|
EventHandler(QCustomPlot *plot, QCPItemStraightLine *line1, QCPItemStraightLine *line2,
|
||||||
QObject *parent);
|
QObject *parent);
|
||||||
#if 0
|
|
||||||
EventHandler(QCustomPlot *plot, QCPItemStraightLine *line1, QCPItemStraightLine *line2,
|
|
||||||
QCPGraph*graph,QObject *parent);
|
|
||||||
#endif
|
|
||||||
~EventHandler();
|
~EventHandler();
|
||||||
|
|
||||||
// void setGraph(QCPGraph* g){ _graph = g;}
|
|
||||||
void setEnable(const bool flag){_enableFlag = flag;}
|
void setEnable(const bool flag){_enableFlag = flag;}
|
||||||
enum Mode{
|
enum Mode{
|
||||||
Null,
|
Null,
|
||||||
@ -54,7 +49,6 @@ private:
|
|||||||
QCustomPlot *_plot;
|
QCustomPlot *_plot;
|
||||||
QCPItemStraightLine *_line1,*_line2;
|
QCPItemStraightLine *_line1,*_line2;
|
||||||
QCPItemStraightLine *_draggingLine = nullptr;
|
QCPItemStraightLine *_draggingLine = nullptr;
|
||||||
// QCPGraph *_graph;
|
|
||||||
QMenu* _menu;
|
QMenu* _menu;
|
||||||
QAction* _specificHeatItemAction,*_baseLineAction,
|
QAction* _specificHeatItemAction,*_baseLineAction,
|
||||||
*_standardSampleAction,*_sampleAction;
|
*_standardSampleAction,*_sampleAction;
|
||||||
|
|||||||
@ -5,38 +5,39 @@ QVector<QCPItemText*> _QCPItemTextVtr;
|
|||||||
QVector<QCPItemLine*> _QCPItemLineVtr;
|
QVector<QCPItemLine*> _QCPItemLineVtr;
|
||||||
QVector<QCPGraph*> _QCPGraphVtr;
|
QVector<QCPGraph*> _QCPGraphVtr;
|
||||||
|
|
||||||
void addTemporaryQCPItemText(QCPItemText *item)
|
void addTemporaryQCPItemText(QCPItemText *item,const QString objectName)
|
||||||
{
|
{
|
||||||
item->setObjectName(TemporaryStr);
|
item->setObjectName(TemporaryStr + Separator + objectName);
|
||||||
_QCPItemTextVtr.push_back(item);
|
_QCPItemTextVtr.push_back(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
void addTemporaryQCPItemLine(QCPItemLine *item)
|
void addTemporaryQCPItemLine(QCPItemLine *item,const QString objectName)
|
||||||
{
|
{
|
||||||
item->setObjectName(TemporaryStr);
|
item->setObjectName(TemporaryStr + Separator + objectName);
|
||||||
_QCPItemLineVtr.push_back(item);
|
_QCPItemLineVtr.push_back(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void addTemporaryQCPGraph(QCPGraph * graph,const QString objectName)
|
||||||
|
{
|
||||||
|
graph->setObjectName(TemporaryStr + Separator + objectName);
|
||||||
|
_QCPGraphVtr.push_back(graph);
|
||||||
|
}
|
||||||
|
|
||||||
void confirm()
|
void confirm()
|
||||||
{
|
{
|
||||||
for(QCPItemText *item:_QCPItemTextVtr){
|
for(QCPItemText *item:_QCPItemTextVtr){
|
||||||
item->setObjectName(ConfirmStr);
|
objectNameModifyConfirm(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(QCPItemLine *item:_QCPItemLineVtr){
|
for(QCPItemLine *item:_QCPItemLineVtr){
|
||||||
item->setObjectName(ConfirmStr);
|
objectNameModifyConfirm(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(QCPGraph *graph:_QCPGraphVtr){
|
for(QCPGraph *graph:_QCPGraphVtr){
|
||||||
graph->setObjectName(ConfirmStr);
|
objectNameModifyConfirm(graph);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void addTemporaryQCPGraph(QCPGraph * graph)
|
|
||||||
{
|
|
||||||
graph->setObjectName(TemporaryStr);
|
|
||||||
_QCPGraphVtr.push_back(graph);
|
|
||||||
}
|
|
||||||
|
|
||||||
void removeItem(QObject *obj)
|
void removeItem(QObject *obj)
|
||||||
{
|
{
|
||||||
@ -45,7 +46,7 @@ void removeItem(QObject *obj)
|
|||||||
if (item == obj) {
|
if (item == obj) {
|
||||||
|
|
||||||
_QCPItemTextVtr.remove(i);
|
_QCPItemTextVtr.remove(i);
|
||||||
// return;
|
// return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,7 +54,7 @@ void removeItem(QObject *obj)
|
|||||||
QCPItemLine *item = _QCPItemLineVtr[i];
|
QCPItemLine *item = _QCPItemLineVtr[i];
|
||||||
if (item == obj) {
|
if (item == obj) {
|
||||||
_QCPItemLineVtr.remove(i);
|
_QCPItemLineVtr.remove(i);
|
||||||
// return;
|
// return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,7 +62,7 @@ void removeItem(QObject *obj)
|
|||||||
QCPGraph *item = _QCPGraphVtr[i];
|
QCPGraph *item = _QCPGraphVtr[i];
|
||||||
if (item == obj) {
|
if (item == obj) {
|
||||||
_QCPGraphVtr.remove(i);
|
_QCPGraphVtr.remove(i);
|
||||||
// return;
|
// return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,5 +70,45 @@ void removeItem(QObject *obj)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void objectNameModifyConfirm(QObject* obj) {
|
||||||
|
|
||||||
|
QString objectName = obj->objectName();
|
||||||
|
|
||||||
|
if (objectName.contains(Separator)) {
|
||||||
|
QStringList parts = objectName.split(Separator);
|
||||||
|
|
||||||
|
if (parts.size() >= 2) {
|
||||||
|
QString extractedObjectName = parts[1];
|
||||||
|
QString newObjectName = ConfirmStr + Separator + extractedObjectName;
|
||||||
|
|
||||||
|
obj->setObjectName(newObjectName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void removeItemsByObjectName(const QString objectName)
|
||||||
|
{
|
||||||
|
for (int i = _QCPItemTextVtr.size() - 1; i >= 0; --i) {
|
||||||
|
QCPItemText *item = _QCPItemTextVtr[i];
|
||||||
|
if (item->objectName().contains(objectName)){
|
||||||
|
|
||||||
|
_QCPItemTextVtr.remove(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = _QCPItemLineVtr.size() - 1; i >= 0; --i) {
|
||||||
|
QCPItemLine *item = _QCPItemLineVtr[i];
|
||||||
|
if (item->objectName().contains(objectName)){
|
||||||
|
_QCPItemLineVtr.remove(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = _QCPGraphVtr.size() - 1; i >= 0; --i) {
|
||||||
|
QCPGraph *item = _QCPGraphVtr[i];
|
||||||
|
if (item->objectName().contains(objectName)){
|
||||||
|
_QCPGraphVtr.remove(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,28 +8,22 @@ const QString OriginStr("origin");
|
|||||||
const QString ConfirmStr("confirm");
|
const QString ConfirmStr("confirm");
|
||||||
const QString TemporaryStr("temporary");
|
const QString TemporaryStr("temporary");
|
||||||
|
|
||||||
const QString Separator("__");
|
const QString Separator("___");
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
enum ItemAttribute{
|
|
||||||
Origin,
|
|
||||||
Last,
|
|
||||||
Temporary
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern QVector<QCPItemText*> _QCPItemTextVtr;
|
extern QVector<QCPItemText*> _QCPItemTextVtr;
|
||||||
extern QVector<QCPItemLine*> _QCPItemLineVtr;
|
extern QVector<QCPItemLine*> _QCPItemLineVtr;
|
||||||
extern QVector<QCPGraph*> _QCPGraphVtr;
|
extern QVector<QCPGraph*> _QCPGraphVtr;
|
||||||
|
|
||||||
void addTemporaryQCPItemText(QCPItemText*);
|
void addTemporaryQCPItemText(QCPItemText*,const QString objectName);
|
||||||
void addTemporaryQCPItemLine(QCPItemLine*);
|
void addTemporaryQCPItemLine(QCPItemLine*,const QString objectName);
|
||||||
void addTemporaryQCPGraph(QCPGraph*);
|
void addTemporaryQCPGraph(QCPGraph*,const QString objectName);
|
||||||
|
|
||||||
void removeItem(QObject* obj);
|
void removeItem(QObject* obj);
|
||||||
|
void removeItemsByObjectName(const QString objectName);
|
||||||
|
|
||||||
void confirm();
|
void confirm();
|
||||||
|
void objectNameModifyConfirm(QObject* obj);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,10 @@
|
|||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
|
#include <qmap.h>
|
||||||
|
|
||||||
#include "printpreviewform.h"
|
#include "printpreviewform.h"
|
||||||
#include "ui_printpreviewform.h"
|
#include "ui_printpreviewform.h"
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
|
#include "logger.h"
|
||||||
|
|
||||||
PrintPreviewForm::PrintPreviewForm(QWidget *parent) :
|
PrintPreviewForm::PrintPreviewForm(QWidget *parent) :
|
||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
@ -90,7 +92,10 @@ void PrintPreviewForm::slotPaintRequested(QPrinter *printer)
|
|||||||
QRect fileInfoRect(frameRect.x(),frameRect.y() + imageRect.height(),
|
QRect fileInfoRect(frameRect.x(),frameRect.y() + imageRect.height(),
|
||||||
frameRect.width(),30);
|
frameRect.width(),30);
|
||||||
painter.drawRect(fileInfoRect);
|
painter.drawRect(fileInfoRect);
|
||||||
painter.drawText(fileInfoRect, Qt::AlignLeft|Qt::AlignVCenter, " Hello, World!");
|
|
||||||
|
QString fileInfoStr = QString(" 设备:差式扫描量热仪 文件名:")
|
||||||
|
+ Global::_curveFileDataVtr.first().fileName;
|
||||||
|
painter.drawText(fileInfoRect, Qt::AlignLeft|Qt::AlignVCenter, fileInfoStr);
|
||||||
|
|
||||||
// Experiment info.
|
// Experiment info.
|
||||||
// Only print the first experiment data.
|
// Only print the first experiment data.
|
||||||
@ -101,7 +106,7 @@ void PrintPreviewForm::slotPaintRequested(QPrinter *printer)
|
|||||||
Global::ExperimentInfo & exInfo = Global::_curveFileDataVtr.first().ei;
|
Global::ExperimentInfo & exInfo = Global::_curveFileDataVtr.first().ei;
|
||||||
|
|
||||||
QString experimentInfoStr = QString(" 样品名称:%1 \n"
|
QString experimentInfoStr = QString(" 样品名称:%1 \n"
|
||||||
" 样品重量:%2 \n"
|
" 样品重量:%2 mg\n"
|
||||||
" 实验日期:%3 \n"
|
" 实验日期:%3 \n"
|
||||||
" 实验人员:%4 \n"
|
" 实验人员:%4 \n"
|
||||||
)
|
)
|
||||||
@ -110,16 +115,56 @@ void PrintPreviewForm::slotPaintRequested(QPrinter *printer)
|
|||||||
.arg(exInfo.date)
|
.arg(exInfo.date)
|
||||||
.arg(exInfo.experimentor);
|
.arg(exInfo.experimentor);
|
||||||
painter.drawText(experimentRect, Qt::AlignLeft|Qt::AlignVCenter, experimentInfoStr);
|
painter.drawText(experimentRect, Qt::AlignLeft|Qt::AlignVCenter, experimentInfoStr);
|
||||||
|
|
||||||
// Phase info.
|
// Phase info.
|
||||||
QRect phaseInfoRect(experimentRect.x() + experimentRect.width(),experimentRect.y(),
|
QRect phaseInfoRect(experimentRect.x() + experimentRect.width(),experimentRect.y(),
|
||||||
frameRect.width() - experimentRect.width(),experimentRect.height());
|
frameRect.width() - experimentRect.width(),experimentRect.height());
|
||||||
|
|
||||||
QVector<Global::PhaseTotalInfo>& phaseTotalVtr = Global::_curveFileDataVtr.first().phaseTotalVtr;
|
QVector<Global::PhaseTotalInfo>& phaseTotalVtr
|
||||||
QVector<Phase> phaseVtr;
|
= Global::_curveFileDataVtr.first().phaseTotalVtr;
|
||||||
|
|
||||||
|
logde<<"phaseTotalVtr size:"<<phaseTotalVtr.size();
|
||||||
|
|
||||||
|
|
||||||
|
QMap<int,Phase> phaseMap;
|
||||||
|
|
||||||
for(Global::PhaseTotalInfo& ptInfo:phaseTotalVtr){
|
for(Global::PhaseTotalInfo& ptInfo:phaseTotalVtr){
|
||||||
if(ptInfo.)
|
phaseMap.insert(ptInfo.phaseIndex,ptInfo.phase);
|
||||||
|
logde<<"cutoff temp:"<<ptInfo.phase.cutoff_temp;
|
||||||
}
|
}
|
||||||
QString phaseInfoStr = QString(" 气氛:%1 ; 扫描速率:%2 ; 持续时间:%3 \n").arg("Jay").arg("20250101");
|
|
||||||
|
QString phaseInfoStr;
|
||||||
|
for (auto it = phaseMap.constBegin(); it != phaseMap.constEnd(); ++it) {
|
||||||
|
logde << "Key:" << it.key() << ", Onoff:" << it.value().onoff;
|
||||||
|
|
||||||
|
if(!it.value().onoff){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString gasName;
|
||||||
|
switch(it.value().gas){
|
||||||
|
case GasType::NC:
|
||||||
|
gasName = "NC";
|
||||||
|
break;
|
||||||
|
case GasType::N2:
|
||||||
|
gasName = "N2";
|
||||||
|
break;
|
||||||
|
case GasType::O2:
|
||||||
|
gasName = "O2";
|
||||||
|
break;
|
||||||
|
default:break;
|
||||||
|
}
|
||||||
|
|
||||||
|
phaseInfoStr.append(QString("阶段:%1 截止温度:%2 扫描速率:%3 恒温时间:%4 气氛:%5 \n")
|
||||||
|
.arg(QString::number(it.key()))
|
||||||
|
.arg(QString::number(it.value().cutoff_temp,'f',3))
|
||||||
|
.arg(QString::number(it.value().temp_flow,'f',3))
|
||||||
|
.arg(QString::number(it.value().constant_temp_time_min,'f',3))
|
||||||
|
.arg(gasName)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
painter.drawText(phaseInfoRect, Qt::AlignLeft|Qt::AlignVCenter, phaseInfoStr);
|
painter.drawText(phaseInfoRect, Qt::AlignLeft|Qt::AlignVCenter, phaseInfoStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user