完成创建分析视图的框架调整
This commit is contained in:
parent
f970d7f43e
commit
017d77ed84
|
|
@ -140,38 +140,35 @@ void MainWindow::initAction()
|
|||
{
|
||||
auto new_measurement_analysis_handler = [this]() {
|
||||
NewMeasureAnalysisDlg new_measure_analysis_dlg;
|
||||
new_measure_analysis_dlg.exec();
|
||||
/*
|
||||
// new_measure_analysis_dlg.exec();
|
||||
if (QDialog::Accepted == new_measure_analysis_dlg.exec()) {
|
||||
auto project_model = ProjectList::Instance()->GetCurrentProjectModel();
|
||||
// this->_tree_measure_analysis->AddProjectModel(project_model);
|
||||
// if (project_model->GetIsMeasureComplete()) {
|
||||
// const QString& project_name = project_model->GetProjectName();
|
||||
ProjectList* project_list_model = ProjectList::Instance();
|
||||
auto project_model = project_list_model->GetCurrentProjectModel();
|
||||
if (project_model->GetIsMeasureComplete()) {
|
||||
const QString& project_name = project_model->GetProjectName();
|
||||
|
||||
//
|
||||
// // const QString& result_data_dir = QDir(project_model->GetProjectDir()).filePath("EveryChannelParticleData");
|
||||
// // auto separate_task = new DataProcessWorkPool::EveryChannelParticleDataSeparateTask;
|
||||
// // separate_task->SetAllChannelParticleDataFilename(project_model->GetAllChannelParticleDataFilename());
|
||||
// // separate_task->SetResultDataDir(result_data_dir);
|
||||
// // separate_task->SetFinishedNotifier(this->_tree_measure_analysis, "onFinishedSeparateEveryChannelParticleData", project_name);
|
||||
// // separate_task->StartTask();
|
||||
//
|
||||
// const QString& result_data_dir = QDir(project_model->GetProjectDir()).filePath("EveryChannelParticleData");
|
||||
// auto separate_task = new DataProcessWorkPool::EveryChannelParticleDataSeparateTask;
|
||||
// separate_task->SetAllChannelParticleDataFilename(project_model->GetAllChannelParticleDataFilename());
|
||||
// separate_task->SetResultDataDir(result_data_dir);
|
||||
// separate_task->SetFinishedNotifier(this->_tree_measure_analysis, "onFinishedSeparateEveryChannelParticleData", project_name);
|
||||
// separate_task->StartTask();
|
||||
|
||||
// auto separate_task = new DataProcessWorkPool::ParticleDataSortTask;
|
||||
// separate_task->SetAllChannelParticleDataFilename(project_model->GetAllChannelParticleDataFilename());
|
||||
// separate_task->SetSortedResultDir(project_model->GetProjectDir());
|
||||
// separate_task->StartTask();
|
||||
// auto separate_task = new DataProcessWorkPool::ParticleDataSortTask;
|
||||
// separate_task->SetAllChannelParticleDataFilename(project_model->GetAllChannelParticleDataFilename());
|
||||
// separate_task->SetSortedResultDir(project_model->GetProjectDir());
|
||||
// separate_task->StartTask();
|
||||
|
||||
// const QString& all_ch_count_dir = project_model->GetProjectDir();
|
||||
// const QString& every_ch_count_dir = QDir(project_model->GetProjectDir()).filePath("EveryChannelParticleCountData");
|
||||
// auto count_task = new DataProcessWorkPool::EveryChannelParticleCountDataTask;
|
||||
// count_task->SetAllChannelParticleDataFilename(project_model->GetAllChannelParticleDataFilename());
|
||||
// count_task->SetAllChannelCountResultDir(all_ch_count_dir);
|
||||
// count_task->SetEveryChannelCountResultDir(every_ch_count_dir);
|
||||
// count_task->SetFinishedNotifier(this->_tree_measure_analysis, "onFinishedParticleCountData", project_name);
|
||||
// count_task->StartTask();
|
||||
const QString& all_ch_count_dir = project_model->GetProjectDir();
|
||||
const QString& every_ch_count_dir = QDir(project_model->GetProjectDir()).filePath(QStringLiteral(u"通道道址计数"));
|
||||
auto count_task = new DataProcessWorkPool::EveryChannelParticleCountDataTask;
|
||||
count_task->SetAllChannelParticleDataFilename(project_model->GetAllChannelParticleDataFilename());
|
||||
count_task->SetAllChannelCountResultDir(all_ch_count_dir);
|
||||
count_task->SetEveryChannelCountResultDir(every_ch_count_dir);
|
||||
count_task->SetFinishedNotifier(project_list_model, "onChannelAddressCountProcessFinished", project_name);
|
||||
count_task->StartTask();
|
||||
}
|
||||
}
|
||||
*/
|
||||
};
|
||||
|
||||
connect(ui->action_new_measurement_analysis, &QAction::triggered, this, new_measurement_analysis_handler);
|
||||
|
|
@ -203,8 +200,7 @@ void MainWindow::initAction()
|
|||
about_dlg.exec();
|
||||
});
|
||||
|
||||
/*
|
||||
connect(_tree_measure_analysis, &MeasureAnalysisTree::TreeWidget::currentItemViewWidget, [this](MeasureAnalysisView* view) {
|
||||
connect(_tree_measure_analysis, &MeasureAnalysisTreeView::currentItemView, [this](MeasureAnalysisView* view) {
|
||||
if (view && this->_dock_manager) {
|
||||
bool view_exist = false;
|
||||
QList<CDockWidget*> dock_widget_list = this->_dock_manager->dockWidgetsMap().values();
|
||||
|
|
@ -221,38 +217,31 @@ void MainWindow::initAction()
|
|||
if ( !view_exist ) {
|
||||
ads::CDockWidget* dock_widget = new ads::CDockWidget(view->GetViewName());
|
||||
auto central_area = _dock_manager->centralWidget()->dockAreaWidget();
|
||||
CDockAreaWidget* dock_area = _dock_manager->addDockWidget(ads::DockWidgetArea::CenterDockWidgetArea, dock_widget, central_area);
|
||||
dock_widget->hide();
|
||||
_dock_manager->addDockWidget(ads::DockWidgetArea::CenterDockWidgetArea, dock_widget, central_area);
|
||||
|
||||
dock_widget->setWidget(view);
|
||||
dock_widget->setMinimumSizeHintMode(ads::CDockWidget::MinimumSizeHintFromContentMinimumSize);
|
||||
if (view->GetAnalyzeViewType() == MeasureAnalysisViewType::DataTable) {
|
||||
if (view->IsDeleteOnClose()) {
|
||||
dock_widget->setFeatures(dock_widget->features() | ads::CDockWidget::DockWidgetDeleteOnClose);
|
||||
_menu_view_data_table_list->addAction(dock_widget->toggleViewAction());
|
||||
} else {
|
||||
// dock_widget->setFeatures(dock_widget->features() | ads::CDockWidget::CustomCloseHandling);
|
||||
dock_widget->setProperty("TakeWidget", true);
|
||||
// connect(dock_widget, &CDockWidget::closeRequested, [dock_widget](){
|
||||
// dock_widget->takeWidget();
|
||||
// dock_widget->deleteDockWidget();
|
||||
// });
|
||||
dock_widget->setProperty("TakeWidget", true);
|
||||
}
|
||||
if ( view->GetViewType() == MeasureAnalysisView::DataTable ) {
|
||||
_menu_view_data_table_list->addAction(dock_widget->toggleViewAction());
|
||||
}
|
||||
if ( view->GetViewType() == MeasureAnalysisView::PlotFrame ) {
|
||||
_menu_view_analysis_view_list->addAction(dock_widget->toggleViewAction());
|
||||
}
|
||||
|
||||
dock_widget->show();
|
||||
central_area->update();
|
||||
central_area->updateGeometry();
|
||||
dock_area->update();
|
||||
dock_area->updateGeometry();
|
||||
dock_widget->update();
|
||||
dock_widget->updateGeometry();
|
||||
view->update();
|
||||
view->updateGeometry();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
connect(_tree_measure_analysis, &MeasureAnalysisTree::TreeWidget::removeItemViewFromStack, [this](MeasureAnalysisView* view) {
|
||||
connect(_tree_measure_analysis, &MeasureAnalysisTreeView::removeItemView, [this](MeasureAnalysisView* view) {
|
||||
if (this->_dock_manager) {
|
||||
QList<CDockWidget*> dock_widget_list = this->_dock_manager->dockWidgetsMap().values();
|
||||
for (auto it = dock_widget_list.constBegin(); it != dock_widget_list.constEnd(); ++it) {
|
||||
|
|
@ -266,7 +255,7 @@ void MainWindow::initAction()
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
connect(_tree_measure_analysis, &MeasureAnalysisTree::TreeWidget::newMeasureAnalysisProject, new_measurement_analysis_handler);
|
||||
*/
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ MeasureAnalysisDataTableView::MeasureAnalysisDataTableView(QWidget* parent)
|
|||
, _block_size(100)
|
||||
, _buffer_size(50)
|
||||
{
|
||||
this->setAnalyzeViewType(MeasureAnalysisViewType::DataTable);
|
||||
this->setViewType(DataTable);
|
||||
QHBoxLayout* layout = new QHBoxLayout(this);
|
||||
// 创建表格视图
|
||||
_tableView = new VirtualTableView(this);
|
||||
|
|
|
|||
|
|
@ -62,8 +62,7 @@ QColor getDistinctColorForManyCurves(int curveIndex)
|
|||
MeasureAnalysisParticleCountPlotView::MeasureAnalysisParticleCountPlotView(QWidget* parent)
|
||||
: MeasureAnalysisView { parent }
|
||||
{
|
||||
this->setAnalyzeViewType(MeasureAnalysisViewType::CountSpectrum);
|
||||
|
||||
this->setViewType(PlotFrame);
|
||||
QHBoxLayout* layout = new QHBoxLayout(this);
|
||||
_plot = new QwtPlot(this);
|
||||
layout->addWidget(_plot);
|
||||
|
|
@ -76,8 +75,6 @@ void MeasureAnalysisParticleCountPlotView::SetAnalyzeDataFilename(const QMap<QSt
|
|||
for (auto it = data_files_set.begin(); it != data_files_set.end(); ++it) {
|
||||
loadDataFromFile(it.key(), it.value().toString());
|
||||
}
|
||||
// _custom_plot->update();
|
||||
this->update();
|
||||
}
|
||||
|
||||
void MeasureAnalysisParticleCountPlotView::setupPlot()
|
||||
|
|
@ -93,6 +90,9 @@ void MeasureAnalysisParticleCountPlotView::setupPlot()
|
|||
// 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();
|
||||
|
|
@ -127,12 +127,4 @@ void MeasureAnalysisParticleCountPlotView::loadDataFromFile(const QString& data_
|
|||
curve->setPen(QPen(getDistinctColorForManyCurves(0)));
|
||||
curve->setSamples(x, y);
|
||||
curve->attach(_plot);
|
||||
|
||||
// auto graph = _custom_plot->addGraph();
|
||||
// graph->setName(data_name);
|
||||
// graph->setPen(QPen(getDistinctColorForManyCurves(_custom_plot->graphCount())));
|
||||
// graph->setData(x, y, true);
|
||||
// graph->rescaleAxes();
|
||||
|
||||
// _custom_plot->replot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ void MeasureAnalysisProjectModel::SetAllChannelParticleDataFilename(const QStrin
|
|||
this->_all_channel_particle_data_filename = filename;
|
||||
}
|
||||
|
||||
void MeasureAnalysisProjectModel::SetSortedParticleDataFilename(const QString &filename)
|
||||
void MeasureAnalysisProjectModel::SetSortedParticleDataFilename(const QString& filename)
|
||||
{
|
||||
this->_sorted_particle_data_filename = filename;
|
||||
}
|
||||
|
|
@ -74,7 +74,7 @@ void MeasureAnalysisProjectModel::SetSortedParticleDataFilename(const QString &f
|
|||
|
||||
void MeasureAnalysisProjectModel::SetChannelAddressCountDataFilename(uint channel, const QString& filename)
|
||||
{
|
||||
this->_channel_particle_count_data_filename_list[channel] = filename;
|
||||
this->_channel_address_count_data_filename_list[channel] = filename;
|
||||
}
|
||||
|
||||
// void MeasureAnalysisProjectModel::SetAllChannelParticleTotalCountDataFilename(const QString& filename)
|
||||
|
|
@ -82,12 +82,12 @@ void MeasureAnalysisProjectModel::SetChannelAddressCountDataFilename(uint channe
|
|||
// this->_all_channel_particle_total_count_data_filename = filename;
|
||||
// }
|
||||
|
||||
void MeasureAnalysisProjectModel::SetChannelEneryCountDataFilename(uint channel, const QString &filename)
|
||||
void MeasureAnalysisProjectModel::SetChannelEneryCountDataFilename(uint channel, const QString& filename)
|
||||
{
|
||||
this->_channel_every_count_data_filename_list[channel] = filename;
|
||||
}
|
||||
|
||||
void MeasureAnalysisProjectModel::SetAllChannelEneryTotalCountDataFilename(const QString &filename)
|
||||
void MeasureAnalysisProjectModel::SetAllChannelEneryTotalCountDataFilename(const QString& filename)
|
||||
{
|
||||
this->_all_channel_enery_total_count_data_filename = filename;
|
||||
}
|
||||
|
|
@ -157,7 +157,7 @@ const QString& MeasureAnalysisProjectModel::GetAllChannelParticleDataFilename()
|
|||
return this->_all_channel_particle_data_filename;
|
||||
}
|
||||
|
||||
const QString &MeasureAnalysisProjectModel::GetSortAllChannelParticleDataFilename() const
|
||||
const QString& MeasureAnalysisProjectModel::GetSortAllChannelParticleDataFilename() const
|
||||
{
|
||||
return this->_sorted_particle_data_filename;
|
||||
}
|
||||
|
|
@ -174,12 +174,16 @@ const QString &MeasureAnalysisProjectModel::GetSortAllChannelParticleDataFilenam
|
|||
|
||||
const QMap<uint, QString>& MeasureAnalysisProjectModel::GetChannelAddressCountDataFilenameList() const
|
||||
{
|
||||
return this->_channel_particle_count_data_filename_list;
|
||||
return this->_channel_address_count_data_filename_list;
|
||||
}
|
||||
|
||||
const QString& MeasureAnalysisProjectModel::GetChannelParticleCountDataFilename(uint channel) const
|
||||
const QString& MeasureAnalysisProjectModel::GetChannelAddressCountDataFilename(uint channel) const
|
||||
{
|
||||
return this->_channel_particle_count_data_filename_list[channel];
|
||||
QString file_name;
|
||||
if ( this->_channel_address_count_data_filename_list.contains(channel) ) {
|
||||
file_name = this->_channel_address_count_data_filename_list[channel];
|
||||
}
|
||||
return file_name;
|
||||
}
|
||||
|
||||
// const QString& MeasureAnalysisProjectModel::GetAllChannelParticleTotalCountDataFilename() const
|
||||
|
|
@ -187,24 +191,32 @@ const QString& MeasureAnalysisProjectModel::GetChannelParticleCountDataFilename(
|
|||
// return this->_all_channel_particle_total_count_data_filename;
|
||||
// }
|
||||
|
||||
const QMap<uint, QString> &MeasureAnalysisProjectModel::GetChannelEneryCountDataFilenameList() const
|
||||
const QMap<uint, QString>& MeasureAnalysisProjectModel::GetChannelEneryCountDataFilenameList() const
|
||||
{
|
||||
return this->_channel_every_count_data_filename_list;
|
||||
}
|
||||
|
||||
const QString &MeasureAnalysisProjectModel::GetChannelEneryCountDataFilename(uint channel) const
|
||||
const QString& MeasureAnalysisProjectModel::GetChannelEneryCountDataFilename(uint channel) const
|
||||
{
|
||||
return this->_all_channel_enery_total_count_data_filename[channel];
|
||||
QString file_name;
|
||||
if ( this->_channel_every_count_data_filename_list.contains(channel) ) {
|
||||
file_name = this->_channel_every_count_data_filename_list[channel];
|
||||
}
|
||||
return file_name;
|
||||
}
|
||||
|
||||
const QString &MeasureAnalysisProjectModel::GetAllChannelEneryTotalCountDataFilename() const
|
||||
const QString& MeasureAnalysisProjectModel::GetAllChannelEneryTotalCountDataFilename() const
|
||||
{
|
||||
return this->_all_channel_enery_total_count_data_filename;
|
||||
}
|
||||
|
||||
const QMap<uint, QString> &MeasureAnalysisProjectModel::GetTimeWinConformParticleDataFilenameList(uint time_win) const
|
||||
const QMap<uint, QString>& MeasureAnalysisProjectModel::GetTimeWinConformParticleDataFilenameList(uint time_win) const
|
||||
{
|
||||
return this->_time_win_conform_particle_data[time_win];
|
||||
QMap<uint, QString> conform_particle_data;
|
||||
if ( this->_time_win_conform_particle_data.contains(time_win) ) {
|
||||
conform_particle_data = this->_time_win_conform_particle_data[time_win];
|
||||
}
|
||||
return conform_particle_data;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -216,223 +228,62 @@ enum ColumnType {
|
|||
StatusColumn
|
||||
};
|
||||
|
||||
enum ItemDataType {
|
||||
UserData = Qt::UserRole,
|
||||
FixedData = Qt::UserRole + 1,
|
||||
ProjectData = Qt::UserRole + 2
|
||||
};
|
||||
|
||||
MeasureAnalysisProjectModelList* MeasureAnalysisProjectModelList::_s_instance { nullptr };
|
||||
|
||||
MeasureAnalysisProjectModelList* MeasureAnalysisProjectModelList::Instance()
|
||||
{
|
||||
if ( !_s_instance ) {
|
||||
if (!_s_instance) {
|
||||
_s_instance = new MeasureAnalysisProjectModelList();
|
||||
}
|
||||
return _s_instance;
|
||||
}
|
||||
|
||||
MeasureAnalysisProjectModelList::MeasureAnalysisProjectModelList(QObject *parent)
|
||||
: QStandardItemModel(parent),
|
||||
_current_project_model(nullptr)
|
||||
void MeasureAnalysisProjectModelList::AddProjectModel(MeasureAnalysisProjectModel* model)
|
||||
{
|
||||
const QString& project_name = model->GetProjectName();
|
||||
_project_models[project_name] = model;
|
||||
SetCurrentProjectModel(project_name);
|
||||
intiProjectNodeStruce();
|
||||
}
|
||||
|
||||
void MeasureAnalysisProjectModelList::RmProjectModel(const QString& project_name)
|
||||
{
|
||||
if (_project_models.contains(project_name)) {
|
||||
delete _project_models[project_name];
|
||||
_project_models.remove(project_name);
|
||||
}
|
||||
}
|
||||
|
||||
MeasureAnalysisProjectModel* MeasureAnalysisProjectModelList::GetProjectModel(const QString& project_name)
|
||||
{
|
||||
if (_project_models.contains(project_name)) {
|
||||
return _project_models[project_name];
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
MeasureAnalysisProjectModel* MeasureAnalysisProjectModelList::GetCurrentProjectModel()
|
||||
{
|
||||
return _current_project_model;
|
||||
}
|
||||
|
||||
void MeasureAnalysisProjectModelList::SetCurrentProjectModel(const QString& project_name)
|
||||
{
|
||||
if (_project_models.contains(project_name)) {
|
||||
_current_project_model = _project_models[project_name];
|
||||
}
|
||||
}
|
||||
|
||||
MeasureAnalysisProjectModelList::MeasureAnalysisProjectModelList(QObject* parent)
|
||||
: QStandardItemModel(parent)
|
||||
, _current_project_model(nullptr)
|
||||
{
|
||||
setColumnCount(2);
|
||||
setHeaderData(NameColumn, Qt::Horizontal, QStringLiteral(u"项名"));
|
||||
setHeaderData(StatusColumn, Qt::Horizontal, QStringLiteral(u"状态"));
|
||||
}
|
||||
|
||||
void MeasureAnalysisProjectModelList::intiProjectNodeStruce()
|
||||
{
|
||||
MeasureAnalysisProjectModel* cur_pro_model = GetCurrentProjectModel();
|
||||
if ( !cur_pro_model ) {
|
||||
return;
|
||||
}
|
||||
|
||||
QMap<QString, QStandardItem*> node_map;
|
||||
QStandardItem *root_item = invisibleRootItem();
|
||||
|
||||
const QString& project_name = cur_pro_model->GetProjectName();
|
||||
QString status = cur_pro_model->GetIsMeasureComplete() ? QStringLiteral(u"测量完成") : QStringLiteral(u"未测量");
|
||||
QVariant analys_type = QVariant::fromValue(AnalysisType::Project);
|
||||
QStandardItem *project_item = AddChildNode(root_item, project_name, status, analys_type, false);
|
||||
project_item->setData(project_name, ProjectData);
|
||||
|
||||
// 测量控制
|
||||
QString item_name = QStringLiteral(u"测量控制");
|
||||
QStandardItem *measure_ctrl_item = AddChildNode(project_item, item_name, QString(), QVariant(), true);
|
||||
measure_ctrl_item->setData(item_name, ProjectData);
|
||||
node_map[item_name] = measure_ctrl_item;
|
||||
|
||||
if (!cur_pro_model->GetIsMeasureComplete()) {
|
||||
const QString& measure_device_params_cfg_filename = cur_pro_model->GetMeasureDeviceParamsCfgFilename();
|
||||
status = measure_device_params_cfg_filename.isEmpty() ? QStringLiteral(u"未配置") : QStringLiteral(u"已配置");
|
||||
analys_type = QVariant::fromValue(AnalysisType::DeviceParamsCfg);
|
||||
item_name = QStringLiteral(u"设备配置参数");
|
||||
QStandardItem *node_item = AddChildNode(measure_ctrl_item, item_name, status, analys_type, true);
|
||||
node_item->setData(item_name, ProjectData);
|
||||
node_map[item_name] = node_item;
|
||||
}
|
||||
|
||||
status = cur_pro_model->GetEneryScaleFilename().isEmpty() ? QStringLiteral(u"未配置") : QStringLiteral(u"已配置");
|
||||
analys_type = QVariant::fromValue(AnalysisType::EnergyScale);
|
||||
item_name = QStringLiteral(u"能量刻度");
|
||||
QStandardItem *node_item = AddChildNode(measure_ctrl_item, item_name, status, analys_type, true);
|
||||
node_item->setData(item_name, ProjectData);
|
||||
node_map[item_name] = node_item;
|
||||
|
||||
status = cur_pro_model->GetEfficiencyScaleFilename().isEmpty() ? QStringLiteral(u"未配置") : QStringLiteral(u"已配置");
|
||||
analys_type = QVariant::fromValue(AnalysisType::EfficiencyScale);
|
||||
item_name = QStringLiteral(u"效率刻度");
|
||||
node_item = AddChildNode(measure_ctrl_item, item_name, status, analys_type, true);
|
||||
node_item->setData(item_name, ProjectData);
|
||||
node_map[item_name] = node_item;
|
||||
|
||||
// 分析数据
|
||||
item_name = QStringLiteral(u"分析数据");
|
||||
QStandardItem *analysis_data_item = AddChildNode(project_item, item_name, QString(), QVariant(), true);
|
||||
analysis_data_item->setData(item_name, ProjectData);
|
||||
node_map[item_name] = node_item;
|
||||
|
||||
status = cur_pro_model->GetAllChannelParticleDataFilename().isEmpty() ? QStringLiteral(u"无效") : QStringLiteral(u"有效");
|
||||
analys_type = QVariant::fromValue(AnalysisType::ParticleData);
|
||||
item_name = QStringLiteral(u"测量粒子数据");
|
||||
node_item = AddChildNode(analysis_data_item, item_name, status, analys_type, true);
|
||||
node_item->setData(item_name, ProjectData);
|
||||
node_map[item_name] = node_item;
|
||||
|
||||
item_name = QStringLiteral(u"道址计数");
|
||||
status = cur_pro_model->GetChannelAddressCountDataFilenameList().isEmpty() ? QStringLiteral(u"无效") : QStringLiteral(u"有效");
|
||||
analys_type = QVariant::fromValue(AnalysisType::AddressCountData);
|
||||
node_item = AddChildNode(analysis_data_item, item_name, status, QVariant(), true);
|
||||
node_item->setData(item_name, ProjectData);
|
||||
node_map[item_name] = node_item;
|
||||
|
||||
item_name = QStringLiteral(u"能量计数");
|
||||
status = cur_pro_model->GetAllChannelEneryTotalCountDataFilename().isEmpty() ? QStringLiteral(u"无效") : QStringLiteral(u"有效");
|
||||
analys_type = QVariant::fromValue(AnalysisType::EnergyCountData);
|
||||
node_item = AddChildNode(analysis_data_item, item_name, status, analys_type, true);
|
||||
node_item->setData(item_name, ProjectData);
|
||||
node_map[item_name] = node_item;
|
||||
|
||||
uint conform_time_win = cur_pro_model->GetConformTimeWin();
|
||||
status = cur_pro_model->GetTimeWinConformParticleDataFilenameList(conform_time_win).isEmpty() ? QStringLiteral(u"无效") : QStringLiteral(u"有效");
|
||||
analys_type = QVariant::fromValue(AnalysisType::CoincidenceParticleEnergyData);
|
||||
item_name = QStringLiteral(u"符合粒子数据[%1ns]").arg(conform_time_win);
|
||||
node_item = AddChildNode(analysis_data_item, item_name, status, analys_type, true);
|
||||
node_item->setData(item_name, ProjectData);
|
||||
node_map[item_name] = node_item;
|
||||
|
||||
// 交互分析
|
||||
item_name = QStringLiteral(u"交互分析");
|
||||
QStandardItem *interactive_analysis_item = AddChildNode(project_item, item_name, QString(), QVariant(), true);
|
||||
interactive_analysis_item->setData(item_name, ProjectData);
|
||||
node_map[item_name] = interactive_analysis_item;
|
||||
|
||||
status = cur_pro_model->GetChannelAddressCountDataFilenameList().isEmpty() ? QStringLiteral(u"无效") : QStringLiteral(u"有效");
|
||||
analys_type = QVariant::fromValue(AnalysisType::CountSpectrumView);
|
||||
item_name = QStringLiteral(u"道址计数谱");
|
||||
node_item = AddChildNode(interactive_analysis_item, item_name, status, analys_type, true);
|
||||
node_item->setData(item_name, ProjectData);
|
||||
node_map[item_name] = node_item;
|
||||
|
||||
status = cur_pro_model->GetChannelEneryCountDataFilenameList().isEmpty() ? QStringLiteral(u"无效") : QStringLiteral(u"有效");
|
||||
analys_type = QVariant::fromValue(AnalysisType::CountSpectrumView);
|
||||
item_name = QStringLiteral(u"通道能量计数谱");
|
||||
node_item = AddChildNode(interactive_analysis_item, item_name, status, analys_type, true);
|
||||
node_item->setData(item_name, ProjectData);
|
||||
node_map[item_name] = node_item;
|
||||
|
||||
status = cur_pro_model->GetAllChannelEneryTotalCountDataFilename().isEmpty() ? QStringLiteral(u"无效") : QStringLiteral(u"有效");
|
||||
analys_type = QVariant::fromValue(AnalysisType::CountSpectrumView);
|
||||
item_name = QStringLiteral(u"能量计数谱");
|
||||
node_item = AddChildNode(interactive_analysis_item, item_name, status, analys_type, true);
|
||||
node_item->setData(item_name, ProjectData);
|
||||
node_map[item_name] = node_item;
|
||||
|
||||
status = cur_pro_model->GetSortAllChannelParticleDataFilename().isEmpty() ? QStringLiteral(u"无效") : QStringLiteral(u"有效");
|
||||
analys_type = QVariant::fromValue(AnalysisType::CountingRateView);
|
||||
item_name = QStringLiteral(u"计数率分析");
|
||||
node_item = AddChildNode(interactive_analysis_item, item_name, status, analys_type, true);
|
||||
node_item->setData(item_name, ProjectData);
|
||||
node_map[item_name] = node_item;
|
||||
|
||||
status = cur_pro_model->GetAllChannelEneryTotalCountDataFilename().isEmpty() ? QStringLiteral(u"无效") : QStringLiteral(u"有效");
|
||||
analys_type = QVariant::fromValue(AnalysisType::EnergyPeakFitView);
|
||||
item_name = QStringLiteral(u"峰拟合分析");
|
||||
node_item = AddChildNode(interactive_analysis_item, item_name, status, analys_type, true);
|
||||
node_item->setData(item_name, ProjectData);
|
||||
node_map[item_name] = node_item;
|
||||
|
||||
status = cur_pro_model->GetAllChannelEneryTotalCountDataFilename().isEmpty() ? QStringLiteral(u"无效") : QStringLiteral(u"有效");
|
||||
analys_type = QVariant::fromValue(AnalysisType::NuclideAnalysisView);
|
||||
item_name = QStringLiteral(u"核素分析");
|
||||
node_item = AddChildNode(interactive_analysis_item, item_name, status, analys_type, true);
|
||||
node_item->setData(item_name, ProjectData);
|
||||
node_map[item_name] = node_item;
|
||||
|
||||
status = cur_pro_model->GetSortAllChannelParticleDataFilename().isEmpty() ? QStringLiteral(u"无效") : QStringLiteral(u"有效");
|
||||
analys_type = QVariant::fromValue(AnalysisType::ParticleInTimeView);
|
||||
item_name = QStringLiteral(u"粒子入射时间分析");
|
||||
node_item = AddChildNode(interactive_analysis_item, item_name, status, analys_type, true);
|
||||
node_item->setData(item_name, ProjectData);
|
||||
node_map[item_name] = node_item;
|
||||
|
||||
status = cur_pro_model->GetSortAllChannelParticleDataFilename().isEmpty() ? QStringLiteral(u"无效") : QStringLiteral(u"有效");
|
||||
analys_type = QVariant::fromValue(AnalysisType::ParticleTimeDiffView);
|
||||
item_name = QStringLiteral(u"粒子时间差分析");
|
||||
node_item = AddChildNode(interactive_analysis_item, item_name, status, analys_type, true);
|
||||
node_item->setData(item_name, ProjectData);
|
||||
node_map[item_name] = node_item;
|
||||
|
||||
status = cur_pro_model->GetTimeWinConformParticleDataFilenameList(conform_time_win).isEmpty() ? QStringLiteral(u"无效") : QStringLiteral(u"有效");
|
||||
analys_type = QVariant::fromValue(AnalysisType::CoincidenceEventTimeView);
|
||||
item_name = QStringLiteral(u"符合事件时间分析");
|
||||
node_item = AddChildNode(interactive_analysis_item, item_name, status, analys_type, true);
|
||||
node_item->setData(item_name, ProjectData);
|
||||
node_map[item_name] = node_item;
|
||||
|
||||
analys_type = QVariant::fromValue(AnalysisType::CoincidenceParticleEnergySpectrumView);
|
||||
item_name = QStringLiteral(u"符合能谱[%1ns]").arg(conform_time_win);
|
||||
node_item = AddChildNode(interactive_analysis_item, item_name, status, analys_type, true);
|
||||
node_item->setData(item_name, ProjectData);
|
||||
node_map[item_name] = node_item;
|
||||
|
||||
analys_type = QVariant::fromValue(AnalysisType::AntiCoincidenceSpectrumView);
|
||||
item_name = QStringLiteral(u"反符合能谱[%1ns]").arg(conform_time_win);
|
||||
node_item = AddChildNode(interactive_analysis_item, item_name, status, analys_type, true);
|
||||
node_item->setData(item_name, ProjectData);
|
||||
node_map[item_name] = node_item;
|
||||
|
||||
analys_type = QVariant::fromValue(AnalysisType::CoincidenceParticleEnergySpectrum2DView);
|
||||
item_name = QStringLiteral(u"二维符合能谱[%1ns]").arg(conform_time_win);
|
||||
node_item = AddChildNode(interactive_analysis_item, item_name, status, analys_type, true);
|
||||
node_item->setData(item_name, ProjectData);
|
||||
node_map[item_name] = node_item;
|
||||
|
||||
analys_type = QVariant::fromValue(AnalysisType::CoincidenceParticleEnergySpectrum3DView);
|
||||
item_name = QStringLiteral(u"三维符合能谱[%1ns]").arg(conform_time_win);
|
||||
node_item = AddChildNode(interactive_analysis_item, item_name, status, analys_type, true);
|
||||
node_item->setData(item_name, ProjectData);
|
||||
node_map[item_name] = node_item;
|
||||
|
||||
_project_node_items[project_name] = node_map;
|
||||
|
||||
|
||||
LOG_INFO(QStringLiteral(u"测量分析项目\"%1\"创建成功.").arg(project_name));
|
||||
if (!cur_pro_model->GetIsMeasureComplete()) {
|
||||
if (cur_pro_model->GetMeasureDeviceParamsCfgFilename().isEmpty()) {
|
||||
LOG_WARN(QStringLiteral(u"测量分析项目\"%1\"测量设备参数未配置!").arg(project_name));
|
||||
}
|
||||
}
|
||||
if (cur_pro_model->GetEneryScaleFilename().isEmpty()) {
|
||||
LOG_WARN(QStringLiteral(u"测量分析项目\"%1\"能量刻度未配置!").arg(project_name));
|
||||
}
|
||||
if (cur_pro_model->GetEfficiencyScaleFilename().isEmpty()) {
|
||||
LOG_WARN(QStringLiteral(u"测量分析项目\"%1\"效率刻度未配置!").arg(project_name));
|
||||
}
|
||||
}
|
||||
|
||||
QStandardItem *MeasureAnalysisProjectModelList::GetItemFromIndex(const QModelIndex &index) const
|
||||
QStandardItem* MeasureAnalysisProjectModelList::GetItemFromIndex(const QModelIndex& index) const
|
||||
{
|
||||
QModelIndex nameIndex = index.sibling(index.row(), NameColumn);
|
||||
return itemFromIndex(nameIndex);
|
||||
|
|
@ -446,8 +297,8 @@ QStandardItem* MeasureAnalysisProjectModelList::AddChildNode(
|
|||
return nullptr;
|
||||
|
||||
QStandardItem* name_item = new QStandardItem(node_name);
|
||||
name_item->setData(user_data, UserData);
|
||||
name_item->setData(is_fixed, FixedData);
|
||||
name_item->setData(user_data, NodeType);
|
||||
name_item->setData(is_fixed, Fixed);
|
||||
|
||||
QStandardItem* status_item = new QStandardItem(status);
|
||||
|
||||
|
|
@ -462,7 +313,7 @@ bool MeasureAnalysisProjectModelList::RemoveNode(QStandardItem* item)
|
|||
{
|
||||
if (!item)
|
||||
return false;
|
||||
if (item->column() == NameColumn && item->data(FixedData).toBool())
|
||||
if (item->column() == NameColumn && item->data(Fixed).toBool())
|
||||
return false;
|
||||
|
||||
QStandardItem* parent_item = item->parent();
|
||||
|
|
@ -471,14 +322,14 @@ bool MeasureAnalysisProjectModelList::RemoveNode(QStandardItem* item)
|
|||
}
|
||||
parent_item->removeRow(item->row());
|
||||
|
||||
const QString& project_name = item->data(ProjectData).toString();
|
||||
if (AnalysisType::Project == item->data(UserData).value<AnalysisType>()) {
|
||||
const QString& project_name = item->data(ProjectName).toString();
|
||||
if (AnalysisType::Project == item->data(NodeType).value<AnalysisType>()) {
|
||||
_project_node_items.remove(project_name);
|
||||
return true;
|
||||
} else {
|
||||
const QString& node_name = item->text();
|
||||
if ( _project_node_items.contains(project_name) ) {
|
||||
if ( _project_node_items[project_name].contains(node_name) ) {
|
||||
if (_project_node_items.contains(project_name)) {
|
||||
if (_project_node_items[project_name].contains(node_name)) {
|
||||
_project_node_items[project_name].remove(node_name);
|
||||
}
|
||||
}
|
||||
|
|
@ -490,12 +341,12 @@ bool MeasureAnalysisProjectModelList::RemoveNode(QStandardItem* item)
|
|||
void MeasureAnalysisProjectModelList::SetNodeUserData(QStandardItem* item, const QVariant& data)
|
||||
{
|
||||
if (item && item->column() == NameColumn)
|
||||
item->setData(data, UserData);
|
||||
item->setData(data, NodeType);
|
||||
}
|
||||
|
||||
QVariant MeasureAnalysisProjectModelList::GetNodeUserData(QStandardItem* item) const
|
||||
QVariant MeasureAnalysisProjectModelList::GetNodeUserData(QStandardItem* item, UserDataType data_type) const
|
||||
{
|
||||
return (item && item->column() == NameColumn) ? item->data(UserData) : QVariant();
|
||||
return (item && item->column() == NameColumn) ? item->data(data_type) : QVariant();
|
||||
}
|
||||
|
||||
void MeasureAnalysisProjectModelList::SetNodeStatus(QStandardItem* item, const QString& status)
|
||||
|
|
@ -503,8 +354,8 @@ void MeasureAnalysisProjectModelList::SetNodeStatus(QStandardItem* item, const Q
|
|||
if (!item || item->column() != NameColumn)
|
||||
return;
|
||||
QStandardItem* status_item = item->parent()
|
||||
? item->parent()->child(item->row(), StatusColumn)
|
||||
: invisibleRootItem()->child(item->row(), StatusColumn);
|
||||
? item->parent()->child(item->row(), StatusColumn)
|
||||
: invisibleRootItem()->child(item->row(), StatusColumn);
|
||||
if (status_item) {
|
||||
status_item->setText(status);
|
||||
}
|
||||
|
|
@ -515,44 +366,232 @@ QString MeasureAnalysisProjectModelList::GetNodeStatus(QStandardItem* item) cons
|
|||
if (!item || item->column() != NameColumn)
|
||||
return QString();
|
||||
QStandardItem* status_item = item->parent()
|
||||
? item->parent()->child(item->row(), StatusColumn)
|
||||
: invisibleRootItem()->child(item->row(), StatusColumn);
|
||||
? item->parent()->child(item->row(), StatusColumn)
|
||||
: invisibleRootItem()->child(item->row(), StatusColumn);
|
||||
return status_item ? status_item->text() : QString();
|
||||
}
|
||||
|
||||
void MeasureAnalysisProjectModelList::AddProjectModel(MeasureAnalysisProjectModel *model)
|
||||
void MeasureAnalysisProjectModelList::onChannelAddressCountProcessFinished(const QString& project_name)
|
||||
{
|
||||
const QString& project_name = model->GetProjectName();
|
||||
_project_models[project_name] = model;
|
||||
SetCurrentProjectModel(project_name);
|
||||
intiProjectNodeStruce();
|
||||
}
|
||||
if (this->_project_models.contains(project_name)) {
|
||||
auto pro_model = this->_project_models[project_name];
|
||||
const QMap<uint, QString>& filename_list = pro_model->GetChannelAddressCountDataFilenameList();
|
||||
|
||||
void MeasureAnalysisProjectModelList::RmProjectModel(const QString &project_name)
|
||||
{
|
||||
if (_project_models.contains(project_name)) {
|
||||
delete _project_models[project_name];
|
||||
_project_models.remove(project_name);
|
||||
QString status = QStringLiteral(u"无效");
|
||||
if (!filename_list.isEmpty()) {
|
||||
status = QStringLiteral(u"有效");
|
||||
}
|
||||
|
||||
auto& node_map = this->_project_node_items[project_name];
|
||||
const QString& adrr_count_item_name = QStringLiteral(u"道址计数");
|
||||
if (node_map.contains(adrr_count_item_name)) {
|
||||
auto adrr_count_item = node_map[adrr_count_item_name];
|
||||
this->SetNodeStatus(adrr_count_item, status);
|
||||
|
||||
for (auto it = filename_list.begin(); it != filename_list.end(); ++it) {
|
||||
uint ch_num = it.key();
|
||||
QString item_name = QStringLiteral(u"通道%1道址计数").arg(ch_num);
|
||||
const QVariant& analys_type = QVariant::fromValue(AnalysisType::AddressCountData);
|
||||
QStandardItem* node_item = AddChildNode(adrr_count_item, item_name, status, analys_type, true);
|
||||
node_item->setData(project_name, ProjectName);
|
||||
node_item->setData(ch_num, ChannelNum);
|
||||
node_map[item_name] = node_item;
|
||||
}
|
||||
}
|
||||
|
||||
const QString& adrr_count_spec_item_name = QStringLiteral(u"道址计数谱");
|
||||
if (node_map.contains(adrr_count_spec_item_name)) {
|
||||
auto adrr_count_spec_item = node_map[adrr_count_spec_item_name];
|
||||
this->SetNodeStatus(adrr_count_spec_item, status);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MeasureAnalysisProjectModel *MeasureAnalysisProjectModelList::GetProjectModel(const QString &project_name)
|
||||
void MeasureAnalysisProjectModelList::intiProjectNodeStruce()
|
||||
{
|
||||
if (_project_models.contains(project_name)) {
|
||||
return _project_models[project_name];
|
||||
MeasureAnalysisProjectModel* cur_pro_model = GetCurrentProjectModel();
|
||||
if (!cur_pro_model) {
|
||||
return;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
MeasureAnalysisProjectModel *MeasureAnalysisProjectModelList::GetCurrentProjectModel()
|
||||
{
|
||||
return _current_project_model;
|
||||
}
|
||||
QMap<QString, QStandardItem*> node_map;
|
||||
QStandardItem* root_item = invisibleRootItem();
|
||||
|
||||
void MeasureAnalysisProjectModelList::SetCurrentProjectModel(const QString &project_name)
|
||||
{
|
||||
if (_project_models.contains(project_name)) {
|
||||
_current_project_model = _project_models[project_name];
|
||||
const QString& project_name = cur_pro_model->GetProjectName();
|
||||
QString status = cur_pro_model->GetIsMeasureComplete() ? QStringLiteral(u"测量完成") : QStringLiteral(u"未测量");
|
||||
QVariant analys_type = QVariant::fromValue(AnalysisType::Project);
|
||||
QStandardItem* project_item = AddChildNode(root_item, project_name, status, analys_type, false);
|
||||
project_item->setData(project_name, ProjectName);
|
||||
|
||||
// 测量控制
|
||||
QString item_name = QStringLiteral(u"测量控制");
|
||||
QStandardItem* measure_ctrl_item = AddChildNode(project_item, item_name, QString(), QVariant(), true);
|
||||
measure_ctrl_item->setData(project_name, ProjectName);
|
||||
node_map[item_name] = measure_ctrl_item;
|
||||
|
||||
if (!cur_pro_model->GetIsMeasureComplete()) {
|
||||
const QString& measure_device_params_cfg_filename = cur_pro_model->GetMeasureDeviceParamsCfgFilename();
|
||||
status = measure_device_params_cfg_filename.isEmpty() ? QStringLiteral(u"未配置") : QStringLiteral(u"已配置");
|
||||
analys_type = QVariant::fromValue(AnalysisType::DeviceParamsCfg);
|
||||
item_name = QStringLiteral(u"设备配置参数");
|
||||
QStandardItem* node_item = AddChildNode(measure_ctrl_item, item_name, status, analys_type, true);
|
||||
node_item->setData(project_name, ProjectName);
|
||||
node_map[item_name] = node_item;
|
||||
}
|
||||
|
||||
status = cur_pro_model->GetEneryScaleFilename().isEmpty() ? QStringLiteral(u"未配置") : QStringLiteral(u"已配置");
|
||||
analys_type = QVariant::fromValue(AnalysisType::EnergyScale);
|
||||
item_name = QStringLiteral(u"能量刻度");
|
||||
QStandardItem* node_item = AddChildNode(measure_ctrl_item, item_name, status, analys_type, true);
|
||||
node_item->setData(project_name, ProjectName);
|
||||
node_map[item_name] = node_item;
|
||||
|
||||
status = cur_pro_model->GetEfficiencyScaleFilename().isEmpty() ? QStringLiteral(u"未配置") : QStringLiteral(u"已配置");
|
||||
analys_type = QVariant::fromValue(AnalysisType::EfficiencyScale);
|
||||
item_name = QStringLiteral(u"效率刻度");
|
||||
node_item = AddChildNode(measure_ctrl_item, item_name, status, analys_type, true);
|
||||
node_item->setData(project_name, ProjectName);
|
||||
node_map[item_name] = node_item;
|
||||
|
||||
// 分析数据
|
||||
item_name = QStringLiteral(u"分析数据");
|
||||
QStandardItem* analysis_data_item = AddChildNode(project_item, item_name, QString(), QVariant(), true);
|
||||
analysis_data_item->setData(project_name, ProjectName);
|
||||
node_map[item_name] = node_item;
|
||||
|
||||
status = cur_pro_model->GetAllChannelParticleDataFilename().isEmpty() ? QStringLiteral(u"无效") : QStringLiteral(u"有效");
|
||||
analys_type = QVariant::fromValue(AnalysisType::ParticleData);
|
||||
item_name = QStringLiteral(u"测量粒子数据");
|
||||
node_item = AddChildNode(analysis_data_item, item_name, status, analys_type, true);
|
||||
node_item->setData(project_name, ProjectName);
|
||||
node_map[item_name] = node_item;
|
||||
|
||||
item_name = QStringLiteral(u"道址计数");
|
||||
status = cur_pro_model->GetChannelAddressCountDataFilenameList().isEmpty() ? QStringLiteral(u"无效") : QStringLiteral(u"有效");
|
||||
node_item = AddChildNode(analysis_data_item, item_name, status, QVariant(), true);
|
||||
node_item->setData(project_name, ProjectName);
|
||||
node_map[item_name] = node_item;
|
||||
|
||||
item_name = QStringLiteral(u"能量计数");
|
||||
status = cur_pro_model->GetAllChannelEneryTotalCountDataFilename().isEmpty() ? QStringLiteral(u"无效") : QStringLiteral(u"有效");
|
||||
analys_type = QVariant::fromValue(AnalysisType::EnergyCountData);
|
||||
node_item = AddChildNode(analysis_data_item, item_name, status, analys_type, true);
|
||||
node_item->setData(project_name, ProjectName);
|
||||
node_map[item_name] = node_item;
|
||||
|
||||
uint conform_time_win = cur_pro_model->GetConformTimeWin();
|
||||
status = cur_pro_model->GetTimeWinConformParticleDataFilenameList(conform_time_win).isEmpty() ? QStringLiteral(u"无效") : QStringLiteral(u"有效");
|
||||
analys_type = QVariant::fromValue(AnalysisType::CoincidenceParticleEnergyData);
|
||||
item_name = QStringLiteral(u"符合粒子数据[%1ns]").arg(conform_time_win);
|
||||
node_item = AddChildNode(analysis_data_item, item_name, status, analys_type, true);
|
||||
node_item->setData(project_name, ProjectName);
|
||||
node_map[item_name] = node_item;
|
||||
|
||||
// 交互分析
|
||||
item_name = QStringLiteral(u"交互分析");
|
||||
QStandardItem* interactive_analysis_item = AddChildNode(project_item, item_name, QString(), QVariant(), true);
|
||||
interactive_analysis_item->setData(project_name, ProjectName);
|
||||
node_map[item_name] = interactive_analysis_item;
|
||||
|
||||
status = cur_pro_model->GetChannelAddressCountDataFilenameList().isEmpty() ? QStringLiteral(u"无效") : QStringLiteral(u"有效");
|
||||
analys_type = QVariant::fromValue(AnalysisType::AddressCountSpectrumView);
|
||||
item_name = QStringLiteral(u"道址计数谱");
|
||||
node_item = AddChildNode(interactive_analysis_item, item_name, status, analys_type, true);
|
||||
node_item->setData(project_name, ProjectName);
|
||||
node_map[item_name] = node_item;
|
||||
|
||||
status = cur_pro_model->GetChannelEneryCountDataFilenameList().isEmpty() ? QStringLiteral(u"无效") : QStringLiteral(u"有效");
|
||||
analys_type = QVariant::fromValue(AnalysisType::EneryCountSpectrumView);
|
||||
item_name = QStringLiteral(u"通道能量计数谱");
|
||||
node_item = AddChildNode(interactive_analysis_item, item_name, status, analys_type, true);
|
||||
node_item->setData(project_name, ProjectName);
|
||||
node_map[item_name] = node_item;
|
||||
|
||||
status = cur_pro_model->GetAllChannelEneryTotalCountDataFilename().isEmpty() ? QStringLiteral(u"无效") : QStringLiteral(u"有效");
|
||||
analys_type = QVariant::fromValue(AnalysisType::EneryCountSpectrumView);
|
||||
item_name = QStringLiteral(u"能量计数谱");
|
||||
node_item = AddChildNode(interactive_analysis_item, item_name, status, analys_type, true);
|
||||
node_item->setData(project_name, ProjectName);
|
||||
node_map[item_name] = node_item;
|
||||
|
||||
status = cur_pro_model->GetSortAllChannelParticleDataFilename().isEmpty() ? QStringLiteral(u"无效") : QStringLiteral(u"有效");
|
||||
analys_type = QVariant::fromValue(AnalysisType::CountingRateView);
|
||||
item_name = QStringLiteral(u"计数率分析");
|
||||
node_item = AddChildNode(interactive_analysis_item, item_name, status, analys_type, true);
|
||||
node_item->setData(project_name, ProjectName);
|
||||
node_map[item_name] = node_item;
|
||||
|
||||
status = cur_pro_model->GetAllChannelEneryTotalCountDataFilename().isEmpty() ? QStringLiteral(u"无效") : QStringLiteral(u"有效");
|
||||
analys_type = QVariant::fromValue(AnalysisType::EnergyPeakFitView);
|
||||
item_name = QStringLiteral(u"峰拟合分析");
|
||||
node_item = AddChildNode(interactive_analysis_item, item_name, status, analys_type, true);
|
||||
node_item->setData(project_name, ProjectName);
|
||||
node_map[item_name] = node_item;
|
||||
|
||||
status = cur_pro_model->GetAllChannelEneryTotalCountDataFilename().isEmpty() ? QStringLiteral(u"无效") : QStringLiteral(u"有效");
|
||||
analys_type = QVariant::fromValue(AnalysisType::NuclideAnalysisView);
|
||||
item_name = QStringLiteral(u"核素分析");
|
||||
node_item = AddChildNode(interactive_analysis_item, item_name, status, analys_type, true);
|
||||
node_item->setData(project_name, ProjectName);
|
||||
node_map[item_name] = node_item;
|
||||
|
||||
status = cur_pro_model->GetSortAllChannelParticleDataFilename().isEmpty() ? QStringLiteral(u"无效") : QStringLiteral(u"有效");
|
||||
analys_type = QVariant::fromValue(AnalysisType::ParticleInTimeView);
|
||||
item_name = QStringLiteral(u"粒子入射时间分析");
|
||||
node_item = AddChildNode(interactive_analysis_item, item_name, status, analys_type, true);
|
||||
node_item->setData(project_name, ProjectName);
|
||||
node_map[item_name] = node_item;
|
||||
|
||||
status = cur_pro_model->GetSortAllChannelParticleDataFilename().isEmpty() ? QStringLiteral(u"无效") : QStringLiteral(u"有效");
|
||||
analys_type = QVariant::fromValue(AnalysisType::ParticleTimeDiffView);
|
||||
item_name = QStringLiteral(u"粒子时间差分析");
|
||||
node_item = AddChildNode(interactive_analysis_item, item_name, status, analys_type, true);
|
||||
node_item->setData(project_name, ProjectName);
|
||||
node_map[item_name] = node_item;
|
||||
|
||||
status = cur_pro_model->GetTimeWinConformParticleDataFilenameList(conform_time_win).isEmpty() ? QStringLiteral(u"无效") : QStringLiteral(u"有效");
|
||||
analys_type = QVariant::fromValue(AnalysisType::CoincidenceEventTimeView);
|
||||
item_name = QStringLiteral(u"符合事件时间分析");
|
||||
node_item = AddChildNode(interactive_analysis_item, item_name, status, analys_type, true);
|
||||
node_item->setData(project_name, ProjectName);
|
||||
node_map[item_name] = node_item;
|
||||
|
||||
analys_type = QVariant::fromValue(AnalysisType::CoincidenceParticleEnergySpectrumView);
|
||||
item_name = QStringLiteral(u"符合能谱[%1ns]").arg(conform_time_win);
|
||||
node_item = AddChildNode(interactive_analysis_item, item_name, status, analys_type, true);
|
||||
node_item->setData(project_name, ProjectName);
|
||||
node_map[item_name] = node_item;
|
||||
|
||||
analys_type = QVariant::fromValue(AnalysisType::AntiCoincidenceSpectrumView);
|
||||
item_name = QStringLiteral(u"反符合能谱[%1ns]").arg(conform_time_win);
|
||||
node_item = AddChildNode(interactive_analysis_item, item_name, status, analys_type, true);
|
||||
node_item->setData(project_name, ProjectName);
|
||||
node_map[item_name] = node_item;
|
||||
|
||||
analys_type = QVariant::fromValue(AnalysisType::CoincidenceParticleEnergySpectrum2DView);
|
||||
item_name = QStringLiteral(u"二维符合能谱[%1ns]").arg(conform_time_win);
|
||||
node_item = AddChildNode(interactive_analysis_item, item_name, status, analys_type, true);
|
||||
node_item->setData(project_name, ProjectName);
|
||||
node_map[item_name] = node_item;
|
||||
|
||||
analys_type = QVariant::fromValue(AnalysisType::CoincidenceParticleEnergySpectrum3DView);
|
||||
item_name = QStringLiteral(u"三维符合能谱[%1ns]").arg(conform_time_win);
|
||||
node_item = AddChildNode(interactive_analysis_item, item_name, status, analys_type, true);
|
||||
node_item->setData(project_name, ProjectName);
|
||||
node_map[item_name] = node_item;
|
||||
|
||||
_project_node_items[project_name] = node_map;
|
||||
|
||||
LOG_INFO(QStringLiteral(u"测量分析项目\"%1\"创建成功.").arg(project_name));
|
||||
if (!cur_pro_model->GetIsMeasureComplete()) {
|
||||
if (cur_pro_model->GetMeasureDeviceParamsCfgFilename().isEmpty()) {
|
||||
LOG_WARN(QStringLiteral(u"测量分析项目\"%1\"测量设备参数未配置!").arg(project_name));
|
||||
}
|
||||
}
|
||||
if (cur_pro_model->GetEneryScaleFilename().isEmpty()) {
|
||||
LOG_WARN(QStringLiteral(u"测量分析项目\"%1\"能量刻度未配置!").arg(project_name));
|
||||
}
|
||||
if (cur_pro_model->GetEfficiencyScaleFilename().isEmpty()) {
|
||||
LOG_WARN(QStringLiteral(u"测量分析项目\"%1\"效率刻度未配置!").arg(project_name));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ public:
|
|||
// const QString& GetChannelParticleDataFilename(uint channel) const;
|
||||
|
||||
const QMap<uint, QString>& GetChannelAddressCountDataFilenameList() const;
|
||||
const QString& GetChannelParticleCountDataFilename(uint channel) const;
|
||||
const QString& GetChannelAddressCountDataFilename(uint channel) const;
|
||||
// const QString& GetAllChannelParticleTotalCountDataFilename() const;
|
||||
|
||||
const QMap<uint, QString>& GetChannelEneryCountDataFilenameList() const;
|
||||
|
|
@ -87,7 +87,7 @@ private:
|
|||
QString _sorted_particle_data_filename;
|
||||
// QMap<uint, QString> _channel_particle_data_filename_list;
|
||||
|
||||
QMap<uint, QString> _channel_particle_count_data_filename_list;
|
||||
QMap<uint, QString> _channel_address_count_data_filename_list;
|
||||
// QString _all_channel_particle_total_count_data_filename;
|
||||
|
||||
QMap<uint, QString> _channel_every_count_data_filename_list;
|
||||
|
|
@ -102,6 +102,14 @@ class MeasureAnalysisProjectModelList : public QStandardItemModel
|
|||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum UserDataType {
|
||||
NodeType = Qt::UserRole,
|
||||
Fixed = Qt::UserRole + 1,
|
||||
ProjectName = Qt::UserRole + 2,
|
||||
ChannelNum = Qt::UserRole + 3
|
||||
};
|
||||
|
||||
public:
|
||||
static MeasureAnalysisProjectModelList* Instance();
|
||||
|
||||
|
|
@ -112,9 +120,6 @@ public:
|
|||
MeasureAnalysisProjectModel* GetCurrentProjectModel();
|
||||
void SetCurrentProjectModel(const QString& project_name);
|
||||
|
||||
private:
|
||||
void intiProjectNodeStruce();
|
||||
|
||||
public:
|
||||
QStandardItem* GetItemFromIndex(const QModelIndex &index) const;
|
||||
QStandardItem* AddChildNode(QStandardItem *parent_item,
|
||||
|
|
@ -124,13 +129,20 @@ public:
|
|||
bool is_fixed = false);
|
||||
bool RemoveNode(QStandardItem *item);
|
||||
void SetNodeUserData(QStandardItem* item, const QVariant& data);
|
||||
QVariant GetNodeUserData(QStandardItem* item) const;
|
||||
QVariant GetNodeUserData(QStandardItem* item, UserDataType data_type = NodeType) const;
|
||||
void SetNodeStatus(QStandardItem* item, const QString& status);
|
||||
QString GetNodeStatus(QStandardItem* item) const;
|
||||
|
||||
private slots:
|
||||
void onChannelAddressCountProcessFinished(const QString& project_name);
|
||||
|
||||
private:
|
||||
void intiProjectNodeStruce();
|
||||
|
||||
private:
|
||||
explicit MeasureAnalysisProjectModelList(QObject *parent = nullptr);
|
||||
static MeasureAnalysisProjectModelList* _s_instance;
|
||||
|
||||
private:
|
||||
MeasureAnalysisProjectModel* _current_project_model;
|
||||
QMap<QString, MeasureAnalysisProjectModel*> _project_models;
|
||||
|
|
|
|||
|
|
@ -3,115 +3,124 @@
|
|||
#include "MeasureAnalysisDataTableView.h"
|
||||
#include "MeasureAnalysisParticleCountPlotView.h"
|
||||
|
||||
QMap<QString, MeasureAnalysisViewType> MeasureAnalysisView::_s_analyze_view_type_list {
|
||||
{ QStringLiteral(u"数据表视图"),
|
||||
MeasureAnalysisViewType::DataTable },
|
||||
{ QStringLiteral(u"计数谱视图"),
|
||||
MeasureAnalysisViewType::CountSpectrum },
|
||||
{ QStringLiteral(u"符合能谱谱三维分析视图"),
|
||||
MeasureAnalysisViewType::CoincidenceEnergySpectrum3D },
|
||||
{ QStringLiteral(u"计数率分析视图"),
|
||||
MeasureAnalysisViewType::CountingRate },
|
||||
{ QStringLiteral(u"峰拟合分析视图"),
|
||||
MeasureAnalysisViewType::EnergyPeakFit },
|
||||
{ QStringLiteral(u"核素分析视图"),
|
||||
MeasureAnalysisViewType::NuclideAnalysis },
|
||||
{ QStringLiteral(u"粒子入射时间分析视图"),
|
||||
MeasureAnalysisViewType::ParticleInTime },
|
||||
{ QStringLiteral(u"粒子时间差分析视图"),
|
||||
MeasureAnalysisViewType::ParticleTimeDiff },
|
||||
{ QStringLiteral(u"符合事件时间分析视图"),
|
||||
MeasureAnalysisViewType::CoincidenceEventTime },
|
||||
{ QStringLiteral(u"符合能谱分析视图"),
|
||||
MeasureAnalysisViewType::CoincidenceEnergySpectrum },
|
||||
{ QStringLiteral(u"反符合能谱分析视图"),
|
||||
MeasureAnalysisViewType::AntiCoincidenceSpectrum }
|
||||
};
|
||||
|
||||
MeasureAnalysisView *MeasureAnalysisView::NewAnalyzeView(const QString& view_type_text)
|
||||
MeasureAnalysisView *MeasureAnalysisView::NewAnalyzeView(AnalysisType view_type)
|
||||
{
|
||||
MeasureAnalysisView* new_view = nullptr;
|
||||
if (_s_analyze_view_type_list.contains(view_type_text)) {
|
||||
MeasureAnalysisViewType view_type = _s_analyze_view_type_list[view_type_text];
|
||||
switch (view_type) {
|
||||
case MeasureAnalysisViewType::DataTable: {
|
||||
new_view = new MeasureAnalysisDataTableView;
|
||||
} break;
|
||||
case MeasureAnalysisViewType::CountSpectrum: {
|
||||
new_view = new MeasureAnalysisParticleCountPlotView;
|
||||
} break;
|
||||
case MeasureAnalysisViewType::CoincidenceEnergySpectrum3D: {
|
||||
new_view = new MeasureAnalysisDataTableView;
|
||||
} break;
|
||||
case MeasureAnalysisViewType::CountingRate: {
|
||||
new_view = new MeasureAnalysisDataTableView;
|
||||
} break;
|
||||
case MeasureAnalysisViewType::EnergyPeakFit: {
|
||||
new_view = new MeasureAnalysisDataTableView;
|
||||
} break;
|
||||
case MeasureAnalysisViewType::NuclideAnalysis: {
|
||||
new_view = new MeasureAnalysisDataTableView;
|
||||
} break;
|
||||
case MeasureAnalysisViewType::ParticleInTime: {
|
||||
new_view = new MeasureAnalysisDataTableView;
|
||||
} break;
|
||||
case MeasureAnalysisViewType::ParticleTimeDiff: {
|
||||
new_view = new MeasureAnalysisDataTableView;
|
||||
} break;
|
||||
case MeasureAnalysisViewType::CoincidenceEventTime: {
|
||||
new_view = new MeasureAnalysisDataTableView;
|
||||
} break;
|
||||
case MeasureAnalysisViewType::CoincidenceEnergySpectrum: {
|
||||
new_view = new MeasureAnalysisDataTableView;
|
||||
} break;
|
||||
case MeasureAnalysisViewType::AntiCoincidenceSpectrum: {
|
||||
new_view = new MeasureAnalysisDataTableView;
|
||||
} break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
switch (view_type) {
|
||||
case AnalysisType::Project: {
|
||||
// new_view = new MeasureAnalysisDataTableView;
|
||||
// new_view->setDeleteOnClose(true);
|
||||
} break;
|
||||
case AnalysisType::DeviceParamsCfg: {
|
||||
// new_view = new MeasureAnalysisDataTableView;
|
||||
// new_view->setDeleteOnClose(true);
|
||||
} break;
|
||||
case AnalysisType::EnergyScale: {
|
||||
// new_view = new MeasureAnalysisDataTableView;
|
||||
// new_view->setDeleteOnClose(true);
|
||||
} break;
|
||||
case AnalysisType::EfficiencyScale: {
|
||||
// new_view = new MeasureAnalysisDataTableView;
|
||||
// new_view->setDeleteOnClose(true);
|
||||
} break;
|
||||
case AnalysisType::ParticleData: {
|
||||
new_view = new MeasureAnalysisDataTableView;
|
||||
new_view->setDeleteOnClose(true);
|
||||
} break;
|
||||
case AnalysisType::AddressCountData: {
|
||||
new_view = new MeasureAnalysisDataTableView;
|
||||
new_view->setDeleteOnClose(true);
|
||||
} break;
|
||||
case AnalysisType::EnergyCountData: {
|
||||
new_view = new MeasureAnalysisDataTableView;
|
||||
new_view->setDeleteOnClose(true);
|
||||
} break;
|
||||
case AnalysisType::ChannelEnergyCountData: {
|
||||
new_view = new MeasureAnalysisDataTableView;
|
||||
new_view->setDeleteOnClose(true);
|
||||
} break;
|
||||
case AnalysisType::CoincidenceParticleEnergyData: {
|
||||
new_view = new MeasureAnalysisDataTableView;
|
||||
new_view->setDeleteOnClose(true);
|
||||
} break;
|
||||
case AnalysisType::AddressCountSpectrumView: {
|
||||
new_view = new MeasureAnalysisParticleCountPlotView;
|
||||
new_view->setDeleteOnClose(false);
|
||||
} break;
|
||||
case AnalysisType::EneryCountSpectrumView: {
|
||||
// new_view = new MeasureAnalysisParticleCountPlotView;
|
||||
// new_view->setDeleteOnClose(false);
|
||||
} break;
|
||||
case AnalysisType::CoincidenceParticleEnergySpectrum2DView: {
|
||||
// new_view = new MeasureAnalysisDataTableView;
|
||||
// new_view->setDeleteOnClose(false);
|
||||
} break;
|
||||
case AnalysisType::CoincidenceParticleEnergySpectrum3DView: {
|
||||
// new_view = new MeasureAnalysisDataTableView;
|
||||
// new_view->setDeleteOnClose(false);
|
||||
} break;
|
||||
case AnalysisType::CountingRateView: {
|
||||
// new_view = new MeasureAnalysisDataTableView;
|
||||
// new_view->setDeleteOnClose(false);
|
||||
} break;
|
||||
case AnalysisType::EnergyPeakFitView: {
|
||||
// new_view = new MeasureAnalysisDataTableView;
|
||||
// new_view->setDeleteOnClose(false);
|
||||
} break;
|
||||
case AnalysisType::NuclideAnalysisView: {
|
||||
// new_view = new MeasureAnalysisDataTableView;
|
||||
// new_view->setDeleteOnClose(false);
|
||||
} break;
|
||||
case AnalysisType::ParticleInTimeView: {
|
||||
// new_view = new MeasureAnalysisDataTableView;
|
||||
// new_view->setDeleteOnClose(false);
|
||||
} break;
|
||||
case AnalysisType::ParticleTimeDiffView: {
|
||||
// new_view = new MeasureAnalysisParticleCountPlotView;
|
||||
// new_view->setDeleteOnClose(false);
|
||||
} break;
|
||||
case AnalysisType::CoincidenceEventTimeView: {
|
||||
// new_view = new MeasureAnalysisParticleCountPlotView;
|
||||
// new_view->setDeleteOnClose(false);
|
||||
} break;
|
||||
case AnalysisType::CoincidenceParticleEnergySpectrumView: {
|
||||
// new_view = new MeasureAnalysisDataTableView;
|
||||
// new_view->setDeleteOnClose(false);
|
||||
} break;
|
||||
case AnalysisType::AntiCoincidenceSpectrumView: {
|
||||
// new_view = new MeasureAnalysisDataTableView;
|
||||
// new_view->setDeleteOnClose(false);
|
||||
} break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if ( new_view ) {
|
||||
new_view->setAnalyzeType(view_type);
|
||||
}
|
||||
return new_view;
|
||||
}
|
||||
|
||||
const QString &MeasureAnalysisView::GetAnalyzeViewTypeText(MeasureAnalysisViewType type)
|
||||
{
|
||||
QString view_type_text;
|
||||
auto it_type = MeasureAnalysisView::_s_analyze_view_type_list.constBegin();
|
||||
auto it_type_end = MeasureAnalysisView::_s_analyze_view_type_list.constEnd();
|
||||
for (; it_type != it_type_end; ++it_type) {
|
||||
if (type == it_type.value()) {
|
||||
view_type_text = it_type.key();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return view_type_text;
|
||||
}
|
||||
|
||||
MeasureAnalysisView::MeasureAnalysisView(QWidget* parent)
|
||||
: QWidget { parent }
|
||||
{
|
||||
_view_type = MeasureAnalysisViewType::None;
|
||||
_analysis_type = AnalysisType::None;
|
||||
}
|
||||
|
||||
MeasureAnalysisViewType MeasureAnalysisView::GetAnalyzeViewType()
|
||||
AnalysisType MeasureAnalysisView::GetAnalyzeType()
|
||||
{
|
||||
return _analysis_type;
|
||||
}
|
||||
|
||||
bool MeasureAnalysisView::IsDeleteOnClose()
|
||||
{
|
||||
return _delete_on_close;
|
||||
}
|
||||
|
||||
MeasureAnalysisView::ViewType MeasureAnalysisView::GetViewType()
|
||||
{
|
||||
return _view_type;
|
||||
}
|
||||
|
||||
const QString &MeasureAnalysisView::GetAnalyzeViewTypeText() const
|
||||
{
|
||||
QString view_type_text;
|
||||
auto it_type = MeasureAnalysisView::_s_analyze_view_type_list.constBegin();
|
||||
auto it_type_end = MeasureAnalysisView::_s_analyze_view_type_list.constEnd();
|
||||
for (; it_type != it_type_end; ++it_type) {
|
||||
if (_view_type == it_type.value()) {
|
||||
view_type_text = it_type.key();
|
||||
}
|
||||
}
|
||||
return view_type_text;
|
||||
}
|
||||
|
||||
void MeasureAnalysisView::SetViewName(const QString &name)
|
||||
{
|
||||
this->_name = name;
|
||||
|
|
@ -132,9 +141,19 @@ const QString &MeasureAnalysisView::GetViewDescription() const
|
|||
return this->_description;
|
||||
}
|
||||
|
||||
void MeasureAnalysisView::setAnalyzeViewType(MeasureAnalysisViewType type)
|
||||
void MeasureAnalysisView::setAnalyzeType(AnalysisType type)
|
||||
{
|
||||
_view_type = type;
|
||||
_analysis_type = type;
|
||||
}
|
||||
|
||||
void MeasureAnalysisView::setDeleteOnClose(bool del)
|
||||
{
|
||||
_delete_on_close = del;
|
||||
}
|
||||
|
||||
void MeasureAnalysisView::setViewType(ViewType view_type)
|
||||
{
|
||||
_view_type = view_type;
|
||||
}
|
||||
|
||||
QDataStream& operator<<(QDataStream& out, const MeasureAnalysisView& view)
|
||||
|
|
|
|||
|
|
@ -6,36 +6,28 @@
|
|||
#include <QMap>
|
||||
#include <QVariantMap>
|
||||
#include <QWidget>
|
||||
#include "AnalysisTypeDefine.h"
|
||||
|
||||
enum class MeasureAnalysisViewType {
|
||||
None,
|
||||
DataTable,
|
||||
CountSpectrum,
|
||||
CoincidenceEnergySpectrum3D,
|
||||
CountingRate,
|
||||
EnergyPeakFit,
|
||||
NuclideAnalysis,
|
||||
ParticleInTime,
|
||||
ParticleTimeDiff,
|
||||
CoincidenceEventTime,
|
||||
CoincidenceEnergySpectrum,
|
||||
AntiCoincidenceSpectrum
|
||||
};
|
||||
|
||||
class MeasureAnalysisView : public QWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
static MeasureAnalysisView* NewAnalyzeView(const QString& view_type_text);
|
||||
static const QString& GetAnalyzeViewTypeText(MeasureAnalysisViewType type);
|
||||
private:
|
||||
static QMap<QString, MeasureAnalysisViewType> _s_analyze_view_type_list;
|
||||
|
||||
public:
|
||||
static MeasureAnalysisView* NewAnalyzeView(AnalysisType view_type);
|
||||
|
||||
public:
|
||||
enum ViewType {
|
||||
None,
|
||||
ConfigFrame,
|
||||
DataTable,
|
||||
PlotFrame
|
||||
};
|
||||
|
||||
explicit MeasureAnalysisView(QWidget* parent = nullptr);
|
||||
|
||||
MeasureAnalysisViewType GetAnalyzeViewType();
|
||||
const QString& GetAnalyzeViewTypeText() const;
|
||||
AnalysisType GetAnalyzeType();
|
||||
bool IsDeleteOnClose();
|
||||
ViewType GetViewType();
|
||||
void SetViewName(const QString& name);
|
||||
void SetViewDescription(const QString& description);
|
||||
const QString& GetViewName() const;
|
||||
|
|
@ -43,10 +35,14 @@ public:
|
|||
virtual void SetAnalyzeDataFilename(const QMap<QString, QVariant>& data_files_set) = 0;
|
||||
|
||||
protected:
|
||||
void setAnalyzeViewType(MeasureAnalysisViewType type);
|
||||
void setAnalyzeType(AnalysisType type);
|
||||
void setDeleteOnClose(bool del);
|
||||
void setViewType(ViewType view_type);
|
||||
|
||||
private:
|
||||
MeasureAnalysisViewType _view_type;
|
||||
bool _delete_on_close = true;
|
||||
AnalysisType _analysis_type = AnalysisType::None;
|
||||
ViewType _view_type = ViewType::None;
|
||||
QString _name;
|
||||
QString _description;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user