modify new ui

This commit is contained in:
brige 2025-07-05 12:07:30 +08:00
parent cf189a7600
commit 69caff5ce7
8 changed files with 170 additions and 79 deletions

View File

@ -523,133 +523,128 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ui/MainWindow.cpp" line="66"/> <location filename="../ui/MainWindow.cpp" line="65"/>
<source>model elements</source> <source>model elements</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ui/MainWindow.cpp" line="72"/> <location filename="../ui/MainWindow.cpp" line="71"/>
<source>attribte</source> <source>attribte</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ui/MainWindow.cpp" line="109"/> <location filename="../ui/MainWindow.cpp" line="108"/>
<source>Wave Curve</source> <source>Wave Curve</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ui/MainWindow.cpp" line="115"/> <location filename="../ui/MainWindow.cpp" line="114"/>
<source>Speed Curve</source> <source>Speed Curve</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ui/MainWindow.cpp" line="124"/> <location filename="../ui/MainWindow.cpp" line="123"/>
<source>3D Curve</source> <source>3D Curve</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ui/MainWindow.cpp" line="136"/> <location filename="../ui/MainWindow.cpp" line="135"/>
<source>Target number</source> <source>Target number</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ui/MainWindow.cpp" line="136"/> <location filename="../ui/MainWindow.cpp" line="135"/>
<source>Signal-to-noise ratio</source> <source>Signal-to-noise ratio</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ui/MainWindow.cpp" line="137"/> <location filename="../ui/MainWindow.cpp" line="136"/>
<source>Azimuth line of sight</source> <source>Azimuth line of sight</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ui/MainWindow.cpp" line="137"/> <location filename="../ui/MainWindow.cpp" line="136"/>
<source>Pitch gaze angle</source> <source>Pitch gaze angle</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ui/MainWindow.cpp" line="138"/> <location filename="../ui/MainWindow.cpp" line="137"/>
<source>azimuth</source> <source>azimuth</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ui/MainWindow.cpp" line="138"/> <location filename="../ui/MainWindow.cpp" line="137"/>
<source>Pitch angle</source> <source>Pitch angle</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ui/MainWindow.cpp" line="139"/> <location filename="../ui/MainWindow.cpp" line="138"/>
<source>attribute</source> <source>attribute</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ui/MainWindow.cpp" line="139"/> <location filename="../ui/MainWindow.cpp" line="138"/>
<source>Doppler</source> <source>Doppler</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ui/MainWindow.cpp" line="140"/> <location filename="../ui/MainWindow.cpp" line="139"/>
<source>course</source> <source>course</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ui/MainWindow.cpp" line="140"/> <location filename="../ui/MainWindow.cpp" line="139"/>
<source>Speed</source> <source>Speed</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ui/MainWindow.cpp" line="141"/> <location filename="../ui/MainWindow.cpp" line="140"/>
<source>longitude</source> <source>longitude</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ui/MainWindow.cpp" line="141"/> <location filename="../ui/MainWindow.cpp" line="140"/>
<source>latitude</source> <source>latitude</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ui/MainWindow.cpp" line="142"/> <location filename="../ui/MainWindow.cpp" line="141"/>
<source>distance</source> <source>distance</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ui/MainWindow.cpp" line="142"/> <location filename="../ui/MainWindow.cpp" line="141"/>
<source>velocity</source> <source>velocity</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ui/MainWindow.cpp" line="143"/> <location filename="../ui/MainWindow.cpp" line="142"/>
<source>Radial dimensions</source> <source>Radial dimensions</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ui/MainWindow.cpp" line="143"/> <location filename="../ui/MainWindow.cpp" line="142"/>
<source>Target RCS</source> <source>Target RCS</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ui/MainWindow.cpp" line="149"/> <location filename="../ui/MainWindow.cpp" line="148"/>
<source>Report Table</source> <source>Report Table</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ui/MainWindow.cpp" line="158"/> <location filename="../ui/MainWindow.cpp" line="157"/>
<source>Signal Indicator Lamp</source> <source>Signal Indicator Lamp</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ui/MainWindow.cpp" line="165"/> <location filename="../ui/MainWindow.cpp" line="164"/>
<source>ParamSetting</source> <source>ParamSetting</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ui/MainWindow.cpp" line="170"/> <location filename="../ui/MainWindow.cpp" line="169"/>
<source>Matlab File</source> <source>bat File</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/MainWindow.cpp" line="175"/>
<source>name: 5year 0412</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>

