Files
qt-migration-legatus/qt5-before/dlbo/Lts/Services/CentralEffectSimulation/handler_building_data.h
T
torstenandCopilot 7173785915 Qt6 Migration: Complete migration with DDS/RTI support and build validation
Major Changes:
- Merged latest Qt5 devel content from dlbo (292 files changed, 7 new dirs)
- Consolidated forward-declarations and include folders
- Removed unneeded modules per Niklas' repo check list

Build System Fixes:
- Fixed CMake VERSION_GREATER syntax in ParticipantManagement/CMakeLists.txt
- Added VLC packages (libvlc-dev, vlc-plugin-base) to docker_build.sh
- Added PostgreSQL dev packages (libpq-dev, postgresql-server-dev-all) to Dockerfile
- Fixed locale warnings (ANSI_X3.4-1968 → C.UTF-8)
- Fixed ArcGIS SDK path warnings when BUILD_ARCGIS=OFF

Code Generation Fixes:
- Fixed IDL enum collisions (PortType→CorePortType/DdsutPortType, PdmEventType)
- Fixed Grantlee template svc_translation.cpp.grantlee:
  - Changed {{ idl_enum.name }}_def:: to {{ idl_enum.name }}::
  - Fixed .underlying() calls for C++11 scoped enums (enum class)
- Removed generated files from repo (moc_*, *_dtc.h, *_ftc.h)

Validation:
- BUILD_RTI=ON: SUCCESS
- BUILD_RTI=OFF: SUCCESS
- C++17 standard maintained for RTI 7.7 compatibility
- Ubuntu 26.04 Docker environment verified

Remaining Warnings (expected):
- BgViewer, KDChart, KDReports, Poppler-Qt6 not found (optional features)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-09-15 18:20:26 +00:00

116 lines
4.2 KiB
C++

/**
* Handler for player data
* $Id$
* $HeadURL$
* $Author$
* Created by gr, SLSE, 2017-02-20
*/
#pragma once
#include <CentralEffectSimulation/logger.h>
#include <CentralEffectSimulation/svccesddscommon_export.h>
#include <CentralEffectSimulation/dds_handler.h>
#include <QObject>
#include <QPolygonF>
#include <QHash>
// Data for buildings
namespace CentralEffectSimulation
{
//------------------------------------------------------------------------------
// Helper function to calculate the (2D) center of a polygon like a (metric) footprint
//------------------------------------------------------------------------------
// Note:
// The centroid of a non-self-intersecting closed polygon defined by n vertices.
QPointF compute2DPolygonCentroid_deprecated(const QPolygonF &metricVertices);
//------------------------------------------------------------------------------
// class HandlerBuildingData
//------------------------------------------------------------------------------
class SVCCESDDSCOMMON_EXPORT HandlerBuildingData : public QObject
{
Q_OBJECT
public:
struct AssetPosition
{
int structureElementId;
InfrastructureManagement::MountingPointType mountingPointType;
QString hostname;
Core::RelativePosition relPosition;
Core::GeoPosition geoPosition;
QPointF positionUtm;
int zone;
};
struct Footprint
{
int mseId{-1};
int zone{-1};
Core::GeoPosition geoPosition;
QPolygonF polyUtm;
QRectF boundingBoxPolyUtm;
QPointF centroid; // centroid for concealment calculation (Verdeckung)
bool isValid() const { return mseId > 0; }
};
explicit HandlerBuildingData(const std::shared_ptr<CentralEffectSimulation::DdsHandler> &ddsHandler, QObject *parent = nullptr);
~HandlerBuildingData();
/**
* Initialize the handler to manage information from player management
*/
bool init();
int getFloorIdFromRoomId(int roomId) const { return m_floorRoom.value(roomId, -1); }
int getBuildingIdFromFloorId(int floorId) const { return m_buildingFloor.value(floorId, -1); }
int getBuildingIdFromRoomId(const int roomId);
QVector<int> polygonEncloseBuildings(const QPolygonF &polygon);
QVector<int> getFloorsFromStructureElementId(int structureElementId) const;
QVector<int> getFloorsFromBuilding(int buildingId) const;
InfrastructureManagement::MainStructureElement mainStructureElement(int mseId) const { return m_mainStructureElements.value(mseId); }
QHash<int, AssetPosition> getAssetPositions(){return m_assetPositions;}
void printAssetPositions();
QHash<int, Footprint> getFootprints(){return m_footprints;}
private:
void getFootprintsByExercise();
private Q_SLOTS:
/**
* Handle MainStructureElement from 'ISM'
*/
void onMainStructureElementChanged(const InfrastructureManagement::MainStructureElement &data, DataModification modType);
void onMountingPointAssetChanged(const InfrastructureManagement::MountingPointAsset &data, DataModification modType);
void onInstrumentationAssetChanged(const InfrastructureManagement::InstrumentationAsset &data, DataModification modType);
private: // attributes
std::shared_ptr<CentralEffectSimulation::DdsHandler> m_ddsHandler; ///< Pointer to VOM DDS handler
QHash<int, InfrastructureManagement::MainStructureElement> m_mainStructureElements;
QHash<int, int> m_floorRoom; // key = roomId, Value = floorId
QHash<int, int> m_structureElementToFloor; // key = floorId, Value = structureElementId
QHash<int, int> m_buildingFloor; // key = floorId, Value = buildingId (ism_main_structure_element)
QHash<int, int> m_ToFloor; // key = floorId, Value = structureElementId
QHash<int, int> m_mountingPointAsset; // key = structureElementId , Value = assetId;
QHash<int, int> m_assetMountingPoint; // key = assetId , Value = structureElementId;
QHash<int, QString> m_instrumentationAssets; // key = assetId, Value = hostname
QHash<int, AssetPosition> m_assetPositions; // key = structureElementId
QHash<int, Footprint> m_footprints; // key = footprint.mseId
int m_zone = -1;
CentralEffectSimulation::LOGGER_T &m_logger; ///< Interface to the Logging-Facility
};
} // namespace CentralEffectSimulation2D