优化测量分析树分析节点状态显示

This commit is contained in:
徐海 2026-03-24 13:58:48 +08:00
parent 114e6843e3
commit ee794cfccc
2 changed files with 236 additions and 88 deletions

View File

@ -98,6 +98,11 @@ void MeasureAnalysisProjectModel::SetAllChannelEnergyTotalCountDataFilename(cons
this->_all_channel_energy_total_count_data_filename = filename;
}
void MeasureAnalysisProjectModel::SetParticleEnergyDataFilename(const QString &filename)
{
this->_particle_energy_data_filename = filename;
}
void MeasureAnalysisProjectModel::SetTimeWinConformParticleData(uint time_win, uint conform_particle_count, const QString& filename)
{
this->_time_win_conform_particle_data[time_win][conform_particle_count] = filename;
@ -221,6 +226,11 @@ const QString& MeasureAnalysisProjectModel::GetAllChannelEnergyTotalCountDataFil
return this->_all_channel_energy_total_count_data_filename;
}
const QString MeasureAnalysisProjectModel::GetParticleEnergyDataFilename() const
{
return this->_particle_energy_data_filename;
}
const QMap<uint, QString> MeasureAnalysisProjectModel::GetTimeWinConformParticleDataFilenameList(uint time_win) const
{
QMap<uint, QString> conform_particle_data;
@ -309,23 +319,19 @@ bool MeasureAnalysisProjectModel::LoadProjectModel(const QString& project_filena
this->_measure_device_params_cfg_filename = ProjectAbsFilename(json_obj["MeasureDeviceParamsCfgFilename"].toString());
this->_energy_scale_filename = ProjectAbsFilename(json_obj["EnergyScaleFilename"].toString());
this->_efficiency_scale_filename = ProjectAbsFilename(json_obj["EfficiencyScaleFilename"].toString());
this->_all_channel_particle_data_filename = ProjectAbsFilename(json_obj["AllChannelParticleDataFilename"].toString());
const auto& address_count_data_filename_list = json_obj["ChannelAddressCountDataFilenameList"].toObject().toVariantMap();
for (auto it = address_count_data_filename_list.constBegin(); it!=address_count_data_filename_list.constEnd(); ++it) {
uint channel_num = it.key().toUInt();
this->_channel_address_count_data_filename_list[channel_num] = ProjectAbsFilename(it.value().toString());
}
const auto& energy_count_data_filename_list = json_obj["ChannelEnergyCountDataFilenameList"].toObject().toVariantMap();
for (auto it = energy_count_data_filename_list.constBegin(); it!=energy_count_data_filename_list.constEnd(); ++it) {
uint channel_num = it.key().toUInt();
this->_channel_energy_count_data_filename_list[channel_num] = ProjectAbsFilename(it.value().toString());
}
this->_all_channel_energy_total_count_data_filename = ProjectAbsFilename(json_obj["AllChannelEnergyTotalCountDataFilename"].toString());
this->_particle_energy_data_filename = ProjectAbsFilename(json_obj["ParticleEnergyDataFilename"].toString());
const auto& time_win_conform_particle_data = json_obj["TimeWinConformParticleData"].toObject().toVariantMap();
for (auto it = time_win_conform_particle_data.constBegin(); it!=time_win_conform_particle_data.constEnd(); ++it) {
uint time_win = it.key().toUInt();
@ -337,7 +343,6 @@ bool MeasureAnalysisProjectModel::LoadProjectModel(const QString& project_filena
// }
this->_time_win_conform_particle_data[time_win] = conform_particle_data;
}
return true;
}
@ -391,6 +396,7 @@ bool MeasureAnalysisProjectModel::SaveProjectModel()
}
time_win_conform_particle_data[QString::number(it.key())] = conform_particle_data;
}
project_json_obj_map["ParticleEnergyDataFilename"] = ProjectRelativeFilename(this->_particle_energy_data_filename);
project_json_obj_map["TimeWinConformParticleData"] = time_win_conform_particle_data;
// 将项目模型保存到json文件
@ -536,8 +542,8 @@ QStandardItem* MeasureAnalysisProjectModelList::GetItemFromIndex(const QModelInd
}
QStandardItem* MeasureAnalysisProjectModelList::AddChildNode(
QStandardItem* parent_item, const QString& node_name, const QString& status,
const QVariant& user_data, bool is_fixed)
QStandardItem* parent_item, const QString& node_name, const QString& status_text,
const QVariant& user_data, bool is_fixed, bool state_ok)
{
if (!parent_item)
return nullptr;
@ -545,9 +551,15 @@ QStandardItem* MeasureAnalysisProjectModelList::AddChildNode(
QStandardItem* name_item = new QStandardItem(node_name);
name_item->setData(user_data, NodeType);
name_item->setData(is_fixed, Fixed);
QStandardItem* status_item = new QStandardItem(status);
QStandardItem* status_item = new QStandardItem(status_text);
status_item->setData(state_ok, Qt::UserRole);
if (state_ok) {
name_item->setForeground(Qt::black);
status_item->setForeground(Qt::black);
} else {
name_item->setForeground(Qt::gray);
status_item->setForeground(Qt::gray);
}
QList<QStandardItem*> row_items;
row_items << name_item << status_item;
parent_item->appendRow(row_items);
@ -593,7 +605,7 @@ QVariant MeasureAnalysisProjectModelList::GetNodeUserData(QStandardItem* item, U
return (item && item->column() == NameColumn) ? item->data(data_type) : QVariant();
}
void MeasureAnalysisProjectModelList::SetNodeStatus(QStandardItem* item, const QString& status)
void MeasureAnalysisProjectModelList::SetNodeStatus(QStandardItem* item, const QString& status, bool state_ok)
{
if (!item || item->column() != NameColumn)
return;
@ -602,17 +614,25 @@ void MeasureAnalysisProjectModelList::SetNodeStatus(QStandardItem* item, const Q
: invisibleRootItem()->child(item->row(), StatusColumn);
if (status_item) {
status_item->setText(status);
status_item->setData(state_ok, Qt::UserRole);
if (state_ok) {
status_item->setForeground(Qt::black);
} else {
status_item->setForeground(Qt::gray);
}
}
}
QString MeasureAnalysisProjectModelList::GetNodeStatus(QStandardItem* item) const
bool MeasureAnalysisProjectModelList::GetNodeStatus(QStandardItem* item) const
{
if (!item || item->column() != NameColumn)
return QString();
return false;
QStandardItem* status_item = item->parent()
? item->parent()->child(item->row(), StatusColumn)
: invisibleRootItem()->child(item->row(), StatusColumn);
return status_item ? status_item->text() : QString();
if ( !status_item )
return false;
return status_item->data(Qt::UserRole).toBool();
}
void MeasureAnalysisProjectModelList::ApplyEnergyScale(const QString &project_name)
@ -649,18 +669,15 @@ void MeasureAnalysisProjectModelList::onChannelAddressCountProcessFinished(bool
if (this->_project_models.contains(project_name)) {
auto pro_model = this->_project_models[project_name];
const QMap<uint, QString>& filename_list = pro_model->GetChannelAddressCountDataFilenameList();
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);
@ -671,23 +688,16 @@ void MeasureAnalysisProjectModelList::onChannelAddressCountProcessFinished(bool
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);
}
pro_model->SaveProjectModel();
}
}
void MeasureAnalysisProjectModelList::onEnergyScaleParticleDataFinished(bool ok, const QString &project_name, const QVariant &data)
{
}
void MeasureAnalysisProjectModelList::onEnergyCountProcessFinished(bool ok, const QString &project_name, const QVariant &data)
{
Q_UNUSED(data);
if ( !ok )
@ -725,9 +735,121 @@ void MeasureAnalysisProjectModelList::onEnergyCountProcessFinished(bool ok, cons
}
}
void MeasureAnalysisProjectModelList::onEnergyCountProcessFinished(bool ok, const QString &project_name, const QVariant &data)
{
Q_UNUSED(data);
if ( !ok )
return;
if (this->_project_models.contains(project_name)) {
auto pro_model = this->_project_models[project_name];
auto& node_map = this->_project_node_items[project_name];
bool status_ok = false;
QString status = QStringLiteral(u"无效");
const QString& energy_total_count_filename = pro_model->GetAllChannelEnergyTotalCountDataFilename();
if (!energy_total_count_filename.isEmpty()) {
status_ok = true;
status = QStringLiteral(u"有效");
const QString& energy_total_count_item_name = QStringLiteral(u"能量计数");
if (node_map.contains(energy_total_count_item_name)) {
auto energy_total_count_item = node_map[energy_total_count_item_name];
this->SetNodeStatus(energy_total_count_item, status, status_ok);
const QMap<uint, QString>& channel_energy_count_filename_list = pro_model->GetChannelEnergyCountDataFilenameList();
for (auto it = channel_energy_count_filename_list.constBegin(); it != channel_energy_count_filename_list.constEnd(); ++it) {
uint ch_num = it.key();
QString item_name = QStringLiteral(u"通道%1能量计数").arg(ch_num);
if ( !node_map.contains(item_name) ) {
const QVariant& analys_type = QVariant::fromValue(AnalysisType::EnergyCountData);
QStandardItem* node_item = AddChildNode(energy_total_count_item, item_name, status, analys_type, true, status_ok);
node_item->setData(project_name, ProjectName);
node_item->setData(ch_num, ChannelNum);
node_map[item_name] = node_item;
} else {
auto ch_energy_count_item = node_map[item_name];
this->SetNodeStatus(ch_energy_count_item, status, status_ok);
}
}
const auto& ch_energy_count_data_list = pro_model->GetChannelEnergyCountDataFilenameList();
if (!ch_energy_count_data_list.isEmpty()) {
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);
}
}
}
}
const QString& particle_energy_data_filename = pro_model->GetParticleEnergyDataFilename();
if (!particle_energy_data_filename.isEmpty()) {
status_ok = true;
status = QStringLiteral(u"有效");
const QString& count_rate_analysis_item_name = QStringLiteral(u"计数率分析");
if (node_map.contains(count_rate_analysis_item_name)) {
auto energy_total_count_spec_item = node_map[count_rate_analysis_item_name];
this->SetNodeStatus(energy_total_count_spec_item, status, status_ok);
}
const QString& peak_fit_analysis_item_name = QStringLiteral(u"峰拟合分析");
if (node_map.contains(peak_fit_analysis_item_name)) {
auto energy_total_count_spec_item = node_map[peak_fit_analysis_item_name];
this->SetNodeStatus(energy_total_count_spec_item, status, status_ok);
}
const QString& nuclide_analysis_item_name = QStringLiteral(u"核素分析");
if (node_map.contains(nuclide_analysis_item_name)) {
auto energy_total_count_spec_item = node_map[nuclide_analysis_item_name];
this->SetNodeStatus(energy_total_count_spec_item, status, status_ok);
}
const QString& particle_in_time_analysis_item_name = QStringLiteral(u"粒子入射时间分析");
if (node_map.contains(particle_in_time_analysis_item_name)) {
auto energy_total_count_spec_item = node_map[particle_in_time_analysis_item_name];
this->SetNodeStatus(energy_total_count_spec_item, status, status_ok);
}
}
pro_model->SaveProjectModel();
}
}
void MeasureAnalysisProjectModelList::onCoincidenceProcessFinished(bool ok, const QString &project_name, const QVariant &data)
{
Q_UNUSED(data);
if ( !ok )
return;
if (this->_project_models.contains(project_name)) {
auto pro_model = this->_project_models[project_name];
auto& node_map = this->_project_node_items[project_name];
bool status_ok = false;
QString status = QStringLiteral(u"无效");
uint conform_time_win = pro_model->GetConformTimeWin();
const auto& Conform_energy_data_filename_list = pro_model->GetTimeWinConformEnergyDataFilenameList(conform_time_win);
if (!Conform_energy_data_filename_list.isEmpty()) {
status_ok = true;
status = QStringLiteral(u"有效");
QString item_name = QStringLiteral(u"符合事件时间分析");
if (node_map.contains(item_name)) {
auto energy_total_count_item = node_map[item_name];
this->SetNodeStatus(energy_total_count_item, status, status_ok);
}
item_name = QStringLiteral(u"符合能谱[%1ns]").arg(conform_time_win);
if (node_map.contains(item_name)) {
auto energy_total_count_spec_item = node_map[item_name];
this->SetNodeStatus(energy_total_count_spec_item, status, status_ok);
}
item_name = QStringLiteral(u"反符合能谱[%1ns]").arg(conform_time_win);
if (node_map.contains(item_name)) {
auto energy_total_count_spec_item = node_map[item_name];
this->SetNodeStatus(energy_total_count_spec_item, status, status_ok);
}
item_name = QStringLiteral(u"二维符合能谱[%1ns]").arg(conform_time_win);
if (node_map.contains(item_name)) {
auto energy_total_count_spec_item = node_map[item_name];
this->SetNodeStatus(energy_total_count_spec_item, status, status_ok);
}
item_name = QStringLiteral(u"三维符合能谱[%1ns]").arg(conform_time_win);
if (node_map.contains(item_name)) {
auto energy_total_count_spec_item = node_map[item_name];
this->SetNodeStatus(energy_total_count_spec_item, status, status_ok);
}
}
pro_model->SaveProjectModel();
}
}
void MeasureAnalysisProjectModelList::intiProjectNodeStruce(MeasureAnalysisProjectModel* pro_model)
@ -742,57 +864,60 @@ void MeasureAnalysisProjectModelList::intiProjectNodeStruce(MeasureAnalysisProje
const QString& project_name = pro_model->GetProjectName();
QString status = 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);
QStandardItem* project_item = AddChildNode(root_item, project_name, status, analys_type, false, true);
project_item->setData(project_name, ProjectName);
node_map[project_name] = project_item;
// 测量控制
QString item_name = QStringLiteral(u"测量控制");
QStandardItem* measure_ctrl_item = AddChildNode(project_item, item_name, QString(), QVariant(), true);
QStandardItem* measure_ctrl_item = AddChildNode(project_item, item_name, QString(), QVariant(), true, true);
measure_ctrl_item->setData(project_name, ProjectName);
node_map[item_name] = measure_ctrl_item;
if (!pro_model->GetIsMeasureComplete()) {
const QString& measure_device_params_cfg_filename = pro_model->GetMeasureDeviceParamsCfgFilename();
status = measure_device_params_cfg_filename.isEmpty() ? QStringLiteral(u"未配置") : QStringLiteral(u"已配置");
bool state_ok = !measure_device_params_cfg_filename.isEmpty();
status = state_ok ? 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);
QStandardItem* node_item = AddChildNode(measure_ctrl_item, item_name, status, analys_type, true, state_ok);
node_item->setData(project_name, ProjectName);
node_map[item_name] = node_item;
}
status = pro_model->GetEnergyScaleFilename().isEmpty() ? QStringLiteral(u"未配置") : QStringLiteral(u"已配置");
state_ok = !pro_model->GetEnergyScaleFilename().isEmpty();
status = state_ok ? 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 = AddChildNode(measure_ctrl_item, item_name, status, analys_type, true, state_ok);
node_item->setData(project_name, ProjectName);
node_map[item_name] = node_item;
status = pro_model->GetEfficiencyScaleFilename().isEmpty() ? QStringLiteral(u"未配置") : QStringLiteral(u"已配置");
state_ok = !pro_model->GetEfficiencyScaleFilename().isEmpty();
status = state_ok ? 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 = AddChildNode(measure_ctrl_item, item_name, status, analys_type, true, state_ok);
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);
QStandardItem* analysis_data_item = AddChildNode(project_item, item_name, QString(), QVariant(), true, true);
analysis_data_item->setData(project_name, ProjectName);
node_map[item_name] = node_item;
status = pro_model->GetAllChannelParticleDataFilename().isEmpty() ? QStringLiteral(u"无效") : QStringLiteral(u"有效");
state_ok = !pro_model->GetAllChannelParticleDataFilename().isEmpty();
status = state_ok ? 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 = AddChildNode(analysis_data_item, item_name, status, analys_type, true, state_ok);
node_item->setData(project_name, ProjectName);
node_map[item_name] = node_item;
item_name = QStringLiteral(u"道址计数");
const auto& ch_addr_count_data_filename_list = pro_model->GetChannelAddressCountDataFilenameList();
status = ch_addr_count_data_filename_list.isEmpty() ? QStringLiteral(u"无效") : QStringLiteral(u"有效");
node_item = AddChildNode(analysis_data_item, item_name, status, QVariant(), true);
state_ok = !ch_addr_count_data_filename_list.isEmpty();
status = state_ok ? QStringLiteral(u"有效") : QStringLiteral(u"无效");
item_name = QStringLiteral(u"道址计数");
node_item = AddChildNode(analysis_data_item, item_name, status, QVariant(), true, state_ok);
node_item->setData(project_name, ProjectName);
node_map[item_name] = node_item;
QStandardItem* adrr_count_item = node_item;
@ -800,128 +925,147 @@ void MeasureAnalysisProjectModelList::intiProjectNodeStruce(MeasureAnalysisProje
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);
QStandardItem* node_item = AddChildNode(adrr_count_item, item_name, status, analys_type, true, state_ok);
node_item->setData(project_name, ProjectName);
node_item->setData(ch_num, ChannelNum);
node_map[item_name] = node_item;
}
state_ok = !pro_model->GetParticleEnergyDataFilename().isEmpty();
status = state_ok ? QStringLiteral(u"有效") : QStringLiteral(u"无效");
analys_type = QVariant::fromValue(AnalysisType::CoincidenceParticleEnergyData);
item_name = QStringLiteral(u"粒子能量数据");
node_item = AddChildNode(analysis_data_item, item_name, status, analys_type, true, state_ok);
node_item->setData(project_name, ProjectName);
node_map[item_name] = node_item;
state_ok = !pro_model->GetAllChannelEnergyTotalCountDataFilename().isEmpty();
status = state_ok ? QStringLiteral(u"有效") : QStringLiteral(u"无效");
item_name = QStringLiteral(u"能量计数");
status = pro_model->GetAllChannelEnergyTotalCountDataFilename().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 = AddChildNode(analysis_data_item, item_name, status, analys_type, true, state_ok);
node_item->setData(project_name, ProjectName);
node_map[item_name] = node_item;
QStandardItem* energy_count_item = node_item;
const auto& ch_energy_count_data_filename_list = pro_model->GetChannelEnergyCountDataFilenameList();
state_ok = !ch_energy_count_data_filename_list.isEmpty();
for (auto it = ch_energy_count_data_filename_list.begin(); it != ch_energy_count_data_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::EnergyCountData);
QStandardItem* node_item = AddChildNode(energy_count_item, item_name, status, analys_type, true);
QStandardItem* node_item = AddChildNode(energy_count_item, item_name, status, analys_type, true, state_ok);
node_item->setData(project_name, ProjectName);
node_item->setData(ch_num, ChannelNum);
node_map[item_name] = node_item;
}
uint conform_time_win = pro_model->GetConformTimeWin();
status = pro_model->GetTimeWinConformParticleDataFilenameList(conform_time_win).isEmpty() ? QStringLiteral(u"无效") : QStringLiteral(u"有效");
state_ok = !pro_model->GetTimeWinConformParticleDataFilenameList(conform_time_win).isEmpty();
status = state_ok ? 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 = AddChildNode(analysis_data_item, item_name, status, analys_type, true, state_ok);
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);
QStandardItem* interactive_analysis_item = AddChildNode(project_item, item_name, QString(), QVariant(), true, true);
interactive_analysis_item->setData(project_name, ProjectName);
node_map[item_name] = interactive_analysis_item;
status = pro_model->GetChannelAddressCountDataFilenameList().isEmpty() ? QStringLiteral(u"无效") : QStringLiteral(u"有效");
state_ok = !pro_model->GetChannelAddressCountDataFilenameList().isEmpty();
status = state_ok ? 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 = AddChildNode(interactive_analysis_item, item_name, status, analys_type, true, state_ok);
node_item->setData(project_name, ProjectName);
node_map[item_name] = node_item;
status = pro_model->GetChannelEnergyCountDataFilenameList().isEmpty() ? QStringLiteral(u"无效") : QStringLiteral(u"有效");
analys_type = QVariant::fromValue(AnalysisType::EnergyCountSpectrumView);
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 = pro_model->GetAllChannelEnergyTotalCountDataFilename().isEmpty() ? QStringLiteral(u"无效") : QStringLiteral(u"有效");
state_ok = !pro_model->GetAllChannelEnergyTotalCountDataFilename().isEmpty();
state_ok &= pro_model->GetChannelEnergyCountDataFilenameList().isEmpty();
status = state_ok ? QStringLiteral(u"有效") : QStringLiteral(u"无效");
analys_type = QVariant::fromValue(AnalysisType::EnergyCountSpectrumView);
item_name = QStringLiteral(u"能量计数谱");
node_item = AddChildNode(interactive_analysis_item, item_name, status, analys_type, true);
node_item = AddChildNode(interactive_analysis_item, item_name, status, analys_type, true, state_ok);
node_item->setData(project_name, ProjectName);
node_map[item_name] = node_item;
status = pro_model->GetAllChannelParticleDataFilename().isEmpty() ? QStringLiteral(u"无效") : QStringLiteral(u"有效");
state_ok = !pro_model->GetParticleEnergyDataFilename().isEmpty();
status = state_ok ? 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 = AddChildNode(interactive_analysis_item, item_name, status, analys_type, true, state_ok);
node_item->setData(project_name, ProjectName);
node_map[item_name] = node_item;
status = pro_model->GetAllChannelEnergyTotalCountDataFilename().isEmpty() ? QStringLiteral(u"无效") : QStringLiteral(u"有效");
state_ok = !pro_model->GetParticleEnergyDataFilename().isEmpty();
status = state_ok ? 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 = AddChildNode(interactive_analysis_item, item_name, status, analys_type, true, state_ok);
node_item->setData(project_name, ProjectName);
node_map[item_name] = node_item;
status = pro_model->GetAllChannelEnergyTotalCountDataFilename().isEmpty() ? QStringLiteral(u"无效") : QStringLiteral(u"有效");
state_ok = !pro_model->GetParticleEnergyDataFilename().isEmpty();
status = state_ok ? 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 = AddChildNode(interactive_analysis_item, item_name, status, analys_type, true, state_ok);
node_item->setData(project_name, ProjectName);
node_map[item_name] = node_item;
status = pro_model->GetAllChannelParticleDataFilename().isEmpty() ? QStringLiteral(u"无效") : QStringLiteral(u"有效");
state_ok = !pro_model->GetParticleEnergyDataFilename().isEmpty();
status = state_ok ? 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 = AddChildNode(interactive_analysis_item, item_name, status, analys_type, true, state_ok);
node_item->setData(project_name, ProjectName);
node_map[item_name] = node_item;
status = pro_model->GetAllChannelParticleDataFilename().isEmpty() ? QStringLiteral(u"无效") : QStringLiteral(u"有效");
state_ok = !pro_model->GetAllChannelParticleDataFilename().isEmpty();
status = state_ok ? 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 = AddChildNode(interactive_analysis_item, item_name, status, analys_type, true, state_ok);
node_item->setData(project_name, ProjectName);
node_map[item_name] = node_item;
status = pro_model->GetTimeWinConformParticleDataFilenameList(conform_time_win).isEmpty() ? QStringLiteral(u"无效") : QStringLiteral(u"有效");
state_ok = !pro_model->GetTimeWinConformEnergyDataFilenameList(conform_time_win).isEmpty();
status = state_ok ? 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 = AddChildNode(interactive_analysis_item, item_name, status, analys_type, true, state_ok);
node_item->setData(project_name, ProjectName);
node_map[item_name] = node_item;
state_ok = !pro_model->GetTimeWinConformEnergyDataFilenameList(conform_time_win).isEmpty();
status = state_ok ? QStringLiteral(u"有效") : QStringLiteral(u"无效");
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 = AddChildNode(interactive_analysis_item, item_name, status, analys_type, true, state_ok);
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 = AddChildNode(interactive_analysis_item, item_name, status, analys_type, true, state_ok);
node_item->setData(project_name, ProjectName);
node_map[item_name] = node_item;
state_ok = !pro_model->GetTimeWinConformEnergyDataFilenameList(conform_time_win).isEmpty();
status = state_ok ? QStringLiteral(u"有效") : QStringLiteral(u"无效");
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 = AddChildNode(interactive_analysis_item, item_name, status, analys_type, true, state_ok);
node_item->setData(project_name, ProjectName);
node_map[item_name] = node_item;
state_ok = !pro_model->GetTimeWinConformEnergyDataFilenameList(conform_time_win).isEmpty();
status = state_ok ? QStringLiteral(u"有效") : QStringLiteral(u"无效");
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 = AddChildNode(interactive_analysis_item, item_name, status, analys_type, true, state_ok);
node_item->setData(project_name, ProjectName);
node_map[item_name] = node_item;

