modify AddSurfaceFileDlg
This commit is contained in:
parent
8c0f345454
commit
1e7538796a
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,4 +3,5 @@ build/
|
|||||||
bin/
|
bin/
|
||||||
thirdparty/
|
thirdparty/
|
||||||
tritoin/
|
tritoin/
|
||||||
|
CMakeFiles/
|
||||||
QWEN.md
|
QWEN.md
|
||||||
|
|||||||
@ -683,11 +683,6 @@
|
|||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>AddSurfaceFileDlg</name>
|
<name>AddSurfaceFileDlg</name>
|
||||||
<message>
|
|
||||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="14"/>
|
|
||||||
<source>Add Surface Data File</source>
|
|
||||||
<translation type="unfinished"></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="20"/>
|
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="20"/>
|
||||||
<source>File Selection</source>
|
<source>File Selection</source>
|
||||||
@ -695,113 +690,242 @@
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="26"/>
|
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="26"/>
|
||||||
<source>File Path:</source>
|
|
||||||
<translation type="unfinished"></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="33"/>
|
|
||||||
<source>Select surface data file...</source>
|
<source>Select surface data file...</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="14"/>
|
||||||
|
<source>Add Surface File</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="33"/>
|
||||||
|
<source>Browse...</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="43"/>
|
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="43"/>
|
||||||
<source>...</source>
|
<source>Chart Properties</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="50"/>
|
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="49"/>
|
||||||
<source>File Name:</source>
|
<source>X Axis Title:</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="57"/>
|
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="59"/>
|
||||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="71"/>
|
<source>Y Axis Title:</source>
|
||||||
<source>-</source>
|
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="64"/>
|
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="69"/>
|
||||||
<source>File Size:</source>
|
<source>Z Axis Title:</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="81"/>
|
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="79"/>
|
||||||
<source>Surface Parameters</source>
|
<source>Time Parameter:</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="87"/>
|
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="99"/>
|
||||||
|
<source>X Range:</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="121"/>
|
||||||
|
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="185"/>
|
||||||
|
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="249"/>
|
||||||
|
<source>to</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="143"/>
|
||||||
|
<source>X Count:</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="163"/>
|
||||||
|
<source>Y Range:</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="207"/>
|
||||||
|
<source>Y Count:</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="227"/>
|
||||||
|
<source>Z Range:</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="271"/>
|
||||||
|
<source>Z Count:</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="294"/>
|
||||||
|
<source>Surface Management</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="302"/>
|
||||||
|
<source>Add Surface</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="319"/>
|
||||||
|
<source>Remove</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="328"/>
|
||||||
|
<source>Surface Properties</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="334"/>
|
||||||
|
<source>Name:</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="344"/>
|
||||||
|
<source>Color:</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="357"/>
|
||||||
|
<source>Select Color</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="364"/>
|
||||||
|
<source>Start Point:</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="381"/>
|
||||||
|
<source>End Point:</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="404"/>
|
||||||
|
<source>Data Format Parameters</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="410"/>
|
||||||
<source>X Column:</source>
|
<source>X Column:</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="107"/>
|
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="430"/>
|
||||||
<source>Y Column:</source>
|
<source>Y Column:</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="127"/>
|
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="450"/>
|
||||||
<source>Z Column:</source>
|
<source>Z Column:</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="147"/>
|
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="470"/>
|
||||||
<source>Separator:</source>
|
<source>Separator:</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="155"/>
|
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="477"/>
|
||||||
<source>Comma (,)</source>
|
<source>,</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="160"/>
|
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="524"/>
|
||||||
<source>Tab</source>
|
<source>Has Header Row</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="165"/>
|
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="484"/>
|
||||||
<source>Space</source>
|
|
||||||
<translation type="unfinished"></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="170"/>
|
|
||||||
<source>Semicolon (;)</source>
|
|
||||||
<translation type="unfinished"></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="178"/>
|
|
||||||
<source>X Grid Size:</source>
|
<source>X Grid Size:</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="198"/>
|
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="504"/>
|
||||||
<source>Y Grid Size:</source>
|
<source>Y Grid Size:</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="218"/>
|
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.cpp" line="112"/>
|
||||||
<source>File has header row</source>
|
<source>Select Surface Data File</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="231"/>
|
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.cpp" line="118"/>
|
||||||
<source>Description (Optional)</source>
|
<source>Please add at least one surface.</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="243"/>
|
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.cpp" line="107"/>
|
||||||
<source>Enter file description...</source>
|
<source>Surface Data Files (*.txt *.dat *.csv);;All Files (*.*)</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="281"/>
|
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.cpp" line="118"/>
|
||||||
<source>Add File</source>
|
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.cpp" line="124"/>
|
||||||
|
<source>Warning</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="291"/>
|
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.cpp" line="124"/>
|
||||||
<source>Cancel</source>
|
<source>Please fill in all axis titles.</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.cpp" line="153"/>
|
||||||
|
<source>Select Surface Color</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.cpp" line="365"/>
|
||||||
|
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.cpp" line="383"/>
|
||||||
|
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.cpp" line="408"/>
|
||||||
|
<source>Error</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.cpp" line="365"/>
|
||||||
|
<source>Failed to create surface file entry.</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.cpp" line="383"/>
|
||||||
|
<source>Unable to get current workspace</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.cpp" line="393"/>
|
||||||
|
<source>Surface file count has reached the limit (9 files)</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.cpp" line="396"/>
|
||||||
|
<source>File already exists</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.cpp" line="399"/>
|
||||||
|
<source>File copy failed</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.cpp" line="402"/>
|
||||||
|
<source>Invalid file</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.cpp" line="405"/>
|
||||||
|
<source>Failed to add file</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
|
|||||||
@ -1,135 +1,414 @@
|
|||||||
#include "AddSurfaceFileDlg.h"
|
#include "AddSurfaceFileDlg.h"
|
||||||
|
#include "ui_AddSurfaceFileDlg.h"
|
||||||
#include <QMessageBox>
|
#include "workspace/WorkSpaceManager.h"
|
||||||
#include <QFileInfo>
|
#include "workspace/WorkSpace.h"
|
||||||
#include <QFileDialog>
|
|
||||||
#include "app/Application.h"
|
|
||||||
#include "common/SpdLogger.h"
|
#include "common/SpdLogger.h"
|
||||||
|
|
||||||
#include "ui_AddSurfaceFileDlg.h"
|
#include <QFileDialog>
|
||||||
|
#include <QFileInfo>
|
||||||
|
#include <QColorDialog>
|
||||||
|
#include <QMessageBox>
|
||||||
|
#include <QListWidgetItem>
|
||||||
|
#include <QStandardPaths>
|
||||||
|
#include <QDir>
|
||||||
|
|
||||||
AddSurfaceFileDlg::AddSurfaceFileDlg(QWidget* parent)
|
AddSurfaceFileDlg::AddSurfaceFileDlg(QWidget *parent)
|
||||||
: BaseAddFileDlg(FileEntryType::Surface, parent)
|
: BaseAddFileDlg(FileEntryType::Surface, parent)
|
||||||
, ui_(new Ui::AddSurfaceFileDlg) {
|
, ui(new Ui::AddSurfaceFileDlg)
|
||||||
|
, currentSurfaceIndex_(-1)
|
||||||
ui_->setupUi(this);
|
, selectedColor_(Qt::blue)
|
||||||
|
{
|
||||||
|
SetupUI(ui);
|
||||||
SetTitle(getDialogTitle());
|
SetTitle(getDialogTitle());
|
||||||
setupConnections();
|
setupConnections();
|
||||||
|
|
||||||
|
// Initialize chart properties with default values
|
||||||
|
chartProperties_.xCount = 100;
|
||||||
|
chartProperties_.yCount = 100;
|
||||||
|
chartProperties_.zCount = 100;
|
||||||
|
chartProperties_.xMin = 0.0;
|
||||||
|
chartProperties_.xMax = 1.0;
|
||||||
|
chartProperties_.yMin = 0.0;
|
||||||
|
chartProperties_.yMax = 1.0;
|
||||||
|
chartProperties_.zMin = 0.0;
|
||||||
|
chartProperties_.zMax = 1.0;
|
||||||
|
chartProperties_.timeParam = 0.0;
|
||||||
|
chartProperties_.xTitle = "X Axis";
|
||||||
|
chartProperties_.yTitle = "Y Axis";
|
||||||
|
chartProperties_.zTitle = "Z Axis";
|
||||||
|
|
||||||
|
// Set default UI values
|
||||||
|
ui->xCountSpinBox->setValue(chartProperties_.xCount);
|
||||||
|
ui->yCountSpinBox->setValue(chartProperties_.yCount);
|
||||||
|
ui->zCountSpinBox->setValue(chartProperties_.zCount);
|
||||||
|
ui->xMinSpinBox->setValue(chartProperties_.xMin);
|
||||||
|
ui->xMaxSpinBox->setValue(chartProperties_.xMax);
|
||||||
|
ui->yMinSpinBox->setValue(chartProperties_.yMin);
|
||||||
|
ui->yMaxSpinBox->setValue(chartProperties_.yMax);
|
||||||
|
ui->zMinSpinBox->setValue(chartProperties_.zMin);
|
||||||
|
ui->zMaxSpinBox->setValue(chartProperties_.zMax);
|
||||||
|
ui->timeParamSpinBox->setValue(chartProperties_.timeParam);
|
||||||
|
ui->xTitleLineEdit->setText(chartProperties_.xTitle);
|
||||||
|
ui->yTitleLineEdit->setText(chartProperties_.yTitle);
|
||||||
|
ui->zTitleLineEdit->setText(chartProperties_.zTitle);
|
||||||
|
|
||||||
|
// Initialize color preview
|
||||||
|
updateColorPreview(ui->surfaceColorButton, selectedColor_);
|
||||||
|
|
||||||
|
// Clear surface properties initially
|
||||||
|
clearSurfaceProperties();
|
||||||
}
|
}
|
||||||
|
|
||||||
AddSurfaceFileDlg::~AddSurfaceFileDlg() {
|
AddSurfaceFileDlg::~AddSurfaceFileDlg()
|
||||||
delete ui_;
|
{
|
||||||
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddSurfaceFileDlg::setupConnections() {
|
void AddSurfaceFileDlg::setupConnections()
|
||||||
connect(ui_->selectFileBtn, &QToolButton::clicked, this, &AddSurfaceFileDlg::onSelectFileClicked);
|
{
|
||||||
connect(ui_->filePathEdit, &QLineEdit::textChanged, this, &AddSurfaceFileDlg::onFilePathChanged);
|
// File selection connections
|
||||||
connect(ui_->addBtn, &QPushButton::clicked, this, [this]() { OnSure(); });
|
connect(ui->browseButton, &QPushButton::clicked, this, &AddSurfaceFileDlg::onSelectFile);
|
||||||
connect(ui_->cancelBtn, &QPushButton::clicked, this, &QDialog::reject);
|
connect(ui->filePathLineEdit, &QLineEdit::textChanged, this, &AddSurfaceFileDlg::onFilePathChanged);
|
||||||
|
|
||||||
|
// Surface management connections
|
||||||
|
connect(ui->surfaceColorButton, &QPushButton::clicked, this, &AddSurfaceFileDlg::onSurfaceColorButtonClicked);
|
||||||
|
connect(ui->addSurfaceButton, &QPushButton::clicked, this, &AddSurfaceFileDlg::onAddSurfaceClicked);
|
||||||
|
connect(ui->removeSurfaceButton, &QPushButton::clicked, this, &AddSurfaceFileDlg::onRemoveSurfaceClicked);
|
||||||
|
connect(ui->surfaceListWidget, &QListWidget::itemClicked, this, &AddSurfaceFileDlg::onSurfaceListItemClicked);
|
||||||
|
connect(ui->surfaceListWidget, &QListWidget::itemSelectionChanged, this, &AddSurfaceFileDlg::onSurfaceSelectionChanged);
|
||||||
|
|
||||||
|
// Surface properties connections
|
||||||
|
connect(ui->surfaceNameLineEdit, &QLineEdit::textChanged, this, &AddSurfaceFileDlg::onSurfaceNameChanged);
|
||||||
|
connect(ui->surfaceStartSpinBox, QOverload<int>::of(&QSpinBox::valueChanged), this, &AddSurfaceFileDlg::onSurfaceDataChanged);
|
||||||
|
connect(ui->surfaceStopSpinBox, QOverload<int>::of(&QSpinBox::valueChanged), this, &AddSurfaceFileDlg::onSurfaceDataChanged);
|
||||||
|
|
||||||
|
// Chart properties connections (save to member variables when changed)
|
||||||
|
connect(ui->xCountSpinBox, QOverload<int>::of(&QSpinBox::valueChanged), [this](int value) { chartProperties_.xCount = value; });
|
||||||
|
connect(ui->yCountSpinBox, QOverload<int>::of(&QSpinBox::valueChanged), [this](int value) { chartProperties_.yCount = value; });
|
||||||
|
connect(ui->zCountSpinBox, QOverload<int>::of(&QSpinBox::valueChanged), [this](int value) { chartProperties_.zCount = value; });
|
||||||
|
connect(ui->xMinSpinBox, QOverload<double>::of(&QDoubleSpinBox::valueChanged), [this](double value) { chartProperties_.xMin = value; });
|
||||||
|
connect(ui->xMaxSpinBox, QOverload<double>::of(&QDoubleSpinBox::valueChanged), [this](double value) { chartProperties_.xMax = value; });
|
||||||
|
connect(ui->yMinSpinBox, QOverload<double>::of(&QDoubleSpinBox::valueChanged), [this](double value) { chartProperties_.yMin = value; });
|
||||||
|
connect(ui->yMaxSpinBox, QOverload<double>::of(&QDoubleSpinBox::valueChanged), [this](double value) { chartProperties_.yMax = value; });
|
||||||
|
connect(ui->zMinSpinBox, QOverload<double>::of(&QDoubleSpinBox::valueChanged), [this](double value) { chartProperties_.zMin = value; });
|
||||||
|
connect(ui->zMaxSpinBox, QOverload<double>::of(&QDoubleSpinBox::valueChanged), [this](double value) { chartProperties_.zMax = value; });
|
||||||
|
connect(ui->timeParamSpinBox, QOverload<double>::of(&QDoubleSpinBox::valueChanged), [this](double value) { chartProperties_.timeParam = value; });
|
||||||
|
connect(ui->xTitleLineEdit, &QLineEdit::textChanged, [this](const QString& text) { chartProperties_.xTitle = text; });
|
||||||
|
connect(ui->yTitleLineEdit, &QLineEdit::textChanged, [this](const QString& text) { chartProperties_.yTitle = text; });
|
||||||
|
connect(ui->zTitleLineEdit, &QLineEdit::textChanged, [this](const QString& text) { chartProperties_.zTitle = text; });
|
||||||
|
|
||||||
|
// Dialog button connections
|
||||||
|
connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &AddSurfaceFileDlg::accept);
|
||||||
|
connect(ui->buttonBox, &QDialogButtonBox::rejected, this, &AddSurfaceFileDlg::reject);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddSurfaceFileDlg::onSelectFileClicked() {
|
QString AddSurfaceFileDlg::getFileFilter() const
|
||||||
const QString workspacePath = Application::GetWorkSpacePath();
|
{
|
||||||
QString filePath = QFileDialog::getOpenFileName(
|
return tr("Surface Data Files (*.txt *.dat *.csv);;All Files (*.*)");
|
||||||
this,
|
|
||||||
QStringLiteral("Select Surface Data File"),
|
|
||||||
workspacePath,
|
|
||||||
getFileFilter()
|
|
||||||
);
|
|
||||||
|
|
||||||
if (filePath.isEmpty()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ui_->filePathEdit->setText(filePath);
|
|
||||||
updateFileInfo(filePath);
|
|
||||||
|
|
||||||
LOG_INFO("Selected surface file: {}", filePath.toStdString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddSurfaceFileDlg::onFilePathChanged() {
|
QString AddSurfaceFileDlg::getDialogTitle() const
|
||||||
QString filePath = ui_->filePathEdit->text();
|
{
|
||||||
if (!filePath.isEmpty()) {
|
return tr("Select Surface Data File");
|
||||||
updateFileInfo(filePath);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddSurfaceFileDlg::updateFileInfo(const QString& filePath) {
|
bool AddSurfaceFileDlg::validateSpecificParams()
|
||||||
QFileInfo fileInfo(filePath);
|
{
|
||||||
ui_->fileNameValue->setText(fileInfo.fileName());
|
if (surfaces_.isEmpty()) {
|
||||||
|
QMessageBox::warning(this, tr("Warning"), tr("Please add at least one surface."));
|
||||||
qint64 size = fileInfo.size();
|
|
||||||
QString sizeText;
|
|
||||||
if (size < 1024) {
|
|
||||||
sizeText = QString("%1 B").arg(size);
|
|
||||||
} else if (size < 1024 * 1024) {
|
|
||||||
sizeText = QString("%1 KB").arg(size / 1024.0, 0, 'f', 1);
|
|
||||||
} else {
|
|
||||||
sizeText = QString("%1 MB").arg(size / (1024.0 * 1024.0), 0, 'f', 1);
|
|
||||||
}
|
|
||||||
ui_->fileSizeValue->setText(sizeText);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool AddSurfaceFileDlg::validateSpecificParams() {
|
|
||||||
if (ui_->filePathEdit->text().isEmpty()) {
|
|
||||||
QMessageBox::warning(this, QStringLiteral("Warning"),
|
|
||||||
QStringLiteral("Please select a surface data file."));
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QFileInfo fileInfo(ui_->filePathEdit->text());
|
// Validate chart properties
|
||||||
if (!fileInfo.exists()) {
|
if (chartProperties_.xTitle.isEmpty() || chartProperties_.yTitle.isEmpty() || chartProperties_.zTitle.isEmpty()) {
|
||||||
QMessageBox::warning(this, QStringLiteral("Warning"),
|
QMessageBox::warning(this, tr("Warning"), tr("Please fill in all axis titles."));
|
||||||
QStringLiteral("The selected file does not exist."));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ui_->xColumnSpinBox->value() == ui_->yColumnSpinBox->value() ||
|
|
||||||
ui_->xColumnSpinBox->value() == ui_->zColumnSpinBox->value() ||
|
|
||||||
ui_->yColumnSpinBox->value() == ui_->zColumnSpinBox->value()) {
|
|
||||||
QMessageBox::warning(this, QStringLiteral("Warning"),
|
|
||||||
QStringLiteral("X, Y, and Z columns must be different."));
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString AddSurfaceFileDlg::getFileFilter() const {
|
void AddSurfaceFileDlg::updateFileInfo(const QString& filePath)
|
||||||
return QStringLiteral("Surface Data Files (*.txt *.csv *.dat *.xyz);;All Files (*.*)");
|
{
|
||||||
|
ui->filePathLineEdit->setText(filePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString AddSurfaceFileDlg::getDialogTitle() const {
|
void AddSurfaceFileDlg::onSelectFile()
|
||||||
return QStringLiteral("Add Surface Data File");
|
{
|
||||||
}
|
QString documentsPath = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);
|
||||||
|
QString fileName = QFileDialog::getOpenFileName(this, getDialogTitle(), documentsPath, getFileFilter());
|
||||||
|
|
||||||
QString AddSurfaceFileDlg::getSelectedFilePath() const {
|
if (!fileName.isEmpty()) {
|
||||||
return ui_->filePathEdit->text();
|
updateFileInfo(fileName);
|
||||||
}
|
|
||||||
|
|
||||||
QString AddSurfaceFileDlg::getDescription() const {
|
|
||||||
return ui_->descriptionEdit->toPlainText().trimmed();
|
|
||||||
}
|
|
||||||
|
|
||||||
AddSurfaceFileDlg::SurfaceParams AddSurfaceFileDlg::getSurfaceParams() const {
|
|
||||||
SurfaceParams params;
|
|
||||||
params.xColumn = ui_->xColumnSpinBox->value();
|
|
||||||
params.yColumn = ui_->yColumnSpinBox->value();
|
|
||||||
params.zColumn = ui_->zColumnSpinBox->value();
|
|
||||||
params.xGridSize = ui_->xGridSizeSpinBox->value();
|
|
||||||
params.yGridSize = ui_->yGridSizeSpinBox->value();
|
|
||||||
params.hasHeader = ui_->hasHeaderCheckBox->isChecked();
|
|
||||||
params.description = ui_->descriptionEdit->toPlainText().trimmed();
|
|
||||||
|
|
||||||
// Get delimiter from combo box
|
|
||||||
int index = ui_->separatorComboBox->currentIndex();
|
|
||||||
switch (index) {
|
|
||||||
case 0: params.delimiter = ","; break;
|
|
||||||
case 1: params.delimiter = "\t"; break;
|
|
||||||
case 2: params.delimiter = " "; break;
|
|
||||||
case 3: params.delimiter = ";"; break;
|
|
||||||
default: params.delimiter = ","; break;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AddSurfaceFileDlg::onFilePathChanged()
|
||||||
|
{
|
||||||
|
// File path changed, could update preview or validation here
|
||||||
|
}
|
||||||
|
|
||||||
|
void AddSurfaceFileDlg::onSurfaceColorButtonClicked()
|
||||||
|
{
|
||||||
|
QColor color = QColorDialog::getColor(selectedColor_, this, tr("Select Surface Color"));
|
||||||
|
if (color.isValid()) {
|
||||||
|
selectedColor_ = color;
|
||||||
|
updateColorPreview(ui->surfaceColorButton, selectedColor_);
|
||||||
|
|
||||||
|
// Update current surface color if one is selected
|
||||||
|
if (currentSurfaceIndex_ >= 0 && currentSurfaceIndex_ < surfaces_.size()) {
|
||||||
|
surfaces_[currentSurfaceIndex_].color = selectedColor_;
|
||||||
|
|
||||||
|
// Update list item color
|
||||||
|
QListWidgetItem* item = ui->surfaceListWidget->item(currentSurfaceIndex_);
|
||||||
|
if (item) {
|
||||||
|
QPixmap pixmap(16, 16);
|
||||||
|
pixmap.fill(selectedColor_);
|
||||||
|
item->setIcon(QIcon(pixmap));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AddSurfaceFileDlg::onAddSurfaceClicked()
|
||||||
|
{
|
||||||
|
FileEntrySurface::SurfaceProperty surface;
|
||||||
|
surface.name = generateSurfaceName();
|
||||||
|
surface.color = generateSurfaceColor();
|
||||||
|
surface.start = 0;
|
||||||
|
surface.stop = 1000;
|
||||||
|
surface.x = QString::number(ui->xColumnSpinBox->value());
|
||||||
|
surface.y = QString::number(ui->yColumnSpinBox->value());
|
||||||
|
surface.z = QString::number(ui->zColumnSpinBox->value());
|
||||||
|
|
||||||
|
surfaces_.append(surface);
|
||||||
|
addSurfaceToList(surface);
|
||||||
|
|
||||||
|
// Select the newly added surface
|
||||||
|
ui->surfaceListWidget->setCurrentRow(surfaces_.size() - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AddSurfaceFileDlg::onRemoveSurfaceClicked()
|
||||||
|
{
|
||||||
|
int currentRow = ui->surfaceListWidget->currentRow();
|
||||||
|
if (currentRow >= 0 && currentRow < surfaces_.size()) {
|
||||||
|
surfaces_.removeAt(currentRow);
|
||||||
|
delete ui->surfaceListWidget->takeItem(currentRow);
|
||||||
|
|
||||||
|
// Update current surface index
|
||||||
|
if (currentRow < surfaces_.size()) {
|
||||||
|
ui->surfaceListWidget->setCurrentRow(currentRow);
|
||||||
|
} else if (surfaces_.size() > 0) {
|
||||||
|
ui->surfaceListWidget->setCurrentRow(surfaces_.size() - 1);
|
||||||
|
} else {
|
||||||
|
currentSurfaceIndex_ = -1;
|
||||||
|
clearSurfaceProperties();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AddSurfaceFileDlg::onSurfaceListItemClicked(QListWidgetItem* item)
|
||||||
|
{
|
||||||
|
int row = ui->surfaceListWidget->row(item);
|
||||||
|
if (row >= 0 && row < surfaces_.size()) {
|
||||||
|
saveSurfaceProperties(); // Save current surface properties
|
||||||
|
currentSurfaceIndex_ = row;
|
||||||
|
updateSurfaceProperties(); // Load new surface properties
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AddSurfaceFileDlg::onSurfaceSelectionChanged()
|
||||||
|
{
|
||||||
|
int currentRow = ui->surfaceListWidget->currentRow();
|
||||||
|
if (currentRow >= 0 && currentRow < surfaces_.size()) {
|
||||||
|
saveSurfaceProperties(); // Save current surface properties
|
||||||
|
currentSurfaceIndex_ = currentRow;
|
||||||
|
updateSurfaceProperties(); // Load new surface properties
|
||||||
|
} else {
|
||||||
|
currentSurfaceIndex_ = -1;
|
||||||
|
clearSurfaceProperties();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AddSurfaceFileDlg::onSurfaceNameChanged()
|
||||||
|
{
|
||||||
|
if (currentSurfaceIndex_ >= 0 && currentSurfaceIndex_ < surfaces_.size()) {
|
||||||
|
QString newName = ui->surfaceNameLineEdit->text();
|
||||||
|
surfaces_[currentSurfaceIndex_].name = newName;
|
||||||
|
|
||||||
|
// Update list item text
|
||||||
|
QListWidgetItem* item = ui->surfaceListWidget->item(currentSurfaceIndex_);
|
||||||
|
if (item) {
|
||||||
|
item->setText(newName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AddSurfaceFileDlg::onSurfaceDataChanged()
|
||||||
|
{
|
||||||
|
if (currentSurfaceIndex_ >= 0 && currentSurfaceIndex_ < surfaces_.size()) {
|
||||||
|
surfaces_[currentSurfaceIndex_].start = ui->surfaceStartSpinBox->value();
|
||||||
|
surfaces_[currentSurfaceIndex_].stop = ui->surfaceStopSpinBox->value();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AddSurfaceFileDlg::updateColorPreview(QPushButton* button, const QColor& color)
|
||||||
|
{
|
||||||
|
if (button && color.isValid()) {
|
||||||
|
QString styleSheet = QString("QPushButton { background-color: %1; }").arg(color.name());
|
||||||
|
button->setStyleSheet(styleSheet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AddSurfaceFileDlg::addSurfaceToList(const FileEntrySurface::SurfaceProperty& surface)
|
||||||
|
{
|
||||||
|
QListWidgetItem* item = new QListWidgetItem(surface.name);
|
||||||
|
|
||||||
|
// Set color icon
|
||||||
|
QPixmap pixmap(16, 16);
|
||||||
|
pixmap.fill(surface.color);
|
||||||
|
item->setIcon(QIcon(pixmap));
|
||||||
|
|
||||||
|
ui->surfaceListWidget->addItem(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AddSurfaceFileDlg::updateSurfaceProperties()
|
||||||
|
{
|
||||||
|
if (currentSurfaceIndex_ >= 0 && currentSurfaceIndex_ < surfaces_.size()) {
|
||||||
|
const auto& surface = surfaces_[currentSurfaceIndex_];
|
||||||
|
|
||||||
|
ui->surfaceNameLineEdit->setText(surface.name);
|
||||||
|
ui->surfaceStartSpinBox->setValue(surface.start);
|
||||||
|
ui->surfaceStopSpinBox->setValue(surface.stop);
|
||||||
|
|
||||||
|
selectedColor_ = surface.color;
|
||||||
|
updateColorPreview(ui->surfaceColorButton, selectedColor_);
|
||||||
|
|
||||||
|
ui->surfacePropertiesGroupBox->setEnabled(true);
|
||||||
|
} else {
|
||||||
|
clearSurfaceProperties();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AddSurfaceFileDlg::saveSurfaceProperties()
|
||||||
|
{
|
||||||
|
if (currentSurfaceIndex_ >= 0 && currentSurfaceIndex_ < surfaces_.size()) {
|
||||||
|
surfaces_[currentSurfaceIndex_].name = ui->surfaceNameLineEdit->text();
|
||||||
|
surfaces_[currentSurfaceIndex_].start = ui->surfaceStartSpinBox->value();
|
||||||
|
surfaces_[currentSurfaceIndex_].stop = ui->surfaceStopSpinBox->value();
|
||||||
|
surfaces_[currentSurfaceIndex_].color = selectedColor_;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AddSurfaceFileDlg::clearSurfaceProperties()
|
||||||
|
{
|
||||||
|
ui->surfaceNameLineEdit->clear();
|
||||||
|
ui->surfaceStartSpinBox->setValue(0);
|
||||||
|
ui->surfaceStopSpinBox->setValue(1000);
|
||||||
|
selectedColor_ = Qt::blue;
|
||||||
|
updateColorPreview(ui->surfaceColorButton, selectedColor_);
|
||||||
|
ui->surfacePropertiesGroupBox->setEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString AddSurfaceFileDlg::generateSurfaceName() const
|
||||||
|
{
|
||||||
|
return QString("Surface %1").arg(surfaces_.size() + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
QColor AddSurfaceFileDlg::generateSurfaceColor() const
|
||||||
|
{
|
||||||
|
// Generate different colors for each surface
|
||||||
|
static const QColor colors[] = {
|
||||||
|
Qt::blue, Qt::red, Qt::green, Qt::magenta, Qt::cyan, Qt::yellow,
|
||||||
|
Qt::darkBlue, Qt::darkRed, Qt::darkGreen, Qt::darkMagenta, Qt::darkCyan, Qt::darkYellow
|
||||||
|
};
|
||||||
|
|
||||||
|
int colorIndex = surfaces_.size() % (sizeof(colors) / sizeof(colors[0]));
|
||||||
|
return colors[colorIndex];
|
||||||
|
}
|
||||||
|
|
||||||
|
AddSurfaceFileDlg::SurfaceParams AddSurfaceFileDlg::GetSurfaceParams() const
|
||||||
|
{
|
||||||
|
SurfaceParams params;
|
||||||
|
params.xColumn = ui->xColumnSpinBox->value();
|
||||||
|
params.yColumn = ui->yColumnSpinBox->value();
|
||||||
|
params.zColumn = ui->zColumnSpinBox->value();
|
||||||
|
params.separator = ui->separatorLineEdit->text();
|
||||||
|
params.xGridSize = ui->xGridSizeSpinBox->value();
|
||||||
|
params.yGridSize = ui->yGridSizeSpinBox->value();
|
||||||
|
params.hasHeader = ui->hasHeaderCheckBox->isChecked();
|
||||||
return params;
|
return params;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString AddSurfaceFileDlg::GetSelectedFilePath() const
|
||||||
|
{
|
||||||
|
return ui->filePathLineEdit->text();
|
||||||
|
}
|
||||||
|
|
||||||
|
QString AddSurfaceFileDlg::GetDescription() const
|
||||||
|
{
|
||||||
|
return getDescription(); // 使用基类的getDescription方法
|
||||||
|
}
|
||||||
|
|
||||||
|
void AddSurfaceFileDlg::accept()
|
||||||
|
{
|
||||||
|
if (!validateSpecificParams()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save current surface properties before creating FileEntry
|
||||||
|
saveSurfaceProperties();
|
||||||
|
|
||||||
|
// Create FileEntrySurface
|
||||||
|
auto fileEntry = std::dynamic_pointer_cast<FileEntrySurface>(CreateFileEntrySurface(GetSelectedFilePath()));
|
||||||
|
if (!fileEntry) {
|
||||||
|
QMessageBox::critical(this, tr("Error"), tr("Failed to create surface file entry."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set chart properties
|
||||||
|
fileEntry->SetChartProperties(chartProperties_);
|
||||||
|
|
||||||
|
// Set surface properties
|
||||||
|
for (const auto& surface : surfaces_) {
|
||||||
|
fileEntry->AddSurfaceProperty(surface);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set description
|
||||||
|
fileEntry->SetDescription(GetDescription());
|
||||||
|
|
||||||
|
// Add to workspace
|
||||||
|
WorkSpace* workspace = WorkSpaceManager::Get().GetCurrent();
|
||||||
|
if (!workspace) {
|
||||||
|
QMessageBox::critical(this, tr("Error"), tr("Unable to get current workspace"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add FileEntrySurface to workspace using SetFileEntry method
|
||||||
|
auto result = workspace->SetFileEntry(fileEntry);
|
||||||
|
if (result != WorkSpace::FileEntryResult::Ok) {
|
||||||
|
QString errorMsg;
|
||||||
|
switch (result) {
|
||||||
|
case WorkSpace::FileEntryResult::LimitExceeded:
|
||||||
|
errorMsg = tr("Surface file count has reached the limit (9 files)");
|
||||||
|
break;
|
||||||
|
case WorkSpace::FileEntryResult::Duplicate:
|
||||||
|
errorMsg = tr("File already exists");
|
||||||
|
break;
|
||||||
|
case WorkSpace::FileEntryResult::CopyFailed:
|
||||||
|
errorMsg = tr("File copy failed");
|
||||||
|
break;
|
||||||
|
case WorkSpace::FileEntryResult::InvalidFile:
|
||||||
|
errorMsg = tr("Invalid file");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
errorMsg = tr("Failed to add file");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
QMessageBox::warning(this, tr("Error"), errorMsg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG_INFO("Added surface file to workspace: {}", GetSelectedFilePath().toUtf8().constData());
|
||||||
|
QDialog::accept();
|
||||||
|
}
|
||||||
@ -1,56 +1,86 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "BaseAddFileDlg.h"
|
#include "BaseAddFileDlg.h"
|
||||||
|
#include "workspace/FileEntry.h"
|
||||||
|
#include <QWidget>
|
||||||
|
#include <QColor>
|
||||||
|
#include <QList>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
|
||||||
class QLineEdit;
|
class QLineEdit;
|
||||||
class QCheckBox;
|
|
||||||
class QSpinBox;
|
class QSpinBox;
|
||||||
class QComboBox;
|
class QCheckBox;
|
||||||
class QTextEdit;
|
class QTextEdit;
|
||||||
class QToolButton;
|
class QComboBox;
|
||||||
class QLabel;
|
class QPushButton;
|
||||||
QT_END_NAMESPACE
|
class QListWidget;
|
||||||
|
class QListWidgetItem;
|
||||||
|
class QDoubleSpinBox;
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class AddSurfaceFileDlg;
|
class AddSurfaceFileDlg;
|
||||||
}
|
}
|
||||||
|
|
||||||
class AddSurfaceFileDlg : public BaseAddFileDlg {
|
class AddSurfaceFileDlg : public BaseAddFileDlg
|
||||||
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
struct SurfaceParams {
|
struct SurfaceParams {
|
||||||
QString delimiter;
|
|
||||||
bool hasHeader;
|
|
||||||
int xColumn;
|
int xColumn;
|
||||||
int yColumn;
|
int yColumn;
|
||||||
int zColumn;
|
int zColumn;
|
||||||
|
QString separator;
|
||||||
int xGridSize;
|
int xGridSize;
|
||||||
int yGridSize;
|
int yGridSize;
|
||||||
QString description;
|
bool hasHeader;
|
||||||
};
|
};
|
||||||
|
|
||||||
explicit AddSurfaceFileDlg(QWidget* parent = nullptr);
|
public:
|
||||||
~AddSurfaceFileDlg() override;
|
explicit AddSurfaceFileDlg(QWidget *parent = nullptr);
|
||||||
|
~AddSurfaceFileDlg();
|
||||||
|
|
||||||
SurfaceParams getSurfaceParams() const;
|
// BaseAddFileDlg interface
|
||||||
QString getSelectedFilePath() const;
|
|
||||||
QString getDescription() const;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
QString getFileFilter() const override;
|
QString getFileFilter() const override;
|
||||||
QString getDialogTitle() const override;
|
QString getDialogTitle() const override;
|
||||||
bool validateSpecificParams() override;
|
bool validateSpecificParams() override;
|
||||||
|
void updateFileInfo(const QString& filePath) override;
|
||||||
|
|
||||||
|
// Get surface parameters
|
||||||
|
SurfaceParams GetSurfaceParams() const;
|
||||||
|
QString GetSelectedFilePath() const;
|
||||||
|
QString GetDescription() const;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onSelectFileClicked();
|
void onSelectFile();
|
||||||
void onFilePathChanged();
|
void onFilePathChanged();
|
||||||
|
|
||||||
|
// Surface management slots
|
||||||
|
void onSurfaceColorButtonClicked();
|
||||||
|
void onAddSurfaceClicked();
|
||||||
|
void onRemoveSurfaceClicked();
|
||||||
|
void onSurfaceListItemClicked(QListWidgetItem* item);
|
||||||
|
void onSurfaceSelectionChanged();
|
||||||
|
void onSurfaceNameChanged();
|
||||||
|
void onSurfaceDataChanged();
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void accept() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setupConnections();
|
void setupConnections();
|
||||||
void updateFileInfo(const QString& filePath);
|
void updateColorPreview(QPushButton* button, const QColor& color);
|
||||||
|
void addSurfaceToList(const FileEntrySurface::SurfaceProperty& surface);
|
||||||
|
void updateSurfaceProperties();
|
||||||
|
void saveSurfaceProperties();
|
||||||
|
void clearSurfaceProperties();
|
||||||
|
QString generateSurfaceName() const;
|
||||||
|
QColor generateSurfaceColor() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::AddSurfaceFileDlg* ui_;
|
Ui::AddSurfaceFileDlg *ui;
|
||||||
|
int currentSurfaceIndex_;
|
||||||
|
QColor selectedColor_;
|
||||||
|
FileEntrySurface::ChartProperties chartProperties_;
|
||||||
|
FileEntrySurface::SurfaceProperties surfaces_;
|
||||||
};
|
};
|
||||||
@ -6,12 +6,12 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>500</width>
|
<width>800</width>
|
||||||
<height>520</height>
|
<height>726</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Add Surface Data File</string>
|
<string>Add Surface File</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
@ -19,56 +19,18 @@
|
|||||||
<property name="title">
|
<property name="title">
|
||||||
<string>File Selection</string>
|
<string>File Selection</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="fileGridLayout">
|
<layout class="QHBoxLayout" name="fileLayout">
|
||||||
<item row="0" column="0">
|
<item>
|
||||||
<widget class="QLabel" name="filePathLabel">
|
<widget class="QLineEdit" name="filePathLineEdit">
|
||||||
<property name="text">
|
|
||||||
<string>File Path:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QLineEdit" name="filePathEdit">
|
|
||||||
<property name="placeholderText">
|
<property name="placeholderText">
|
||||||
<string>Select surface data file...</string>
|
<string>Select surface data file...</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="readOnly">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="2">
|
<item>
|
||||||
<widget class="QToolButton" name="selectFileBtn">
|
<widget class="QPushButton" name="browseButton">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>...</string>
|
<string>Browse...</string>
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLabel" name="fileNameLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>File Name:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1" colspan="2">
|
|
||||||
<widget class="QLabel" name="fileNameValue">
|
|
||||||
<property name="text">
|
|
||||||
<string>-</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0">
|
|
||||||
<widget class="QLabel" name="fileSizeLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>File Size:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1" colspan="2">
|
|
||||||
<widget class="QLabel" name="fileSizeValue">
|
|
||||||
<property name="text">
|
|
||||||
<string>-</string>
|
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -76,11 +38,372 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="paramsGroupBox">
|
<widget class="QGroupBox" name="chartPropertiesGroupBox">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Surface Parameters</string>
|
<string>Chart Properties</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="paramsGridLayout">
|
<layout class="QGridLayout" name="chartPropertiesLayout">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="xTitleLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>X Axis Title:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLineEdit" name="xTitleLineEdit"/>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="2">
|
||||||
|
<widget class="QLabel" name="yTitleLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Y Axis Title:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="3">
|
||||||
|
<widget class="QLineEdit" name="yTitleLineEdit"/>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="zTitleLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Z Axis Title:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QLineEdit" name="zTitleLineEdit"/>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="2">
|
||||||
|
<widget class="QLabel" name="timeParamLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Time Parameter:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="3">
|
||||||
|
<widget class="QDoubleSpinBox" name="timeParamSpinBox">
|
||||||
|
<property name="decimals">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<double>-999999.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<double>999999.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="xRangeLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>X Range:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<layout class="QHBoxLayout" name="xRangeLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QDoubleSpinBox" name="xMinSpinBox">
|
||||||
|
<property name="decimals">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<double>-999999.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<double>999999.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="xToLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>to</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QDoubleSpinBox" name="xMaxSpinBox">
|
||||||
|
<property name="decimals">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<double>-999999.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<double>999999.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="2">
|
||||||
|
<widget class="QLabel" name="xCountLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>X Count:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="3">
|
||||||
|
<widget class="QSpinBox" name="xCountSpinBox">
|
||||||
|
<property name="minimum">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>10000</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>100</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QLabel" name="yRangeLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Y Range:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
|
<layout class="QHBoxLayout" name="yRangeLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QDoubleSpinBox" name="yMinSpinBox">
|
||||||
|
<property name="decimals">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<double>-999999.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<double>999999.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="yToLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>to</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QDoubleSpinBox" name="yMaxSpinBox">
|
||||||
|
<property name="decimals">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<double>-999999.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<double>999999.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="2">
|
||||||
|
<widget class="QLabel" name="yCountLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Y Count:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="3">
|
||||||
|
<widget class="QSpinBox" name="yCountSpinBox">
|
||||||
|
<property name="minimum">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>10000</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>100</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0">
|
||||||
|
<widget class="QLabel" name="zRangeLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Z Range:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="1">
|
||||||
|
<layout class="QHBoxLayout" name="zRangeLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QDoubleSpinBox" name="zMinSpinBox">
|
||||||
|
<property name="decimals">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<double>-999999.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<double>999999.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="zToLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>to</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QDoubleSpinBox" name="zMaxSpinBox">
|
||||||
|
<property name="decimals">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<double>-999999.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<double>999999.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="2">
|
||||||
|
<widget class="QLabel" name="zCountLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Z Count:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="3">
|
||||||
|
<widget class="QSpinBox" name="zCountSpinBox">
|
||||||
|
<property name="minimum">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>10000</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>100</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="surfaceManagementGroupBox">
|
||||||
|
<property name="title">
|
||||||
|
<string>Surface Management</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="surfaceManagementLayout">
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="surfaceListLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="addSurfaceButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>Add Surface</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QListWidget" name="surfaceListWidget">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>200</width>
|
||||||
|
<height>150</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="removeSurfaceButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>Remove</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="surfacePropertiesGroupBox">
|
||||||
|
<property name="title">
|
||||||
|
<string>Surface Properties</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="surfacePropertiesLayout">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="surfaceNameLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Name:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLineEdit" name="surfaceNameLineEdit"/>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="surfaceColorLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Color:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QPushButton" name="surfaceColorButton">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>100</width>
|
||||||
|
<height>30</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Select Color</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="surfaceStartLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Start Point:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QSpinBox" name="surfaceStartSpinBox">
|
||||||
|
<property name="minimum">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>999999</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QLabel" name="surfaceStopLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>End Point:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
|
<widget class="QSpinBox" name="surfaceStopSpinBox">
|
||||||
|
<property name="minimum">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>999999</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="dataFormatGroupBox">
|
||||||
|
<property name="title">
|
||||||
|
<string>Data Format Parameters</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="dataFormatLayout">
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="xColumnLabel">
|
<widget class="QLabel" name="xColumnLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@ -94,92 +417,75 @@
|
|||||||
<number>1</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<number>100</number>
|
<number>1000</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="value">
|
<property name="value">
|
||||||
<number>1</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="0" column="2">
|
||||||
<widget class="QLabel" name="yColumnLabel">
|
<widget class="QLabel" name="yColumnLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Y Column:</string>
|
<string>Y Column:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="0" column="3">
|
||||||
<widget class="QSpinBox" name="yColumnSpinBox">
|
<widget class="QSpinBox" name="yColumnSpinBox">
|
||||||
<property name="minimum">
|
<property name="minimum">
|
||||||
<number>1</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<number>100</number>
|
<number>1000</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="value">
|
<property name="value">
|
||||||
<number>2</number>
|
<number>2</number>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QLabel" name="zColumnLabel">
|
<widget class="QLabel" name="zColumnLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Z Column:</string>
|
<string>Z Column:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1">
|
<item row="1" column="1">
|
||||||
<widget class="QSpinBox" name="zColumnSpinBox">
|
<widget class="QSpinBox" name="zColumnSpinBox">
|
||||||
<property name="minimum">
|
<property name="minimum">
|
||||||
<number>1</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<number>100</number>
|
<number>1000</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="value">
|
<property name="value">
|
||||||
<number>3</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
<item row="1" column="2">
|
||||||
<widget class="QLabel" name="separatorLabel">
|
<widget class="QLabel" name="separatorLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Separator:</string>
|
<string>Separator:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="1">
|
<item row="1" column="3">
|
||||||
<widget class="QComboBox" name="separatorComboBox">
|
<widget class="QLineEdit" name="separatorLineEdit">
|
||||||
<item>
|
<property name="text">
|
||||||
<property name="text">
|
<string>,</string>
|
||||||
<string>Comma (,)</string>
|
</property>
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Tab</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Space</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Semicolon (;)</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="0">
|
<item row="2" column="0">
|
||||||
<widget class="QLabel" name="xGridSizeLabel">
|
<widget class="QLabel" name="xGridSizeLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>X Grid Size:</string>
|
<string>X Grid Size:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="1">
|
<item row="2" column="1">
|
||||||
<widget class="QSpinBox" name="xGridSizeSpinBox">
|
<widget class="QSpinBox" name="xGridSizeSpinBox">
|
||||||
<property name="minimum">
|
<property name="minimum">
|
||||||
<number>1</number>
|
<number>1</number>
|
||||||
@ -192,14 +498,14 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="0">
|
<item row="2" column="2">
|
||||||
<widget class="QLabel" name="yGridSizeLabel">
|
<widget class="QLabel" name="yGridSizeLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Y Grid Size:</string>
|
<string>Y Grid Size:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="1">
|
<item row="2" column="3">
|
||||||
<widget class="QSpinBox" name="yGridSizeSpinBox">
|
<widget class="QSpinBox" name="yGridSizeSpinBox">
|
||||||
<property name="minimum">
|
<property name="minimum">
|
||||||
<number>1</number>
|
<number>1</number>
|
||||||
@ -212,13 +518,10 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="0" colspan="2">
|
<item row="3" column="0" colspan="2">
|
||||||
<widget class="QCheckBox" name="hasHeaderCheckBox">
|
<widget class="QCheckBox" name="hasHeaderCheckBox">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>File has header row</string>
|
<string>Has Header Row</string>
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -226,76 +529,50 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="descGroupBox">
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
<property name="title">
|
|
||||||
<string>Description (Optional)</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="descVerticalLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QTextEdit" name="descriptionEdit">
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>16777215</width>
|
|
||||||
<height>80</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="placeholderText">
|
|
||||||
<string>Enter file description...</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="verticalSpacer">
|
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="standardButtons">
|
||||||
<size>
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</widget>
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="buttonLayout">
|
|
||||||
<item>
|
|
||||||
<spacer name="horizontalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="addBtn">
|
|
||||||
<property name="text">
|
|
||||||
<string>Add File</string>
|
|
||||||
</property>
|
|
||||||
<property name="default">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="cancelBtn">
|
|
||||||
<property name="text">
|
|
||||||
<string>Cancel</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>accepted()</signal>
|
||||||
|
<receiver>AddSurfaceFileDlg</receiver>
|
||||||
|
<slot>accept()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>248</x>
|
||||||
|
<y>254</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>157</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>rejected()</signal>
|
||||||
|
<receiver>AddSurfaceFileDlg</receiver>
|
||||||
|
<slot>reject()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>316</x>
|
||||||
|
<y>260</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>286</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
</ui>
|
</ui>
|
||||||
@ -46,13 +46,16 @@ std::shared_ptr<FileEntryCurve> CreateFileEntryCurve(const QString& filePath) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<FileEntry> CreateFileEntrySurface(const QString& filePath) {
|
std::shared_ptr<FileEntry> CreateFileEntrySurface(const QString& filePath) {
|
||||||
auto fileEntry = std::make_shared<FileEntry>();
|
QFileInfo fileInfo(filePath);
|
||||||
fileEntry->SetType(FileEntryType::Surface);
|
if (!fileInfo.exists()) {
|
||||||
|
LOG_ERROR("File does not exist: {}", filePath.toUtf8().constData());
|
||||||
if (!filePath.isEmpty()) {
|
return nullptr;
|
||||||
fileEntry->SetPath(filePath);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto fileEntry = std::make_shared<FileEntrySurface>();
|
||||||
|
fileEntry->SetPath(filePath);
|
||||||
|
fileEntry->SetName(fileInfo.baseName()); // Use base name as default display name
|
||||||
|
|
||||||
return fileEntry;
|
return fileEntry;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,3 +83,44 @@ std::shared_ptr<FileEntryLight> CreateFileEntryLight(const QString& filePath) {
|
|||||||
|
|
||||||
return fileEntry;
|
return fileEntry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FileEntrySurface method implementations
|
||||||
|
void FileEntrySurface::SetChartProperties(const ChartProperties& properties) {
|
||||||
|
chartProperties_ = properties;
|
||||||
|
}
|
||||||
|
|
||||||
|
const FileEntrySurface::ChartProperties& FileEntrySurface::GetChartProperties() const {
|
||||||
|
return chartProperties_;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FileEntrySurface::AddSurfaceProperty(const SurfaceProperty& surface) {
|
||||||
|
surfaceProperties_.append(surface);
|
||||||
|
}
|
||||||
|
|
||||||
|
void FileEntrySurface::RemoveSurfaceProperty(int index) {
|
||||||
|
if (index >= 0 && index < surfaceProperties_.size()) {
|
||||||
|
surfaceProperties_.removeAt(index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void FileEntrySurface::SetSurfaceProperty(int index, const SurfaceProperty& surface) {
|
||||||
|
if (index >= 0 && index < surfaceProperties_.size()) {
|
||||||
|
surfaceProperties_[index] = surface;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const FileEntrySurface::SurfaceProperties& FileEntrySurface::GetSurfaceProperties() const {
|
||||||
|
return surfaceProperties_;
|
||||||
|
}
|
||||||
|
|
||||||
|
FileEntrySurface* FileEntrySurface::AsSurface() {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FileEntrySurface::SetDescription(const QString& description) {
|
||||||
|
description_ = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
const QString& FileEntrySurface::GetDescription() const {
|
||||||
|
return description_;
|
||||||
|
}
|
||||||
@ -31,6 +31,7 @@ inline bool FileEntryTypeFromString(const char* s, FileEntryType& out) {
|
|||||||
|
|
||||||
class FileEntryCurve;
|
class FileEntryCurve;
|
||||||
class FileEntryLight;
|
class FileEntryLight;
|
||||||
|
class FileEntrySurface;
|
||||||
|
|
||||||
class FileEntry {
|
class FileEntry {
|
||||||
public:
|
public:
|
||||||
@ -48,8 +49,9 @@ public:
|
|||||||
void SetName(const QString& name) { name_ = name; }
|
void SetName(const QString& name) { name_ = name; }
|
||||||
QString GetName() const { return name_; }
|
QString GetName() const { return name_; }
|
||||||
|
|
||||||
virtual FileEntryCurve* AsCurve() { return nullptr; }
|
virtual FileEntryCurve* AsCurve() { return nullptr; }
|
||||||
virtual FileEntryLight* AsLight() { return nullptr; }
|
virtual FileEntryLight* AsLight() { return nullptr; }
|
||||||
|
virtual FileEntrySurface* AsSurface() { return nullptr; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
FileEntryType type_;
|
FileEntryType type_;
|
||||||
@ -105,6 +107,62 @@ private:
|
|||||||
CurveProperties curveProperties_;
|
CurveProperties curveProperties_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class FileEntrySurface : public FileEntry {
|
||||||
|
public:
|
||||||
|
struct ChartProperties {
|
||||||
|
int xCount;
|
||||||
|
int yCount; // Added missing yCount
|
||||||
|
int zCount; // Added missing zCount
|
||||||
|
QString xTitle;
|
||||||
|
QString yTitle;
|
||||||
|
QString zTitle;
|
||||||
|
double xMin;
|
||||||
|
double xMax;
|
||||||
|
double yMin;
|
||||||
|
double yMax;
|
||||||
|
double zMin;
|
||||||
|
double zMax;
|
||||||
|
double timeParam;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SurfaceProperty {
|
||||||
|
QString name;
|
||||||
|
QColor color;
|
||||||
|
int start;
|
||||||
|
int stop;
|
||||||
|
QString x;
|
||||||
|
QString y;
|
||||||
|
QString z;
|
||||||
|
};
|
||||||
|
|
||||||
|
using SurfaceProperties = QList<SurfaceProperty>;
|
||||||
|
|
||||||
|
public:
|
||||||
|
FileEntrySurface() { type_ = FileEntryType::Surface; }
|
||||||
|
|
||||||
|
// Chart properties management
|
||||||
|
void SetChartProperties(const ChartProperties& properties);
|
||||||
|
const ChartProperties& GetChartProperties() const;
|
||||||
|
|
||||||
|
// Surface properties management
|
||||||
|
void AddSurfaceProperty(const SurfaceProperty& surface);
|
||||||
|
void RemoveSurfaceProperty(int index);
|
||||||
|
void SetSurfaceProperty(int index, const SurfaceProperty& surface);
|
||||||
|
const SurfaceProperties& GetSurfaceProperties() const;
|
||||||
|
|
||||||
|
// Type conversion
|
||||||
|
FileEntrySurface* AsSurface() override;
|
||||||
|
|
||||||
|
// Description management
|
||||||
|
void SetDescription(const QString& description);
|
||||||
|
const QString& GetDescription() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
ChartProperties chartProperties_;
|
||||||
|
SurfaceProperties surfaceProperties_;
|
||||||
|
QString description_;
|
||||||
|
};
|
||||||
|
|
||||||
class FileEntryLight : public FileEntry {
|
class FileEntryLight : public FileEntry {
|
||||||
public:
|
public:
|
||||||
struct ColorProperties {
|
struct ColorProperties {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user