添加峰拟合视图初步实现;优化其他一直BUG;

This commit is contained in:
徐海 2026-03-26 19:07:49 +08:00
parent 7219460e45
commit a3bfaa3333
8 changed files with 42 additions and 24 deletions

View File

@ -54,10 +54,12 @@ QList<QwtPlotCurve *> CustomQwtPlot::GetCurveList() const
return _curves.values();
}
void CustomQwtPlot::AddCurve(QwtPlotCurve *curve)
void CustomQwtPlot::AddCurve(QwtPlotCurve *curve, bool auto_color)
{
if (curve) {
if ( auto_color ) {
curve->setPen(QPen(getDistinctColorForManyCurves(_curves.count()), 1));
}
curve->setZ(0);
curve->attach(this);
_curves[curve->title().text()] = curve;
@ -212,14 +214,17 @@ void CustomQwtPlot::showEvent(QShowEvent *event)
{
Q_UNUSED(event);
this->updateAxes();
double x_min = this->axisScaleDiv(QwtPlot::xBottom).lowerBound();
if ((0 == this->_init_x_max) && (0 == this->_init_y_max)) {
// double x_min = this->axisScaleDiv(QwtPlot::xBottom).lowerBound();
double x_max = this->axisScaleDiv(QwtPlot::xBottom).upperBound();
double y_min = this->axisScaleDiv(QwtPlot::yLeft).lowerBound();
double y_max = this->axisScaleDiv(QwtPlot::yLeft).upperBound();
this->_init_x_min = x_min;
this->_init_x_min = 0;
this->_init_x_max = x_max;
this->_init_y_min = y_min;
this->_init_y_max = y_max;
this->setAxisScale(QwtPlot::xBottom, 0, x_max);
}
}
CustomQwtPlotXaxisPanner::CustomQwtPlotXaxisPanner(QWidget *canvas)

View File

@ -24,7 +24,7 @@ public:
QwtPlotCurve* GetCurve(const QString& curve_name);
QList<QwtPlotCurve*> GetCurveList() const;
void AddCurve(QwtPlotCurve* curve);
void AddCurve(QwtPlotCurve* curve, bool auto_color = true);
QwtPlotMarker* GetMarker(const QString& marker_name, const QString& postion);
QList<QwtPlotMarker*> GetMarkerList() const;
@ -42,8 +42,8 @@ protected:
bool eventFilter(QObject *obj, QEvent *event) override;
virtual void showEvent(QShowEvent *event) override;
private:
double _init_x_min = 0, _init_x_max = 10;
double _init_y_min = 0, _init_y_max = 10;
double _init_x_min = 0, _init_x_max = 0;
double _init_y_min = 0, _init_y_max = 0;
bool _is_dragging = false;
QPoint _last_pos;
std::function<bool(QObject*, QEvent*)> _event_filter_func = nullptr;

View File

@ -57,8 +57,6 @@ void EnergyCountPlotView::SetAnalyzeDataFilename(const QMap<QString, QVariant> &
void EnergyCountPlotView::setupPlot()
{
_plot->setTitle(QString(QStringLiteral(u"能量计数谱")));
_plot->setCanvasBackground(Qt::white);
QwtPlotCanvas* canvas = qobject_cast<QwtPlotCanvas*>(_plot->canvas());
canvas->setFrameStyle(QFrame::NoFrame);

View File

@ -120,10 +120,10 @@ void MainWindow::initMainWindow()
MeasureAnalysisHistoryForm* measure_analysis_history_form = new MeasureAnalysisHistoryForm;
CDockWidget* central_dock_widget = _dock_manager->createDockWidget(QStringLiteral(u"测量分析记录"));
central_dock_widget->setWidget(measure_analysis_history_form);
central_dock_widget->setFeature(ads::CDockWidget::AllDockWidgetFeatures, true);
// central_dock_widget->setFeature(ads::CDockWidget::AllDockWidgetFeatures, true);
_central_dock_area = _dock_manager->setCentralWidget(central_dock_widget);
_action_central_dock_widget = central_dock_widget->toggleViewAction();
_action_central_dock_widget->setCheckable(false);
// _action_central_dock_widget->setCheckable(false);
ui->menu_view->addAction(_action_central_dock_widget);
// 构建测量分析工程树视图

View File

@ -187,6 +187,15 @@ void MeasureAnalysisTreeView::onNodeDoubleClicked(const QModelIndex& index)
}
}
} break;
case AnalysisType::EnergyPeakFitView: {
MeasureAnalysisProjectModel* project_model = _model->GetProjectModel(project_name);
if (project_model) {
auto all_ch_energy_count_file_name = project_model->GetAllChannelEnergyTotalCountDataFilename();
if (!all_ch_energy_count_file_name.isEmpty()) {
data_files_set[QStringLiteral(u"测量能谱")] = all_ch_energy_count_file_name;
}
}
} break;
case AnalysisType::ParticleInTimeView: {
MeasureAnalysisProjectModel* project_model = _model->GetProjectModel(project_name);
if (project_model) {

View File

@ -7,6 +7,8 @@
#include "EnergyCountPlotView.h"
#include "ParticleTimePoorView.h"
#include "ConformityAnalysis.h"
#include "EnergyCountPeakFitView.h"
MeasureAnalysisView *MeasureAnalysisView::NewAnalyzeView(AnalysisType view_type)
{
MeasureAnalysisView* new_view = nullptr;
@ -72,8 +74,8 @@ MeasureAnalysisView *MeasureAnalysisView::NewAnalyzeView(AnalysisType view_type)
new_view->setDeleteOnClose(false);
} break;
case AnalysisType::EnergyPeakFitView: {
// new_view = new MeasureAnalysisDataTableView;
// new_view->setDeleteOnClose(false);
new_view = new EnergyCountPeakFitView;
new_view->setDeleteOnClose(false);
} break;
case AnalysisType::NuclideAnalysisView: {
// new_view = new MeasureAnalysisDataTableView;

View File

@ -152,8 +152,6 @@ void ParticleCountPlotView::setupMenu()
void ParticleCountPlotView::setupPlot()
{
_plot->setTitle(QString(QStringLiteral(u"粒子计数谱")));
_plot->setCanvasBackground(Qt::white);
QwtPlotCanvas* canvas = qobject_cast<QwtPlotCanvas*>(_plot->canvas());
canvas->setFrameStyle(QFrame::NoFrame);

View File

@ -37,22 +37,25 @@ INCLUDEPATH += \
$${PWD}/EnergyCountPlotView \
$${PWD}/CountRateAnalysisView \
$${PWD}/ParticleTimePoorView \
$${PWD}/ThreeDimensionalConformityAnalysisView
$${PWD}/ThreeDimensionalConformityAnalysisView \
$${PWD}/EnergyCountPeakFitView
DEPENDPATH += \
$${PWD}/MeasureAnalysisParticleCountPlotView \
$${PWD}/ParticleCountPlotView \
$${PWD}/ParticleInjectTimeView\
$${PWD}/ParticleInjectTimeView \
$${PWD}/EnergyCountPlotView \
$${PWD}/CountRateAnalysisView \
$${PWD}/ParticleTimePoorView \
$${PWD}/ThreeDimensionalConformityAnalysisView
$${PWD}/ThreeDimensionalConformityAnalysisView \
$${PWD}/EnergyCountPeakFitView
SOURCES += \
AboutDlg.cpp \
CountRateAnalysisView/CountRateAnalysisView.cpp \
CustomQwtPlot.cpp \
DataProcessWorkPool.cpp \
EnergyCountPeakFitView/EnergyCountPeakFitView.cpp \
EnergyCountPlotView/EnergyCountPlotView.cpp \
EnergyScaleDataModel.cpp \
EnergyScaleForm.cpp \
@ -77,6 +80,7 @@ SOURCES += \
ThreeDimensionalConformityAnalysisView/DetectorStatusSummary.cpp \
ThreeDimensionalConformityAnalysisView/ParticleDataStatistics.cpp \
ThreeDimensionalConformityAnalysisView/ThreeDDisplay.cpp \
EnergyCountPeakFitView/EnergyCountPeakFitView.cpp \
main.cpp
HEADERS += \
@ -85,6 +89,7 @@ HEADERS += \
CountRateAnalysisView/CountRateAnalysisView.h \
CustomQwtPlot.h \
DataProcessWorkPool.h \
EnergyCountPeakFitView/EnergyCountPeakFitView.h \
EnergyCountPlotView/EnergyCountPlotView.h \
EnergyScaleDataModel.h \
EnergyScaleForm.h \
@ -111,6 +116,7 @@ HEADERS += \
ThreeDimensionalConformityAnalysisView/DetectorStatusSummary.h \
ThreeDimensionalConformityAnalysisView/ParticleDataStatistics.h \
ThreeDimensionalConformityAnalysisView/ThreeDDisplay.h \
EnergyCountPeakFitView/EnergyCountPeakFitView.h
FORMS += \