remove worksapce attribute

This commit is contained in:
brige 2025-11-02 17:47:54 +08:00
parent 7a0a0b7495
commit f65ea8dcd8
13 changed files with 67 additions and 638 deletions

View File

@ -126,7 +126,6 @@ void MainFrame::InitUI() {
OsgWidget* viewWidget = mainWindow->GetViewWidget(); OsgWidget* viewWidget = mainWindow->GetViewWidget();
connect(fileMenu, &FileManagerMenu::LoadDyt, viewWidget, &OsgWidget::OnLoadDyt); connect(fileMenu, &FileManagerMenu::LoadDyt, viewWidget, &OsgWidget::OnLoadDyt);
connect(viewWidget, &OsgWidget::signalResetWorkSpace, mainWindow, &MainWindow::slotResetWorkSpace);
//connect(system_, &SystemManagerMenu::signalShowUISetting, mainWindow, &MainWindow::slotShowUISetting); //connect(system_, &SystemManagerMenu::signalShowUISetting, mainWindow, &MainWindow::slotShowUISetting);

View File

@ -140,20 +140,3 @@ void MainWindow::UninitUI() {
} }
} }
void MainWindow::slotResetWorkSpace()
{
QString wavePath = "", speedPath = "", rdPath = "";
if (WorkSpaceManager::Get().GetCurrent()) {
if (!WorkSpaceManager::Get().GetCurrent()->GetWavePath().isEmpty()) {
wavePath = RecourceHelper::Get().GetBasePath() + "/" + WorkSpaceManager::Get().GetCurrent()->GetWavePath();
}
if (!WorkSpaceManager::Get().GetCurrent()->GetReportPath().isEmpty()) {
speedPath = RecourceHelper::Get().GetBasePath() + "/" + WorkSpaceManager::Get().GetCurrent()->GetReportPath();
}
if (!WorkSpaceManager::Get().GetCurrent()->GetRDPath().isEmpty()) {
rdPath = RecourceHelper::Get().GetBasePath() + "/" + WorkSpaceManager::Get().GetCurrent()->GetRDPath();
}
}
}

View File

@ -36,9 +36,6 @@ public:
return dataPanelManager_; return dataPanelManager_;
} }
public slots:
void slotResetWorkSpace();
private: private:
void InitUI(); void InitUI();
void UninitUI(); void UninitUI();

View File

