入射粒子时间集成,修改显示大小问题
This commit is contained in:
parent
209be2b040
commit
364f4e6c1a
|
|
@ -122,6 +122,15 @@ void MeasureAnalysisTreeView::onNodeDoubleClicked(const QModelIndex& index)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
case AnalysisType::ParticleInTimeView: {
|
||||||
|
MeasureAnalysisProjectModel* project_model = _model->GetProjectModel(project_name);
|
||||||
|
if (project_model) {
|
||||||
|
auto file_name = project_model->GetParticleEnergyDataFilename();
|
||||||
|
if ( !file_name.isEmpty() ) {
|
||||||
|
data_files_set[QStringLiteral(u"粒子能量数据")] = file_name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include "MeasureAnalysisDataTableView.h"
|
#include "MeasureAnalysisDataTableView.h"
|
||||||
#include "MeasureAnalysisParticleCountPlotView.h"
|
#include "MeasureAnalysisParticleCountPlotView.h"
|
||||||
|
#include "ParticleInjectTimeAnalysis.h"
|
||||||
|
|
||||||
MeasureAnalysisView *MeasureAnalysisView::NewAnalyzeView(AnalysisType view_type)
|
MeasureAnalysisView *MeasureAnalysisView::NewAnalyzeView(AnalysisType view_type)
|
||||||
{
|
{
|
||||||
|
|
@ -76,7 +77,7 @@ MeasureAnalysisView *MeasureAnalysisView::NewAnalyzeView(AnalysisType view_type)
|
||||||
// new_view->setDeleteOnClose(false);
|
// new_view->setDeleteOnClose(false);
|
||||||
} break;
|
} break;
|
||||||
case AnalysisType::ParticleInTimeView: {
|
case AnalysisType::ParticleInTimeView: {
|
||||||
new_view = new MeasureAnalysisDataTableView;
|
new_view = new ParticleInjectTimeAnalysis;
|
||||||
new_view->setDeleteOnClose(false);
|
new_view->setDeleteOnClose(false);
|
||||||
} break;
|
} break;
|
||||||
case AnalysisType::ParticleTimeDiffView: {
|
case AnalysisType::ParticleTimeDiffView: {
|
||||||
|
|
|
||||||
|
|
@ -6,21 +6,22 @@
|
||||||
#include <QwtPlotCurve>
|
#include <QwtPlotCurve>
|
||||||
#include <QwtPlotMarker>
|
#include <QwtPlotMarker>
|
||||||
#include <QwtPlotZoneItem>
|
#include <QwtPlotZoneItem>
|
||||||
|
#include <QwtPlotCanvas>
|
||||||
|
#include <QwtLegend>
|
||||||
#include <QwtText>
|
#include <QwtText>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <QtMath>
|
#include <QtMath>
|
||||||
#include "CustomQwtPlot.h"
|
#include "CustomQwtPlot.h"
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <GlobalDefine.h>
|
||||||
|
|
||||||
ParticleInjectTimeAnalysis::ParticleInjectTimeAnalysis(QWidget *parent) :
|
ParticleInjectTimeAnalysis::ParticleInjectTimeAnalysis(QWidget *parent) :
|
||||||
MeasureAnalysisView(parent),
|
MeasureAnalysisView(parent),
|
||||||
ui(new Ui::ParticleInjectTimeAnalysis)
|
ui(new Ui::ParticleInjectTimeAnalysis)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
InitUi();
|
InitUi();
|
||||||
// 获取当前可执行文件的路径
|
|
||||||
QString Path = QCoreApplication::applicationDirPath();
|
|
||||||
m_AllData = getParticleInjectTimeData(Path + "/data.csv");
|
|
||||||
setData(m_AllData);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ParticleInjectTimeAnalysis::~ParticleInjectTimeAnalysis()
|
ParticleInjectTimeAnalysis::~ParticleInjectTimeAnalysis()
|
||||||
|
|
@ -35,7 +36,11 @@ void ParticleInjectTimeAnalysis::InitViewWorkspace(const QString &project_name)
|
||||||
|
|
||||||
void ParticleInjectTimeAnalysis::SetAnalyzeDataFilename(const QMap<QString, QVariant> &data_files_set)
|
void ParticleInjectTimeAnalysis::SetAnalyzeDataFilename(const QMap<QString, QVariant> &data_files_set)
|
||||||
{
|
{
|
||||||
|
if(!data_files_set.isEmpty())
|
||||||
|
{
|
||||||
|
m_AllData = getParticleInjectTimeData(data_files_set.first().toString());
|
||||||
|
setData(m_AllData);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ParticleInjectTimeAnalysis::setData(QVector<ParticleInjectTime> data)
|
void ParticleInjectTimeAnalysis::setData(QVector<ParticleInjectTime> data)
|
||||||
|
|
@ -61,16 +66,16 @@ void ParticleInjectTimeAnalysis::setData(QVector<ParticleInjectTime> data)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 创建曲线并设置数据
|
// 创建曲线并设置数据
|
||||||
QwtPlotCurve *curve = new QwtPlotCurve("正弦曲线");
|
QwtPlotCurve *curve = new QwtPlotCurve();
|
||||||
curve->setSamples(x, y);
|
curve->setSamples(x, y);
|
||||||
|
|
||||||
// 将曲线添加到 CustomQwtPlot 中(会自动分配颜色)
|
// 将曲线添加到 CustomQwtPlot 中(会自动分配颜色)
|
||||||
plot->AddCurve(curve);
|
plot->AddCurve(curve);
|
||||||
// 设置坐标轴范围和标题
|
// 设置坐标轴范围和标题
|
||||||
plot->setAxisScale(QwtPlot::xBottom, 0, x.last());
|
// plot->setAxisScale(QwtPlot::xBottom, 0, x.last());
|
||||||
plot->setAxisScale(QwtPlot::yLeft,minValue , maxValue);
|
// plot->setAxisScale(QwtPlot::yLeft,minValue , maxValue);
|
||||||
plot->setAxisTitle(QwtPlot::xBottom, "粒子序号");
|
plot->setAxisTitle(QwtPlot::xBottom, "粒子序号");
|
||||||
plot->setAxisTitle(QwtPlot::yLeft, "粒子时间");
|
plot->setAxisTitle(QwtPlot::yLeft, "粒子时间");
|
||||||
|
LOG_INFO(QStringLiteral(u"%1数据读取完毕.").arg(this->GetViewName()));
|
||||||
|
|
||||||
// 刷新绘图
|
// 刷新绘图
|
||||||
plot->replot();
|
plot->replot();
|
||||||
|
|
@ -129,6 +134,7 @@ QVector<ParticleInjectTime> ParticleInjectTimeAnalysis::getParticleInjectTimeDat
|
||||||
}
|
}
|
||||||
|
|
||||||
file.close();
|
file.close();
|
||||||
|
|
||||||
return records;
|
return records;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -136,5 +142,29 @@ void ParticleInjectTimeAnalysis::InitUi()
|
||||||
{
|
{
|
||||||
plot = new CustomQwtPlot();
|
plot = new CustomQwtPlot();
|
||||||
plot->SetXaxisDragScale(true);
|
plot->SetXaxisDragScale(true);
|
||||||
ui->verticalLayout->addWidget(plot);
|
setupPlot();
|
||||||
|
ui->verticalLayout_2->addWidget(plot);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ParticleInjectTimeAnalysis::setupPlot()
|
||||||
|
{
|
||||||
|
plot->setCanvasBackground(Qt::white);
|
||||||
|
QwtPlotCanvas* canvas = qobject_cast<QwtPlotCanvas*>(plot->canvas());
|
||||||
|
canvas->setFrameStyle(QFrame::NoFrame);
|
||||||
|
|
||||||
|
plot->setAxisTitle(QwtPlot::xBottom, QString(QStringLiteral(u"道址")));
|
||||||
|
plot->setAxisTitle(QwtPlot::yLeft, QString(QStringLiteral(u"计数")));
|
||||||
|
// set axis auto scale
|
||||||
|
plot->setAxisAutoScale(QwtPlot::xBottom, true);
|
||||||
|
plot->setAxisAutoScale(QwtPlot::yLeft, true);
|
||||||
|
// 启用网格线
|
||||||
|
plot->enableAxis(QwtPlot::xBottom);
|
||||||
|
plot->enableAxis(QwtPlot::yLeft);
|
||||||
|
|
||||||
|
// 设置QWT图例
|
||||||
|
QwtLegend* legend = new QwtLegend();
|
||||||
|
legend->setDefaultItemMode(QwtLegendData::ReadOnly);
|
||||||
|
plot->insertLegend(legend, QwtPlot::RightLegend);
|
||||||
|
|
||||||
|
plot->SetXaxisDragScale(true);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@ public:
|
||||||
QVector<ParticleInjectTime> getParticleInjectTimeData(QString path);
|
QVector<ParticleInjectTime> getParticleInjectTimeData(QString path);
|
||||||
private:
|
private:
|
||||||
void InitUi();
|
void InitUi();
|
||||||
|
void setupPlot();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::ParticleInjectTimeAnalysis *ui;
|
Ui::ParticleInjectTimeAnalysis *ui;
|
||||||
|
|
|
||||||
|
|
@ -13,10 +13,7 @@
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>ParticleInjectTimeAnalysis</string>
|
<string>ParticleInjectTimeAnalysis</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,100">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<property name="spacing">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
|
|
@ -124,7 +121,16 @@
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QWidget" name="widget" native="true">
|
<widget class="QWidget" name="widget" native="true">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true"/>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
|
|
@ -138,7 +144,7 @@
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout"/>
|
<layout class="QVBoxLayout" name="verticalLayout_2"/>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
|
||||||
|
|
@ -31,11 +31,11 @@ MOC_DIR = $${BUILD_MOC}/$${TARGET}/moc
|
||||||
UI_DIR = $${BUILD_UI}/$${TARGET}/ui
|
UI_DIR = $${BUILD_UI}/$${TARGET}/ui
|
||||||
|
|
||||||
INCLUDEPATH += \
|
INCLUDEPATH += \
|
||||||
$${PWD}/MeasureAnalysisParticleCountPlotView
|
$${PWD}/MeasureAnalysisParticleCountPlotView \
|
||||||
$${PWD}/ParticleInjectTimeView
|
$${PWD}/ParticleInjectTimeView
|
||||||
|
|
||||||
DEPENDPATH += \
|
DEPENDPATH += \
|
||||||
$${PWD}/MeasureAnalysisParticleCountPlotView
|
$${PWD}/MeasureAnalysisParticleCountPlotView \
|
||||||
$${PWD}/ParticleInjectTimeView
|
$${PWD}/ParticleInjectTimeView
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user