From b80863eddc282cbcaad29b451c116950acac18ec Mon Sep 17 00:00:00 2001 From: 15712809671 <136563253+15712809671@users.noreply.github.com> Date: Tue, 7 Jan 2025 23:45:23 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=91=E5=AE=9A=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/translations/Dyt_zh_CN.ts | 186 ++++++++++-------- src/ui/Layout/AddParamSetting.cpp | 16 +- src/ui/Layout/CodeEdtUI.cpp | 29 ++- src/ui/MainWindow.cpp | 77 ++++---- src/ui/Menu/ChartPlotMenu.cpp | 23 ++- src/ui/PropertyBrowser/qtpropertymanager.cpp | 98 ++++++++- .../PropertyBrowser/qtworkspaceattribute.cpp | 83 ++++++++ src/ui/PropertyBrowser/qtworkspaceattribute.h | 14 ++ src/ui/Table/targetlistwgt.cpp | 5 + src/ui/chartPlot/FitCurveDialog.cpp | 6 + src/ui/chartPlot/SurfaceDialog.cpp | 3 + src/workspace/WorkSpace.h | 42 ++++ src/workspace/WorkSpaceManager.h | 88 --------- src/workspace/WorkSpaceXMLParse.cpp | 40 +--- src/workspace/WorkSpaceXMLWrite.cpp | 29 +-- 15 files changed, 444 insertions(+), 295 deletions(-) diff --git a/src/translations/Dyt_zh_CN.ts b/src/translations/Dyt_zh_CN.ts index 32238090..d586ed54 100644 --- a/src/translations/Dyt_zh_CN.ts +++ b/src/translations/Dyt_zh_CN.ts @@ -4,22 +4,22 @@ AddParamSetting - + ParamSetting - - input param name + + param - + input param descript - + input value @@ -109,17 +109,7 @@ - &Import the Main template - - - - - &Import the LD template - - - - - &Import the SeekerSim template + &Import the template @@ -422,12 +412,12 @@ - + 2D Curve - + 2D(y(lg)) Curve @@ -509,136 +499,141 @@ - + Wave Curve - + Speed Curve - + 3D Curve - - + + Target number - - + + Signal-to-noise ratio - - + + Azimuth line of sight - - + + Pitch gaze angle - - + + azimuth - - + + Pitch angle - - + + attribute - - + + Doppler - - + + course - - + + Speed - - + + longitude - - + + latitude - - + + distance - - + + velocity - - + + Radial dimensions - - + + Target RCS - + Report Table - + Report - + Signal Indicator Lamp - + ParamSetting + + + Matlab File + + ModelBrowser @@ -974,43 +969,43 @@ QtConeWaveComponentManager - - + + ConeWaveComponent - + Height - + Radius - + levelCount - + levelHeight - + Color1 - + Color2 - + Color3 @@ -1116,28 +1111,28 @@ QtDashedLineComponentManager - - + + DashedLineComponent - + Start - + End - + Radius - + Color @@ -1153,12 +1148,12 @@ QtEntityPropertyManager - + Name - + Transform @@ -1240,13 +1235,13 @@ QtMeshComponetManager - - + + MeshComponent - + Mesh @@ -1290,13 +1285,13 @@ QtPathComponentManager - - + + PathComponent - + Path @@ -1546,20 +1541,45 @@ QtWorkspacePropertyManager - + Name - + Description - + Timestep + + + SimMatlab + + + + + MatlabParam + + + + + Wave + + + + + RD + + + + + Report + + SignalIndicatorLampUI diff --git a/src/ui/Layout/AddParamSetting.cpp b/src/ui/Layout/AddParamSetting.cpp index d31110ff..614fd4ee 100644 --- a/src/ui/Layout/AddParamSetting.cpp +++ b/src/ui/Layout/AddParamSetting.cpp @@ -11,6 +11,7 @@ #include #include "../../workspace/WorkSpaceManager.h" +#include "../../workspace/WorkSpace.h" #include "../../common/RecourceHelper.h" #include @@ -70,6 +71,9 @@ void AddParamSetting::AttachDock(DockWidget* dockWidget) void AddParamSetting::InitTable() { + if (m_strDir.isEmpty()) + return; + QSettings sett(m_strDir, QSettings::IniFormat); QStringList listGroup = sett.childGroups(); @@ -410,11 +414,19 @@ void AddParamSetting::slotButtonRemove() void AddParamSetting::slotButtonCommit() { - QString strMatlabFile = WorkSpaceManager::Get().GetDYTMatlabPFile(); + QString strMatlabFile =""; + if (WorkSpaceManager::Get().GetCurrent()) + { + if (!WorkSpaceManager::Get().GetCurrent()->GetMatlabParam().isEmpty()) + { + strMatlabFile = RecourceHelper::Get().GetBasePath() + "/" + WorkSpaceManager::Get().GetCurrent()->GetMatlabParam(); + } + } + if (strMatlabFile.isEmpty()) { strMatlabFile = RecourceHelper::Get().GetBasePath() + "/workspace/MatlabParam.m"; - WorkSpaceManager::Get().SetDYTMatlabPFile(strMatlabFile); + WorkSpaceManager::Get().GetCurrent()->SetMatlabParam("MatlabParam.m"); } QFile file(strMatlabFile); diff --git a/src/ui/Layout/CodeEdtUI.cpp b/src/ui/Layout/CodeEdtUI.cpp index 50988582..2f499358 100644 --- a/src/ui/Layout/CodeEdtUI.cpp +++ b/src/ui/Layout/CodeEdtUI.cpp @@ -34,18 +34,18 @@ CodeEdtUI::CodeEdtUI(QWidget *parent) // 创建菜单 QMenu* fileMenu = menuBar()->addMenu(tr("&file")); - QAction* openMainAction = new QAction(tr("&Import the Main template"), this); - QAction* openLDAction = new QAction(tr("&Import the LD template"), this); - QAction* openSeekerSimAction = new QAction(tr("&Import the SeekerSim template"), this); + QAction* openMainAction = new QAction(tr("&Import the template"), this); + /* QAction* openLDAction = new QAction(tr("&Import the LD template"), this); + QAction* openSeekerSimAction = new QAction(tr("&Import the SeekerSim template"), this);*/ QAction* saveAction = new QAction(tr("&save"), this); fileMenu->addAction(openMainAction); - fileMenu->addAction(openLDAction); - fileMenu->addAction(openSeekerSimAction); + //fileMenu->addAction(openLDAction); + //fileMenu->addAction(openSeekerSimAction); fileMenu->addAction(saveAction); connect(openMainAction, &QAction::triggered, this, &CodeEdtUI::openMainFile); - connect(openLDAction, &QAction::triggered, this, &CodeEdtUI::openLDFile); - connect(openSeekerSimAction, &QAction::triggered, this, &CodeEdtUI::openSeekerSimFile); + /* connect(openLDAction, &QAction::triggered, this, &CodeEdtUI::openLDFile); + connect(openSeekerSimAction, &QAction::triggered, this, &CodeEdtUI::openSeekerSimFile);*/ connect(saveAction, &QAction::triggered, this, &CodeEdtUI::saveFile); @@ -71,11 +71,10 @@ void CodeEdtUI::AttachDock(DockWidget* dockWidget) } void CodeEdtUI::openMainFile() { - QString fileName = WorkSpaceManager::Get().GetDYTMMainFile(); //QFileDialog::getOpenFileName(this, "Open File", "", "Matlab Files (*.m)"); + QString fileName = ""; //QFileDialog::getOpenFileName(this, "Open File", "", "Matlab Files (*.m)"); if (fileName.isEmpty()) { fileName = QFileDialog::getOpenFileName(this, "Open File", "", "Matlab Files (*.m)"); - WorkSpaceManager::Get().SetDYTMMainFile(fileName); } if (!fileName.isEmpty()) { @@ -92,11 +91,10 @@ void CodeEdtUI::openMainFile() { void CodeEdtUI::openLDFile() { - QString fileName = WorkSpaceManager::Get().GetDYTMLDFile(); //QFileDialog::getOpenFileName(this, "Open File", "", "Matlab Files (*.m)"); + QString fileName = ""; //QFileDialog::getOpenFileName(this, "Open File", "", "Matlab Files (*.m)"); if (fileName.isEmpty()) { fileName = QFileDialog::getOpenFileName(this, "Open File", "", "Matlab Files (*.m)"); - WorkSpaceManager::Get().SetDYTMLDFile(fileName); } if (!fileName.isEmpty()) { @@ -115,11 +113,10 @@ void CodeEdtUI::openLDFile() void CodeEdtUI::openSeekerSimFile() { - QString fileName = WorkSpaceManager::Get().GetDYTMSeekerSimFile(); //QFileDialog::getOpenFileName(this, "Open File", "", "Matlab Files (*.m)"); + QString fileName = ""; //QFileDialog::getOpenFileName(this, "Open File", "", "Matlab Files (*.m)"); if (fileName.isEmpty()) { fileName = QFileDialog::getOpenFileName(this, "Open File", "", "Matlab Files (*.m)"); - WorkSpaceManager::Get().SetDYTMSeekerSimFile(fileName); } if (!fileName.isEmpty()) { @@ -137,9 +134,9 @@ void CodeEdtUI::openSeekerSimFile() } void CodeEdtUI::saveFile() { - //QString fileName = QFileDialog::getSaveFileName(this, "Save File", "", "Matlab Files (*.m)"); - if (!m_strCurOpenFile.isEmpty()) { - QFile file(m_strCurOpenFile); + QString fileName = QFileDialog::getSaveFileName(this, "Save File", "", "Matlab Files (*.m)"); + if (!fileName.isEmpty()) { + QFile file(fileName); if (file.open(QIODevice::WriteOnly | QIODevice::Text)) { QTextStream out(&file); out << editor->toPlainText(); diff --git a/src/ui/MainWindow.cpp b/src/ui/MainWindow.cpp index fc866df4..eed403af 100644 --- a/src/ui/MainWindow.cpp +++ b/src/ui/MainWindow.cpp @@ -87,28 +87,32 @@ void MainWindow::InitUI() { qtOsgViewWidget_->Initialize(); m_mapDockWidget.insert("PropertyBrowser", attribte); - QString wavePath = WorkSpaceManager::Get().GetDYTWaveFile(); - if (wavePath.isEmpty()) { - wavePath = RecourceHelper::Get().GetBasePath() + "/workspace/Wave.txt"; - WorkSpaceManager::Get().SetDYTWaveFile(wavePath); - } - // const QString wavePath = RecourceHelper::Get().GetBasePath() + "/workspace/Wave.txt"; + QString wavePath ="", speedPath = "", rdPath = "", matlabParam=""; + if (WorkSpaceManager::Get().GetCurrent()) + { + if (!WorkSpaceManager::Get().GetCurrent()->GetWavePath().isEmpty()) + { + wavePath = RecourceHelper::Get().GetBasePath() + "/" + WorkSpaceManager::Get().GetCurrent()->GetWavePath(); + } - QString speedPath = WorkSpaceManager::Get().GetDYTReportFile(); - if (speedPath.isEmpty()) { - speedPath = RecourceHelper::Get().GetBasePath() + "/workspace/Report.txt"; - WorkSpaceManager::Get().SetDYTReportFile(speedPath); + 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(); + } + + if (!WorkSpaceManager::Get().GetCurrent()->GetMatlabParam().isEmpty()) + { + matlabParam = RecourceHelper::Get().GetBasePath() + "/" + WorkSpaceManager::Get().GetCurrent()->GetMatlabParam(); + } } - //const QString speedPath = RecourceHelper::Get().GetBasePath() + "/workspace/Report.txt"; - QString rdPath = WorkSpaceManager::Get().GetDYTRDFile(); - if (rdPath.isEmpty()) { - rdPath = RecourceHelper::Get().GetBasePath() + "/workspace/RD.txt"; - WorkSpaceManager::Get().SetDYTRDFile(rdPath); - } - // const QString rdPath = RecourceHelper::Get().GetBasePath() + "/workspace/RD.txt"; DockWidget* fitCurveDock = new DockWidget(tr("Wave Curve"), 0); - // addDockWidget(pSettingUI->GetArea("2DCurveDialog"), fitCurveDock); + fitCurveDlg_ = new FitCurveDialog(1); fitCurveDlg_->AttachDock(fitCurveDock); m_mapDockWidget.insert("WaveCurveDialog", fitCurveDock); @@ -116,7 +120,7 @@ void MainWindow::InitUI() { fitCurveDlg_->InitWaveFile(wavePath); DockWidget* fitLgCurveDock = new DockWidget(tr("Speed Curve"), 0); - //addDockWidget(pSettingUI->GetArea("2D(lg)CurveDialog"), fitLgCurveDock); + fitYLgCurveDlg_ = new FitCurveDialog(1); fitYLgCurveDlg_->AttachDock(fitLgCurveDock); m_mapDockWidget.insert("SpeedCurveDialog", fitLgCurveDock); @@ -125,7 +129,7 @@ void MainWindow::InitUI() { fitYLgCurveDlg_->InitReportFile(speedPath); DockWidget* surfaceCurveDock = new DockWidget(tr("3D Curve"), 0); - // addDockWidget(pSettingUI->GetArea("3DCurveDialog"), surfaceCurveDock); + surfaceDlg_ = new SurfaceDialog(); surfaceDlg_->AttachDock(surfaceCurveDock); m_mapDockWidget.insert("3DCurveDialog", surfaceCurveDock); @@ -190,9 +194,8 @@ void MainWindow::InitUI() { m_mapDockWidget.insert("SignalIndicatorLampUI", signalIndicatorLampDock); - const QString iniPath = RecourceHelper::Get().GetBasePath() + "/workspace/ParamSetting.ini"; DockWidget* addParamSettingDock = new DockWidget(tr("ParamSetting"), 0); - addParamDlg_ = new AddParamSetting(iniPath); + addParamDlg_ = new AddParamSetting(matlabParam); addParamDlg_->AttachDock(addParamSettingDock); m_mapDockWidget.insert("ParamSetting", addParamSettingDock); @@ -359,25 +362,23 @@ void MainWindow::slotShowUISetting() { void MainWindow::slotResetWorkSpace() { - QString wavePath = WorkSpaceManager::Get().GetDYTWaveFile(); - if (wavePath.isEmpty()) + QString wavePath = "", speedPath = "", rdPath = ""; + if (WorkSpaceManager::Get().GetCurrent()) { - wavePath = RecourceHelper::Get().GetBasePath() + "/workspace/Wave.txt"; - WorkSpaceManager::Get().SetDYTWaveFile(wavePath); - } + if (!WorkSpaceManager::Get().GetCurrent()->GetWavePath().isEmpty()) + { + wavePath = RecourceHelper::Get().GetBasePath() + "/" + WorkSpaceManager::Get().GetCurrent()->GetWavePath(); + } - QString speedPath = WorkSpaceManager::Get().GetDYTReportFile(); - if (speedPath.isEmpty()) - { - speedPath = RecourceHelper::Get().GetBasePath() + "/workspace/Report.txt"; - WorkSpaceManager::Get().SetDYTReportFile(speedPath); - } + if (!WorkSpaceManager::Get().GetCurrent()->GetReportPath().isEmpty()) + { + speedPath = RecourceHelper::Get().GetBasePath() + "/" + WorkSpaceManager::Get().GetCurrent()->GetReportPath(); + } - QString rdPath = WorkSpaceManager::Get().GetDYTRDFile(); - if (rdPath.isEmpty()) - { - rdPath = RecourceHelper::Get().GetBasePath() + "/workspace/RD.txt"; - WorkSpaceManager::Get().SetDYTRDFile(rdPath); + if (!WorkSpaceManager::Get().GetCurrent()->GetRDPath().isEmpty()) + { + rdPath = RecourceHelper::Get().GetBasePath() + "/" + WorkSpaceManager::Get().GetCurrent()->GetRDPath(); + } } fitCurveDlg_->InitWaveFile(wavePath); diff --git a/src/ui/Menu/ChartPlotMenu.cpp b/src/ui/Menu/ChartPlotMenu.cpp index 4b278de5..b90fcc36 100644 --- a/src/ui/Menu/ChartPlotMenu.cpp +++ b/src/ui/Menu/ChartPlotMenu.cpp @@ -1,7 +1,7 @@ #include "ChartPlotMenu.h" #include "../Matlab/MatlabObject.h" - +#include "../../common/RecourceHelper.h" #include "workspace/WorkSpace.h" #include "workspace/WorkSpaceManager.h" #include @@ -22,15 +22,20 @@ ChartPlotMenu::~ChartPlotMenu() void ChartPlotMenu::InitMenu() { connect(ui.toolButton, &QToolButton::clicked, this, [=] { - MatlabObject mtlb; - QString strFile = WorkSpaceManager::Get().GetDYTMMainFile(); - if (!strFile.isEmpty()) + if (WorkSpaceManager::Get().GetCurrent()) { - mtlb.RunMatlabFile(strFile); - } - else - { - QMessageBox::information(nullptr, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("请检查仿真文件路径是否存在!")); + MatlabObject mtlb; + QString strFile = WorkSpaceManager::Get().GetCurrent()->GetSimMatlab(); + if (!strFile.isEmpty()) + { + strFile = RecourceHelper::Get().GetBasePath() + "/" + WorkSpaceManager::Get().GetCurrent()->GetSimMatlab(); + + mtlb.RunMatlabFile(strFile); + } + else + { + QMessageBox::information(nullptr, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("请检查仿真文件路径是否存在!")); + } } }); } diff --git a/src/ui/PropertyBrowser/qtpropertymanager.cpp b/src/ui/PropertyBrowser/qtpropertymanager.cpp index 2e6f7f72..8d61fec7 100644 --- a/src/ui/PropertyBrowser/qtpropertymanager.cpp +++ b/src/ui/PropertyBrowser/qtpropertymanager.cpp @@ -7875,10 +7875,22 @@ public: QMap m_properyToName; QMap m_properyToDescription; QMap m_properyToTimestep; + QMap m_properyToSimMatlab; + QMap m_properyToMatlabParam; + + QMap m_properyToWave; + QMap m_properyToReport; + QMap m_properyToRD; QMap m_nameToPropery; QMap m_descriptionToPropery; QMap m_timestepToPropery; + QMap m_simMatlabToPropery; + QMap m_matlabParamToPropery; + + QMap m_waveToPropery; + QMap m_reportToPropery; + QMap m_rdToPropery; }; void QtWorkspacePropertyManagerPrivate::slotStringChanged(QtProperty* property, QString value) { @@ -7894,7 +7906,11 @@ 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)) { + QWorkspaceAttribute c = m_values[prop]; + c.SetSimMatlab(value); + q_ptr->setValue(prop, c); + } } void QtWorkspacePropertyManagerPrivate::slotPropertyDestroyed(QtProperty* property) { @@ -7912,6 +7928,11 @@ void QtWorkspacePropertyManagerPrivate::slotPropertyDestroyed(QtProperty* proper m_timestepToPropery[subProp] = 0; m_timestepToPropery.remove(property); } + + if (QtProperty* subProp = m_simMatlabToPropery.value(property, nullptr)) { + m_simMatlabToPropery[subProp] = 0; + m_simMatlabToPropery.remove(property); + } } QtWorkspacePropertyManager::QtWorkspacePropertyManager(QObject* parent) @@ -7996,6 +8017,12 @@ 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_properyToWave[property], value.GetWavePath()); + d_ptr->m_filesProperyManager->setValue(d_ptr->m_properyToReport[property], value.GetReportPath()); + d_ptr->m_filesProperyManager->setValue(d_ptr->m_properyToRD[property], value.GetRDPath()); emit propertyChanged(property); emit valueChanged(property, value); @@ -8028,6 +8055,41 @@ void QtWorkspacePropertyManager::initializeProperty(QtProperty* property) { d_ptr->m_properyToTimestep[property] = prop; 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_simMatlabToPropery[prop] = property; + property->addSubProperty(prop); + + prop = d_ptr->m_filesProperyManager->addProperty(); + prop->setPropertyName(tr("Wave")); + d_ptr->m_filesProperyManager->setValueOnly(prop, val.GetWavePath()); + d_ptr->m_properyToWave[property] = prop; + d_ptr->m_waveToPropery[prop] = property; + property->addSubProperty(prop); + + prop = d_ptr->m_filesProperyManager->addProperty(); + prop->setPropertyName(tr("RD")); + d_ptr->m_filesProperyManager->setValueOnly(prop, val.GetRDPath()); + d_ptr->m_properyToRD[property] = prop; + d_ptr->m_rdToPropery[prop] = property; + property->addSubProperty(prop); + + prop = d_ptr->m_filesProperyManager->addProperty(); + prop->setPropertyName(tr("Report")); + d_ptr->m_filesProperyManager->setValueOnly(prop, val.GetReportPath()); + d_ptr->m_properyToReport[property] = prop; + d_ptr->m_reportToPropery[prop] = property; + property->addSubProperty(prop); } /*! @@ -8055,6 +8117,40 @@ void QtWorkspacePropertyManager::uninitializeProperty(QtProperty* property) { } d_ptr->m_properyToTimestep.remove(property); + prop = d_ptr->m_simMatlabToPropery[property]; + if (prop) { + d_ptr->m_simMatlabToPropery.remove(prop); + delete prop; + } + d_ptr->m_properyToSimMatlab.remove(property); + + prop = d_ptr->m_matlabParamToPropery[property]; + if (prop) { + d_ptr->m_matlabParamToPropery.remove(prop); + delete prop; + } + d_ptr->m_properyToMatlabParam.remove(property); + + prop = d_ptr->m_waveToPropery[property]; + if (prop) { + d_ptr->m_waveToPropery.remove(prop); + delete prop; + } + d_ptr->m_properyToWave.remove(property); + + prop = d_ptr->m_reportToPropery[property]; + if (prop) { + d_ptr->m_reportToPropery.remove(prop); + delete prop; + } + d_ptr->m_properyToReport.remove(property); + + prop = d_ptr->m_rdToPropery[property]; + if (prop) { + d_ptr->m_rdToPropery.remove(prop); + delete prop; + } + d_ptr->m_properyToRD.remove(property); } #pragma endregion diff --git a/src/ui/PropertyBrowser/qtworkspaceattribute.cpp b/src/ui/PropertyBrowser/qtworkspaceattribute.cpp index e176f13d..45c705d2 100644 --- a/src/ui/PropertyBrowser/qtworkspaceattribute.cpp +++ b/src/ui/PropertyBrowser/qtworkspaceattribute.cpp @@ -88,6 +88,89 @@ 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(); +} + QTransformAttribute::QTransformAttribute(class Transform* obj) : object_(obj) { diff --git a/src/ui/PropertyBrowser/qtworkspaceattribute.h b/src/ui/PropertyBrowser/qtworkspaceattribute.h index 8ba881c6..49f8ff7d 100644 --- a/src/ui/PropertyBrowser/qtworkspaceattribute.h +++ b/src/ui/PropertyBrowser/qtworkspaceattribute.h @@ -62,6 +62,20 @@ 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; private: class WorkSpace* workspace_{ nullptr }; }; diff --git a/src/ui/Table/targetlistwgt.cpp b/src/ui/Table/targetlistwgt.cpp index f93e002a..725eacfe 100644 --- a/src/ui/Table/targetlistwgt.cpp +++ b/src/ui/Table/targetlistwgt.cpp @@ -104,6 +104,11 @@ void TargetListWgt::AddRowData(QVariant& var) void TargetListWgt::InitFile(const QString& strFile, int iBatchCount) { + if (strFile.isEmpty()) + { + return; + } + m_iBatchCount = iBatchCount; m_strFile = strFile; m_vecReportPoint.clear(); diff --git a/src/ui/chartPlot/FitCurveDialog.cpp b/src/ui/chartPlot/FitCurveDialog.cpp index e8c46b14..6b764150 100644 --- a/src/ui/chartPlot/FitCurveDialog.cpp +++ b/src/ui/chartPlot/FitCurveDialog.cpp @@ -629,12 +629,18 @@ QVector FitCurveDialog::getAxisRanges() { void FitCurveDialog::InitWaveFile(const QString& strFile, int iBatchCount) { + if (strFile.isEmpty()) + return; + m_vecWavePoint.clear(); ParseWave(strFile, m_vecWavePoint, iBatchCount); } void FitCurveDialog::InitReportFile(const QString& strFile, int iBatchCount) { + if (strFile.isEmpty()) + return; + m_vecReportPoint.clear(); ParseReport(strFile, m_vecReportPoint, iBatchCount); } diff --git a/src/ui/chartPlot/SurfaceDialog.cpp b/src/ui/chartPlot/SurfaceDialog.cpp index 209f01a7..30105a15 100644 --- a/src/ui/chartPlot/SurfaceDialog.cpp +++ b/src/ui/chartPlot/SurfaceDialog.cpp @@ -48,6 +48,9 @@ void SurfaceDialog::AttachDock(DockWidget* dockWidget) void SurfaceDialog::InitRD(const QString& strFile, int iBatch, int iRowCount) { + if (strFile.isEmpty()) + return; + m_vecRDPoint.clear(); ParseRD(strFile, m_vecRDPoint,iBatch, iRowCount); } diff --git a/src/workspace/WorkSpace.h b/src/workspace/WorkSpace.h index 003891ae..a61eabed 100644 --- a/src/workspace/WorkSpace.h +++ b/src/workspace/WorkSpace.h @@ -46,6 +46,41 @@ public: inline const QString& GetDescribe() const { return describe_; } + inline void SetSimMatlab(const QString& path) { + simMatlabPath_ = path; + } + inline const QString GetSimMatlab() const { + return simMatlabPath_; + } + + inline void SetMatlabParam(const QString& path) { + matlabParamPath_ = path; + } + inline const QString GetMatlabParam() const { + return matlabParamPath_; + } + + inline void SetWavePath(const QString& path) { + waveFile_ = path; + } + inline const QString GetWavePath() const { + return waveFile_; + } + + inline void SetReportPath(const QString& path) { + reportFile_ = path; + } + inline const QString GetReportPath() const { + return reportFile_; + } + + inline void SetRDPath(const QString& path) { + rdFile_ = path; + } + inline const QString GetRDPath() const { + return rdFile_; + } + inline void SetHomeViewpoint(const osgEarth::Viewpoint& viewpoint) { homeViewpoint_ = viewpoint; } @@ -107,6 +142,13 @@ private: QString uuid_; QString describe_; QString path_; + QString simMatlabPath_; + + QString waveFile_; + QString reportFile_; + QString rdFile_; + QString matlabParamPath_; + osgEarth::Viewpoint homeViewpoint_; bool leaded_{ false }; diff --git a/src/workspace/WorkSpaceManager.h b/src/workspace/WorkSpaceManager.h index 8835f084..b88366f2 100644 --- a/src/workspace/WorkSpaceManager.h +++ b/src/workspace/WorkSpaceManager.h @@ -29,83 +29,6 @@ public: void SetCurrent(WorkSpace* workspace); WorkSpace* GetCurrent() const { return current_; } - bool SetDYTWaveFile(const QString& file) - { - m_waveFile = file; - return true; - } - - bool SetDYTReportFile(const QString& file) - { - m_reportFile = file; - return true; - } - - bool SetDYTRDFile(const QString& file) - { - m_rdFile = file; - return true; - } - - bool SetDYTMMainFile(const QString& file) - { - m_mMainFile = file; - return true; - } - - bool SetDYTMLDFile(const QString& file) - { - m_mLDFile = file; - return true; - } - - bool SetDYTMSeekerSimFile(const QString& file) - { - m_mSeekerSimFile = file; - return true; - } - - bool SetDYTMatlabPFile(const QString& file) - { - m_strMatlabPile = file; - return true; - } - - QString GetDYTWaveFile() - { - return m_waveFile; - } - - QString GetDYTReportFile() - { - return m_reportFile; - } - - QString GetDYTRDFile() - { - return m_rdFile; - } - - QString GetDYTMMainFile() - { - return m_mMainFile; - } - - QString GetDYTMLDFile() - { - return m_mLDFile; - } - - QString GetDYTMSeekerSimFile() - { - return m_mSeekerSimFile; - } - - QString GetDYTMatlabPFile() - { - return m_strMatlabPile; - } - void OnFrame(); signals: @@ -119,15 +42,4 @@ private: class OEScene* scene_{ nullptr }; WorkSpace* current_{ nullptr }; int64_t lastTime_{ 0 }; - - QString m_waveFile; - QString m_reportFile; - QString m_rdFile; - - QString m_mMainFile; - QString m_mLDFile; - QString m_mSeekerSimFile; - - QString m_strMatlabPile; - }; \ No newline at end of file diff --git a/src/workspace/WorkSpaceXMLParse.cpp b/src/workspace/WorkSpaceXMLParse.cpp index 724aac11..7a2046b2 100644 --- a/src/workspace/WorkSpaceXMLParse.cpp +++ b/src/workspace/WorkSpaceXMLParse.cpp @@ -114,7 +114,7 @@ bool WorkSpaceXMLParse::ParseChart(const tinyxml2::XMLElement* element) const tinyxml2::XMLAttribute* attribute = xmlElement->FirstAttribute(); while (nullptr != attribute) { - WorkSpaceManager::Get().SetDYTWaveFile(QString::fromLocal8Bit(attribute->Value())); + workSpace_->SetWavePath(QString::fromLocal8Bit(attribute->Value())); attribute = attribute->Next(); } } @@ -124,7 +124,7 @@ bool WorkSpaceXMLParse::ParseChart(const tinyxml2::XMLElement* element) const tinyxml2::XMLAttribute* attribute = xmlElement->FirstAttribute(); while (nullptr != attribute) { - WorkSpaceManager::Get().SetDYTReportFile(QString::fromLocal8Bit(attribute->Value())); + workSpace_->SetReportPath(QString::fromLocal8Bit(attribute->Value())); attribute = attribute->Next(); } } @@ -134,47 +134,17 @@ bool WorkSpaceXMLParse::ParseChart(const tinyxml2::XMLElement* element) const tinyxml2::XMLAttribute* attribute = xmlElement->FirstAttribute(); while (nullptr != attribute) { - WorkSpaceManager::Get().SetDYTRDFile(QString::fromLocal8Bit(attribute->Value())); + workSpace_->SetRDPath(QString::fromLocal8Bit(attribute->Value())); attribute = attribute->Next(); } } - else if (0 == strcmp(name, "MMain")) + else if (0 == strcmp(name, "SimMatlab")) { QVariantMap varChart; const tinyxml2::XMLAttribute* attribute = xmlElement->FirstAttribute(); while (nullptr != attribute) { - WorkSpaceManager::Get().SetDYTMMainFile(QString::fromLocal8Bit(attribute->Value())); - attribute = attribute->Next(); - } - } - else if (0 == strcmp(name, "MLD")) - { - QVariantMap varChart; - const tinyxml2::XMLAttribute* attribute = xmlElement->FirstAttribute(); - while (nullptr != attribute) { - - WorkSpaceManager::Get().SetDYTMLDFile(QString::fromLocal8Bit(attribute->Value())); - attribute = attribute->Next(); - } - } - else if (0 == strcmp(name, "MSeekerSim")) - { - QVariantMap varChart; - const tinyxml2::XMLAttribute* attribute = xmlElement->FirstAttribute(); - while (nullptr != attribute) { - - WorkSpaceManager::Get().SetDYTMSeekerSimFile(QString::fromLocal8Bit(attribute->Value())); - attribute = attribute->Next(); - } - } - else if (0 == strcmp(name, "MatlabP")) - { - QVariantMap varChart; - const tinyxml2::XMLAttribute* attribute = xmlElement->FirstAttribute(); - while (nullptr != attribute) { - - WorkSpaceManager::Get().SetDYTMatlabPFile(QString::fromLocal8Bit(attribute->Value())); + workSpace_->SetSimMatlab(QString::fromLocal8Bit(attribute->Value())); attribute = attribute->Next(); } } diff --git a/src/workspace/WorkSpaceXMLWrite.cpp b/src/workspace/WorkSpaceXMLWrite.cpp index 404df04f..cc80ad68 100644 --- a/src/workspace/WorkSpaceXMLWrite.cpp +++ b/src/workspace/WorkSpaceXMLWrite.cpp @@ -93,46 +93,29 @@ bool WorkSpaceXMLWrite::SaveChart(tinyxml2::XMLElement* scene, tinyxml2::XMLDocu tinyxml2::XMLElement* chart = doc->NewElement("Wave"); charts->LinkEndChild(chart); - chart->SetAttribute("file", WorkSpaceManager::Get().GetDYTWaveFile().toLocal8Bit().constData()); + chart->SetAttribute("file", workSpace_->GetWavePath().toLocal8Bit().constData()); } { tinyxml2::XMLElement* chart = doc->NewElement("Report"); charts->LinkEndChild(chart); - chart->SetAttribute("Report", WorkSpaceManager::Get().GetDYTReportFile().toLocal8Bit().constData()); + chart->SetAttribute("Report", workSpace_->GetReportPath().toLocal8Bit().constData()); } { tinyxml2::XMLElement* chart = doc->NewElement("RD"); charts->LinkEndChild(chart); - chart->SetAttribute("RD", WorkSpaceManager::Get().GetDYTRDFile().toLocal8Bit().constData()); + chart->SetAttribute("RD", workSpace_->GetRDPath().toLocal8Bit().constData()); } { - tinyxml2::XMLElement* chart = doc->NewElement("MMain"); + tinyxml2::XMLElement* chart = doc->NewElement("SimMatlab"); charts->LinkEndChild(chart); - chart->SetAttribute("MMain", WorkSpaceManager::Get().GetDYTMMainFile().toLocal8Bit().constData()); - } - { - tinyxml2::XMLElement* chart = doc->NewElement("MLD"); - charts->LinkEndChild(chart); - - chart->SetAttribute("MLD", WorkSpaceManager::Get().GetDYTMLDFile().toLocal8Bit().constData()); - } - { - tinyxml2::XMLElement* chart = doc->NewElement("MSeekerSim"); - charts->LinkEndChild(chart); - - chart->SetAttribute("MSeekerSim", WorkSpaceManager::Get().GetDYTMSeekerSimFile().toLocal8Bit().constData()); - } - { - tinyxml2::XMLElement* chart = doc->NewElement("MatlabP"); - charts->LinkEndChild(chart); - - chart->SetAttribute("MatlabP", WorkSpaceManager::Get().GetDYTMatlabPFile().toLocal8Bit().constData()); + chart->SetAttribute("SimMatlab", workSpace_->GetSimMatlab().toLocal8Bit().constData()); } + return true; }