@ -1,4 +1,4 @@
#include "ChartPlotMenu.h" #include "ChartPlotMenu.h"
#include "../Matlab/MatlabObject.h" #include "../Matlab/MatlabObject.h"
#include "../../common/RecourceHelper.h" #include "../../common/RecourceHelper.h"
@ -9,6 +9,7 @@
#include <qmessagebox.h> #include <qmessagebox.h>
#include <qfiledialog.h> #include <qfiledialog.h>
#include <QDir>
ChartPlotMenu::ChartPlotMenu(QWidget *parent) ChartPlotMenu::ChartPlotMenu(QWidget *parent)
: QWidget(parent) : QWidget(parent)
@ -25,217 +26,35 @@ ChartPlotMenu::~ChartPlotMenu()
void ChartPlotMenu::InitMenu() void ChartPlotMenu::InitMenu()
{ {
connect(ui.toolButton, &QToolButton::clicked, this, [=] { // Deprecated: SimMatlab run action removed
if (WorkSpaceManager::Get().GetCurrent())
{
QString strFile = WorkSpaceManager::Get().GetCurrent()->GetSimMatlab();
if (!strFile.isEmpty())
{
MatlabObject::GetInstance()->RunMatlabFile(strFile);
}
else
{
QMessageBox::information(nullptr, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("请检查仿真文件路径是否存在!"));
}
}
});
connect(ui.toolButton_2, &QToolButton::clicked, this, [=] { // Deprecated: SimMatlab selection removed
auto current = WorkSpaceManager::Get().GetCurrent();
if (nullptr == current) {
QMessageBox::information(nullptr, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("请先创建空间!"));
return;
}
QString strSel = QFileDialog::getOpenFileName(this, u8"选择仿真运行文件", RecourceHelper::Get().GetBasePath() + "/workspace/", "*.m");
if (strSel.isEmpty()) {
LOG_WARN("选择文件为空");
return;
}
const QString old = current->GetSimMatlab(); // Deprecated: Wave file selection removed
if (old == strSel) {
LOG_INFO("选择文件与当前文件相同");
return;
} else if (!old.isEmpty()) {
if (QFileInfo(old).isFile() && QFile::exists(old)) {
if (QMessageBox::Yes == QMessageBox::question(nullptr,
QString::fromLocal8Bit("询问"),
QString::fromLocal8Bit("替换当前仿真文件!"),
QMessageBox::Yes | QMessageBox::No)
) {
if (!QFile::remove(old)) {
LOG_WARN("删除文件失败");
QMessageBox::information(nullptr,
QString::fromLocal8Bit("提示"),
QString::fromLocal8Bit("删除文件失败!"));
return;
}
}
}
}
current->SetSimMatlab(strSel); // Deprecated: RD file selection removed
});
// Deprecated: Report file selection removed
connect(ui.toolButton_5, &QToolButton::clicked, this, [=] {
auto current = WorkSpaceManager::Get().GetCurrent(); // Restore Lamp file selection with safe encoding
if (nullptr == current) { connect(ui.toolButton_6, &QToolButton::clicked, this, [this]() {
QMessageBox::information(nullptr, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("请先创建空间!")); auto* ws = WorkSpaceManager::Get().GetCurrent();
return; const QString defaultDir = ws ? ws->GetDir() : QDir::currentPath();
} const QString title = QString::fromLocal8Bit("选择Lamp文件");
QString strSel = QFileDialog::getOpenFileName(this, u8"选择Wave文件", RecourceHelper::Get().GetBasePath() + "/workspace/", "*.txt"); const QString filters = QString::fromLocal8Bit("文本文件 (*.txt);;所有文件 (*.*)");
if (strSel.isEmpty()) { const QString file = QFileDialog::getOpenFileName(this, title, defaultDir, filters);
LOG_WARN("选择文件为空"); if (file.isEmpty()) {
return; return;
} }
if (!ws) {
const QString old = current->GetWavePath(); QMessageBox::warning(this, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("当前无工作区"));
if (old == strSel) { return;
LOG_INFO("选择文件与当前文件相同"); }
return; const bool ok = ws->SetLampPath(file);
} if (ok) {
else if (!old.isEmpty()) { QMessageBox::information(this, QString::fromLocal8Bit("Lamp"), QString::fromLocal8Bit("已加载 Lamp 文件"));
if (QFileInfo(old).isFile() && QFile::exists(old)) { } else {
if (QMessageBox::Yes == QMessageBox::question(nullptr, QMessageBox::warning(this, QString::fromLocal8Bit("Lamp"), QString::fromLocal8Bit("加载 Lamp 文件失败"));
QString::fromLocal8Bit("询问"), }
QString::fromLocal8Bit("替换当前Wave文件"), });
QMessageBox::Yes | QMessageBox::No)
) {
if (!QFile::remove(old)) {
LOG_WARN("删除文件失败");
QMessageBox::information(nullptr,
QString::fromLocal8Bit("提示"),
QString::fromLocal8Bit("删除文件失败!"));
return;
}
}
}
}
current->SetWavePath(strSel);
});
connect(ui.toolButton_3, &QToolButton::clicked, this, [=] {
auto current = WorkSpaceManager::Get().GetCurrent();
if (nullptr == current) {
QMessageBox::information(nullptr, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("请先创建空间!"));
return;
}
QString strSel = QFileDialog::getOpenFileName(this, u8"选择RD文件", RecourceHelper::Get().GetBasePath() + "/workspace/", "*.txt");
if (strSel.isEmpty()) {
LOG_WARN("选择文件为空");
return;
}
const QString old = current->GetRDPath();
if (old == strSel) {
LOG_INFO("选择文件与当前文件相同");
return;
}
else if (!old.isEmpty()) {
if (QFileInfo(old).isFile() && QFile::exists(old)) {
if (QMessageBox::Yes == QMessageBox::question(nullptr,
QString::fromLocal8Bit("询问"),
QString::fromLocal8Bit("替换当前RD文件"),
QMessageBox::Yes | QMessageBox::No)
) {
if (!QFile::remove(old)) {
LOG_WARN("删除文件失败");
QMessageBox::information(nullptr,
QString::fromLocal8Bit("提示"),
QString::fromLocal8Bit("删除文件失败!"));
return;
}
}
}
}
current->SetRDPath(strSel);
});
connect(ui.toolButton_4, &QToolButton::clicked, this, [=] {
auto current = WorkSpaceManager::Get().GetCurrent();
if (nullptr == current) {
QMessageBox::information(nullptr, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("请先创建空间!"));
return;
}
QString strSel = QFileDialog::getOpenFileName(this, u8"选择Report文件", RecourceHelper::Get().GetBasePath() + "/workspace/", "*.txt");
if (strSel.isEmpty()) {
LOG_WARN("选择文件为空");
return;
}
const QString old = current->GetReportPath();
if (old == strSel) {
LOG_INFO("选择文件与当前文件相同");
return;
}
else if (!old.isEmpty()) {
if (QFileInfo(old).isFile() && QFile::exists(old)) {
if (QMessageBox::Yes == QMessageBox::question(nullptr,
QString::fromLocal8Bit("询问"),
QString::fromLocal8Bit("替换当前Report文件"),
QMessageBox::Yes | QMessageBox::No)
) {
if (!QFile::remove(old)) {
LOG_WARN("删除文件失败");
QMessageBox::information(nullptr,
QString::fromLocal8Bit("提示"),
QString::fromLocal8Bit("删除文件失败!"));
return;
}
}
}
}
current->SetReportPath(strSel);
});
connect(ui.toolButton_6, &QToolButton::clicked, this, [=] {
auto current = WorkSpaceManager::Get().GetCurrent();
if (nullptr == current) {
QMessageBox::information(nullptr, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("请先创建空间!"));
return;
}
QString strSel = QFileDialog::getOpenFileName(this, u8"选择Lamp文件", RecourceHelper::Get().GetBasePath() + "/workspace/", "*.txt");
if (strSel.isEmpty()) {
LOG_WARN("选择文件为空");
return;
}
auto lampStatus = current->GetLampStatus();
if (nullptr != lampStatus) {
const QString& old = lampStatus->GetPath();
if (old == strSel) {
LOG_INFO("选择文件与当前文件相同");
return;
}
else if (!old.isEmpty()) {
if (QFileInfo(old).isFile() && QFile::exists(old)) {
if (QMessageBox::Yes == QMessageBox::question(nullptr,
QString::fromLocal8Bit("询问"),
QString::fromLocal8Bit("替换当前Lamp文件"),
QMessageBox::Yes | QMessageBox::No)
) {
if (!QFile::remove(old)) {
LOG_WARN("删除文件失败");
QMessageBox::information(nullptr,
QString::fromLocal8Bit("提示"),
QString::fromLocal8Bit("删除文件失败!"));
return;
}
}
}
}
}
QFileInfo fileInfo(strSel);
QString dirPath = QString("%1/%2").arg(current->GetDir(), fileInfo.fileName());
bool sucess = FileUtils::CopyFileToPath(strSel, dirPath, true);
LOG_INFO("copy Wave file {}: {} to {}",
strSel.toLocal8Bit().data(),
dirPath.toLocal8Bit().data(),
sucess);
current->SetLampPath(dirPath);
});
} }

