2025-01-04 04:12:51 +00:00
|
|
|
|
#include "MainWindow.h"
|
|
|
|
|
|
|
|
|
|
|
|
#include <qtabwidget.h>
|
2025-10-12 03:10:10 +00:00
|
|
|
|
#include "utils/UiLayoutManager.h"
|
2025-01-04 04:12:51 +00:00
|
|
|
|
|
|
|
|
|
|
#include "PropertyBrowser.h"
|
|
|
|
|
|
#include "ModelBrowser.h"
|
|
|
|
|
|
#include "DockWidget.h"
|
|
|
|
|
|
|
|
|
|
|
|
#include "viewer/QtOsgViewWidget.h"
|
|
|
|
|
|
#include "viewer/OsgViewer.h"
|
|
|
|
|
|
|
|
|
|
|
|
#include "chartPlot/FitCurveDialog.h"
|
|
|
|
|
|
#include "chartPlot/SurfaceDialog.h"
|
|
|
|
|
|
#include "Layout/LayoutSettingUI.h"
|
|
|
|
|
|
#include "Layout/SignalIndicatorLampUI.h"
|
|
|
|
|
|
#include "Layout/AddParamSetting.h"
|
|
|
|
|
|
#include "Layout/CodeEdtUI.h"
|
|
|
|
|
|
|
|
|
|
|
|
#include "Table/targetlistwgt.h"
|
|
|
|
|
|
#include "common/RecourceHelper.h"
|
|
|
|
|
|
|
|
|
|
|
|
#include "../workspace/WorkSpaceManager.h"
|
|
|
|
|
|
#include "../workspace/WorkSpace.h"
|
|
|
|
|
|
#include "../workspace/Timestep.h"
|
|
|
|
|
|
#include "../workspace/LampStatus.h"
|
|
|
|
|
|
|
|
|
|
|
|
#include "Matlab/MatlabObject.h"
|
|
|
|
|
|
|
|
|
|
|
|
#include "ui_MainWindow.h"
|
2025-03-13 00:42:41 +00:00
|
|
|
|
#include "viewer/OsgWidget.h"
|
2025-10-12 06:33:16 +00:00
|
|
|
|
#include "DockTitleBar.h"
|
2025-01-04 04:12:51 +00:00
|
|
|
|
|
|
|
|
|
|
MainWindow::MainWindow(QWidget* parent)
|
|
|
|
|
|
: QMainWindow(parent)
|
|
|
|
|
|
, ui(new Ui::MainWindow) {
|
|
|
|
|
|
ui->setupUi(this);
|
|
|
|
|
|
|
|
|
|
|
|
InitUI();
|
2025-04-21 00:20:00 +00:00
|
|
|
|
}
|
2025-01-04 04:12:51 +00:00
|
|
|
|
|
|
|
|
|
|
MainWindow::~MainWindow() {
|
2025-06-19 14:05:52 +00:00
|
|
|
|
UninitUI();
|
2025-01-04 04:12:51 +00:00
|
|
|
|
delete ui;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::InitUI() {
|
2025-10-12 03:10:10 +00:00
|
|
|
|
QWidget* centralWidget = takeCentralWidget();
|
|
|
|
|
|
if (nullptr != centralWidget) {
|
|
|
|
|
|
delete centralWidget;
|
|
|
|
|
|
}
|
|
|
|
|
|
setDockNestingEnabled(true);
|
2025-01-04 04:12:51 +00:00
|
|
|
|
|
|
|
|
|
|
setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
|
|
|
|
|
|
setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea);
|
2025-10-12 03:10:10 +00:00
|
|
|
|
setDockOptions(QMainWindow::AllowTabbedDocks | QMainWindow::AllowNestedDocks | QMainWindow::AnimatedDocks);
|
2025-01-04 04:12:51 +00:00
|
|
|
|
|
|
|
|
|
|
DockWidget* model = new DockWidget(tr("model elements"), 0);
|
2025-10-12 06:33:16 +00:00
|
|
|
|
model->SetDockWidgetTitleBar(new DockTitleBar(model));
|
2025-10-12 03:10:10 +00:00
|
|
|
|
model->setObjectName("Dock.ModelBrowser");
|
2025-01-04 04:12:51 +00:00
|
|
|
|
// addDockWidget(pSettingUI->GetArea("ModelBrowser"), model);
|
|
|
|
|
|
modelBrowser_ = new ModelBrowser(0);
|
|
|
|
|
|
modelBrowser_->AttachDock(model);
|
|
|
|
|
|
m_mapDockWidget.insert("ModelBrowser", model);
|
|
|
|
|
|
|
|
|
|
|
|
DockWidget* attribte = new DockWidget(tr("attribte"), 0);
|
2025-10-12 06:33:16 +00:00
|
|
|
|
attribte->SetDockWidgetTitleBar(new DockTitleBar(attribte));
|
2025-10-12 03:10:10 +00:00
|
|
|
|
attribte->setObjectName("Dock.PropertyBrowser");
|
2025-01-04 04:12:51 +00:00
|
|
|
|
//addDockWidget(pSettingUI->GetArea("PropertyBrowser"), attribte);
|
|
|
|
|
|
propertyBrowser_ = new PropertyBrowser(0);
|
|
|
|
|
|
propertyBrowser_->AttachDock(attribte);
|
|
|
|
|
|
m_mapDockWidget.insert("PropertyBrowser", attribte);
|
2025-10-12 03:10:10 +00:00
|
|
|
|
addDockWidget(Qt::RightDockWidgetArea, attribte);
|
2025-01-04 04:12:51 +00:00
|
|
|
|
|
|
|
|
|
|
connect(modelBrowser_, &ModelBrowser::WorkSpaceChange, propertyBrowser_, &PropertyBrowser::OnWorkSpaceChange);
|
|
|
|
|
|
connect(modelBrowser_, &ModelBrowser::EntityChange, propertyBrowser_, &PropertyBrowser::OnEntityChange);
|
|
|
|
|
|
|
2025-03-13 00:42:41 +00:00
|
|
|
|
qtOsgViewWidget_ = new OsgWidget;
|
2025-01-05 11:12:18 +00:00
|
|
|
|
qtOsgViewWidget_->Initialize();
|
2025-10-12 03:10:10 +00:00
|
|
|
|
|
|
|
|
|
|
// 主视图改为 DockWidget,支持自由停靠
|
|
|
|
|
|
DockWidget* viewDock = new DockWidget(tr("Main View"), 0);
|
2025-10-12 06:33:16 +00:00
|
|
|
|
viewDock->SetDockWidgetTitleBar(new DockTitleBar(viewDock));
|
2025-10-12 03:10:10 +00:00
|
|
|
|
viewDock->setObjectName("Dock.MainView");
|
|
|
|
|
|
viewDock->setWidget(qtOsgViewWidget_);
|
|
|
|
|
|
addDockWidget(Qt::LeftDockWidgetArea, viewDock);
|
|
|
|
|
|
m_mapDockWidget.insert("MainView", viewDock);
|
|
|
|
|
|
|
|
|
|
|
|
addDockWidget(Qt::LeftDockWidgetArea, model);
|
|
|
|
|
|
splitDockWidget(model, viewDock, Qt::Horizontal);
|
2025-01-04 04:12:51 +00:00
|
|
|
|
|
2025-01-07 15:45:23 +00:00
|
|
|
|
QString wavePath ="", speedPath = "", rdPath = "", matlabParam="";
|
|
|
|
|
|
if (WorkSpaceManager::Get().GetCurrent())
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!WorkSpaceManager::Get().GetCurrent()->GetWavePath().isEmpty())
|
|
|
|
|
|
{
|
|
|
|
|
|
wavePath = RecourceHelper::Get().GetBasePath() + "/" + WorkSpaceManager::Get().GetCurrent()->GetWavePath();
|
|
|
|
|
|
}
|
2025-01-04 04:12:51 +00:00
|
|
|
|
|
2025-01-07 15:45:23 +00:00
|
|
|
|
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();
|
|
|
|
|
|
}
|
2025-01-04 04:12:51 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
DockWidget* fitCurveDock = new DockWidget(tr("Wave Curve"), 0);
|
2025-10-12 06:33:16 +00:00
|
|
|
|
fitCurveDock->SetDockWidgetTitleBar(new DockTitleBar(fitCurveDock));
|
2025-10-12 03:10:10 +00:00
|
|
|
|
fitCurveDock->setObjectName("Dock.WaveCurveDialog");
|
2025-01-04 04:12:51 +00:00
|
|
|
|
fitCurveDlg_ = new FitCurveDialog(1);
|
|
|
|
|
|
fitCurveDlg_->AttachDock(fitCurveDock);
|
|
|
|
|
|
m_mapDockWidget.insert("WaveCurveDialog", fitCurveDock);
|
2025-10-12 03:10:10 +00:00
|
|
|
|
addDockWidget(Qt::BottomDockWidgetArea, fitCurveDock);
|
2025-01-04 04:12:51 +00:00
|
|
|
|
|
|
|
|
|
|
fitCurveDlg_->InitWaveFile(wavePath);
|
|
|
|
|
|
DockWidget* fitLgCurveDock = new DockWidget(tr("Speed Curve"), 0);
|
2025-10-12 06:33:16 +00:00
|
|
|
|
fitLgCurveDock->SetDockWidgetTitleBar(new DockTitleBar(fitLgCurveDock));
|
2025-10-12 03:10:10 +00:00
|
|
|
|
fitLgCurveDock->setObjectName("Dock.SpeedCurveDialog");
|
2025-01-07 15:45:23 +00:00
|
|
|
|
|
2025-01-04 04:12:51 +00:00
|
|
|
|
fitYLgCurveDlg_ = new FitCurveDialog(1);
|
|
|
|
|
|
fitYLgCurveDlg_->AttachDock(fitLgCurveDock);
|
|
|
|
|
|
m_mapDockWidget.insert("SpeedCurveDialog", fitLgCurveDock);
|
2025-10-12 03:10:10 +00:00
|
|
|
|
addDockWidget(Qt::BottomDockWidgetArea, fitLgCurveDock);
|
|
|
|
|
|
tabifyDockWidget(fitCurveDock, fitLgCurveDock);
|
2025-01-04 04:12:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fitYLgCurveDlg_->InitReportFile(speedPath);
|
|
|
|
|
|
|
|
|
|
|
|
DockWidget* surfaceCurveDock = new DockWidget(tr("3D Curve"), 0);
|
2025-10-12 06:33:16 +00:00
|
|
|
|
surfaceCurveDock->SetDockWidgetTitleBar(new DockTitleBar(surfaceCurveDock));
|
2025-10-12 03:10:10 +00:00
|
|
|
|
surfaceCurveDock->setObjectName("Dock.3DCurveDialog");
|
2025-01-07 15:45:23 +00:00
|
|
|
|
|
2025-01-04 04:12:51 +00:00
|
|
|
|
surfaceDlg_ = new SurfaceDialog();
|
|
|
|
|
|
surfaceDlg_->AttachDock(surfaceCurveDock);
|
|
|
|
|
|
m_mapDockWidget.insert("3DCurveDialog", surfaceCurveDock);
|
2025-10-12 03:10:10 +00:00
|
|
|
|
addDockWidget(Qt::BottomDockWidgetArea, surfaceCurveDock);
|
|
|
|
|
|
tabifyDockWidget(fitCurveDock, surfaceCurveDock);
|
2025-01-04 04:12:51 +00:00
|
|
|
|
|
|
|
|
|
|
surfaceDlg_->InitRD(rdPath);
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
targetUITable_ = new TargetListWgt;
|
|
|
|
|
|
|
|
|
|
|
|
QStringList headerLabels;
|
2025-03-13 00:42:41 +00:00
|
|
|
|
headerLabels << tr("Target number") << tr("Signal-to-noise ratio")
|
|
|
|
|
|
<< tr("Azimuth line of sight") << tr("Pitch gaze angle")
|
|
|
|
|
|
<< tr("azimuth") << tr("Pitch angle")
|
|
|
|
|
|
<< tr("attribute") << tr("Doppler")
|
|
|
|
|
|
<< tr("course") << tr("Speed")
|
|
|
|
|
|
<< tr("longitude") << tr("latitude")
|
|
|
|
|
|
<< tr("distance") << tr("velocity")
|
|
|
|
|
|
<< tr("Radial dimensions") << tr("Target RCS");
|
2025-01-04 04:12:51 +00:00
|
|
|
|
|
|
|
|
|
|
targetUITable_->SetHeader(headerLabels);
|
|
|
|
|
|
//const QString reportPath = RecourceHelper::Get().GetBasePath() + "/workspace/Report.txt";
|
|
|
|
|
|
targetUITable_->InitFile(speedPath, 50);
|
|
|
|
|
|
|
|
|
|
|
|
DockWidget* dataTableDock = new DockWidget(tr("Report Table"), 0);
|
2025-10-12 06:33:16 +00:00
|
|
|
|
dataTableDock->SetDockWidgetTitleBar(new DockTitleBar(dataTableDock));
|
2025-10-12 03:10:10 +00:00
|
|
|
|
dataTableDock->setObjectName("Dock.TargetListWgt_Table");
|
2025-01-04 04:12:51 +00:00
|
|
|
|
// addDockWidget(pSettingUI->GetArea("TargetListWgt"), dataTableDock);
|
|
|
|
|
|
targetUITable_->AttachDock(dataTableDock);
|
|
|
|
|
|
m_mapDockWidget.insert("TargetListWgt_Table", dataTableDock);
|
2025-10-12 03:10:10 +00:00
|
|
|
|
addDockWidget(Qt::BottomDockWidgetArea, dataTableDock);
|
|
|
|
|
|
tabifyDockWidget(fitCurveDock, dataTableDock);
|
2025-01-04 04:12:51 +00:00
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const QString lampPath = RecourceHelper::Get().GetBasePath() + "/workspace/Lamp.txt";
|
|
|
|
|
|
|
|
|
|
|
|
DockWidget* signalIndicatorLampDock = new DockWidget(tr("Signal Indicator Lamp"), 0);
|
2025-10-12 06:33:16 +00:00
|
|
|
|
signalIndicatorLampDock->SetDockWidgetTitleBar(new DockTitleBar(signalIndicatorLampDock));
|
2025-10-12 03:10:10 +00:00
|
|
|
|
signalIndicatorLampDock->setObjectName("Dock.SignalIndicatorLampUI");
|
2025-01-04 04:12:51 +00:00
|
|
|
|
signalIndicatorLampUI_ = new SignalIndicatorLampUI;
|
|
|
|
|
|
signalIndicatorLampUI_->AttachDock(signalIndicatorLampDock);
|
|
|
|
|
|
signalIndicatorLampUI_->InitLamp(lampPath);
|
|
|
|
|
|
|
|
|
|
|
|
m_mapDockWidget.insert("SignalIndicatorLampUI", signalIndicatorLampDock);
|
2025-10-12 03:10:10 +00:00
|
|
|
|
addDockWidget(Qt::BottomDockWidgetArea, signalIndicatorLampDock);
|
|
|
|
|
|
tabifyDockWidget(fitCurveDock, signalIndicatorLampDock);
|
2025-01-04 04:12:51 +00:00
|
|
|
|
|
|
|
|
|
|
DockWidget* addParamSettingDock = new DockWidget(tr("ParamSetting"), 0);
|
2025-10-12 06:33:16 +00:00
|
|
|
|
addParamSettingDock->SetDockWidgetTitleBar(new DockTitleBar(addParamSettingDock));
|
2025-10-12 03:10:10 +00:00
|
|
|
|
addParamSettingDock->setObjectName("Dock.ParamSetting");
|
2025-01-07 15:45:23 +00:00
|
|
|
|
addParamDlg_ = new AddParamSetting(matlabParam);
|
2025-01-04 04:12:51 +00:00
|
|
|
|
addParamDlg_->AttachDock(addParamSettingDock);
|
|
|
|
|
|
m_mapDockWidget.insert("ParamSetting", addParamSettingDock);
|
2025-10-12 03:10:10 +00:00
|
|
|
|
addDockWidget(Qt::BottomDockWidgetArea, addParamSettingDock);
|
|
|
|
|
|
tabifyDockWidget(fitCurveDock, addParamSettingDock);
|
2025-01-04 04:12:51 +00:00
|
|
|
|
|
2025-07-05 04:07:30 +00:00
|
|
|
|
DockWidget* matlabDock = new DockWidget(tr("bat File"), 0);
|
2025-10-12 06:33:16 +00:00
|
|
|
|
matlabDock->SetDockWidgetTitleBar(new DockTitleBar(matlabDock));
|
2025-10-12 03:10:10 +00:00
|
|
|
|
matlabDock->setObjectName("Dock.Matlab");
|
2025-07-05 04:07:30 +00:00
|
|
|
|
matlabFileDlg_ = new CodeEdtUI;
|
|
|
|
|
|
matlabFileDlg_->AttachDock(matlabDock);
|
|
|
|
|
|
m_mapDockWidget.insert("Matlab", matlabDock);
|
2025-10-12 03:10:10 +00:00
|
|
|
|
addDockWidget(Qt::BottomDockWidgetArea, matlabDock);
|
|
|
|
|
|
tabifyDockWidget(fitCurveDock, matlabDock);
|
2025-01-07 14:04:19 +00:00
|
|
|
|
|
2025-07-05 04:07:30 +00:00
|
|
|
|
//ui->discript->setText(tr("name: 5year 0412"));
|
|
|
|
|
|
//ui->status->setText(tr("start: no start"));
|
2025-01-05 11:12:18 +00:00
|
|
|
|
|
2025-10-12 03:10:10 +00:00
|
|
|
|
// InitDockLayout();
|
|
|
|
|
|
|
|
|
|
|
|
// Restore previous UI layout if available
|
|
|
|
|
|
UiLayoutManager::Restore(this, 1);
|
|
|
|
|
|
|
2025-01-05 11:12:18 +00:00
|
|
|
|
//ui->viewWidget->layout()->addWidget(qtOsgViewWidget_);
|
|
|
|
|
|
qtOsgViewWidget_->LoadDefaultScene();
|
2025-04-13 15:12:17 +00:00
|
|
|
|
/*OsgViewer::Get().Initialize();
|
|
|
|
|
|
OsgViewer::Get().OnFrame();*/
|
2025-01-04 04:12:51 +00:00
|
|
|
|
|
2025-07-05 04:07:30 +00:00
|
|
|
|
#if 0
|
|
|
|
|
|
// MatlabObject* mtlb = new MatlabObject;
|
|
|
|
|
|
MatlabObject::GetInstance()->RunMatlabFile("");
|
2025-01-04 04:12:51 +00:00
|
|
|
|
#endif // 1
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-06-19 14:05:52 +00:00
|
|
|
|
void MainWindow::UninitUI() {
|
2025-10-12 03:10:10 +00:00
|
|
|
|
// Save layout state before tearing down widgets
|
|
|
|
|
|
UiLayoutManager::Save(this, 1);
|
2025-06-19 14:05:52 +00:00
|
|
|
|
if (qtOsgViewWidget_) {
|
|
|
|
|
|
qtOsgViewWidget_->Uninitialize();
|
|
|
|
|
|
delete qtOsgViewWidget_;
|
|
|
|
|
|
qtOsgViewWidget_ = nullptr;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-01-04 04:12:51 +00:00
|
|
|
|
void MainWindow::slotShowUISetting() {
|
|
|
|
|
|
pSettingUI->show();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::slotResetWorkSpace()
|
|
|
|
|
|
{
|
2025-01-07 15:45:23 +00:00
|
|
|
|
QString wavePath = "", speedPath = "", rdPath = "";
|
2025-07-05 04:07:30 +00:00
|
|
|
|
if (WorkSpaceManager::Get().GetCurrent()) {
|
|
|
|
|
|
if (!WorkSpaceManager::Get().GetCurrent()->GetWavePath().isEmpty()) {
|
2025-01-07 15:45:23 +00:00
|
|
|
|
wavePath = RecourceHelper::Get().GetBasePath() + "/" + WorkSpaceManager::Get().GetCurrent()->GetWavePath();
|
|
|
|
|
|
}
|
2025-01-04 04:12:51 +00:00
|
|
|
|
|
2025-07-05 04:07:30 +00:00
|
|
|
|
if (!WorkSpaceManager::Get().GetCurrent()->GetReportPath().isEmpty()) {
|
2025-01-07 15:45:23 +00:00
|
|
|
|
speedPath = RecourceHelper::Get().GetBasePath() + "/" + WorkSpaceManager::Get().GetCurrent()->GetReportPath();
|
|
|
|
|
|
}
|
2025-01-04 04:12:51 +00:00
|
|
|
|
|
2025-07-05 04:07:30 +00:00
|
|
|
|
if (!WorkSpaceManager::Get().GetCurrent()->GetRDPath().isEmpty()) {
|
2025-01-07 15:45:23 +00:00
|
|
|
|
rdPath = RecourceHelper::Get().GetBasePath() + "/" + WorkSpaceManager::Get().GetCurrent()->GetRDPath();
|
|
|
|
|
|
}
|
2025-01-04 04:12:51 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fitCurveDlg_->InitWaveFile(wavePath);
|
|
|
|
|
|
fitYLgCurveDlg_->InitReportFile(speedPath);
|
|
|
|
|
|
surfaceDlg_->InitRD(rdPath);
|
|
|
|
|
|
targetUITable_->InitFile(speedPath, 50);
|
|
|
|
|
|
}
|