View File

@ -37,6 +37,7 @@ public:
// void SetAllChannelParticleTotalCountDataFilename(const QString& filename);
void SetChannelEnergyCountDataFilename(uint channel, const QString& filename);
void SetAllChannelEnergyTotalCountDataFilename(const QString& filename);
void SetParticleEnergyDataFilename(const QString& filename);
void SetTimeWinConformParticleData(uint time_win, uint conform_particle_count, const QString& filename);
void SetTimeWinConformEnergyData(uint time_win, uint conform_particle_count, const QString& filename);
void SetAnalysisCustomData(AnalysisType analysis_type, const QString& data_item_name, const QString& data_filename);
@ -61,6 +62,7 @@ public:
const QMap<uint, QString>& GetChannelEnergyCountDataFilenameList() const;
const QString GetChannelEnergyCountDataFilename(uint channel) const;
const QString& GetAllChannelEnergyTotalCountDataFilename() const;
const QString GetParticleEnergyDataFilename() const;
const QMap<uint, QString> GetTimeWinConformParticleDataFilenameList(uint time_win) const;
const QMap<uint, QString> GetTimeWinConformEnergyDataFilenameList(uint time_win) const;
const QString GetAnalysisCustomData(AnalysisType analysis_type, const QString& data_item_name);
@ -84,6 +86,7 @@ private:
// QString _all_channel_particle_total_count_data_filename;
QMap<uint, QString> _channel_energy_count_data_filename_list;
QString _all_channel_energy_total_count_data_filename;
QString _particle_energy_data_filename;
QMap<uint, QMap<uint, QString> > _time_win_conform_particle_data;
QMap<uint, QMap<uint, QString> > _time_win_conform_energy_data;
QMap<AnalysisType, QMap<QString, QString> > _analysis_custom_data_set;
@ -125,14 +128,15 @@ public:
QStandardItem* GetItemFromIndex(const QModelIndex &index) const;
QStandardItem* AddChildNode(QStandardItem *parent_item,
const QString &node_name,
const QString &status = QString(),
const QString &status_text = QString(),
const QVariant &user_data = QVariant(),
bool is_fixed = false);
bool is_fixed = false,
bool state_ok = false);
bool RemoveNode(QStandardItem *item);
void SetNodeUserData(QStandardItem* item, const QVariant& data);
QVariant GetNodeUserData(QStandardItem* item, UserDataType data_type = NodeType) const;
void SetNodeStatus(QStandardItem* item, const QString& status);
QString GetNodeStatus(QStandardItem* item) const;
void SetNodeStatus(QStandardItem* item, const QString& status, bool state_ok = false);
bool GetNodeStatus(QStandardItem* item) const;
void ApplyEnergyScale(const QString& project_name);