1、完善框架;2、添加qcustomplot;3、处理csv中文路径问题
This commit is contained in:
parent
ceb16887f2
commit
259c798b5d
35529
3rdlib/qcustomplot/qcustomplot.cpp
Normal file
35529
3rdlib/qcustomplot/qcustomplot.cpp
Normal file
File diff suppressed because it is too large
Load Diff
7774
3rdlib/qcustomplot/qcustomplot.h
Normal file
7774
3rdlib/qcustomplot/qcustomplot.h
Normal file
File diff suppressed because it is too large
Load Diff
3
3rdlib/qcustomplot/qcustomplot.pri
Normal file
3
3rdlib/qcustomplot/qcustomplot.pri
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
INCLUDEPATH += $${PWD}
|
||||||
|
HEADERS += $${PWD}/qcustomplot.h
|
||||||
|
SOURCES += $${PWD}/qcustomplot.cpp
|
||||||
|
|
@ -1,16 +1,16 @@
|
||||||
#include "DataProcessWorkPool.h"
|
#include "DataProcessWorkPool.h"
|
||||||
#include <QThreadPool>
|
|
||||||
#include <QDir>
|
|
||||||
#include "MeasureAnalysisProjectModel.h"
|
#include "MeasureAnalysisProjectModel.h"
|
||||||
#include "OutputInfoDefine.h"
|
#include "GlobalDefine.h"
|
||||||
#include "csv.h"
|
#include "csv.h"
|
||||||
#include <fstream>
|
#include <QDir>
|
||||||
#include <vector>
|
#include <QThreadPool>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <queue>
|
#include <fstream>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <queue>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
using namespace DataProcessWorkPool;
|
using namespace DataProcessWorkPool;
|
||||||
using namespace io;
|
using namespace io;
|
||||||
|
|
@ -26,13 +26,11 @@ void ParticleDataTask::SetFinishedNotifier(QObject* finished_notifier, const cha
|
||||||
this->_project_name = project_name;
|
this->_project_name = project_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const QString& ParticleDataTask::GetAllChannelParticleDataFilename() const
|
const QString& ParticleDataTask::GetAllChannelParticleDataFilename() const
|
||||||
{
|
{
|
||||||
return this->_all_channel_particle_data_filename;
|
return this->_all_channel_particle_data_filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const QString& ParticleDataTask::GetProjectName() const
|
const QString& ParticleDataTask::GetProjectName() const
|
||||||
{
|
{
|
||||||
return this->_project_name;
|
return this->_project_name;
|
||||||
|
|
@ -50,10 +48,7 @@ QObject* ParticleDataTask::GetFinishedNotifier() const
|
||||||
|
|
||||||
bool ParticleDataTask::IsValidSetWorkParameters() const
|
bool ParticleDataTask::IsValidSetWorkParameters() const
|
||||||
{
|
{
|
||||||
return (!GetAllChannelParticleDataFilename().isEmpty()) &&
|
return (!GetAllChannelParticleDataFilename().isEmpty()) && (!GetProjectName().isEmpty());
|
||||||
(GetFinishedNotifier() != nullptr) &&
|
|
||||||
(!GetProjectName().isEmpty()) &&
|
|
||||||
(GetFinishedNotifierProcess() != nullptr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ParticleDataTask::StartTask()
|
void ParticleDataTask::StartTask()
|
||||||
|
|
@ -67,11 +62,13 @@ void ParticleDataTask::run()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!processEveryChannelParticleData()) {
|
if (!processEveryChannelParticleData()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QMetaObject::invokeMethod(_finished_notifier, _finished_notifier_process, Qt::QueuedConnection, Q_ARG(QString, _project_name));
|
if ((GetFinishedNotifier() != nullptr) && (GetFinishedNotifierProcess() != nullptr)) {
|
||||||
|
QMetaObject::invokeMethod(_finished_notifier, _finished_notifier_process, Qt::QueuedConnection, Q_ARG(QString, _project_name));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EveryChannelParticleDataSeparateTask::SetResultDataDir(const QString& result_data_dir)
|
void EveryChannelParticleDataSeparateTask::SetResultDataDir(const QString& result_data_dir)
|
||||||
|
|
@ -113,8 +110,8 @@ bool EveryChannelParticleDataSeparateTask::processEveryChannelParticleData()
|
||||||
io::trim_chars<' ', '\t'>,
|
io::trim_chars<' ', '\t'>,
|
||||||
io::double_quote_escape<',', '"'>,
|
io::double_quote_escape<',', '"'>,
|
||||||
io::throw_on_overflow,
|
io::throw_on_overflow,
|
||||||
io::empty_line_comment
|
io::empty_line_comment>
|
||||||
> reader(all_channel_particle_data_filename.toStdString());
|
reader(QStrToSysPath(all_channel_particle_data_filename));
|
||||||
reader.read_header(io::ignore_extra_column, board_id_str, channel_id_str, address_str, time_str);
|
reader.read_header(io::ignore_extra_column, board_id_str, channel_id_str, address_str, time_str);
|
||||||
uint board_id;
|
uint board_id;
|
||||||
uint channel_id;
|
uint channel_id;
|
||||||
|
|
@ -129,11 +126,10 @@ bool EveryChannelParticleDataSeparateTask::processEveryChannelParticleData()
|
||||||
particle_data_filename_list.insert(channel_num, particle_data_filename);
|
particle_data_filename_list.insert(channel_num, particle_data_filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !ch_particle_data_of_list.contains(channel_num) ) {
|
if (!ch_particle_data_of_list.contains(channel_num)) {
|
||||||
std::shared_ptr<std::ofstream> out(
|
std::shared_ptr<std::ofstream> out(
|
||||||
new std::ofstream(particle_data_filename.toStdString(), std::ios::out | std::ios::app),
|
new std::ofstream(QStrToSysPath(particle_data_filename), std::ios::out | std::ios::app),
|
||||||
[](std::ofstream* p){p->close();}
|
[](std::ofstream* p) { p->close(); });
|
||||||
);
|
|
||||||
*out << QString(QStringLiteral(u"板卡号,通道号,道址,时间计数")).toStdString() << std::endl;
|
*out << QString(QStringLiteral(u"板卡号,通道号,道址,时间计数")).toStdString() << std::endl;
|
||||||
ch_particle_data_of_list.insert(channel_num, out);
|
ch_particle_data_of_list.insert(channel_num, out);
|
||||||
}
|
}
|
||||||
|
|
@ -166,31 +162,29 @@ bool EveryChannelParticleDataSeparateTask::processEveryChannelParticleData()
|
||||||
return ret_ok;
|
return ret_ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EveryChannelParticleCountDataTask::SetAllChannelCountResultDir(const QString &dir_path)
|
void EveryChannelParticleCountDataTask::SetAllChannelCountResultDir(const QString& dir_path)
|
||||||
{
|
{
|
||||||
this->_all_ch_count_dir = dir_path;
|
this->_all_ch_count_dir = dir_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString &EveryChannelParticleCountDataTask::GetAllChannelCountResultDir() const
|
const QString& EveryChannelParticleCountDataTask::GetAllChannelCountResultDir() const
|
||||||
{
|
{
|
||||||
return this->_all_ch_count_dir;
|
return this->_all_ch_count_dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EveryChannelParticleCountDataTask::SetEveryChannelCountResultDir(const QString &dir_path)
|
void EveryChannelParticleCountDataTask::SetEveryChannelCountResultDir(const QString& dir_path)
|
||||||
{
|
{
|
||||||
this->_every_ch_count_dir = dir_path;
|
this->_every_ch_count_dir = dir_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString &EveryChannelParticleCountDataTask::GetEveryChannelCountResultDir() const
|
const QString& EveryChannelParticleCountDataTask::GetEveryChannelCountResultDir() const
|
||||||
{
|
{
|
||||||
return this->_every_ch_count_dir;
|
return this->_every_ch_count_dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EveryChannelParticleCountDataTask::IsValidSetWorkParameters() const
|
bool EveryChannelParticleCountDataTask::IsValidSetWorkParameters() const
|
||||||
{
|
{
|
||||||
return (!GetAllChannelCountResultDir().isEmpty()) &&
|
return (!GetAllChannelCountResultDir().isEmpty()) && (!GetEveryChannelCountResultDir().isEmpty()) && ParticleDataTask::IsValidSetWorkParameters();
|
||||||
(!GetEveryChannelCountResultDir().isEmpty()) &&
|
|
||||||
ParticleDataTask::IsValidSetWorkParameters();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EveryChannelParticleCountDataTask::processEveryChannelParticleData()
|
bool EveryChannelParticleCountDataTask::processEveryChannelParticleData()
|
||||||
|
|
@ -227,8 +221,8 @@ bool EveryChannelParticleCountDataTask::processEveryChannelParticleData()
|
||||||
io::trim_chars<' ', '\t'>,
|
io::trim_chars<' ', '\t'>,
|
||||||
io::double_quote_escape<',', '"'>,
|
io::double_quote_escape<',', '"'>,
|
||||||
io::throw_on_overflow,
|
io::throw_on_overflow,
|
||||||
io::empty_line_comment
|
io::empty_line_comment>
|
||||||
> reader(all_channel_particle_data_filename.toStdString());
|
reader(QStrToSysPath(all_channel_particle_data_filename));
|
||||||
reader.read_header(io::ignore_extra_column, board_id_str, channel_id_str, address_str, time_str);
|
reader.read_header(io::ignore_extra_column, board_id_str, channel_id_str, address_str, time_str);
|
||||||
uint board_id;
|
uint board_id;
|
||||||
uint channel_id;
|
uint channel_id;
|
||||||
|
|
@ -258,7 +252,7 @@ bool EveryChannelParticleCountDataTask::processEveryChannelParticleData()
|
||||||
particle_count_filename_list.insert(channel_num, count_data_filename);
|
particle_count_filename_list.insert(channel_num, count_data_filename);
|
||||||
|
|
||||||
// 创建文件流
|
// 创建文件流
|
||||||
std::shared_ptr<std::ofstream> out(new std::ofstream(count_data_filename.toStdString()));
|
std::shared_ptr<std::ofstream> out(new std::ofstream( QStrToSysPath(count_data_filename)));
|
||||||
channel_file_streams[channel_num] = out;
|
channel_file_streams[channel_num] = out;
|
||||||
*out << QString(QStringLiteral(u"道址")).toStdString() << "," << QString(QStringLiteral(u"计数")).toStdString() << std::endl;
|
*out << QString(QStringLiteral(u"道址")).toStdString() << "," << QString(QStringLiteral(u"计数")).toStdString() << std::endl;
|
||||||
}
|
}
|
||||||
|
|
@ -281,7 +275,7 @@ bool EveryChannelParticleCountDataTask::processEveryChannelParticleData()
|
||||||
|
|
||||||
// 写入所有通道的粒子计数数据
|
// 写入所有通道的粒子计数数据
|
||||||
all_channel_total_count_filename = all_ch_count_output_dir.filePath("AllChannelParticleTotalCountData.csv");
|
all_channel_total_count_filename = all_ch_count_output_dir.filePath("AllChannelParticleTotalCountData.csv");
|
||||||
std::ofstream all_channel_out(all_channel_total_count_filename.toStdString());
|
std::ofstream all_channel_out(QStrToSysPath(all_channel_total_count_filename));
|
||||||
all_channel_out << QString(QStringLiteral(u"道址")).toStdString() << "," << QString(QStringLiteral(u"计数")).toStdString() << std::endl;
|
all_channel_out << QString(QStringLiteral(u"道址")).toStdString() << "," << QString(QStringLiteral(u"计数")).toStdString() << std::endl;
|
||||||
|
|
||||||
for (auto address_it = all_channel_address_counts.begin(); address_it != all_channel_address_counts.end(); ++address_it) {
|
for (auto address_it = all_channel_address_counts.begin(); address_it != all_channel_address_counts.end(); ++address_it) {
|
||||||
|
|
@ -345,12 +339,14 @@ struct CsvRow {
|
||||||
unsigned long long time;
|
unsigned long long time;
|
||||||
size_t chunk_index;
|
size_t chunk_index;
|
||||||
|
|
||||||
bool operator<(const CsvRow& other) const {
|
bool operator<(const CsvRow& other) const
|
||||||
|
{
|
||||||
return time > other.time;
|
return time > other.time;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
std::vector<std::string> splitFile(const std::string& inputFile, size_t chunkSize) {
|
std::vector<std::string> splitFile(const std::string& input_file, size_t chunk_size)
|
||||||
|
{
|
||||||
std::vector<std::string> chunks;
|
std::vector<std::string> chunks;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
@ -358,8 +354,14 @@ std::vector<std::string> splitFile(const std::string& inputFile, size_t chunkSiz
|
||||||
std::string channel_id_str = QString(QStringLiteral(u"通道号")).toStdString();
|
std::string channel_id_str = QString(QStringLiteral(u"通道号")).toStdString();
|
||||||
std::string address_str = QString(QStringLiteral(u"道址")).toStdString();
|
std::string address_str = QString(QStringLiteral(u"道址")).toStdString();
|
||||||
std::string time_str = QString(QStringLiteral(u"时间计数")).toStdString();
|
std::string time_str = QString(QStringLiteral(u"时间计数")).toStdString();
|
||||||
// Use csv.h to read the file
|
|
||||||
io::CSVReader<4, io::trim_chars<' ', '\t'>, io::double_quote_escape<',', '"'>, io::throw_on_overflow, io::empty_line_comment> reader(inputFile);
|
io::CSVReader<
|
||||||
|
4,
|
||||||
|
io::trim_chars<' ', '\t'>,
|
||||||
|
io::double_quote_escape<',', '"'>,
|
||||||
|
io::throw_on_overflow,
|
||||||
|
io::empty_line_comment
|
||||||
|
> reader(input_file);
|
||||||
reader.read_header(io::ignore_extra_column, board_id_str, channel_id_str, address_str, time_str);
|
reader.read_header(io::ignore_extra_column, board_id_str, channel_id_str, address_str, time_str);
|
||||||
|
|
||||||
int chunkIndex = 0;
|
int chunkIndex = 0;
|
||||||
|
|
@ -381,25 +383,23 @@ std::vector<std::string> splitFile(const std::string& inputFile, size_t chunkSiz
|
||||||
row.time = time;
|
row.time = time;
|
||||||
|
|
||||||
// Estimate row size
|
// Estimate row size
|
||||||
currentSize += std::to_string(board_id).size() +
|
currentSize += std::to_string(board_id).size() + std::to_string(channel_id).size() + std::to_string(address).size() + std::to_string(time).size() + 4; // +4 for commas
|
||||||
std::to_string(channel_id).size() +
|
|
||||||
std::to_string(address).size() +
|
|
||||||
std::to_string(time).size() + 4; // +4 for commas
|
|
||||||
|
|
||||||
if (currentSize > chunkSize && !rows.empty()) {
|
if (currentSize > chunk_size && !rows.empty()) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
rows.push_back(row);
|
rows.push_back(row);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rows.empty()) break;
|
if (rows.empty())
|
||||||
|
break;
|
||||||
|
|
||||||
std::sort(rows.begin(), rows.end(), [](const CsvRow& a, const CsvRow& b) {
|
std::sort(rows.begin(), rows.end(), [](const CsvRow& a, const CsvRow& b) {
|
||||||
return a.time < b.time;
|
return a.time < b.time;
|
||||||
});
|
});
|
||||||
|
|
||||||
std::string chunkFile = inputFile + ".chunk" + std::to_string(chunkIndex);
|
std::string chunkFile = input_file + ".chunk" + std::to_string(chunkIndex);
|
||||||
std::ofstream outFile(chunkFile);
|
std::ofstream outFile(chunkFile);
|
||||||
for (const auto& row : rows) {
|
for (const auto& row : rows) {
|
||||||
outFile << row.board_id << "," << row.channel_id << "," << row.address << "," << row.time << "\n";
|
outFile << row.board_id << "," << row.channel_id << "," << row.address << "," << row.time << "\n";
|
||||||
|
|
@ -416,7 +416,8 @@ std::vector<std::string> splitFile(const std::string& inputFile, size_t chunkSiz
|
||||||
return chunks;
|
return chunks;
|
||||||
}
|
}
|
||||||
|
|
||||||
void mergeChunks(const std::vector<std::string>& chunks, const std::string& outputFile) {
|
void mergeChunks(const std::vector<std::string>& chunks, const std::string& output_file)
|
||||||
|
{
|
||||||
std::vector<std::unique_ptr<io::CSVReader<4>>> chunkReaders;
|
std::vector<std::unique_ptr<io::CSVReader<4>>> chunkReaders;
|
||||||
std::priority_queue<CsvRow> minHeap;
|
std::priority_queue<CsvRow> minHeap;
|
||||||
|
|
||||||
|
|
@ -446,7 +447,7 @@ void mergeChunks(const std::vector<std::string>& chunks, const std::string& outp
|
||||||
std::string channel_id_str = QString(QStringLiteral(u"通道号")).toStdString();
|
std::string channel_id_str = QString(QStringLiteral(u"通道号")).toStdString();
|
||||||
std::string address_str = QString(QStringLiteral(u"道址")).toStdString();
|
std::string address_str = QString(QStringLiteral(u"道址")).toStdString();
|
||||||
std::string time_str = QString(QStringLiteral(u"时间计数")).toStdString();
|
std::string time_str = QString(QStringLiteral(u"时间计数")).toStdString();
|
||||||
std::ofstream outFile(outputFile);
|
std::ofstream outFile(output_file);
|
||||||
outFile << board_id_str << "," << channel_id_str << "," << address_str << "," << time_str << "\n";
|
outFile << board_id_str << "," << channel_id_str << "," << address_str << "," << time_str << "\n";
|
||||||
|
|
||||||
while (!minHeap.empty()) {
|
while (!minHeap.empty()) {
|
||||||
|
|
@ -495,19 +496,19 @@ bool ParticleDataSortTask::processEveryChannelParticleData()
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const size_t CHUNK_SIZE = 100 * 1024 * 1024; // 100MB chunks
|
const size_t CHUNK_SIZE = 100 * 1024 * 1024; // 100MB chunks
|
||||||
std::vector<std::string> chunks = splitFile(all_channel_particle_data_filename.toStdString(), CHUNK_SIZE);
|
std::vector<std::string> chunks = splitFile(QStrToSysPath(all_channel_particle_data_filename), CHUNK_SIZE);
|
||||||
|
|
||||||
if (chunks.empty()) {
|
if (chunks.empty()) {
|
||||||
std::ifstream inFile(all_channel_particle_data_filename.toStdString());
|
std::ifstream in_file(QStrToSysPath(all_channel_particle_data_filename));
|
||||||
std::ofstream outFile(sorted_output_filename.toStdString());
|
std::ofstream out_file(QStrToSysPath(sorted_output_filename));
|
||||||
std::string line;
|
std::string line;
|
||||||
while (std::getline(inFile, line)) {
|
while (std::getline(in_file, line)) {
|
||||||
outFile << line << "\n";
|
out_file << line << "\n";
|
||||||
}
|
}
|
||||||
inFile.close();
|
in_file.close();
|
||||||
outFile.close();
|
out_file.close();
|
||||||
} else {
|
} else {
|
||||||
mergeChunks(chunks, sorted_output_filename.toStdString());
|
mergeChunks(chunks, QStrToSysPath(sorted_output_filename));
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (const std::exception& e) {
|
} catch (const std::exception& e) {
|
||||||
|
|
|
||||||
|
|
@ -22,16 +22,16 @@
|
||||||
<widget class="QTableWidget" name="tablew_scale_data">
|
<widget class="QTableWidget" name="tablew_scale_data">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>280</x>
|
<x>190</x>
|
||||||
<y>330</y>
|
<y>420</y>
|
||||||
<width>256</width>
|
<width>621</width>
|
||||||
<height>230</height>
|
<height>101</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>0</width>
|
<width>0</width>
|
||||||
<height>230</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<attribute name="horizontalHeaderCascadingSectionResizes">
|
<attribute name="horizontalHeaderCascadingSectionResizes">
|
||||||
|
|
@ -78,57 +78,50 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>20</x>
|
<x>20</x>
|
||||||
<y>10</y>
|
<y>10</y>
|
||||||
<width>171</width>
|
<width>151</width>
|
||||||
<height>451</height>
|
<height>531</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>能量刻度管理列表</string>
|
<string>能量刻度管理列表</string>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QListWidget" name="listWidget">
|
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||||
<property name="geometry">
|
<item>
|
||||||
<rect>
|
<widget class="QTreeWidget" name="treeWidget">
|
||||||
<x>20</x>
|
<column>
|
||||||
<y>20</y>
|
<property name="text">
|
||||||
<width>141</width>
|
<string notr="true">1</string>
|
||||||
<height>192</height>
|
</property>
|
||||||
</rect>
|
</column>
|
||||||
</property>
|
</widget>
|
||||||
</widget>
|
</item>
|
||||||
<widget class="QPushButton" name="pushButton_4">
|
<item>
|
||||||
<property name="geometry">
|
<layout class="QHBoxLayout" name="horizontalLayout_9">
|
||||||
<rect>
|
<item>
|
||||||
<x>10</x>
|
<widget class="QPushButton" name="pushButton_4">
|
||||||
<y>410</y>
|
<property name="text">
|
||||||
<width>75</width>
|
<string>添加</string>
|
||||||
<height>24</height>
|
</property>
|
||||||
</rect>
|
</widget>
|
||||||
</property>
|
</item>
|
||||||
<property name="text">
|
<item>
|
||||||
<string>添加</string>
|
<widget class="QPushButton" name="pushButton_5">
|
||||||
</property>
|
<property name="text">
|
||||||
</widget>
|
<string>删除</string>
|
||||||
<widget class="QPushButton" name="pushButton_5">
|
</property>
|
||||||
<property name="geometry">
|
</widget>
|
||||||
<rect>
|
</item>
|
||||||
<x>90</x>
|
</layout>
|
||||||
<y>410</y>
|
</item>
|
||||||
<width>75</width>
|
</layout>
|
||||||
<height>24</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>删除</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="">
|
<widget class="QWidget" name="layoutWidget">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>191</x>
|
<x>191</x>
|
||||||
<y>9</y>
|
<y>9</y>
|
||||||
<width>631</width>
|
<width>631</width>
|
||||||
<height>314</height>
|
<height>338</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,25 @@
|
||||||
#ifndef OUTPUTINFODEFINE_H
|
#ifndef GLOBALDEFINE_H
|
||||||
#define OUTPUTINFODEFINE_H
|
#define GLOBALDEFINE_H
|
||||||
|
|
||||||
#include "MainWindow.h"
|
#include "MainWindow.h"
|
||||||
#include "QsLog.h"
|
#include "QsLog.h"
|
||||||
|
#include <QTextCodec>
|
||||||
|
|
||||||
|
// 转换Qt字符串路径为系统编码的C字符串(解决中文路径问题)
|
||||||
|
static const char* QStrToSysPath(const QString& qstr_path)
|
||||||
|
{
|
||||||
|
static std::string sys_path; // 静态变量避免内存释放
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
// Windows:转为GBK编码
|
||||||
|
QTextCodec* gbkCodec = QTextCodec::codecForName("GBK");
|
||||||
|
if (!gbkCodec) gbkCodec = QTextCodec::codecForLocale();
|
||||||
|
sys_path = gbkCodec->fromUnicode(qstr_path).toStdString();
|
||||||
|
#else
|
||||||
|
// Linux/Mac:转为UTF-8编码
|
||||||
|
sys_path = qstr_path.toUtf8().toStdString();
|
||||||
|
#endif
|
||||||
|
return sys_path.c_str();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#define STATUS_BAR_MSG(msg) \
|
#define STATUS_BAR_MSG(msg) \
|
||||||
|
|
@ -35,4 +52,4 @@
|
||||||
QLOG_DEBUG() << debug_info; \
|
QLOG_DEBUG() << debug_info; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // OUTPUTINFODEFINE_H
|
#endif // GLOBALDEFINE_H
|
||||||
|
|
@ -25,6 +25,7 @@
|
||||||
#include "MeasureDeviceParamsCfgForm.h"
|
#include "MeasureDeviceParamsCfgForm.h"
|
||||||
#include "NewMeasureAnalysisDlg.h"
|
#include "NewMeasureAnalysisDlg.h"
|
||||||
#include "MeasureAnalysisView.h"
|
#include "MeasureAnalysisView.h"
|
||||||
|
#include "MeasureAnalysisActions.h"
|
||||||
|
|
||||||
using namespace ads;
|
using namespace ads;
|
||||||
|
|
||||||
|
|
@ -123,6 +124,9 @@ void MainWindow::initMainWindow()
|
||||||
_dock_manager->addDockWidget(ads::DockWidgetArea::LeftDockWidgetArea, _dockw_measure_analysis_tree);
|
_dock_manager->addDockWidget(ads::DockWidgetArea::LeftDockWidgetArea, _dockw_measure_analysis_tree);
|
||||||
ui->menu_view->addAction(_dockw_measure_analysis_tree->toggleViewAction());
|
ui->menu_view->addAction(_dockw_measure_analysis_tree->toggleViewAction());
|
||||||
|
|
||||||
|
_tree_actions = new MeasureAnalysisTree::MeasureAnalysisActions(_tree_measure_analysis);
|
||||||
|
_tree_measure_analysis->SetConnectActions(_tree_actions);
|
||||||
|
|
||||||
_menu_view_data_table_list = ui->menu_view->addMenu(QStringLiteral(u"查看数据列表"));
|
_menu_view_data_table_list = ui->menu_view->addMenu(QStringLiteral(u"查看数据列表"));
|
||||||
_menu_view_analysis_view_list = ui->menu_view->addMenu(QStringLiteral(u"分析视图列表"));
|
_menu_view_analysis_view_list = ui->menu_view->addMenu(QStringLiteral(u"分析视图列表"));
|
||||||
|
|
||||||
|
|
@ -145,17 +149,19 @@ void MainWindow::initAction()
|
||||||
this->_tree_measure_analysis->AddProjectModel(project_model);
|
this->_tree_measure_analysis->AddProjectModel(project_model);
|
||||||
if (project_model->GetIsMeasureComplete()) {
|
if (project_model->GetIsMeasureComplete()) {
|
||||||
const QString& project_name = project_model->GetProjectName();
|
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());
|
const QString& result_data_dir = QDir(project_model->GetProjectDir()).filePath("EveryChannelParticleData");
|
||||||
// separate_task->SetResultDataDir(result_data_dir);
|
auto separate_task = new DataProcessWorkPool::EveryChannelParticleDataSeparateTask;
|
||||||
// separate_task->SetFinishedNotifier(this->_tree_measure_analysis, "onFinishedSeparateEveryChannelParticleData", project_name);
|
separate_task->SetAllChannelParticleDataFilename(project_model->GetAllChannelParticleDataFilename());
|
||||||
// separate_task->StartTask();
|
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;
|
auto separate_task = new DataProcessWorkPool::ParticleDataSortTask;
|
||||||
separate_task->SetAllChannelParticleDataFilename(project_model->GetAllChannelParticleDataFilename());
|
separate_task->SetAllChannelParticleDataFilename(project_model->GetAllChannelParticleDataFilename());
|
||||||
separate_task->SetSortedResultDir(project_model->GetProjectDir());
|
separate_task->SetSortedResultDir(project_model->GetProjectDir());
|
||||||
separate_task->SetFinishedNotifier(this->_tree_measure_analysis, "onFinishedParticleSortData", project_name);
|
|
||||||
separate_task->StartTask();
|
separate_task->StartTask();
|
||||||
|
|
||||||
const QString& all_ch_count_dir = project_model->GetProjectDir();
|
const QString& all_ch_count_dir = project_model->GetProjectDir();
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ class CDockWidget;
|
||||||
class QPlainTextEdit;
|
class QPlainTextEdit;
|
||||||
namespace MeasureAnalysisTree {
|
namespace MeasureAnalysisTree {
|
||||||
class TreeWidget;
|
class TreeWidget;
|
||||||
|
class MeasureAnalysisActions;
|
||||||
}
|
}
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
|
@ -59,6 +60,7 @@ private:
|
||||||
ads::CDockAreaWidget* _central_dock_area { nullptr };
|
ads::CDockAreaWidget* _central_dock_area { nullptr };
|
||||||
QAction* _action_central_dock_widget { nullptr };
|
QAction* _action_central_dock_widget { nullptr };
|
||||||
MeasureAnalysisTree::TreeWidget* _tree_measure_analysis { nullptr };
|
MeasureAnalysisTree::TreeWidget* _tree_measure_analysis { nullptr };
|
||||||
|
MeasureAnalysisTree::MeasureAnalysisActions* _tree_actions { nullptr };
|
||||||
ads::CDockWidget* _dockw_measure_analysis_tree { nullptr };
|
ads::CDockWidget* _dockw_measure_analysis_tree { nullptr };
|
||||||
QMenu* _menu_view_data_table_list { nullptr };
|
QMenu* _menu_view_data_table_list { nullptr };
|
||||||
QMenu* _menu_view_analysis_view_list { nullptr };
|
QMenu* _menu_view_analysis_view_list { nullptr };
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
#include "MeasureAnalysisActions.h"
|
#include "MeasureAnalysisActions.h"
|
||||||
|
#include "MeasureAnalysisTreeItem.h"
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
|
|
||||||
namespace MeasureAnalysisTree {
|
namespace MeasureAnalysisTree {
|
||||||
|
|
@ -6,22 +7,22 @@ namespace MeasureAnalysisTree {
|
||||||
MeasureAnalysisActions::MeasureAnalysisActions(QObject* parent)
|
MeasureAnalysisActions::MeasureAnalysisActions(QObject* parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
{
|
{
|
||||||
_act_add_measure_analysis_project = new QAction(QStringLiteral("新建测量分析"), this);
|
_act_add_measure_analysis_project = new QAction(QStringLiteral(u"新建测量分析"), this);
|
||||||
_act_add_measure_analysis_project->setStatusTip(QStringLiteral("新建测量分析"));
|
_act_add_measure_analysis_project->setStatusTip(QStringLiteral(u"新建测量分析"));
|
||||||
_act_add_measure_analysis_project->setDisabled(false);
|
_act_add_measure_analysis_project->setDisabled(false);
|
||||||
connect(_act_add_measure_analysis_project, &QAction::triggered, [this]() {
|
connect(_act_add_measure_analysis_project, &QAction::triggered, [this]() {
|
||||||
emit addMeasureAnalysisProject();
|
emit addMeasureAnalysisProject();
|
||||||
});
|
});
|
||||||
|
|
||||||
_act_rm_measure_analysis_project = new QAction(QStringLiteral("删除测量分析"), this);
|
_act_rm_measure_analysis_project = new QAction(QStringLiteral(u"删除测量分析"), this);
|
||||||
_act_rm_measure_analysis_project->setStatusTip(QStringLiteral("删除测量分析"));
|
_act_rm_measure_analysis_project->setStatusTip(QStringLiteral(u"删除测量分析"));
|
||||||
_act_rm_measure_analysis_project->setDisabled(true);
|
_act_rm_measure_analysis_project->setDisabled(true);
|
||||||
connect(_act_rm_measure_analysis_project, &QAction::triggered, [this]() {
|
connect(_act_rm_measure_analysis_project, &QAction::triggered, [this]() {
|
||||||
emit rmMeasureAnalysisProject();
|
emit rmMeasureAnalysisProject();
|
||||||
});
|
});
|
||||||
|
|
||||||
_act_modify_measure_analysis_project = new QAction(QStringLiteral("修改测量分析"), this);
|
_act_modify_measure_analysis_project = new QAction(QStringLiteral(u"修改测量分析"), this);
|
||||||
_act_modify_measure_analysis_project->setStatusTip(QStringLiteral("修改测量分析"));
|
_act_modify_measure_analysis_project->setStatusTip(QStringLiteral(u"修改测量分析"));
|
||||||
_act_modify_measure_analysis_project->setDisabled(true);
|
_act_modify_measure_analysis_project->setDisabled(true);
|
||||||
connect(_act_modify_measure_analysis_project, &QAction::triggered, [this]() {
|
connect(_act_modify_measure_analysis_project, &QAction::triggered, [this]() {
|
||||||
emit modifyMeasureAnalysisProject();
|
emit modifyMeasureAnalysisProject();
|
||||||
|
|
@ -32,22 +33,22 @@ MeasureAnalysisActions::MeasureAnalysisActions(QObject* parent)
|
||||||
_act_group_measure_analysis_project->addAction(_act_rm_measure_analysis_project);
|
_act_group_measure_analysis_project->addAction(_act_rm_measure_analysis_project);
|
||||||
_act_group_measure_analysis_project->addAction(_act_modify_measure_analysis_project);
|
_act_group_measure_analysis_project->addAction(_act_modify_measure_analysis_project);
|
||||||
|
|
||||||
_act_add_analyze_view = new QAction(QStringLiteral("添加分析视图"), this);
|
_act_add_analyze_view = new QAction(QStringLiteral(u"添加分析视图"), this);
|
||||||
_act_add_analyze_view->setStatusTip(QStringLiteral("添加分析视图"));
|
_act_add_analyze_view->setStatusTip(QStringLiteral(u"添加分析视图"));
|
||||||
_act_add_analyze_view->setDisabled(true);
|
_act_add_analyze_view->setDisabled(true);
|
||||||
connect(_act_add_analyze_view, &QAction::triggered, [this]() {
|
connect(_act_add_analyze_view, &QAction::triggered, [this]() {
|
||||||
emit addAnalyzeView();
|
emit addAnalyzeView();
|
||||||
});
|
});
|
||||||
|
|
||||||
_act_rm_analyze_view = new QAction(QStringLiteral("删除分析视图"), this);
|
_act_rm_analyze_view = new QAction(QStringLiteral(u"删除分析视图"), this);
|
||||||
_act_rm_analyze_view->setStatusTip(QStringLiteral("删除分析视图"));
|
_act_rm_analyze_view->setStatusTip(QStringLiteral(u"删除分析视图"));
|
||||||
_act_rm_analyze_view->setDisabled(true);
|
_act_rm_analyze_view->setDisabled(true);
|
||||||
connect(_act_rm_analyze_view, &QAction::triggered, [this]() {
|
connect(_act_rm_analyze_view, &QAction::triggered, [this]() {
|
||||||
emit rmAnalyzeView();
|
emit rmAnalyzeView();
|
||||||
});
|
});
|
||||||
|
|
||||||
_act_modify_analyze_view = new QAction(QStringLiteral("修改分析视图"), this);
|
_act_modify_analyze_view = new QAction(QStringLiteral(u"修改分析视图"), this);
|
||||||
_act_modify_analyze_view->setStatusTip(QStringLiteral("修改分析视图"));
|
_act_modify_analyze_view->setStatusTip(QStringLiteral(u"修改分析视图"));
|
||||||
_act_modify_analyze_view->setDisabled(true);
|
_act_modify_analyze_view->setDisabled(true);
|
||||||
connect(_act_modify_analyze_view, &QAction::triggered, [this]() {
|
connect(_act_modify_analyze_view, &QAction::triggered, [this]() {
|
||||||
emit modifyAnalyzeView();
|
emit modifyAnalyzeView();
|
||||||
|
|
@ -77,37 +78,39 @@ QActionGroup* MeasureAnalysisActions::GetViewActionGroups()
|
||||||
return _act_group_analyze_view;
|
return _act_group_analyze_view;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MeasureAnalysisActions::SetActionsAvailable(const TreeItem::TreeItemType& item_type)
|
void MeasureAnalysisActions::SetActionsAvailable(const TreeItemType &item_type)
|
||||||
{
|
{
|
||||||
for (QActionGroup* act_group : this->GetActionGroups()) {
|
for (QActionGroup* act_group : this->GetActionGroups()) {
|
||||||
for (QAction* act_item : act_group->actions()) {
|
for (QAction* act_item : act_group->actions()) {
|
||||||
act_item->setDisabled(true);
|
act_item->setDisabled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
_act_add_measure_analysis_project->setEnabled(true);
|
||||||
|
|
||||||
switch (item_type) {
|
switch (item_type) {
|
||||||
case TreeItem::TreeItemType::MeasureAnalysisProject:
|
case TreeItemType::MeasureAnalysisProject:
|
||||||
for (QAction* act_item : _act_group_measure_analysis_project->actions()) {
|
for (QAction* act_item : _act_group_measure_analysis_project->actions()) {
|
||||||
act_item->setEnabled(true);
|
act_item->setEnabled(true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case TreeItem::TreeItemType::ParticleData:
|
case TreeItemType::ParticleData:
|
||||||
_act_add_analyze_view->setEnabled(true);
|
_act_add_analyze_view->setEnabled(true);
|
||||||
break;
|
break;
|
||||||
case TreeItem::TreeItemType::ParticleCountData:
|
case TreeItemType::ParticleCountData:
|
||||||
_act_add_analyze_view->setEnabled(true);
|
_act_add_analyze_view->setEnabled(true);
|
||||||
break;
|
break;
|
||||||
case TreeItem::TreeItemType::ConformParticleData:
|
case TreeItemType::ConformParticleData:
|
||||||
_act_add_analyze_view->setEnabled(true);
|
_act_add_analyze_view->setEnabled(true);
|
||||||
break;
|
break;
|
||||||
case TreeItem::TreeItemType::AnalyzeViewGroup:
|
case TreeItemType::AnalyzeViewGroup:
|
||||||
_act_add_analyze_view->setEnabled(true);
|
_act_add_analyze_view->setEnabled(true);
|
||||||
break;
|
break;
|
||||||
case TreeItem::TreeItemType::AnalyzeView:
|
case TreeItemType::AnalyzeView:
|
||||||
for (QAction* act_item : _act_group_analyze_view->actions()) {
|
for (QAction* act_item : _act_group_analyze_view->actions()) {
|
||||||
act_item->setEnabled(true);
|
act_item->setEnabled(true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case TreeItem::TreeItemType::None:
|
case TreeItemType::None:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
_act_add_measure_analysis_project->setEnabled(true);
|
_act_add_measure_analysis_project->setEnabled(true);
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,15 @@
|
||||||
#ifndef MEASUREANALYSISACTIONS_H
|
#ifndef MEASUREANALYSISACTIONS_H
|
||||||
#define MEASUREANALYSISACTIONS_H
|
#define MEASUREANALYSISACTIONS_H
|
||||||
|
|
||||||
#include "MeasureAnalysisTreeItem.h"
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
|
class QAction;
|
||||||
class QActionGroup;
|
class QActionGroup;
|
||||||
|
|
||||||
namespace MeasureAnalysisTree {
|
namespace MeasureAnalysisTree {
|
||||||
|
|
||||||
|
enum class TreeItemType;
|
||||||
|
|
||||||
class MeasureAnalysisActions : public QObject {
|
class MeasureAnalysisActions : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
|
@ -19,7 +21,7 @@ public:
|
||||||
QActionGroup *GetViewActionGroups();
|
QActionGroup *GetViewActionGroups();
|
||||||
|
|
||||||
|
|
||||||
void SetActionsAvailable(const TreeItem::TreeItemType& item_type);
|
void SetActionsAvailable(const TreeItemType& item_type);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void addMeasureAnalysisProject();
|
void addMeasureAnalysisProject();
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,14 @@
|
||||||
#include "MeasureAnalysisDataTableView.h"
|
#include "MeasureAnalysisDataTableView.h"
|
||||||
#include <QHBoxLayout>
|
|
||||||
#include "VirtualTable/CsvDataSource.h"
|
#include "VirtualTable/CsvDataSource.h"
|
||||||
#include "VirtualTable/VirtualTableView.h"
|
|
||||||
#include "VirtualTable/VirtualTableModel.h"
|
#include "VirtualTable/VirtualTableModel.h"
|
||||||
|
#include "VirtualTable/VirtualTableView.h"
|
||||||
|
#include <QHBoxLayout>
|
||||||
|
|
||||||
MeasureAnalysisDataTableView::MeasureAnalysisDataTableView():
|
MeasureAnalysisDataTableView::MeasureAnalysisDataTableView(QWidget* parent)
|
||||||
_preload_policy(PreloadPolicy::Balanced), _block_size(1000), _buffer_size(50)
|
: MeasureAnalysisView { parent }
|
||||||
|
, _preload_policy(PreloadPolicy::Balanced)
|
||||||
|
, _block_size(1000)
|
||||||
|
, _buffer_size(50)
|
||||||
{
|
{
|
||||||
this->setAnalyzeViewType(ViewType::DataTable);
|
this->setAnalyzeViewType(ViewType::DataTable);
|
||||||
QHBoxLayout* layout = new QHBoxLayout(this);
|
QHBoxLayout* layout = new QHBoxLayout(this);
|
||||||
|
|
@ -17,12 +20,12 @@ MeasureAnalysisDataTableView::MeasureAnalysisDataTableView():
|
||||||
layout->addWidget(_tableView);
|
layout->addWidget(_tableView);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MeasureAnalysisDataTableView::SetAnalyzeDataFilename(const QString &filename)
|
void MeasureAnalysisDataTableView::SetAnalyzeDataFilename(const QMap<QString, QString> &data_files_set)
|
||||||
{
|
{
|
||||||
if (filename.isEmpty()) {
|
if (data_files_set.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto csv_ddata_source = std::make_shared<CsvDataSource>(filename);
|
auto csv_ddata_source = std::make_shared<CsvDataSource>(data_files_set.first());
|
||||||
if (!csv_ddata_source->isValid()) {
|
if (!csv_ddata_source->isValid()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,9 @@ class MeasureAnalysisDataTableView : public MeasureAnalysisView
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
MeasureAnalysisDataTableView();
|
MeasureAnalysisDataTableView(QWidget *parent = nullptr);
|
||||||
|
|
||||||
virtual void SetAnalyzeDataFilename(const QString& filename);
|
virtual void SetAnalyzeDataFilename(const QMap<QString, QString>& data_files_set);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// 私有成员变量
|
// 私有成员变量
|
||||||
|
|
|
||||||
57
src/MeasureAnalysisParticleCountPlotView.cpp
Normal file
57
src/MeasureAnalysisParticleCountPlotView.cpp
Normal file
|
|
@ -0,0 +1,57 @@
|
||||||
|
#include "MeasureAnalysisParticleCountPlotView.h"
|
||||||
|
#include "qcustomplot.h"
|
||||||
|
#include "csv.h"
|
||||||
|
#include <QVector>
|
||||||
|
|
||||||
|
MeasureAnalysisParticleCountPlotView::MeasureAnalysisParticleCountPlotView(QWidget* parent)
|
||||||
|
: MeasureAnalysisView { parent }
|
||||||
|
{
|
||||||
|
this->setAnalyzeViewType(ViewType::CountSpectrum);
|
||||||
|
|
||||||
|
_custom_plot = new QCustomPlot(this);
|
||||||
|
_custom_plot->setGeometry(0, 0, this->width(), this->height());
|
||||||
|
}
|
||||||
|
|
||||||
|
void MeasureAnalysisParticleCountPlotView::SetAnalyzeDataFilename(const QMap<QString, QString>& data_files_set)
|
||||||
|
{
|
||||||
|
for (auto it = data_files_set.begin(); it != data_files_set.end(); ++it) {
|
||||||
|
loadDataFromFile(it.value());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MeasureAnalysisParticleCountPlotView::setupCustomPlot()
|
||||||
|
{
|
||||||
|
_custom_plot->xAxis->setLabel(QString(QStringLiteral(u"道址")));
|
||||||
|
_custom_plot->yAxis->setLabel(QString(QStringLiteral(u"计数")));
|
||||||
|
_custom_plot->legend->setVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MeasureAnalysisParticleCountPlotView::loadDataFromFile(const QString& filename)
|
||||||
|
{
|
||||||
|
std::string address_str = QString(QStringLiteral(u"道址")).toStdString();
|
||||||
|
std::string count_str = QString(QStringLiteral(u"计数")).toStdString();
|
||||||
|
|
||||||
|
io::CSVReader<
|
||||||
|
2,
|
||||||
|
io::trim_chars<' ', '\t'>,
|
||||||
|
io::double_quote_escape<',', '"'>,
|
||||||
|
io::throw_on_overflow,
|
||||||
|
io::empty_line_comment
|
||||||
|
> reader(filename.toUtf8().toStdString());
|
||||||
|
reader.read_header(io::ignore_extra_column, address_str, count_str);
|
||||||
|
|
||||||
|
int address;
|
||||||
|
int particle_count;
|
||||||
|
QVector<double> x, y;
|
||||||
|
while (reader.read_row(address, particle_count)) {
|
||||||
|
x.push_back(address);
|
||||||
|
y.push_back(particle_count);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto graph = _custom_plot->addGraph();
|
||||||
|
// graph->setPen(QPen(Qt::red));
|
||||||
|
// graph->setBrush(QBrush(Qt::red));
|
||||||
|
graph->setData(x, y, true);
|
||||||
|
|
||||||
|
_custom_plot->replot();
|
||||||
|
}
|
||||||
26
src/MeasureAnalysisParticleCountPlotView.h
Normal file
26
src/MeasureAnalysisParticleCountPlotView.h
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
#ifndef MEASUREANALYSISPARTICLECOUNTPLOTVIEW_H
|
||||||
|
#define MEASUREANALYSISPARTICLECOUNTPLOTVIEW_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QWidget>
|
||||||
|
#include "MeasureAnalysisView.h"
|
||||||
|
|
||||||
|
class QCustomPlot;
|
||||||
|
|
||||||
|
class MeasureAnalysisParticleCountPlotView : public MeasureAnalysisView
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
MeasureAnalysisParticleCountPlotView(QWidget *parent = nullptr);
|
||||||
|
|
||||||
|
virtual void SetAnalyzeDataFilename(const QMap<QString, QString>& data_files_set);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void setupCustomPlot();
|
||||||
|
void loadDataFromFile(const QString& filename);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QCustomPlot* _custom_plot { nullptr };
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // MEASUREANALYSISPARTICLECOUNTPLOTVIEW_H
|
||||||
|
|
@ -157,7 +157,7 @@ const QMap<uint, QString>& MeasureAnalysisProjectModel::GetChannelParticleDataFi
|
||||||
|
|
||||||
const QString& MeasureAnalysisProjectModel::GetChannelParticleDataFilename(uint channel) const
|
const QString& MeasureAnalysisProjectModel::GetChannelParticleDataFilename(uint channel) const
|
||||||
{
|
{
|
||||||
return this->_channel_particle_data_filename_list[channel];
|
return QString(this->_channel_particle_data_filename_list[channel]);
|
||||||
}
|
}
|
||||||
|
|
||||||
const QMap<uint, QString>& MeasureAnalysisProjectModel::GetChannelParticleCountDataFilenameList() const
|
const QMap<uint, QString>& MeasureAnalysisProjectModel::GetChannelParticleCountDataFilenameList() const
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,7 @@ public:
|
||||||
const QString& GetEneryScaleFilename() const;
|
const QString& GetEneryScaleFilename() const;
|
||||||
const QString& GetEfficiencyScaleFilename() const;
|
const QString& GetEfficiencyScaleFilename() const;
|
||||||
const QString& GetAllChannelParticleDataFilename() const;
|
const QString& GetAllChannelParticleDataFilename() const;
|
||||||
|
const QString& GetSortParticleDataFilename() const;
|
||||||
const QMap<uint, QString>& GetChannelParticleDataFilenameList() const;
|
const QMap<uint, QString>& GetChannelParticleDataFilenameList() const;
|
||||||
const QString& GetChannelParticleDataFilename(uint channel) const;
|
const QString& GetChannelParticleDataFilename(uint channel) const;
|
||||||
const QMap<uint, QString>& GetChannelParticleCountDataFilenameList() const;
|
const QMap<uint, QString>& GetChannelParticleCountDataFilenameList() const;
|
||||||
|
|
@ -70,6 +71,7 @@ private:
|
||||||
QString _efficiency_scale_filename;
|
QString _efficiency_scale_filename;
|
||||||
|
|
||||||
QString _all_channel_particle_data_filename;
|
QString _all_channel_particle_data_filename;
|
||||||
|
QString _sorted_particle_data_filename;
|
||||||
QMap<uint, QString> _channel_particle_data_filename_list;
|
QMap<uint, QString> _channel_particle_data_filename_list;
|
||||||
QMap<uint, QString> _channel_particle_count_data_filename_list;
|
QMap<uint, QString> _channel_particle_count_data_filename_list;
|
||||||
QString _all_channel_particle_total_count_data_filename;
|
QString _all_channel_particle_total_count_data_filename;
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
#include "MeasureAnalysisTreeItem.h"
|
#include "MeasureAnalysisTreeItem.h"
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include "MeasureAnalysisProjectModel.h"
|
#include "MeasureAnalysisProjectModel.h"
|
||||||
#include "OutputInfoDefine.h"
|
#include "GlobalDefine.h"
|
||||||
#include "QsLog.h"
|
#include "QsLog.h"
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QDropEvent>
|
#include <QDropEvent>
|
||||||
|
|
@ -33,25 +33,25 @@ TreeWidget::TreeWidget(QWidget* parent)
|
||||||
connect(this, &TreeWidget::itemDoubleClicked, [this](QTreeWidgetItem* item_tree_node) {
|
connect(this, &TreeWidget::itemDoubleClicked, [this](QTreeWidgetItem* item_tree_node) {
|
||||||
TreeItem* item = dynamic_cast<TreeItem*>(item_tree_node);
|
TreeItem* item = dynamic_cast<TreeItem*>(item_tree_node);
|
||||||
if (item) {
|
if (item) {
|
||||||
TreeItem::TreeItemType item_type = item->GetType();
|
TreeItemType item_type = item->GetType();
|
||||||
switch (item_type) {
|
switch (item_type) {
|
||||||
case TreeItem::TreeItemType::None:
|
// case TreeItem::TreeItemType::None:
|
||||||
break;
|
// break;
|
||||||
case TreeItem::TreeItemType::MeasureAnalysisProject:
|
// case TreeItem::TreeItemType::MeasureAnalysisProject:
|
||||||
this->expandItem(item);
|
// this->expandItem(item);
|
||||||
break;
|
// break;
|
||||||
case TreeItem::TreeItemType::MeasureCtrlGroup:
|
// case TreeItem::TreeItemType::MeasureCtrlGroup:
|
||||||
this->expandItem(item);
|
// this->expandItem(item);
|
||||||
break;
|
// break;
|
||||||
case TreeItem::TreeItemType::AnalyzeDataGroup:
|
// case TreeItem::TreeItemType::AnalyzeDataGroup:
|
||||||
this->expandItem(item);
|
// this->expandItem(item);
|
||||||
break;
|
// break;
|
||||||
case TreeItem::TreeItemType::AnalyzeViewGroup:
|
// case TreeItem::TreeItemType::AnalyzeViewGroup:
|
||||||
this->expandItem(item);
|
// this->expandItem(item);
|
||||||
break;
|
// break;
|
||||||
case TreeItem::TreeItemType::ParticleData:
|
case TreeItemType::ParticleData:
|
||||||
case TreeItem::TreeItemType::ParticleCountData:
|
case TreeItemType::ParticleCountData:
|
||||||
case TreeItem::TreeItemType::ConformParticleData: {
|
case TreeItemType::ConformParticleData: {
|
||||||
const QString view_type_text = MeasureAnalysisView::GetAnalyzeViewTypeText(MeasureAnalysisView::ViewType::DataTable);
|
const QString view_type_text = MeasureAnalysisView::GetAnalyzeViewTypeText(MeasureAnalysisView::ViewType::DataTable);
|
||||||
item->NewAnalyzeView(item->GetName(), item->GetDescription(), view_type_text);
|
item->NewAnalyzeView(item->GetName(), item->GetDescription(), view_type_text);
|
||||||
MeasureAnalysisView* view = item->GetAnalyzeView();
|
MeasureAnalysisView* view = item->GetAnalyzeView();
|
||||||
|
|
@ -59,7 +59,7 @@ TreeWidget::TreeWidget(QWidget* parent)
|
||||||
emit currentItemViewWidget(view);
|
emit currentItemViewWidget(view);
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case TreeItem::TreeItemType::AnalyzeView: {
|
case TreeItemType::AnalyzeView: {
|
||||||
MeasureAnalysisView* view = item->GetAnalyzeView();
|
MeasureAnalysisView* view = item->GetAnalyzeView();
|
||||||
if (view) {
|
if (view) {
|
||||||
emit currentItemViewWidget(view);
|
emit currentItemViewWidget(view);
|
||||||
|
|
@ -100,7 +100,7 @@ TreeWidget::~TreeWidget()
|
||||||
void TreeWidget::SetConnectActions(MeasureAnalysisActions* const actions_analyze)
|
void TreeWidget::SetConnectActions(MeasureAnalysisActions* const actions_analyze)
|
||||||
{
|
{
|
||||||
auto updateAnalyzeActionsState = [actions_analyze, this](QTreeWidgetItem* item_tree_node) {
|
auto updateAnalyzeActionsState = [actions_analyze, this](QTreeWidgetItem* item_tree_node) {
|
||||||
TreeItem::TreeItemType item_type = TreeItem::TreeItemType::None;
|
TreeItemType item_type = TreeItemType::None;
|
||||||
TreeItem* item = dynamic_cast<TreeItem*>(item_tree_node);
|
TreeItem* item = dynamic_cast<TreeItem*>(item_tree_node);
|
||||||
if (item) {
|
if (item) {
|
||||||
item_type = item->GetType();
|
item_type = item->GetType();
|
||||||
|
|
@ -147,7 +147,7 @@ void TreeWidget::SetConnectActions(MeasureAnalysisActions* const actions_analyze
|
||||||
});
|
});
|
||||||
connect(actions_analyze, &MeasureAnalysisActions::modifyAnalyzeView, [this]() {
|
connect(actions_analyze, &MeasureAnalysisActions::modifyAnalyzeView, [this]() {
|
||||||
TreeItem* item = dynamic_cast<TreeItem*>(this->currentItem());
|
TreeItem* item = dynamic_cast<TreeItem*>(this->currentItem());
|
||||||
if (item && (TreeItem::TreeItemType::AnalyzeView == item->GetType())) {
|
if (item && (TreeItemType::AnalyzeView == item->GetType())) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -162,7 +162,7 @@ void TreeWidget::AddProjectModel(MeasureAnalysisProjectModel* model)
|
||||||
const QString& all_ch_particle_data_filename = model->GetAllChannelParticleDataFilename();
|
const QString& all_ch_particle_data_filename = model->GetAllChannelParticleDataFilename();
|
||||||
TreeItem* new_item_particle_data = new TreeItem;
|
TreeItem* new_item_particle_data = new TreeItem;
|
||||||
new_item_particle_data->SetName(QStringLiteral(u"测量粒子数据"));
|
new_item_particle_data->SetName(QStringLiteral(u"测量粒子数据"));
|
||||||
new_item_particle_data->SetType(TreeItem::TreeItemType::ParticleData);
|
new_item_particle_data->SetType(TreeItemType::ParticleData);
|
||||||
new_item_particle_data->SetDescription(all_ch_particle_data_filename);
|
new_item_particle_data->SetDescription(all_ch_particle_data_filename);
|
||||||
new_item_particle_data->setData(0, Qt::UserRole, all_ch_particle_data_filename);
|
new_item_particle_data->setData(0, Qt::UserRole, all_ch_particle_data_filename);
|
||||||
tree_item_analyze_data_group->insertChild(0, new_item_particle_data);
|
tree_item_analyze_data_group->insertChild(0, new_item_particle_data);
|
||||||
|
|
@ -232,7 +232,7 @@ void TreeWidget::onFinishedParticleCountData(const QString& project_name)
|
||||||
const QString& all_ch_count_filename = project_model->GetAllChannelParticleTotalCountDataFilename();
|
const QString& all_ch_count_filename = project_model->GetAllChannelParticleTotalCountDataFilename();
|
||||||
TreeItem* new_item_all_ch_count = new TreeItem;
|
TreeItem* new_item_all_ch_count = new TreeItem;
|
||||||
new_item_all_ch_count->SetName(QStringLiteral(u"粒子计数数据"));
|
new_item_all_ch_count->SetName(QStringLiteral(u"粒子计数数据"));
|
||||||
new_item_all_ch_count->SetType(TreeItem::TreeItemType::ParticleData);
|
new_item_all_ch_count->SetType(TreeItemType::ParticleData);
|
||||||
new_item_all_ch_count->SetDescription(all_ch_count_filename);
|
new_item_all_ch_count->SetDescription(all_ch_count_filename);
|
||||||
new_item_all_ch_count->setData(0, Qt::UserRole, all_ch_count_filename);
|
new_item_all_ch_count->setData(0, Qt::UserRole, all_ch_count_filename);
|
||||||
tree_item_analyze_data_group->addChild(new_item_all_ch_count);
|
tree_item_analyze_data_group->addChild(new_item_all_ch_count);
|
||||||
|
|
@ -243,7 +243,7 @@ void TreeWidget::onFinishedParticleCountData(const QString& project_name)
|
||||||
const QString& ch_count_filename = it.value();
|
const QString& ch_count_filename = it.value();
|
||||||
TreeItem* new_item_every_ch_count_data = new TreeItem;
|
TreeItem* new_item_every_ch_count_data = new TreeItem;
|
||||||
new_item_every_ch_count_data->SetName(QStringLiteral(u"通道%1粒子计数数据").arg(ch_num));
|
new_item_every_ch_count_data->SetName(QStringLiteral(u"通道%1粒子计数数据").arg(ch_num));
|
||||||
new_item_every_ch_count_data->SetType(TreeItem::TreeItemType::ParticleData);
|
new_item_every_ch_count_data->SetType(TreeItemType::ParticleData);
|
||||||
new_item_every_ch_count_data->SetDescription(ch_count_filename);
|
new_item_every_ch_count_data->SetDescription(ch_count_filename);
|
||||||
new_item_every_ch_count_data->setData(0, Qt::UserRole, ch_count_filename);
|
new_item_every_ch_count_data->setData(0, Qt::UserRole, ch_count_filename);
|
||||||
new_item_all_ch_count->addChild(new_item_every_ch_count_data);
|
new_item_all_ch_count->addChild(new_item_every_ch_count_data);
|
||||||
|
|
@ -255,54 +255,6 @@ void TreeWidget::onFinishedParticleCountData(const QString& project_name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
void TreeWidget::mousePressEvent(QMouseEvent* event)
|
|
||||||
{
|
|
||||||
_tree_item_drag = nullptr;
|
|
||||||
auto tree_item = dynamic_cast<TreeItem*>(this->itemAt(event->pos()));
|
|
||||||
if ((event->button() == Qt::LeftButton) && tree_item) {
|
|
||||||
if ((TreeItem::TreeItemType::Group == tree_item->GetType()) || (TreeItem::TreeItemType::Analyze == tree_item->GetType())) {
|
|
||||||
_tree_item_drag = tree_item;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
QTreeWidget::mousePressEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
void TreeWidget::dragMoveEvent(QDragMoveEvent* event)
|
|
||||||
{
|
|
||||||
if (nullptr == _tree_item_drag) {
|
|
||||||
event->ignore();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
QTreeWidget::dragMoveEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
void TreeWidget::dropEvent(QDropEvent* event)
|
|
||||||
{
|
|
||||||
if (Qt::MoveAction == event->dropAction()) {
|
|
||||||
if (nullptr == _tree_item_drag) {
|
|
||||||
event->ignore();
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
auto tree_item = dynamic_cast<TreeItem*>(this->itemAt(event->pos()));
|
|
||||||
if (tree_item) {
|
|
||||||
if (TreeItem::TreeItemType::Group != tree_item->GetType()) {
|
|
||||||
event->ignore();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
QTreeWidget::dropEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
void TreeWidget::mouseReleaseEvent(QMouseEvent* event)
|
|
||||||
{
|
|
||||||
_tree_item_drag = nullptr;
|
|
||||||
QTreeWidget::mouseReleaseEvent(event);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
void TreeWidget::setCurrentItemHighlight()
|
void TreeWidget::setCurrentItemHighlight()
|
||||||
{
|
{
|
||||||
// 清除之前的高亮
|
// 清除之前的高亮
|
||||||
|
|
@ -334,12 +286,12 @@ void TreeWidget::removeAnalyzeItem()
|
||||||
if (QMessageBox::Yes == QMessageBox::question(nullptr, text_title, text_msg)) {
|
if (QMessageBox::Yes == QMessageBox::question(nullptr, text_title, text_msg)) {
|
||||||
TreeItem* tree_item = dynamic_cast<TreeItem*>(this->currentItem());
|
TreeItem* tree_item = dynamic_cast<TreeItem*>(this->currentItem());
|
||||||
if (tree_item) {
|
if (tree_item) {
|
||||||
TreeItem::TreeItemType item_type = tree_item->GetType();
|
TreeItemType item_type = tree_item->GetType();
|
||||||
if (TreeItem::TreeItemType::MeasureAnalysisProject == item_type) {
|
if (TreeItemType::MeasureAnalysisProject == item_type) {
|
||||||
|
|
||||||
} else if (TreeItem::TreeItemType::ParticleData == item_type) {
|
} else if (TreeItemType::ParticleData == item_type) {
|
||||||
|
|
||||||
} else if (TreeItem::TreeItemType::AnalyzeDataGroup == item_type) {
|
} else if (TreeItemType::AnalyzeDataGroup == item_type) {
|
||||||
}
|
}
|
||||||
MeasureAnalysisView* view = tree_item->GetAnalyzeView();
|
MeasureAnalysisView* view = tree_item->GetAnalyzeView();
|
||||||
if (view) {
|
if (view) {
|
||||||
|
|
|
||||||
|
|
@ -32,21 +32,11 @@ signals:
|
||||||
void currentItemViewWidget(MeasureAnalysisView* view);
|
void currentItemViewWidget(MeasureAnalysisView* view);
|
||||||
void removeItemViewFromStack(MeasureAnalysisView* view);
|
void removeItemViewFromStack(MeasureAnalysisView* view);
|
||||||
|
|
||||||
/*
|
|
||||||
protected:
|
|
||||||
virtual void mousePressEvent(QMouseEvent* event);
|
|
||||||
virtual void dragMoveEvent(QDragMoveEvent* event);
|
|
||||||
virtual void dropEvent(QDropEvent* event);
|
|
||||||
virtual void mouseReleaseEvent(QMouseEvent* event);
|
|
||||||
*/
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setCurrentItemHighlight();
|
void setCurrentItemHighlight();
|
||||||
void removeAnalyzeItem();
|
void removeAnalyzeItem();
|
||||||
void removeTreeItem(QTreeWidgetItem* const item);
|
void removeTreeItem(QTreeWidgetItem* const item);
|
||||||
|
|
||||||
// private:
|
|
||||||
// TreeItem* _tree_item_drag { nullptr };
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace MeasureAnalysisTree
|
} // namespace MeasureAnalysisTree
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
namespace MeasureAnalysisTree {
|
namespace MeasureAnalysisTree {
|
||||||
|
|
||||||
TreeItem::TreeItemType TreeItem::GetType()
|
TreeItemType TreeItem::GetType()
|
||||||
{
|
{
|
||||||
return this->_type;
|
return this->_type;
|
||||||
}
|
}
|
||||||
|
|
@ -54,7 +54,9 @@ void TreeItem::NewAnalyzeView(const QString &name, const QString &description, c
|
||||||
this->_ptr_analyze_view->SetViewName(name);
|
this->_ptr_analyze_view->SetViewName(name);
|
||||||
this->_ptr_analyze_view->SetViewDescription(description);
|
this->_ptr_analyze_view->SetViewDescription(description);
|
||||||
const QString& data_filename = this->data(0, Qt::UserRole).toString();
|
const QString& data_filename = this->data(0, Qt::UserRole).toString();
|
||||||
this->_ptr_analyze_view->SetAnalyzeDataFilename(data_filename);
|
QMap<QString, QString> data_files_set;
|
||||||
|
data_files_set[name] = data_filename;
|
||||||
|
this->_ptr_analyze_view->SetAnalyzeDataFilename(data_files_set);
|
||||||
}
|
}
|
||||||
|
|
||||||
QDataStream& operator<<(QDataStream& out, const TreeItem& item)
|
QDataStream& operator<<(QDataStream& out, const TreeItem& item)
|
||||||
|
|
@ -98,24 +100,24 @@ QDataStream& operator>>(QDataStream& in, TreeItem& item)
|
||||||
|
|
||||||
TreeMeasureAnalysisProjectItem::TreeMeasureAnalysisProjectItem(const QString& project_name, const QString& description)
|
TreeMeasureAnalysisProjectItem::TreeMeasureAnalysisProjectItem(const QString& project_name, const QString& description)
|
||||||
{
|
{
|
||||||
this->SetType(TreeItem::TreeItemType::MeasureAnalysisProject);
|
this->SetType(TreeItemType::MeasureAnalysisProject);
|
||||||
this->SetName(project_name);
|
this->SetName(project_name);
|
||||||
this->SetDescription(description);
|
this->SetDescription(description);
|
||||||
|
|
||||||
TreeItem* tree_group_item = new TreeItem;
|
TreeItem* tree_group_item = new TreeItem;
|
||||||
tree_group_item->SetType(TreeItem::TreeItemType::MeasureCtrlGroup);
|
tree_group_item->SetType(TreeItemType::MeasureCtrlGroup);
|
||||||
tree_group_item->SetName(QStringLiteral(u"测量控制"));
|
tree_group_item->SetName(QStringLiteral(u"测量控制"));
|
||||||
tree_group_item->SetDescription(QStringLiteral(u"测量控制组:包括测量设备参数设置、测量时间设置、能量刻度、效率刻度等配置管理"));
|
tree_group_item->SetDescription(QStringLiteral(u"测量控制组:包括测量设备参数设置、测量时间设置、能量刻度、效率刻度等配置管理"));
|
||||||
this->insertChild(0, tree_group_item);
|
this->insertChild(0, tree_group_item);
|
||||||
|
|
||||||
tree_group_item = new TreeItem;
|
tree_group_item = new TreeItem;
|
||||||
tree_group_item->SetType(TreeItem::TreeItemType::AnalyzeDataGroup);
|
tree_group_item->SetType(TreeItemType::AnalyzeDataGroup);
|
||||||
tree_group_item->SetName(QStringLiteral(u"分析数据"));
|
tree_group_item->SetName(QStringLiteral(u"分析数据"));
|
||||||
tree_group_item->SetDescription(QStringLiteral(u"分析数据组:包括粒子数据、谱计数数据、符合粒子数据等管理"));
|
tree_group_item->SetDescription(QStringLiteral(u"分析数据组:包括粒子数据、谱计数数据、符合粒子数据等管理"));
|
||||||
this->insertChild(1, tree_group_item);
|
this->insertChild(1, tree_group_item);
|
||||||
|
|
||||||
tree_group_item = new TreeItem;
|
tree_group_item = new TreeItem;
|
||||||
tree_group_item->SetType(TreeItem::TreeItemType::AnalyzeViewGroup);
|
tree_group_item->SetType(TreeItemType::AnalyzeViewGroup);
|
||||||
tree_group_item->SetName(QStringLiteral(u"分析视图"));
|
tree_group_item->SetName(QStringLiteral(u"分析视图"));
|
||||||
tree_group_item->SetDescription(QStringLiteral(u"分析视图组:包括粒子数据视图、谱计数数据视图、符合粒子数据视图等管理"));
|
tree_group_item->SetDescription(QStringLiteral(u"分析视图组:包括粒子数据视图、谱计数数据视图、符合粒子数据视图等管理"));
|
||||||
this->insertChild(2, tree_group_item);
|
this->insertChild(2, tree_group_item);
|
||||||
|
|
|
||||||
|
|
@ -8,22 +8,24 @@ namespace MeasureAnalysisTree {
|
||||||
|
|
||||||
class TreeAnalyzeViewItem;
|
class TreeAnalyzeViewItem;
|
||||||
|
|
||||||
|
enum class TreeItemType {
|
||||||
|
None,
|
||||||
|
MeasureAnalysisProject,
|
||||||
|
MeasureCtrlGroup,
|
||||||
|
DeviceConfig,
|
||||||
|
EneryScale,
|
||||||
|
EfficiencyScale,
|
||||||
|
AnalyzeDataGroup,
|
||||||
|
ParticleData,
|
||||||
|
ParticleCountData,
|
||||||
|
ConformParticleData,
|
||||||
|
AnalyzeViewGroup,
|
||||||
|
AnalyzeView
|
||||||
|
};
|
||||||
|
|
||||||
class TreeItem : public QTreeWidgetItem {
|
class TreeItem : public QTreeWidgetItem {
|
||||||
public:
|
public:
|
||||||
enum class TreeItemType {
|
|
||||||
None,
|
|
||||||
MeasureAnalysisProject,
|
|
||||||
MeasureCtrlGroup,
|
|
||||||
DeviceConfig,
|
|
||||||
EneryScale,
|
|
||||||
EfficiencyScale,
|
|
||||||
AnalyzeDataGroup,
|
|
||||||
ParticleData,
|
|
||||||
ParticleCountData,
|
|
||||||
ConformParticleData,
|
|
||||||
AnalyzeViewGroup,
|
|
||||||
AnalyzeView
|
|
||||||
};
|
|
||||||
TreeItemType GetType();
|
TreeItemType GetType();
|
||||||
void SetType(const TreeItemType& type);
|
void SetType(const TreeItemType& type);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ public:
|
||||||
void SetViewDescription(const QString& description);
|
void SetViewDescription(const QString& description);
|
||||||
const QString& GetViewName() const;
|
const QString& GetViewName() const;
|
||||||
const QString& GetViewDescription() const;
|
const QString& GetViewDescription() const;
|
||||||
virtual void SetAnalyzeDataFilename(const QString& filename) = 0;
|
virtual void SetAnalyzeDataFilename(const QMap<QString, QString>& data_files_set) = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void setAnalyzeViewType(ViewType type);
|
void setAnalyzeViewType(ViewType type);
|
||||||
|
|
|
||||||
|
|
@ -140,7 +140,8 @@ void NewMeasureAnalysisDlg::on_btn_ok_clicked()
|
||||||
|
|
||||||
project_dir.mkpath(project_dir_path);
|
project_dir.mkpath(project_dir_path);
|
||||||
// 拷贝粒子数据文件到项目目录
|
// 拷贝粒子数据文件到项目目录
|
||||||
QString all_channel_particle_data_filename = project_dir.filePath("AllChannelParticleData.csv");
|
QFileInfo data_file_info(data_file_path);
|
||||||
|
QString all_channel_particle_data_filename = project_dir.filePath(data_file_info.fileName());
|
||||||
if (!QFile::copy(data_file_path, all_channel_particle_data_filename)) {
|
if (!QFile::copy(data_file_path, all_channel_particle_data_filename)) {
|
||||||
QMessageBox::warning(this, QStringLiteral(u"警告"), QStringLiteral(u"载入粒子数据文件到项目目录失败!"));
|
QMessageBox::warning(this, QStringLiteral(u"警告"), QStringLiteral(u"载入粒子数据文件到项目目录失败!"));
|
||||||
project_dir.removeRecursively();
|
project_dir.removeRecursively();
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ int main(int argc, char *argv[])
|
||||||
app.setProperty("Description", app_desc.remove(QRegExp("\\s")));
|
app.setProperty("Description", app_desc.remove(QRegExp("\\s")));
|
||||||
// 设置应用字体
|
// 设置应用字体
|
||||||
QFont f = app.font();
|
QFont f = app.font();
|
||||||
f.setFamily(QStringLiteral(u"微软雅黑"));
|
f.setFamily(QStringLiteral("Microsoft YaHei"));
|
||||||
f.setPointSizeF(10.0f);
|
f.setPointSizeF(10.0f);
|
||||||
app.setFont(f);
|
app.setFont(f);
|
||||||
// 设置应用图标和关闭属性
|
// 设置应用图标和关闭属性
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
TARGET = EnergySpectrumAnalyer
|
TARGET = EnergySpectrumAnalyer
|
||||||
|
|
||||||
QT += core gui widgets concurrent
|
QT += core gui widgets concurrent printsupport
|
||||||
|
|
||||||
# You can make your code fail to compile if it uses deprecated APIs.
|
# You can make your code fail to compile if it uses deprecated APIs.
|
||||||
# In order to do so, uncomment the following line.
|
# In order to do so, uncomment the following line.
|
||||||
|
|
@ -26,6 +26,7 @@ include($${PROJECT_DIR}/3rdlib/QsLog/QsLog.pri)
|
||||||
# include($${PROJECT_DIR}/3rdlib/qwindowkit/qwindowkit.pri)
|
# include($${PROJECT_DIR}/3rdlib/qwindowkit/qwindowkit.pri)
|
||||||
include($${PROJECT_DIR}/3rdlib/QtAdvancedDockingSystem/ads.pri)
|
include($${PROJECT_DIR}/3rdlib/QtAdvancedDockingSystem/ads.pri)
|
||||||
include($${PROJECT_DIR}/3rdlib/csv/csv.pri)
|
include($${PROJECT_DIR}/3rdlib/csv/csv.pri)
|
||||||
|
include($${PROJECT_DIR}/3rdlib/qcustomplot/qcustomplot.pri)
|
||||||
|
|
||||||
DESTDIR = $${BUILD_BIN}
|
DESTDIR = $${BUILD_BIN}
|
||||||
OBJECTS_DIR = $${BUILD_OBJ}/$${TARGET}/objs
|
OBJECTS_DIR = $${BUILD_OBJ}/$${TARGET}/objs
|
||||||
|
|
@ -40,6 +41,7 @@ SOURCES += \
|
||||||
MeasureAnalysisActions.cpp \
|
MeasureAnalysisActions.cpp \
|
||||||
MeasureAnalysisDataTableView.cpp \
|
MeasureAnalysisDataTableView.cpp \
|
||||||
MeasureAnalysisHistoryForm.cpp \
|
MeasureAnalysisHistoryForm.cpp \
|
||||||
|
MeasureAnalysisParticleCountPlotView.cpp \
|
||||||
MeasureAnalysisProjectModel.cpp \
|
MeasureAnalysisProjectModel.cpp \
|
||||||
MeasureAnalysisTree.cpp \
|
MeasureAnalysisTree.cpp \
|
||||||
MeasureAnalysisTreeItem.cpp \
|
MeasureAnalysisTreeItem.cpp \
|
||||||
|
|
@ -56,17 +58,18 @@ HEADERS += \
|
||||||
AboutDlg.h \
|
AboutDlg.h \
|
||||||
DataProcessWorkPool.h \
|
DataProcessWorkPool.h \
|
||||||
EneryScaleForm.h \
|
EneryScaleForm.h \
|
||||||
|
GlobalDefine.h \
|
||||||
MainWindow.h \
|
MainWindow.h \
|
||||||
MeasureAnalysisActions.h \
|
MeasureAnalysisActions.h \
|
||||||
MeasureAnalysisDataTableView.h \
|
MeasureAnalysisDataTableView.h \
|
||||||
MeasureAnalysisHistoryForm.h \
|
MeasureAnalysisHistoryForm.h \
|
||||||
|
MeasureAnalysisParticleCountPlotView.h \
|
||||||
MeasureAnalysisProjectModel.h \
|
MeasureAnalysisProjectModel.h \
|
||||||
MeasureAnalysisTree.h \
|
MeasureAnalysisTree.h \
|
||||||
MeasureAnalysisTreeItem.h \
|
MeasureAnalysisTreeItem.h \
|
||||||
MeasureAnalysisView.h \
|
MeasureAnalysisView.h \
|
||||||
MeasureDeviceParamsCfgForm.h \
|
MeasureDeviceParamsCfgForm.h \
|
||||||
NewMeasureAnalysisDlg.h \
|
NewMeasureAnalysisDlg.h \
|
||||||
OutputInfoDefine.h \
|
|
||||||
VirtualTable/CsvDataSource.h \
|
VirtualTable/CsvDataSource.h \
|
||||||
VirtualTable/DataSource.h \
|
VirtualTable/DataSource.h \
|
||||||
VirtualTable/SampleDataSource.h \
|
VirtualTable/SampleDataSource.h \
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user