修改峰拟合分析匹配不上框问题,新增峰拟合结果序号,修改新增拟合曲线时峰拟合记录结果不显示问题
This commit is contained in:
parent
9b383103be
commit
8f9586ab89
File diff suppressed because it is too large
Load Diff
|
|
@ -6,11 +6,11 @@
|
|||
#include <QJsonArray>
|
||||
#include <QJsonObject>
|
||||
#include <QObject>
|
||||
#include <QRubberBand> // 新增
|
||||
#include <QRubberBand>
|
||||
#include <QWidget>
|
||||
#include <QwtPickerDragRectMachine>
|
||||
#include <QwtPlotPicker>
|
||||
#include <qwt_plot_shapeitem.h> // 新增
|
||||
#include <qwt_plot_shapeitem.h>
|
||||
|
||||
#include "DataCalcProcess/AdaptiveSimpsonIntegrate.h"
|
||||
#include "DataCalcProcess/FindPeaksBySvd.h"
|
||||
|
|
@ -38,9 +38,10 @@ struct FitCurveData {
|
|||
double xMin; // 曲线X范围最小值
|
||||
double xMax; // 曲线X范围最大值
|
||||
QRectF selectionRect; // 关联的框选区域
|
||||
|
||||
double fwhm; // 半高宽
|
||||
double area; // 峰面积
|
||||
int selectionIndex; // 框选区域在_selectionRectItems中的索引
|
||||
int curveStartIndex; // 拟合曲线在_fitCurves中的起始索引(每条对应2条曲线)
|
||||
};
|
||||
|
||||
struct PeakFitHistoryItem {
|
||||
|
|
@ -94,24 +95,27 @@ private:
|
|||
|
||||
void loadHistoryFromFile();
|
||||
void saveHistoryToFile();
|
||||
void saveCurrentFitToHistory(); // 保存当前拟合结果
|
||||
void displayFitFromHistory(const PeakFitHistoryItem& item); // 显示历史拟合曲线
|
||||
|
||||
int saveCurrentFitToHistory(const QRectF& selectionRect);
|
||||
// 处理鼠标悬停检测
|
||||
void updateHoverState(const QPoint& mousePos);
|
||||
// 显示选中的曲线
|
||||
void displaySelectedCurves(const QList<FitCurveData>& curves, const QList<DisplayedCurveRef>& refs);
|
||||
//检查指定历史曲线是否当前正在显示
|
||||
bool isHistoryCurveDisplayed(int historyIndex, int curveIndex) const;
|
||||
|
||||
private slots:
|
||||
void onActionCurveShowSetting();
|
||||
void onActionPlotConfigure();
|
||||
void clearAllSelectionRects();
|
||||
void clearFitCurves(); // 清除所有拟合曲线
|
||||
void onActionSaveCurrentFit();
|
||||
void onActionShowFitHistory();
|
||||
void onActionDeleteHoveredRect();
|
||||
// 重新拟合当前悬停的框选区域
|
||||
void onActionRefitCurrentRect();
|
||||
|
||||
void onNewFitResultAdded(); // 新拟合结果同步刷新槽
|
||||
void onHistoryDlgClosed(); // 历史对话框关闭清理槽
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject* watched, QEvent* event) override; // 事件过滤器
|
||||
|
||||
|
|
@ -119,15 +123,16 @@ private:
|
|||
void startSelection(const QPoint& pos);
|
||||
void updateSelection(const QPoint& pos);
|
||||
void finishSelection();
|
||||
void addSelectionRect(const QRectF& plotRect);
|
||||
void addSelectionRect(const QRectF& plotRect,int index);
|
||||
void fadeSelectionRectBorders();
|
||||
|
||||
QList<PeakFitResult> performPeakFitting(const QVector<double>& x, const QVector<double>& y /*, const arma::vec* userP0 = nullptr*/);
|
||||
// 根据拟合参数生成曲线
|
||||
QwtPlotCurve* createFitCurve(const PeakFitResult& result, double xMin, double xMax, const QString& name);
|
||||
|
||||
QList<QwtPlotCurve*> createFitCurve(const PeakFitResult& result, arma::vec xVec);
|
||||
|
||||
signals:
|
||||
void newFitResultAdded();
|
||||
|
||||
private:
|
||||
CustomQwtPlot* _plot = nullptr;
|
||||
QMenu* _menu = nullptr;
|
||||
|
|
@ -146,7 +151,6 @@ private:
|
|||
|
||||
QString _historyFilePath;
|
||||
|
||||
// [NEW] 最近一次拟合结果(用于手动保存)
|
||||
PeakFitResult _lastFitResult;
|
||||
arma::vec _lastFitParams; // 6个拟合参数 (A, delt, H, W, C, P)
|
||||
double _lastXMin = 0.0, _lastXMax = 0.0;
|
||||
|
|
@ -160,6 +164,7 @@ private:
|
|||
// 当前悬停的框选区域
|
||||
PlotRectItem* _hoveredRectItem = nullptr;
|
||||
QList<DisplayedCurveRef> _displayedHistoryCurves;
|
||||
QDialog* _historyDlg = nullptr; // 跟踪当前打开的峰拟合结果对话框
|
||||
};
|
||||
|
||||
#endif // ENERGYCOUNTPEAKFITVIEW_H
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user