View File

@ -38,7 +38,6 @@ MainWindow::MainWindow(QWidget* parent)
} }
MainWindow::~MainWindow() { MainWindow::~MainWindow() {
//OsgViewer::Get().Uninitialize();
UninitUI(); UninitUI();
delete ui; delete ui;
} }
@ -167,12 +166,12 @@ void MainWindow::InitUI() {
addParamDlg_->AttachDock(addParamSettingDock); addParamDlg_->AttachDock(addParamSettingDock);
m_mapDockWidget.insert("ParamSetting", addParamSettingDock); m_mapDockWidget.insert("ParamSetting", addParamSettingDock);
DockWidget* matlabDock = new DockWidget(tr("Matlab File"), 0); DockWidget* matlabDock = new DockWidget(tr("bat File"), 0);
matlabFileDlg_ = new CodeEdtUI; matlabFileDlg_ = new CodeEdtUI;
matlabFileDlg_->AttachDock(matlabDock); matlabFileDlg_->AttachDock(matlabDock);
m_mapDockWidget.insert("Matlab", matlabDock); m_mapDockWidget.insert("Matlab", matlabDock);
ui->discript->setText(tr("name: 5year 0412")); //ui->discript->setText(tr("name: 5year 0412"));
//ui->status->setText(tr("start: no start")); //ui->status->setText(tr("start: no start"));
InitDockLayout(); InitDockLayout();
@ -182,7 +181,7 @@ void MainWindow::InitUI() {
/*OsgViewer::Get().Initialize(); /*OsgViewer::Get().Initialize();
OsgViewer::Get().OnFrame();*/ OsgViewer::Get().OnFrame();*/
#if 1 #if 0
// MatlabObject* mtlb = new MatlabObject; // MatlabObject* mtlb = new MatlabObject;
MatlabObject::GetInstance()->RunMatlabFile(""); MatlabObject::GetInstance()->RunMatlabFile("");
#endif // 1 #endif // 1
@ -201,6 +200,8 @@ void MainWindow::InitDockLayout() {
tabWidget_->removeTab(0); tabWidget_->removeTab(0);
} }
tabWidget_->tabBar()->setExpanding(true);
QVariantList listTab = pSettingUI->GetAreaLayout().toList(); QVariantList listTab = pSettingUI->GetAreaLayout().toList();
for (int i = 0; i < listTab.size(); i++) { for (int i = 0; i < listTab.size(); i++) {
QVariantMap mapTab = listTab[i].toMap(); QVariantMap mapTab = listTab[i].toMap();
@ -269,6 +270,7 @@ void MainWindow::InitDockLayout() {
} }
} }
tabWidget_->tabBar()->setMinimumWidth(500);
/* AddDockArea("DockLeftArea"); /* AddDockArea("DockLeftArea");
AddDockArea("DockTopArea"); AddDockArea("DockTopArea");
AddDockArea("DockRightArea"); AddDockArea("DockRightArea");
@ -351,20 +353,16 @@ void MainWindow::slotShowUISetting() {
void MainWindow::slotResetWorkSpace() void MainWindow::slotResetWorkSpace()
{ {
QString wavePath = "", speedPath = "", rdPath = ""; QString wavePath = "", speedPath = "", rdPath = "";
if (WorkSpaceManager::Get().GetCurrent()) if (WorkSpaceManager::Get().GetCurrent()) {
{ if (!WorkSpaceManager::Get().GetCurrent()->GetWavePath().isEmpty()) {
if (!WorkSpaceManager::Get().GetCurrent()->GetWavePath().isEmpty())
{
wavePath = RecourceHelper::Get().GetBasePath() + "/" + WorkSpaceManager::Get().GetCurrent()->GetWavePath(); wavePath = RecourceHelper::Get().GetBasePath() + "/" + WorkSpaceManager::Get().GetCurrent()->GetWavePath();
} }
if (!WorkSpaceManager::Get().GetCurrent()->GetReportPath().isEmpty()) if (!WorkSpaceManager::Get().GetCurrent()->GetReportPath().isEmpty()) {
{
speedPath = RecourceHelper::Get().GetBasePath() + "/" + WorkSpaceManager::Get().GetCurrent()->GetReportPath(); speedPath = RecourceHelper::Get().GetBasePath() + "/" + WorkSpaceManager::Get().GetCurrent()->GetReportPath();
} }
if (!WorkSpaceManager::Get().GetCurrent()->GetRDPath().isEmpty()) if (!WorkSpaceManager::Get().GetCurrent()->GetRDPath().isEmpty()) {
{
rdPath = RecourceHelper::Get().GetBasePath() + "/" + WorkSpaceManager::Get().GetCurrent()->GetRDPath(); rdPath = RecourceHelper::Get().GetBasePath() + "/" + WorkSpaceManager::Get().GetCurrent()->GetRDPath();
} }
} }

View File

@ -143,6 +143,9 @@ void CameraControlManipulator::setByMatrix(const osg::Matrixd& matrix) {
fixVerticalAxis(_center, _rotation, true); fixVerticalAxis(_center, _rotation, true);
} }
break; break;
default:
break;
} }
} }
@ -192,6 +195,9 @@ osg::Matrixd CameraControlManipulator::getMatrix() const {
osg::Matrixd::translate(_center); osg::Matrixd::translate(_center);
} }
break; break;
default:
break;
} }
return matrix; return matrix;
@ -352,7 +358,7 @@ bool CameraControlManipulator::calcMovement() {
// get delta time // get delta time
double eventTimeDelta = _ga_t0->getTime() - _ga_t1->getTime(); double eventTimeDelta = _ga_t0->getTime() - _ga_t1->getTime();
if (eventTimeDelta < 0.) { if (eventTimeDelta < 0.) {
OSG_WARN << "Manipulator warning: eventTimeDelta = " << eventTimeDelta; OSG_WARN << "Manipulator warning: eventTimeDelta = " << eventTimeDelta << std::endl;
eventTimeDelta = 0.; eventTimeDelta = 0.;
} }

View File

@ -14,6 +14,7 @@
#include "xml/tinyxml2.h" #include "xml/tinyxml2.h"
#include "common/SpdLogger.h" #include "common/SpdLogger.h"
#include "entities/Entity.h" #include "entities/Entity.h"
#include "utils/FileUtils.h"
//#include "workspace/WorkSpaceItemGroup.h" //#include "workspace/WorkSpaceItemGroup.h"
//#include "workspace/WorkSpaceRiverGroup.h" //#include "workspace/WorkSpaceRiverGroup.h"
//#include "workspace/WorkSpaceRiverNetGroup.h" //#include "workspace/WorkSpaceRiverNetGroup.h"
@ -38,6 +39,76 @@ const QString WorkSpace::GetDir() const {
return info.absolutePath(); return info.absolutePath();
} }
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();
}
const QString WorkSpace::GetRDPath() const
{
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) {
LOG_WARN("entity is nullptr"); LOG_WARN("entity is nullptr");

View File

@ -46,12 +46,8 @@ public:
inline const QString& GetDescribe() const { inline const QString& GetDescribe() const {
return describe_; return describe_;
} }
inline void SetSimMatlab(const QString& path) { void SetSimMatlab(const QString& path);
simMatlabPath_ = path; const QString GetSimMatlab() const;
}
inline const QString GetSimMatlab() const {
return simMatlabPath_;
}
inline void SetMatlabParam(const QString& path) { inline void SetMatlabParam(const QString& path) {
matlabParamPath_ = path; matlabParamPath_ = path;
@ -60,26 +56,14 @@ public:
return matlabParamPath_; return matlabParamPath_;
} }
inline void SetWavePath(const QString& path) { void SetWavePath(const QString& path);
waveFile_ = path; const QString GetWavePath() const;
}
inline const QString GetWavePath() const {
return waveFile_;
}
inline void SetReportPath(const QString& path) { void SetReportPath(const QString& path) ;
reportFile_ = path; const QString GetReportPath() const;
}
inline const QString GetReportPath() const {
return reportFile_;
}
inline void SetRDPath(const QString& path) { void SetRDPath(const QString& path);
rdFile_ = path; const QString GetRDPath() const;
}
inline const QString GetRDPath() const {
return rdFile_;
}
inline void SetHomeViewpoint(const osgEarth::Viewpoint& viewpoint) { inline void SetHomeViewpoint(const osgEarth::Viewpoint& viewpoint) {
homeViewpoint_ = viewpoint; homeViewpoint_ = viewpoint;
@ -140,6 +124,11 @@ Q_SIGNALS:
void TimestepChanged(class Timestep* timestep); void TimestepChanged(class Timestep* timestep);
void LampStatusChanged(class LampStatus* lampStatus); void LampStatusChanged(class LampStatus* lampStatus);
protected:
const QString& GetSimMatlabName() const {
return simMatlabPath_;
}
private: private:
QString name_; QString name_;
QString uuid_; QString uuid_;
@ -160,5 +149,6 @@ private:
class Timestep* timestep_{ nullptr }; class Timestep* timestep_{ nullptr };
class LampStatus* lampStatus_{ nullptr }; class LampStatus* lampStatus_{ nullptr };
class Entity* trackedEntity_{ nullptr }; class Entity* trackedEntity_{ nullptr };
friend class WorkSpaceXMLWrite;
}; };

View File

@ -155,6 +155,33 @@ bool WorkSpaceXMLParse::ParseChart(const tinyxml2::XMLElement* element)
return true; 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) bool WorkSpaceXMLParse::ParseReport(const tinyxml2::XMLElement* element)
{ {
QString strFile = ""; QString strFile = "";
@ -208,6 +235,9 @@ bool WorkSpaceXMLParse::Load(const QString& dyt) {
else if (0 == strcmp(name, "ReportInfo")) { else if (0 == strcmp(name, "ReportInfo")) {
ParseReport(xmlElement); ParseReport(xmlElement);
} }
else if (0 == strcmp(name, "SimMatlab")) {
ParseSimMatlab(xmlElement);
}
xmlElement = xmlElement->NextSiblingElement(); xmlElement = xmlElement->NextSiblingElement();
} }

View File

@ -34,6 +34,7 @@ private:
bool ParseEntities(const tinyxml2::XMLElement* element); bool ParseEntities(const tinyxml2::XMLElement* element);
bool ParseChart(const tinyxml2::XMLElement* element); bool ParseChart(const tinyxml2::XMLElement* element);
bool ParseReport(const tinyxml2::XMLElement* element); bool ParseReport(const tinyxml2::XMLElement* element);
bool ParseSimMatlab(const tinyxml2::XMLElement* element);
private: private:
QString name_; QString name_;

View File

@ -114,7 +114,7 @@ bool WorkSpaceXMLWrite::SaveChart(tinyxml2::XMLElement* scene, tinyxml2::XMLDocu
tinyxml2::XMLElement* chart = doc->NewElement("SimMatlab"); tinyxml2::XMLElement* chart = doc->NewElement("SimMatlab");
charts->LinkEndChild(chart); charts->LinkEndChild(chart);
chart->SetAttribute("SimMatlab", workSpace_->GetSimMatlab().toLocal8Bit().constData()); chart->SetAttribute("SimMatlab", workSpace_->GetSimMatlabName().toLocal8Bit().constData());
} }
return true; return true;