View File

@ -18,6 +18,9 @@
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
<widget class="QToolButton" name="toolButton_5"> <widget class="QToolButton" name="toolButton_5">
<property name="visible">
<bool>false</bool>
</property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>60</width> <width>60</width>
@ -31,6 +34,9 @@
</item> </item>
<item> <item>
<widget class="QToolButton" name="toolButton_4"> <widget class="QToolButton" name="toolButton_4">
<property name="visible">
<bool>false</bool>
</property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>60</width> <width>60</width>
@ -44,6 +50,9 @@
</item> </item>
<item> <item>
<widget class="QToolButton" name="toolButton_3"> <widget class="QToolButton" name="toolButton_3">
<property name="visible">
<bool>false</bool>
</property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>60</width> <width>60</width>
@ -57,6 +66,9 @@
</item> </item>
<item> <item>
<widget class="QToolButton" name="toolButton_2"> <widget class="QToolButton" name="toolButton_2">
<property name="visible">
<bool>false</bool>
</property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>60</width> <width>60</width>
@ -70,6 +82,9 @@
</item> </item>
<item> <item>
<widget class="QToolButton" name="toolButton_6"> <widget class="QToolButton" name="toolButton_6">
<property name="visible">
<bool>true</bool>
</property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>60</width> <width>60</width>
@ -83,6 +98,9 @@
</item> </item>
<item> <item>
<widget class="QToolButton" name="toolButton"> <widget class="QToolButton" name="toolButton">
<property name="visible">
<bool>false</bool>
</property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>60</width> <width>60</width>

