2025-03-05 09:33:46 +00:00
|
|
|
#ifndef CENTRALWIDGET_H
|
|
|
|
|
#define CENTRALWIDGET_H
|
|
|
|
|
|
|
|
|
|
#include <QWidget>
|
2025-03-21 09:28:36 +00:00
|
|
|
#include <QMenu>
|
2025-03-12 09:29:52 +00:00
|
|
|
|
2025-03-06 09:31:55 +00:00
|
|
|
#include "qcustomplot.h"
|
2025-03-12 09:29:52 +00:00
|
|
|
#include "protocol.h"
|
|
|
|
|
#include "global.h"
|
2025-04-10 07:20:57 +00:00
|
|
|
#include "eventhandler.h"
|
2025-03-26 09:30:02 +00:00
|
|
|
#include "filemanager.h"
|
2025-04-21 09:31:38 +00:00
|
|
|
#include "pointcalculate.h"
|
2025-04-25 09:20:33 +00:00
|
|
|
#include "localcustomplot.h"
|
2025-05-14 09:30:52 +00:00
|
|
|
#include "analysisoperationrecorder.h"
|
2025-05-16 09:01:40 +00:00
|
|
|
#include "global.h"
|
|
|
|
|
|
2025-03-05 09:33:46 +00:00
|
|
|
class CentralWidget:public QWidget
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
2025-05-16 09:28:45 +00:00
|
|
|
using AnalysisOperation = AnalysisOperationRecorder::AnalysisOperation;
|
|
|
|
|
using AnalysisMode = AnalysisOperationRecorder::AnalysisMode;
|
2025-05-14 09:30:52 +00:00
|
|
|
|
2025-03-05 09:33:46 +00:00
|
|
|
CentralWidget(QWidget *parent = nullptr);
|
2025-03-19 03:19:52 +00:00
|
|
|
~CentralWidget();
|
2025-03-20 09:28:22 +00:00
|
|
|
|
2025-05-16 09:28:45 +00:00
|
|
|
void setAnalysisMode(const AnalysisMode);
|
2025-03-25 08:45:16 +00:00
|
|
|
void clearAllData();
|
2025-04-10 09:33:38 +00:00
|
|
|
|
|
|
|
|
EventHandler* getEvnetHandler(){return _eventHandler;}
|
2025-04-25 09:20:33 +00:00
|
|
|
|
|
|
|
|
QPixmap getPixMap();
|
2025-04-28 09:31:29 +00:00
|
|
|
|
|
|
|
|
enum AxisMode{
|
|
|
|
|
SingleY,
|
|
|
|
|
DoubleY
|
|
|
|
|
};
|
|
|
|
|
void switchAxisMode();
|
2025-04-29 09:29:14 +00:00
|
|
|
struct AxisInfo{
|
|
|
|
|
bool visiable;
|
|
|
|
|
double lower;
|
|
|
|
|
double upper;
|
|
|
|
|
};
|
2025-03-21 09:28:36 +00:00
|
|
|
signals:
|
|
|
|
|
void sigContextMenuShow(const QPoint);
|
|
|
|
|
void sigSendLineXCoord(const int,const double);
|
2025-04-01 09:25:12 +00:00
|
|
|
void sigRightDockWidgetHide();
|
2025-04-29 09:29:14 +00:00
|
|
|
|
|
|
|
|
void sigGetAxisInfoWithData(const QVector<AxisInfo>);
|
2025-03-12 09:29:52 +00:00
|
|
|
public slots:
|
2025-04-23 07:33:39 +00:00
|
|
|
// experiment
|
|
|
|
|
void slotAxisModify(const float temp);
|
2025-03-12 09:29:52 +00:00
|
|
|
void slotModeModify(const Global::Mode);
|
2025-03-19 07:19:45 +00:00
|
|
|
void slotRecvCommonData(const CommonData&);
|
|
|
|
|
void slotRecvAnalysisFileName(const QString&);
|
2025-04-10 09:33:38 +00:00
|
|
|
|
2025-03-21 09:28:36 +00:00
|
|
|
//analysis setting
|
|
|
|
|
void slotAnalysisSettingApply();
|
|
|
|
|
void slotAnalysisSettingConfirm();
|
2025-03-24 09:30:42 +00:00
|
|
|
void slotAnalysisSettingUndo();
|
|
|
|
|
void slotAnalysisSettingCancel();
|
2025-04-24 08:41:20 +00:00
|
|
|
|
|
|
|
|
void slotAnalysisSettingLineXPoint(const int index,const double);
|
2025-04-27 07:27:07 +00:00
|
|
|
|
|
|
|
|
void slotDrawCustomText(const QString);
|
2025-05-16 09:01:40 +00:00
|
|
|
|
|
|
|
|
void slotDelCurve(QCPCurve*);
|
2025-04-29 09:29:14 +00:00
|
|
|
//
|
|
|
|
|
void slotGetAxisInfo();
|
|
|
|
|
void slotSetAxisSettings(const QVector<double>);
|
2025-05-16 09:01:40 +00:00
|
|
|
|
2025-03-06 09:31:55 +00:00
|
|
|
protected:
|
|
|
|
|
void timerEvent(QTimerEvent* event);
|
2025-03-12 09:29:52 +00:00
|
|
|
private:
|
2025-05-09 09:28:39 +00:00
|
|
|
void glassTransitionHandle(const double x1,const double x2);
|
2025-04-21 09:31:38 +00:00
|
|
|
void quadraticFit(const QVector<QPointF>& points, double& a, double& b, double& c);
|
|
|
|
|
double derivativeAt(const double a, const double b, const double x);
|
2025-05-16 09:01:40 +00:00
|
|
|
PointCalculate::Line calculateLinearRegression(const QVector<double>& x,
|
|
|
|
|
const QVector<double>& y);
|
2025-04-21 09:31:38 +00:00
|
|
|
|
2025-05-09 09:28:39 +00:00
|
|
|
QPointF OnsetTemperaturePointHandle(const double x1,const double x2);
|
|
|
|
|
|
2025-03-21 09:28:36 +00:00
|
|
|
void setEventHandlerEnable(const bool);
|
2025-04-23 09:25:38 +00:00
|
|
|
QPointF getTheCoordinatesOfTheTextBox(const QPointF point);
|
2025-03-26 09:30:02 +00:00
|
|
|
void drawText(const QPointF,const QString);
|
2025-03-25 08:45:16 +00:00
|
|
|
void fillGraph(const double x1,const double x2);
|
2025-04-08 09:30:33 +00:00
|
|
|
|
2025-04-01 09:25:12 +00:00
|
|
|
enum ClearDataMode{
|
|
|
|
|
All,
|
|
|
|
|
Undo
|
|
|
|
|
};
|
|
|
|
|
void clearData(const ClearDataMode);
|
2025-05-09 09:28:39 +00:00
|
|
|
|
2025-05-19 05:58:34 +00:00
|
|
|
void loadAnalysisData(const AnalysisMode mode,const double x1,const double x2);
|
2025-03-06 09:31:55 +00:00
|
|
|
private:
|
2025-05-16 09:01:40 +00:00
|
|
|
AnalysisOperationRecorder::AnalysisMode _analysisMode;
|
2025-04-25 09:20:33 +00:00
|
|
|
LocalCustomPlot *_customPlot;
|
2025-04-09 09:30:32 +00:00
|
|
|
QCPCurve *_currentCurve;
|
2025-04-10 07:20:57 +00:00
|
|
|
EventHandler* _eventHandler;
|
2025-03-20 09:28:22 +00:00
|
|
|
QCPItemStraightLine *_line1,*_line2;
|
2025-04-03 09:24:29 +00:00
|
|
|
QVector<QCPItemStraightLine*> _lineVtr;
|
2025-04-28 09:31:29 +00:00
|
|
|
AxisMode _axisMode;
|
2025-04-29 09:29:14 +00:00
|
|
|
QVector<QString> _analysisFilePathVtr;
|
2025-05-09 09:28:39 +00:00
|
|
|
|
|
|
|
|
double _x1Record;
|
|
|
|
|
double _x2Record;
|
2025-03-05 09:33:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif // CENTRALWIDGET_H
|