Close bld/OSG floor: OSG 3.4.1 from source + port osgQt to Qt6 + wire BgViewer dtEntity

Migrate BuildingViewer (16 files: DDS members, m_logger inits, QOpenGLWidget); gui:3:bld.info + gui:3:bdv now load
This commit is contained in:
berrux-dev committed 2026-10-24 19:32:52 +02:00
1 parent 8e9594d25c
commit d327c66c46
17 files changed
+360 -219

No files matched your search

@@ -4,6 +4,7 @@
#include "bdv_edit_item.h"
#include "ui_bdv_building_edit.h"
#include <NGLLogger/NGLLoggerBootstrap.h>
#include <Buildings/bld.hpp>
#include <Buildings/bld_ftc.h>
@@ -16,7 +17,8 @@ namespace BuildingViewer
{
BuildingEdit::BuildingEdit(QWidget* parent)
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::OkApplyCancel),
m_requestHelper(new LtsUtils::RequestHelper(this)), m_ui(new Ui::BuildingEdit)
m_requestHelper(new LtsUtils::RequestHelper(this)), m_ui(new Ui::BuildingEdit),
m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("BuildingViewer.BuildingEdit"))
{
m_ui->setupUi(this);
@@ -69,7 +71,7 @@ bool BuildingEdit::init(int32_t buildingDatabaseId,
m_bldFtc = bldFtc;
InfrastructureManagement::MainStructureElement building = m_ismDtc->mainStructureElement(m_buildingDatabaseId);
m_buildingId = building.id();
m_buildingId = building.id;
buildModel();
m_buildingName = m_model->getBuildingName();
@@ -158,14 +160,14 @@ bool BuildingEdit::apply()
{
m_requestHelper->addRequest([this, fortifyFactors]() {
Buildings::SetFortifyFactorRequest fortifyRequest;
fortifyRequest.buildingId(m_buildingDatabaseId);
fortifyRequest.buildingId = m_buildingDatabaseId;
fortifyRequest.fortifyFactors().reserve(fortifyFactors.size());
fortifyRequest.fortifyFactors.reserve(fortifyFactors.size());
for (const auto& e : fortifyFactors)
{
DEBUG_LOG(m_logger) << "push_back= databaseId=" << e.structureElementId()
<< " fortifyFactor=" << e.fortifyFactor();
fortifyRequest.fortifyFactors().push_back(
fortifyRequest.fortifyFactors.push_back(
Buildings::FortifyFactor(e.structureElementId(), e.fortifyFactor()));
}
@@ -184,12 +186,12 @@ bool BuildingEdit::apply()
for (const auto& treeItem : displayNames)
{
for (const auto& room : building.elements())
for (const auto& room : building.elements)
{
if (room.id() == treeItem.structureElementId())
if (room.id == treeItem.structureElementId())
{
auto copy = room;
copy.displayName(treeItem.displayName().toStdString());
copy.displayName = treeItem.displayName().toStdString();
vecModifiedRooms.push_back(copy);
break;
}
@@ -231,7 +233,7 @@ void BuildingEdit::slotMainStructureElementChanged(const InfrastructureManagemen
if (modType == DataModification::eRemoved)
return;
if (mse.id() == m_buildingDatabaseId)
if (mse.id == m_buildingDatabaseId)
{
slotHandleExternalDdsChange();
@@ -243,7 +245,7 @@ void BuildingEdit::slotBuildingStateChanged(const Buildings::BuildingState& stat
if (modType == DataModification::eRemoved)
return;
if (state.id() == m_buildingDatabaseId)
if (state.id == m_buildingDatabaseId)
{
slotHandleExternalDdsChange();
@@ -265,11 +267,11 @@ bool BuildingEdit::sendBuildingStateRequest(ProjectDataManagement::Vulnerability
buildings.resize(1);
Buildings::SetBuildingStatesRequest requestData;
building.buildingId(m_buildingId);
building.roomIds().set(structureElementIds);
building.buildingId = m_buildingId;
building.roomIds.set(structureElementIds);
buildings[0] = building;
requestData.buildings(buildings);
requestData.vulnerabilityState(state);
requestData.buildings = buildings;
requestData.vulnerabilityState = state;
DEBUG_LOG(m_logger) << Q_FUNC_INFO << "currentData: " << state;
@@ -17,11 +17,13 @@ namespace BuildingViewer
BuildingEditModel::BuildingEditModel(QObject* parent,
const std::shared_ptr<InfrastructureManagement::Interface::Dtc>& ismDtc,
const std::shared_ptr<Buildings::Interface::Dtc>& bldDtc)
: NGLTreeModel(parent, new NGLTreeItem(QVariant()), ,
m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger()){
: NGLTreeModel(parent, new NGLTreeItem(QVariant()), {
tr("Selected Building"), QStringLiteral("Name (DEBUG)"),
QStringLiteral("MountingPointId (DEBUG)"), QStringLiteral("StructureElementId (DEBUG)"),
tr("Fortify Factor"), tr("Damage Percent")}),
// m_logger moved out of the NGLTreeModel(...) call (it is a member init);
// getNGLLogger() returns the INGLLogger& the reference member binds to.
m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("BuildingViewer.BuildingEditModel")),
m_ismDtc(ismDtc), m_bldDtc(bldDtc), m_buildingName(QString())
{
}
@@ -125,11 +127,11 @@ bool BuildingEditModel::init(int32_t mseId)
int rootId = 0;
qint32 mapId = 0;
const std::vector<InfrastructureManagement::StructureElement>& vecElements = building.elements();
const std::vector<InfrastructureManagement::StructureElement>& vecElements = building.elements;
for (const auto& se : vecElements)
{
DEBUG_LOG(m_logger) << "se: " << se;
if (se.structureElementTypeId() == InfrastructureManagement::StructureElementType::Building)
if (se.structureElementTypeId == InfrastructureManagement::StructureElementType::Building)
{
BuildingViewer::TreeItem rootItemBuilding(se);
rootName = rootItemBuilding.name();
@@ -142,12 +144,12 @@ bool BuildingEditModel::init(int32_t mseId)
for (const auto& se : vecElements)
{
DEBUG_LOG(m_logger) << "se: =" << se;
if (se.structureElementTypeId() == InfrastructureManagement::StructureElementType::Floor)
if (se.structureElementTypeId == InfrastructureManagement::StructureElementType::Floor)
{
BuildingViewer::TreeItem itemRoom(se);
itemRoom.setSuperior(rootId);
lookupFloorId2TreeId[se.id()] = mapId;
lookupFloorId2TreeId[se.id] = mapId;
treemap[mapId++] = itemRoom;
}
}
@@ -158,20 +160,20 @@ bool BuildingEditModel::init(int32_t mseId)
auto bs = m_bldDtc->buildingState(mseId);
QMap<int32_t, Buildings::RoomState> roomStates;
for (const auto& e : bs.roomStates())
roomStates[e.id()] = e;
for (const auto& e : bs.roomStates)
roomStates[e.id] = e;
for (const auto& se : vecElements)
{
if (se.structureElementTypeId() == InfrastructureManagement::StructureElementType::Room)
if (se.structureElementTypeId == InfrastructureManagement::StructureElementType::Room)
{
double fortifyFactor = 1.0;
qint32 damagePercent = bs.damagePercent();
if (roomStates.contains(se.id()))
qint32 damagePercent = bs.damagePercent;
if (roomStates.contains(se.id))
{
fortifyFactor = roomStates[se.id()].fortifyFactor();
damagePercent = roomStates[se.id()].damagePercent();
fortifyFactor = roomStates[se.id].fortifyFactor;
damagePercent = roomStates[se.id].damagePercent;
}
BuildingViewer::TreeItem itemRoom(se, fortifyFactor, damagePercent);
@@ -179,13 +181,13 @@ bool BuildingEditModel::init(int32_t mseId)
try
{
int32_t floorID = se.path()[1];
int32_t floorID = se.path[1];
itemRoom.setSuperior(lookupFloorId2TreeId[floorID]);
}
catch (const std::out_of_range& e)
{
WARNING_LOG(m_logger) << "Caught exception while trying to get superior id for building " << rootName
<< " with room with mounting point id: " << se.mountingPointId() << ": "
<< " with room with mounting point id: " << se.mountingPointId << ": "
<< e.what();
return false;
}
@@ -1,6 +1,7 @@
#include "bdv_thread_video_exporter.h"
#include <NGLLogger/NGLLoggerBootstrap.h>
#include "bdv_replay_handler.h"
@@ -11,7 +12,9 @@
namespace BuildingViewer
{
VideoExporter::VideoExporter(QObject* parent) : QObject(parent)
VideoExporter::VideoExporter(QObject* parent)
: QObject(parent),
m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("BuildingViewer.VideoExporter"))
{
DEBUG_LOG(m_logger) << "ThreadVideoExporter has been created";
}
@@ -1,6 +1,7 @@
#include "bdv_topic_replay_interface.h"
#include <NGLLogger/NGLLoggerBootstrap.h>
#include "bdv_replay_handler.h"
#include "bdv_thread_video_exporter.h"
@@ -26,7 +27,8 @@ namespace BuildingViewer
{
TopicReplayInterface::TopicReplayInterface(BgViewerController* bgvController, LtsSession::LtsSession* session)
: m_bgvController(bgvController), m_session(session)
: m_bgvController(bgvController), m_session(session),
m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("BuildingViewer.TopicReplayInterface"))
{
session->getForeignGuiInterface<SituationReplay::ForeignGuiInterface>(m_replayIfc);
}
@@ -240,20 +242,20 @@ bool TopicReplayInterface::exportBuildings(const QVector<int>& buildingIds) cons
for (const int buildingId : buildingIds)
{
const auto mse = ismDtc->mainStructureElement(buildingId);
if (mse.id() != buildingId)
if (mse.id != buildingId)
{
WARNING_LOG(m_logger) << "Could not find MainStructureElement for building with id " << buildingId
<< " - skipping";
continue;
}
const QString fnIve = QString::fromStdString(mse.name()) + QStringLiteral(".flt.ive");
const QString fnXml = QString::fromStdString(mse.name()) + QStringLiteral(".flt.xml");
const QString fnIve = QString::fromStdString(mse.name) + QStringLiteral(".flt.ive");
const QString fnXml = QString::fromStdString(mse.name) + QStringLiteral(".flt.xml");
if (!copyFile(fnIve, modelPath, outputPath) || !copyFile(fnXml, modelPath, outputPath))
return false;
bi.name = QString::fromStdString(mse.name());
bi.position = LtsUtils::QPoint3D(mse.geoPosition().lon(), mse.geoPosition().lat(), mse.geoPosition().z());
bi.angleDegree = mse.angle();
bi.id = mse.id();
bi.name = QString::fromStdString(mse.name);
bi.position = LtsUtils::QPoint3D(mse.geoPosition.lon, mse.geoPosition.lat, mse.geoPosition.z);
bi.angleDegree = mse.angle;
bi.id = mse.id;
knownBuildings += bi;
}
@@ -2,6 +2,7 @@
#include "bdv_viewer_data_dialog.h"
#include <NGLLogger/NGLLoggerBootstrap.h>
#include "ui_bdv_viewer_data_dialog.h"
#include <LtsSession/lts_session_data.h>
@@ -12,6 +13,7 @@ namespace BuildingViewer
BgViewerDataViewDialog::BgViewerDataViewDialog(QWidget *parent)
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::CloseOnly)
, m_ui(new Ui::BgViewerDataViewDialog)
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("BuildingViewer.BgViewerDataViewDialog"))
{
m_ui->setupUi(this);
@@ -2,6 +2,7 @@
#include "bdv_viewer_data_view.h"
#include <NGLLogger/NGLLoggerBootstrap.h>
#include "ui_bdv_viewer_data_view.h"
#include "bdv_viewer_data_model.h"
@@ -15,6 +16,7 @@ BgViewerDataView::BgViewerDataView(QWidget *parent)
: QWidget(parent)
, m_ui(new Ui::BgViewerDataView)
, m_pModel(new BgViewerDataViewModel(this))
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("BuildingViewer.BgViewerDataView"))
{
m_ui->setupUi(this);