Merge branch 'new_osg' of http://brigecode.icu:16623/PM/DYTSrouce into new_osg
This commit is contained in:
commit
51a7bbf301
@ -25,11 +25,27 @@ SET(
|
||||
TS_FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/translations/Dyt_zh_CN.ts
|
||||
)
|
||||
|
||||
# 控制是否在构建时自动运行 lupdate 更新 TS 文件。
|
||||
# 关闭时仅在 TS 变更后编译生成 QM,避免每次构建都重新创建翻译文件。
|
||||
option(UPDATE_TRANSLATIONS "Run lupdate to refresh TS files during build" OFF)
|
||||
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
|
||||
if(UPDATE_TRANSLATIONS)
|
||||
# 运行 lupdate + lrelease:更新 TS 并生成 QM(可能导致每次构建都触发)
|
||||
qt6_create_translation(QM_FILES ${CMAKE_CURRENT_SOURCE_DIR} ${TS_FILES})
|
||||
else()
|
||||
# 仅生成 QM,TS 未变化时不重新创建
|
||||
qt_add_translations(QM_FILES TS_FILES ${TS_FILES})
|
||||
endif()
|
||||
add_custom_target(translations DEPENDS ${QM_FILES})
|
||||
else()
|
||||
if(UPDATE_TRANSLATIONS)
|
||||
# 运行 lupdate + lrelease
|
||||
qt5_create_translation(QM_FILES ${CMAKE_CURRENT_SOURCE_DIR} ${TS_FILES})
|
||||
else()
|
||||
# 仅运行 lrelease 生成 QM
|
||||
qt5_add_translation(QM_FILES ${TS_FILES})
|
||||
endif()
|
||||
add_custom_target(translations DEPENDS ${QM_FILES})
|
||||
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS WinExtras REQUIRED)
|
||||
endif()
|
||||
|
||||
@ -126,7 +126,6 @@ void MainFrame::InitUI() {
|
||||
|
||||
OsgWidget* viewWidget = mainWindow->GetViewWidget();
|
||||
connect(fileMenu, &FileManagerMenu::LoadDyt, viewWidget, &OsgWidget::OnLoadDyt);
|
||||
connect(viewWidget, &OsgWidget::signalResetWorkSpace, mainWindow, &MainWindow::slotResetWorkSpace);
|
||||
|
||||
//connect(system_, &SystemManagerMenu::signalShowUISetting, mainWindow, &MainWindow::slotShowUISetting);
|
||||
|
||||
|
||||
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -36,9 +36,6 @@ public:
|
||||
return dataPanelManager_;
|
||||
}
|
||||
|
||||
public slots:
|
||||
void slotResetWorkSpace();
|
||||
|
||||
private:
|
||||
void InitUI();
|
||||
void UninitUI();
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#include "ChartPlotMenu.h"
|
||||
#include "ChartPlotMenu.h"
|
||||
|
||||
#include "../Matlab/MatlabObject.h"
|
||||
#include "../../common/RecourceHelper.h"
|
||||
@ -9,6 +9,7 @@
|
||||
#include <qmessagebox.h>
|
||||
|
||||
#include <qfiledialog.h>
|
||||
#include <QDir>
|
||||
|
||||
ChartPlotMenu::ChartPlotMenu(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
@ -25,217 +26,35 @@ ChartPlotMenu::~ChartPlotMenu()
|
||||
|
||||
void ChartPlotMenu::InitMenu()
|
||||
{
|
||||
connect(ui.toolButton, &QToolButton::clicked, this, [=] {
|
||||
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("请检查仿真文件路径是否存在!"));
|
||||
}
|
||||
}
|
||||
});
|
||||
// Deprecated: SimMatlab run action removed
|
||||
|
||||
connect(ui.toolButton_2, &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"选择仿真运行文件", RecourceHelper::Get().GetBasePath() + "/workspace/", "*.m");
|
||||
if (strSel.isEmpty()) {
|
||||
LOG_WARN("选择文件为空");
|
||||
return;
|
||||
}
|
||||
// Deprecated: SimMatlab selection removed
|
||||
|
||||
const QString old = current->GetSimMatlab();
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Deprecated: Wave file selection removed
|
||||
|
||||
current->SetSimMatlab(strSel);
|
||||
});
|
||||
// Deprecated: RD file selection removed
|
||||
|
||||
connect(ui.toolButton_5, &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"选择Wave文件", RecourceHelper::Get().GetBasePath() + "/workspace/", "*.txt");
|
||||
if (strSel.isEmpty()) {
|
||||
LOG_WARN("选择文件为空");
|
||||
return;
|
||||
}
|
||||
// Deprecated: Report file selection removed
|
||||
|
||||
const QString old = current->GetWavePath();
|
||||
if (old == strSel) {
|
||||
LOG_INFO("选择文件与当前文件相同");
|
||||
// Restore Lamp file selection with safe encoding
|
||||
connect(ui.toolButton_6, &QToolButton::clicked, this, [this]() {
|
||||
auto* ws = WorkSpaceManager::Get().GetCurrent();
|
||||
const QString defaultDir = ws ? ws->GetDir() : QDir::currentPath();
|
||||
const QString title = QString::fromLocal8Bit("选择Lamp文件");
|
||||
const QString filters = QString::fromLocal8Bit("文本文件 (*.txt);;所有文件 (*.*)");
|
||||
const QString file = QFileDialog::getOpenFileName(this, title, defaultDir, filters);
|
||||
if (file.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
else if (!old.isEmpty()) {
|
||||
if (QFileInfo(old).isFile() && QFile::exists(old)) {
|
||||
if (QMessageBox::Yes == QMessageBox::question(nullptr,
|
||||
QString::fromLocal8Bit("询问"),
|
||||
QString::fromLocal8Bit("替换当前Wave文件!"),
|
||||
QMessageBox::Yes | QMessageBox::No)
|
||||
) {
|
||||
if (!QFile::remove(old)) {
|
||||
LOG_WARN("删除文件失败");
|
||||
QMessageBox::information(nullptr,
|
||||
QString::fromLocal8Bit("提示"),
|
||||
QString::fromLocal8Bit("删除文件失败!"));
|
||||
if (!ws) {
|
||||
QMessageBox::warning(this, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("当前无工作区"));
|
||||
return;
|
||||
}
|
||||
const bool ok = ws->SetLampPath(file);
|
||||
if (ok) {
|
||||
QMessageBox::information(this, QString::fromLocal8Bit("Lamp"), QString::fromLocal8Bit("已加载 Lamp 文件"));
|
||||
} else {
|
||||
QMessageBox::warning(this, QString::fromLocal8Bit("Lamp"), QString::fromLocal8Bit("加载 Lamp 文件失败"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
});
|
||||
}
|
||||
|
||||
@ -18,6 +18,9 @@
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButton_5">
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
@ -31,6 +34,9 @@
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButton_4">
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
@ -44,6 +50,9 @@
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButton_3">
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
@ -57,6 +66,9 @@
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButton_2">
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
@ -70,6 +82,9 @@
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButton_6">
|
||||
<property name="visible">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
@ -83,6 +98,9 @@
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButton">
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
|
||||
@ -7991,25 +7991,9 @@ void QtWorkspacePropertyManagerPrivate::slotStringChanged(QtProperty* property,
|
||||
QWorkspaceAttribute c = m_values[prop];
|
||||
c.SetTimeStep(value);
|
||||
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];
|
||||
c.SetSimMatlab(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);
|
||||
c.SetCommondFilePath(value);
|
||||
q_ptr->setValue(prop, c);
|
||||
} else if (QtProperty* prop = m_commondPathToPropery.value(property, 0)) {
|
||||
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_properyToDescription[property], value.GetDescription());
|
||||
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());
|
||||
|
||||
auto syncGroup = [&](FileEntryType type,
|
||||
@ -8323,40 +8302,7 @@ void QtWorkspacePropertyManager::initializeProperty(QtProperty* property) {
|
||||
d_ptr->m_timestepToPropery[prop] = property;
|
||||
property->addSubProperty(prop);
|
||||
|
||||
prop = d_ptr->m_filesProperyManager->addProperty();
|
||||
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);
|
||||
// Deprecated properties (SimMatlab/MatlabParam/WavePath/ReportPath/RDPath) removed from UI
|
||||
|
||||
// Command XML path
|
||||
prop = d_ptr->m_filesProperyManager->addProperty();
|
||||
|
||||
@ -91,88 +91,7 @@ const QString QWorkspaceAttribute::GetTimeStep() const {
|
||||
return timestep->GetPath();
|
||||
}
|
||||
|
||||
void QWorkspaceAttribute::SetSimMatlab(const QString& path) {
|
||||
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();
|
||||
}
|
||||
// Deprecated workspace path setters/getters removed
|
||||
|
||||
void QWorkspaceAttribute::SetCommondFilePath(const QString& path)
|
||||
{
|
||||
|
||||
@ -65,20 +65,7 @@ public:
|
||||
void SetTimeStep(const QString& timestep);
|
||||
const QString GetTimeStep() const;
|
||||
|
||||
void SetSimMatlab(const QString& path);
|
||||
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;
|
||||
// Deprecated fields removed: SimMatlab/MatlabParam/WavePath/ReportPath/RDPath
|
||||
|
||||
// Command XML path
|
||||
void SetCommondFilePath(const QString& path);
|
||||
|
||||
@ -55,69 +55,7 @@ void WorkSpace::SetCommondFilePath(const QString& path) {
|
||||
commondPath_ = fileInfo.fileName();
|
||||
}
|
||||
|
||||
void WorkSpace::SetSimMatlab(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 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();
|
||||
}
|
||||
// Deprecated path APIs removed
|
||||
|
||||
WorkSpace::FileEntryResult WorkSpace::SetFileEntry(std::shared_ptr<FileEntry> fileEntry, bool is_copy) {
|
||||
if (!fileEntry) {
|
||||
@ -253,11 +191,7 @@ QString WorkSpace::GetFileEntryAbsPath(FileEntryType type, int index) const {
|
||||
return QString("%1/%2").arg(GetDir(), name);
|
||||
}
|
||||
|
||||
const QString WorkSpace::GetRDPath() const
|
||||
{
|
||||
QString path = QString("%1/%2").arg(GetDir(), rdFile_);
|
||||
return path;
|
||||
}
|
||||
// RDPath API removed
|
||||
|
||||
void WorkSpace::AddEntity(Entity* entity) {
|
||||
if (nullptr == entity) {
|
||||
|
||||
@ -60,24 +60,7 @@ public:
|
||||
enum class CommandWhen { OnCreate, OnLoad };
|
||||
void ExecuteCommands(CommandWhen when);
|
||||
|
||||
void SetSimMatlab(const QString& path);
|
||||
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;
|
||||
// Deprecated path APIs removed: SimMatlab/MatlabParam/Wave/Report/RD
|
||||
|
||||
// Files list API (per-type, max 9 per type)
|
||||
enum class FileEntryResult { Ok, LimitExceeded, Duplicate, CopyFailed, TypeMismatch, InvalidFile };
|
||||
@ -151,23 +134,13 @@ Q_SIGNALS:
|
||||
void LampStatusChanged(class LampStatus* lampStatus);
|
||||
void FilesChanged(FileEntryType type, std::shared_ptr<FileEntry> fileEntry);
|
||||
|
||||
protected:
|
||||
const QString& GetSimMatlabName() const {
|
||||
return simMatlabPath_;
|
||||
}
|
||||
|
||||
private:
|
||||
QString name_;
|
||||
QString uuid_;
|
||||
QString describe_;
|
||||
QString path_;
|
||||
QString commondPath_;
|
||||
QString simMatlabPath_;
|
||||
|
||||
QString waveFile_;
|
||||
QString reportFile_;
|
||||
QString rdFile_;
|
||||
QString matlabParamPath_;
|
||||
// Removed deprecated path members: simMatlabPath_, waveFile_, reportFile_, rdFile_, matlabParamPath_
|
||||
|
||||
osgEarth::Viewpoint homeViewpoint_;
|
||||
|
||||
|
||||
@ -183,112 +183,6 @@ bool WorkSpaceXMLParse::ParseEntities(const tinyxml2::XMLElement* element) {
|
||||
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) {
|
||||
std::string path = dyt.toLocal8Bit().constData();
|
||||
LOG_INFO("load path:{}", path);
|
||||
@ -315,17 +209,7 @@ bool WorkSpaceXMLParse::Load(const QString& dyt) {
|
||||
ParseLamp(xmlElement);
|
||||
} else if (0 == strcmp(name, "commond")) {
|
||||
ParseCommond(xmlElement);
|
||||
}
|
||||
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")) {
|
||||
} else if (0 == strcmp(name, "files")) {
|
||||
ParseFiles(xmlElement);
|
||||
}
|
||||
xmlElement = xmlElement->NextSiblingElement();
|
||||
|
||||
@ -33,9 +33,6 @@ private:
|
||||
bool ParseLamp(const tinyxml2::XMLElement* element);
|
||||
bool ParseCommond(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);
|
||||
|
||||
private:
|
||||
|
||||
@ -110,37 +110,10 @@ bool WorkSpaceXMLWrite::SaveEntities(tinyxml2::XMLElement* scene, tinyxml2::XMLD
|
||||
|
||||
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);
|
||||
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user