View File

@ -7991,25 +7991,9 @@ void QtWorkspacePropertyManagerPrivate::slotStringChanged(QtProperty* property,
QWorkspaceAttribute c = m_values[prop]; QWorkspaceAttribute c = m_values[prop];
c.SetTimeStep(value); c.SetTimeStep(value);
q_ptr->setValue(prop, c); q_ptr->setValue(prop, c);
} else if (QtProperty* prop = m_simMatlabToPropery.value(property, 0)) { } else if (QtProperty* prop = m_commondPathToPropery.value(property, 0)) {
QWorkspaceAttribute c = m_values[prop]; QWorkspaceAttribute c = m_values[prop];
c.SetSimMatlab(value); c.SetCommondFilePath(value);
q_ptr->setValue(prop, c);
} else if (QtProperty* prop = m_matlabParamToPropery.value(property, 0)) {
QWorkspaceAttribute c = m_values[prop];
c.SetMatlabParam(value);
q_ptr->setValue(prop, c);
} else if (QtProperty* prop = m_wavePathToPropery.value(property, 0)) {
QWorkspaceAttribute c = m_values[prop];
c.SetWavePath(value);
q_ptr->setValue(prop, c);
} else if (QtProperty* prop = m_reportPathToPropery.value(property, 0)) {
QWorkspaceAttribute c = m_values[prop];
c.SetReportPath(value);
q_ptr->setValue(prop, c);
} else if (QtProperty* prop = m_rdPathToPropery.value(property, 0)) {
QWorkspaceAttribute c = m_values[prop];
c.SetRDPath(value);
q_ptr->setValue(prop, c); q_ptr->setValue(prop, c);
} else if (QtProperty* prop = m_commondPathToPropery.value(property, 0)) { } else if (QtProperty* prop = m_commondPathToPropery.value(property, 0)) {
QWorkspaceAttribute c = m_values[prop]; QWorkspaceAttribute c = m_values[prop];
@ -8230,11 +8214,6 @@ void QtWorkspacePropertyManager::setValue(QtProperty* property, const QWorkspace
d_ptr->m_stringProperyManager->setValue(d_ptr->m_properyToName[property], value.GetName()); d_ptr->m_stringProperyManager->setValue(d_ptr->m_properyToName[property], value.GetName());
d_ptr->m_stringProperyManager->setValue(d_ptr->m_properyToDescription[property], value.GetDescription()); d_ptr->m_stringProperyManager->setValue(d_ptr->m_properyToDescription[property], value.GetDescription());
d_ptr->m_filesProperyManager->setValue(d_ptr->m_properyToTimestep[property], value.GetTimeStep()); d_ptr->m_filesProperyManager->setValue(d_ptr->m_properyToTimestep[property], value.GetTimeStep());
d_ptr->m_filesProperyManager->setValue(d_ptr->m_properyToSimMatlab[property], value.GetSimMatlab());
d_ptr->m_filesProperyManager->setValue(d_ptr->m_properyToMatlabParam[property], value.GetMatlabParam());
d_ptr->m_filesProperyManager->setValue(d_ptr->m_properyToWavePath[property], value.GetWavePath());
d_ptr->m_filesProperyManager->setValue(d_ptr->m_properyToReportPath[property], value.GetReportPath());
d_ptr->m_filesProperyManager->setValue(d_ptr->m_properyToRDPath[property], value.GetRDPath());
d_ptr->m_filesProperyManager->setValue(d_ptr->m_properyToCommondPath[property], value.GetCommondFilePath()); d_ptr->m_filesProperyManager->setValue(d_ptr->m_properyToCommondPath[property], value.GetCommondFilePath());
auto syncGroup = [&](FileEntryType type, auto syncGroup = [&](FileEntryType type,
@ -8323,40 +8302,7 @@ void QtWorkspacePropertyManager::initializeProperty(QtProperty* property) {
d_ptr->m_timestepToPropery[prop] = property; d_ptr->m_timestepToPropery[prop] = property;
property->addSubProperty(prop); property->addSubProperty(prop);
prop = d_ptr->m_filesProperyManager->addProperty(); // Deprecated properties (SimMatlab/MatlabParam/WavePath/ReportPath/RDPath) removed from UI
prop->setPropertyName(tr("SimMatlab"));
d_ptr->m_filesProperyManager->setValueOnly(prop, val.GetSimMatlab());
d_ptr->m_properyToSimMatlab[property] = prop;
d_ptr->m_simMatlabToPropery[prop] = property;
property->addSubProperty(prop);
prop = d_ptr->m_filesProperyManager->addProperty();
prop->setPropertyName(tr("MatlabParam"));
d_ptr->m_filesProperyManager->setValueOnly(prop, val.GetMatlabParam());
d_ptr->m_properyToMatlabParam[property] = prop;
d_ptr->m_matlabParamToPropery[prop] = property;
property->addSubProperty(prop);
prop = d_ptr->m_filesProperyManager->addProperty();
prop->setPropertyName(tr("WavePath"));
d_ptr->m_filesProperyManager->setValueOnly(prop, val.GetWavePath());
d_ptr->m_properyToWavePath[property] = prop;
d_ptr->m_wavePathToPropery[prop] = property;
property->addSubProperty(prop);
prop = d_ptr->m_filesProperyManager->addProperty();
prop->setPropertyName(tr("ReportPath"));
d_ptr->m_filesProperyManager->setValueOnly(prop, val.GetReportPath());
d_ptr->m_properyToReportPath[property] = prop;
d_ptr->m_reportPathToPropery[prop] = property;
property->addSubProperty(prop);
prop = d_ptr->m_filesProperyManager->addProperty();
prop->setPropertyName(tr("RDPath"));
d_ptr->m_filesProperyManager->setValueOnly(prop, val.GetRDPath());
d_ptr->m_properyToRDPath[property] = prop;
d_ptr->m_rdPathToPropery[prop] = property;
property->addSubProperty(prop);
// Command XML path // Command XML path
prop = d_ptr->m_filesProperyManager->addProperty(); prop = d_ptr->m_filesProperyManager->addProperty();

View File

@ -91,88 +91,7 @@ const QString QWorkspaceAttribute::GetTimeStep() const {
return timestep->GetPath(); return timestep->GetPath();
} }
void QWorkspaceAttribute::SetSimMatlab(const QString& path) { // Deprecated workspace path setters/getters removed
if (nullptr == workspace_) {
return;
}
workspace_->SetSimMatlab(path);
}
const QString QWorkspaceAttribute::GetSimMatlab() const {
if (nullptr == workspace_) {
return "";
}
return workspace_->GetSimMatlab();
}
void QWorkspaceAttribute::SetMatlabParam(const QString& path)
{
if (nullptr == workspace_) {
return;
}
workspace_->SetMatlabParam(path);
}
const QString QWorkspaceAttribute::GetMatlabParam() const
{
if (nullptr == workspace_) {
return "";
}
return workspace_->GetMatlabParam();
}
void QWorkspaceAttribute::SetWavePath(const QString& path)
{
if (nullptr == workspace_) {
return;
}
workspace_->SetWavePath(path);
}
const QString QWorkspaceAttribute::GetWavePath() const
{
if (nullptr == workspace_) {
return "";
}
return workspace_->GetWavePath();
}
void QWorkspaceAttribute::SetReportPath(const QString& path)
{
if (nullptr == workspace_) {
return;
}
workspace_->SetReportPath(path);
}
const QString QWorkspaceAttribute::GetReportPath() const
{
if (nullptr == workspace_) {
return "";
}
return workspace_->GetReportPath();
}
void QWorkspaceAttribute::SetRDPath(const QString& path)
{
if (nullptr == workspace_) {
return;
}
workspace_->SetRDPath(path);
}
const QString QWorkspaceAttribute::GetRDPath() const
{
if (nullptr == workspace_) {
return "";
}
return workspace_->GetRDPath();
}
void QWorkspaceAttribute::SetCommondFilePath(const QString& path) void QWorkspaceAttribute::SetCommondFilePath(const QString& path)
{ {

View File

@ -65,20 +65,7 @@ public:
void SetTimeStep(const QString& timestep); void SetTimeStep(const QString& timestep);
const QString GetTimeStep() const; const QString GetTimeStep() const;
void SetSimMatlab(const QString& path); // Deprecated fields removed: SimMatlab/MatlabParam/WavePath/ReportPath/RDPath
const QString GetSimMatlab() const;
void SetMatlabParam(const QString& path);
const QString GetMatlabParam() const;
void SetWavePath(const QString& path);
const QString GetWavePath() const;
void SetReportPath(const QString& path);
const QString GetReportPath() const;
void SetRDPath(const QString& path);
const QString GetRDPath() const;
// Command XML path // Command XML path
void SetCommondFilePath(const QString& path); void SetCommondFilePath(const QString& path);

View File

@ -55,69 +55,7 @@ void WorkSpace::SetCommondFilePath(const QString& path) {
commondPath_ = fileInfo.fileName(); commondPath_ = fileInfo.fileName();
} }
void WorkSpace::SetSimMatlab(const QString& path) { // Deprecated path APIs removed
QFileInfo fileInfo(path);
QString dirPath = QString("%1/%2").arg(GetDir(), fileInfo.fileName());
bool sucess = FileUtils::CopyFileToPath(path, dirPath, true);
LOG_INFO("copy simmatlab file {}: {} to {}",
path.toLocal8Bit().data(),
dirPath.toLocal8Bit().data(),
sucess);
simMatlabPath_ = fileInfo.fileName();
}
const QString WorkSpace::GetSimMatlab() const {
QString path = QString("%1/%2").arg(GetDir(), simMatlabPath_);
return path;
}
void WorkSpace::SetWavePath(const QString& path)
{
QFileInfo fileInfo(path);
QString dirPath = QString("%1/%2").arg(GetDir(), fileInfo.fileName());
bool sucess = FileUtils::CopyFileToPath(path, dirPath, true);
LOG_INFO("copy Wave file {}: {} to {}",
path.toLocal8Bit().data(),
dirPath.toLocal8Bit().data(),
sucess);
waveFile_ = fileInfo.fileName();
}
const QString WorkSpace::GetWavePath() const
{
QString path = QString("%1/%2").arg(GetDir(), waveFile_);
return path;
}
void WorkSpace::SetReportPath(const QString& path)
{
QFileInfo fileInfo(path);
QString dirPath = QString("%1/%2").arg(GetDir(), fileInfo.fileName());
bool sucess = FileUtils::CopyFileToPath(path, dirPath, true);
LOG_INFO("copy Wave file {}: {} to {}",
path.toLocal8Bit().data(),
dirPath.toLocal8Bit().data(),
sucess);
reportFile_ = fileInfo.fileName();
}
const QString WorkSpace::GetReportPath() const
{
QString path = QString("%1/%2").arg(GetDir(), reportFile_);
return path;
}
void WorkSpace::SetRDPath(const QString& path)
{
QFileInfo fileInfo(path);
QString dirPath = QString("%1/%2").arg(GetDir(), fileInfo.fileName());
bool sucess = FileUtils::CopyFileToPath(path, dirPath, true);
LOG_INFO("copy RD file {}: {} to {}",
path.toLocal8Bit().data(),
dirPath.toLocal8Bit().data(),
sucess);
rdFile_ = fileInfo.fileName();
}
WorkSpace::FileEntryResult WorkSpace::SetFileEntry(std::shared_ptr<FileEntry> fileEntry, bool is_copy) { WorkSpace::FileEntryResult WorkSpace::SetFileEntry(std::shared_ptr<FileEntry> fileEntry, bool is_copy) {
if (!fileEntry) { if (!fileEntry) {
@ -253,11 +191,7 @@ QString WorkSpace::GetFileEntryAbsPath(FileEntryType type, int index) const {
return QString("%1/%2").arg(GetDir(), name); return QString("%1/%2").arg(GetDir(), name);
} }
const QString WorkSpace::GetRDPath() const // RDPath API removed
{
QString path = QString("%1/%2").arg(GetDir(), rdFile_);
return path;
}
void WorkSpace::AddEntity(Entity* entity) { void WorkSpace::AddEntity(Entity* entity) {
if (nullptr == entity) { if (nullptr == entity) {

View File

@ -60,24 +60,7 @@ public:
enum class CommandWhen { OnCreate, OnLoad }; enum class CommandWhen { OnCreate, OnLoad };
void ExecuteCommands(CommandWhen when); void ExecuteCommands(CommandWhen when);
void SetSimMatlab(const QString& path); // Deprecated path APIs removed: SimMatlab/MatlabParam/Wave/Report/RD
const QString GetSimMatlab() const;
inline void SetMatlabParam(const QString& path) {
matlabParamPath_ = path;
}
inline const QString GetMatlabParam() const {
return matlabParamPath_;
}
void SetWavePath(const QString& path);
const QString GetWavePath() const;
void SetReportPath(const QString& path) ;
const QString GetReportPath() const;
void SetRDPath(const QString& path);
const QString GetRDPath() const;
// Files list API (per-type, max 9 per type) // Files list API (per-type, max 9 per type)
enum class FileEntryResult { Ok, LimitExceeded, Duplicate, CopyFailed, TypeMismatch, InvalidFile }; enum class FileEntryResult { Ok, LimitExceeded, Duplicate, CopyFailed, TypeMismatch, InvalidFile };
@ -142,7 +125,7 @@ public:
void OnFrame(double dt); void OnFrame(double dt);
void End(); void End();
void OnLoaded(); void OnLoaded();
Q_SIGNALS: Q_SIGNALS:
void EntityAdded(class Entity* entity); void EntityAdded(class Entity* entity);
@ -151,25 +134,15 @@ Q_SIGNALS:
void LampStatusChanged(class LampStatus* lampStatus); void LampStatusChanged(class LampStatus* lampStatus);
void FilesChanged(FileEntryType type, std::shared_ptr<FileEntry> fileEntry); void FilesChanged(FileEntryType type, std::shared_ptr<FileEntry> fileEntry);
protected:
const QString& GetSimMatlabName() const {
return simMatlabPath_;
}
private: private:
QString name_; QString name_;
QString uuid_; QString uuid_;
QString describe_; QString describe_;
QString path_; QString path_;
QString commondPath_; QString commondPath_;
QString simMatlabPath_; // Removed deprecated path members: simMatlabPath_, waveFile_, reportFile_, rdFile_, matlabParamPath_
QString waveFile_; osgEarth::Viewpoint homeViewpoint_;
QString reportFile_;
QString rdFile_;
QString matlabParamPath_;
osgEarth::Viewpoint homeViewpoint_;
bool leaded_{ false }; bool leaded_{ false };
std::vector<class Entity*> entities_; std::vector<class Entity*> entities_;

View File

@ -183,112 +183,6 @@ bool WorkSpaceXMLParse::ParseEntities(const tinyxml2::XMLElement* element) {
return false; return false;
} }
bool WorkSpaceXMLParse::ParseChart(const tinyxml2::XMLElement* element)
{
if (nullptr == element) {
LOG_WARN("element is nullptr");
return false;
}
const tinyxml2::XMLElement* xmlElement = element->FirstChildElement();
while (nullptr != xmlElement) {
const char* name = xmlElement->Name();
if (0 == strcmp(name, "Wave"))
{
QVariantMap varChart;
const tinyxml2::XMLAttribute* attribute = xmlElement->FirstAttribute();
while (nullptr != attribute) {
workSpace_->SetWavePath(QString::fromLocal8Bit(attribute->Value()));
attribute = attribute->Next();
}
}
else if (0 == strcmp(name, "Report"))
{
QVariantMap varChart;
const tinyxml2::XMLAttribute* attribute = xmlElement->FirstAttribute();
while (nullptr != attribute) {
workSpace_->SetReportPath(QString::fromLocal8Bit(attribute->Value()));
attribute = attribute->Next();
}
}
else if (0 == strcmp(name, "RD"))
{
QVariantMap varChart;
const tinyxml2::XMLAttribute* attribute = xmlElement->FirstAttribute();
while (nullptr != attribute) {
workSpace_->SetRDPath(QString::fromLocal8Bit(attribute->Value()));
attribute = attribute->Next();
}
}
else if (0 == strcmp(name, "SimMatlab"))
{
QVariantMap varChart;
const tinyxml2::XMLAttribute* attribute = xmlElement->FirstAttribute();
while (nullptr != attribute) {
workSpace_->SetSimMatlab(QString::fromLocal8Bit(attribute->Value()));
attribute = attribute->Next();
}
}
xmlElement = xmlElement->NextSiblingElement();
}
return true;
}
bool WorkSpaceXMLParse::ParseSimMatlab(const tinyxml2::XMLElement* element)
{
if (nullptr == element) {
LOG_WARN("element is nullptr");
return false;
}
const tinyxml2::XMLElement* xmlElement = element->FirstChildElement();
while (nullptr != xmlElement) {
const char* name = xmlElement->Name();
if (0 == strcmp(name, "SimMatlab"))
{
QVariantMap varChart;
const tinyxml2::XMLAttribute* attribute = xmlElement->FirstAttribute();
while (nullptr != attribute) {
WorkSpaceManager::Get().GetCurrent()->SetSimMatlab(QString::fromLocal8Bit(attribute->Value()));
attribute = attribute->Next();
}
}
xmlElement = xmlElement->NextSiblingElement();
}
return true;
}
bool WorkSpaceXMLParse::ParseReport(const tinyxml2::XMLElement* element)
{
QString strFile = "";
int iBatch = 0;
const tinyxml2::XMLAttribute* attribute = element->FirstAttribute();
while (nullptr != attribute) {
if (0 == strcmp(attribute->Name(), "file"))
{
strFile = QString::fromLocal8Bit(attribute->Value());
}
else if (0 == strcmp(attribute->Name(), "batch"))
{
iBatch = atoi(attribute->Value());
}
attribute = attribute->Next();
}
return true;
}
bool WorkSpaceXMLParse::Load(const QString& dyt) { bool WorkSpaceXMLParse::Load(const QString& dyt) {
std::string path = dyt.toLocal8Bit().constData(); std::string path = dyt.toLocal8Bit().constData();
LOG_INFO("load path:{}", path); LOG_INFO("load path:{}", path);
@ -315,17 +209,7 @@ bool WorkSpaceXMLParse::Load(const QString& dyt) {
ParseLamp(xmlElement); ParseLamp(xmlElement);
} else if (0 == strcmp(name, "commond")) { } else if (0 == strcmp(name, "commond")) {
ParseCommond(xmlElement); ParseCommond(xmlElement);
} } else if (0 == strcmp(name, "files")) {
else if (0 == strcmp(name, "charts")) {
ParseChart(xmlElement);
}
else if (0 == strcmp(name, "ReportInfo")) {
ParseReport(xmlElement);
}
else if (0 == strcmp(name, "SimMatlab")) {
ParseSimMatlab(xmlElement);
}
else if (0 == strcmp(name, "files")) {
ParseFiles(xmlElement); ParseFiles(xmlElement);
} }
xmlElement = xmlElement->NextSiblingElement(); xmlElement = xmlElement->NextSiblingElement();

View File

@ -33,9 +33,6 @@ private:
bool ParseLamp(const tinyxml2::XMLElement* element); bool ParseLamp(const tinyxml2::XMLElement* element);
bool ParseCommond(const tinyxml2::XMLElement* element); bool ParseCommond(const tinyxml2::XMLElement* element);
bool ParseEntities(const tinyxml2::XMLElement* element); bool ParseEntities(const tinyxml2::XMLElement* element);
bool ParseChart(const tinyxml2::XMLElement* element);
bool ParseReport(const tinyxml2::XMLElement* element);
bool ParseSimMatlab(const tinyxml2::XMLElement* element);
bool ParseFiles(const tinyxml2::XMLElement* element); bool ParseFiles(const tinyxml2::XMLElement* element);
private: private:

View File

@ -110,36 +110,9 @@ bool WorkSpaceXMLWrite::SaveEntities(tinyxml2::XMLElement* scene, tinyxml2::XMLD
bool WorkSpaceXMLWrite::SaveChart(tinyxml2::XMLElement* scene, tinyxml2::XMLDocument* doc) bool WorkSpaceXMLWrite::SaveChart(tinyxml2::XMLElement* scene, tinyxml2::XMLDocument* doc)
{ {
tinyxml2::XMLElement* charts= doc->NewElement("charts"); // charts section retained for compatibility, but deprecated entries (Wave, Report, RD, SimMatlab) are no longer saved
tinyxml2::XMLElement* charts = doc->NewElement("charts");
scene->LinkEndChild(charts); scene->LinkEndChild(charts);
{
tinyxml2::XMLElement* chart = doc->NewElement("Wave");
charts->LinkEndChild(chart);
chart->SetAttribute("file", workSpace_->GetWavePath().toLocal8Bit().constData());
}
{
tinyxml2::XMLElement* chart = doc->NewElement("Report");
charts->LinkEndChild(chart);
chart->SetAttribute("Report", workSpace_->GetReportPath().toLocal8Bit().constData());
}
{
tinyxml2::XMLElement* chart = doc->NewElement("RD");
charts->LinkEndChild(chart);
chart->SetAttribute("RD", workSpace_->GetRDPath().toLocal8Bit().constData());
}
{
tinyxml2::XMLElement* chart = doc->NewElement("SimMatlab");
charts->LinkEndChild(chart);
chart->SetAttribute("SimMatlab", workSpace_->GetSimMatlabName().toLocal8Bit().constData());
}
return true; return true;
} }