From 1cff02124ae63ce18b8fb472cd76257b99fe9a76 Mon Sep 17 00:00:00 2001 From: pimin <362371171@qq.com> Date: Thu, 20 Nov 2025 21:03:48 +0800 Subject: [PATCH] modified bug --- src/effects/ConeWave.cpp | 1 - src/entities/ConeWaveComponent.cpp | 5 ++++- src/entities/EntitiesManager.cpp | 3 ++- src/entities/LabelComponent.cpp | 11 ++++++----- src/scene/ui/QueryElevationWidget.cpp | 15 ++++++++------- src/translations/Dyt_zh_CN.ts | 6 +++--- src/ui/Layout/AddParamSetting.cpp | 7 +++++++ src/ui/MainFrame.cpp | 2 ++ src/ui/Panel/SurfacePanel.cpp | 8 ++++++++ src/ui/PropertyBrowser/qtpropertymanager.cpp | 4 ++-- src/ui/WorkSpace/WorkSpaceDlg.cpp | 2 +- 11 files changed, 43 insertions(+), 21 deletions(-) diff --git a/src/effects/ConeWave.cpp b/src/effects/ConeWave.cpp index 8d1b7984..f4faaae9 100644 --- a/src/effects/ConeWave.cpp +++ b/src/effects/ConeWave.cpp @@ -93,7 +93,6 @@ ConeWave::ConeWave() { coneAlpha_ = 0.7f; } - ConeWave::~ConeWave(void) { } diff --git a/src/entities/ConeWaveComponent.cpp b/src/entities/ConeWaveComponent.cpp index 51a1a025..c9ac1064 100644 --- a/src/entities/ConeWaveComponent.cpp +++ b/src/entities/ConeWaveComponent.cpp @@ -18,7 +18,10 @@ ConeWaveComponent::ConeWaveComponent(SceneComponent* parent) } ConeWaveComponent::~ConeWaveComponent() { - coneWave_->Destory(); + if (coneWave_->referenceCount() > 0) + { + coneWave_->Destory(); + } } std::string ConeWaveComponent::GetTypeName() { diff --git a/src/entities/EntitiesManager.cpp b/src/entities/EntitiesManager.cpp index b14cd5db..70ad395b 100644 --- a/src/entities/EntitiesManager.cpp +++ b/src/entities/EntitiesManager.cpp @@ -152,7 +152,8 @@ bool EntitiesManager::DeleteEntity(Entity* entity) { // Immediate deletion to ensure scene graph resources are released // before viewer/context teardown. Using deleteLater() may invoke // QObject cleanup after OSG/GL objects are gone, causing crashes. - delete entity; + entity->deleteLater(); + return true; } diff --git a/src/entities/LabelComponent.cpp b/src/entities/LabelComponent.cpp index 4f00a70e..7bf431b8 100644 --- a/src/entities/LabelComponent.cpp +++ b/src/entities/LabelComponent.cpp @@ -32,7 +32,7 @@ void LabelComponent::AttachEntity(Entity* entity) { if (entity && !entity->GetName().isEmpty()) { LOG_INFO("LabelComponent: Attaching to entity '{}'", entity->GetName().toUtf8().data()); - SetText(entity->GetName().toLocal8Bit().data()); + SetText(entity->GetName().toStdString()); Entity* entity = GetEntity(); if (nullptr != entity) { @@ -114,7 +114,7 @@ void LabelComponent::SetText(const std::string& text) { text_ = text; needUpdate_ = true; if (textNode_.valid()) { - textNode_->setText(text_); + textNode_->setText(text_, osgText::String::ENCODING_UTF8); } } } @@ -152,11 +152,12 @@ void LabelComponent::CreateTextNode() { billboard_->setMode(osg::Billboard::POINT_ROT_EYE); textNode_ = new osgText::Text(); + textNode_->setFont("fonts/simhei.ttf"); textNode_->setAlignment(osgText::Text::CENTER_BOTTOM); textNode_->setAxisAlignment(osgText::Text::SCREEN); textNode_->setCharacterSizeMode(osgText::Text::SCREEN_COORDS); - textNode_->setText(text_); + textNode_->setText(text_, osgText::String::ENCODING_UTF8); textNode_->setPosition(osg::Vec3(0.0f, 0.0f, 0.0f)); billboard_->addDrawable(textNode_.get(), osg::Vec3(0.0f, 0.0f, 5.0f)); @@ -179,7 +180,7 @@ void LabelComponent::CreateTextNode() { void LabelComponent::UpdateTextNode() { if (textNode_.valid()) { - textNode_->setText(text_); + textNode_->setText(text_, osgText::String::ENCODING_UTF8); textNode_->setCharacterSize(fontSize_); textNode_->setColor(color_); @@ -188,6 +189,6 @@ void LabelComponent::UpdateTextNode() { } void LabelComponent::UpdateText(const QString& text) { - SetText(text.toLocal8Bit().data()); + SetText(text.toStdString()); needUpdate_ = true; } diff --git a/src/scene/ui/QueryElevationWidget.cpp b/src/scene/ui/QueryElevationWidget.cpp index 7d3abd95..cf553bc2 100644 --- a/src/scene/ui/QueryElevationWidget.cpp +++ b/src/scene/ui/QueryElevationWidget.cpp @@ -11,14 +11,15 @@ struct ColorLabel : public osgWidget::Label { - ColorLabel(const char* label) : + ColorLabel(std::string label) : osgWidget::Label("", "") { - setFont("fonts/Vera.ttf"); + setFont("fonts/simhei.ttf"); setFontSize(14); setFontColor(1.0f, 1.0f, 1.0f, 1.0f); addHeight(18.0f); setCanFill(true); - setLabel(label); + //setLabel(label); + getText()->setText(label, osgText::String::ENCODING_UTF8); } }; @@ -27,7 +28,7 @@ QueryElevationWidget::QueryElevationWidget(OEScene* oeScene) , oeScene_(oeScene) { LOG_INFO("actor self={}", spdlog::fmt_lib::ptr(this)); - label_ = new ColorLabel(GetElevationString(0, 0, 0).c_str()); + label_ = new ColorLabel(GetElevationString(0, 0, 0)); addWidget(label_); getBackground()->setColor(0.0f, 0.0f, 0.0f, 0.3f); } @@ -61,8 +62,8 @@ void QueryElevationWidget::OnUpdateGeoPoint(double x, double y, double z) { dyt_check(nullptr != label_); - label_->setLabel(GetElevationString(x, y, z)); - + label_->getText()->setText(GetElevationString(x, y, z), osgText::String::ENCODING_UTF8); + //label_->setLabel(GetElevationString(x, y, z)); } void QueryElevationWidget::ResetCanvasPosition(double width, double height) { @@ -75,7 +76,7 @@ std::string QueryElevationWidget::GetElevationString(double x, double y, double QString info = QObject::tr("longitude:") + QString::number(x, 'f', 6) + ", " + QObject::tr("latitude:") + QString::number(y, 'f', 6) + ", " + QObject::tr("altitude:") + QString::number(z, 'f', 6); - return std::string(info.toLocal8Bit().constData()); + return info.toStdString(); } QueryElevationWidget::QueryElevationEventHandler::QueryElevationEventHandler( diff --git a/src/translations/Dyt_zh_CN.ts b/src/translations/Dyt_zh_CN.ts index 7286cb90..76891f29 100644 --- a/src/translations/Dyt_zh_CN.ts +++ b/src/translations/Dyt_zh_CN.ts @@ -2907,17 +2907,17 @@ 应用程序崩溃 - + longitude: 经度: - + latitude: 纬度: - + altitude: 高度: diff --git a/src/ui/Layout/AddParamSetting.cpp b/src/ui/Layout/AddParamSetting.cpp index 0a4c10d2..47e2cbc5 100644 --- a/src/ui/Layout/AddParamSetting.cpp +++ b/src/ui/Layout/AddParamSetting.cpp @@ -518,6 +518,13 @@ void AddParamSetting::slotButtonCommit() sett.setValue("Value", strValue); } + else if (strType == "a+bi") + { + QLineEdit* pCuralue = (QLineEdit*)ui.tableWidget->cellWidget(iRow, 6); + QString strValue = pCuralue->text(); + QString strIn = QString("%1 = %2;").arg(strName).arg(strValue); + out << strIn << "\n"; + } else { sett.setValue("MaxValue", 0); diff --git a/src/ui/MainFrame.cpp b/src/ui/MainFrame.cpp index bc0ae579..ce5dadf2 100644 --- a/src/ui/MainFrame.cpp +++ b/src/ui/MainFrame.cpp @@ -53,6 +53,8 @@ MainFrame::MainFrame(QWidget *parent) : InitUI(); SetTitleBar(ui->titleFrame); + + setObjectName("MainFrame"); } MainFrame::~MainFrame() diff --git a/src/ui/Panel/SurfacePanel.cpp b/src/ui/Panel/SurfacePanel.cpp index 03eadf18..fd67b26b 100644 --- a/src/ui/Panel/SurfacePanel.cpp +++ b/src/ui/Panel/SurfacePanel.cpp @@ -508,6 +508,14 @@ void SurfacePanel::slotEndLoadData() if (nullptr != dockWidget_) { dockWidget_->setWindowTitle(m_title); + + if (m_thread) + { + m_thread->requestExit(); + m_thread->wait(); + m_thread->deleteLater(); + m_thread = nullptr; + } } } diff --git a/src/ui/PropertyBrowser/qtpropertymanager.cpp b/src/ui/PropertyBrowser/qtpropertymanager.cpp index b2c485bd..dab1011e 100644 --- a/src/ui/PropertyBrowser/qtpropertymanager.cpp +++ b/src/ui/PropertyBrowser/qtpropertymanager.cpp @@ -7578,8 +7578,8 @@ QString QtTransfromPropertyManager::valueText(const QtProperty* property) const QTransformAttribute c = it.value(); osg::Vec3 t = c.GetLocation(); - osg::Vec3 r = c.GetLocation(); - osg::Vec3 s = c.GetLocation(); + osg::Vec3 r = c.GetRotation(); + osg::Vec3 s = c.GetScale(); return QCoreApplication::translate("QtPropertyBrowserUtils", "[%1, %2, %3] [%4, %5, %6] [%7, %8, %9]") .arg(t.x()).arg(t.y()).arg(t.z()) .arg(r.x()).arg(r.y()).arg(r.z()) diff --git a/src/ui/WorkSpace/WorkSpaceDlg.cpp b/src/ui/WorkSpace/WorkSpaceDlg.cpp index 1460c7e2..f1f8dba6 100644 --- a/src/ui/WorkSpace/WorkSpaceDlg.cpp +++ b/src/ui/WorkSpace/WorkSpaceDlg.cpp @@ -96,7 +96,7 @@ void WorkSpaceDlg::OnSure() { workSpace->SetDescribe(ui->etDescribe->toPlainText()); workSpace->SetCommondFilePath(commondPath_); // Execute commands configured for onCreate right after workspace is set up - workSpace->ExecuteCommands(WorkSpace::CommandWhen::OnCreate); + //workSpace->ExecuteCommands(WorkSpace::CommandWhen::OnCreate); WorkSpaceManager::Get().SetCurrent(workSpace); accept();