Files
qt-migration-legatus/qt5-before/dlbo/Lts/Services/CentralEffectSimulation/handler_participant.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

176 lines
6.8 KiB
C++

/**
* Handler for player data
* $Id$
* $HeadURL$
* $Author$
* Created by gr, SLSE, 2017-02-20
*/
#pragma once
#include "point_helpers.h"
#include "dds_handler.h"
#include "handler_building_data.h"
#include <CentralEffectSimulation/logger.h>
#include <CentralEffectSimulation/svccesddscommon_export.h>
#include <LtsUtilsCore/outdated_position.h>
#include <LtsCoordinate/lts_coordinate.h>
#include <QObject>
#include <QtCore/QMap>
#include <QtCore/QHash>
#include <QtCore/QPointF>
#include <QtCore/QLineF>
#include <QtCore/QSet>
#include <QtGui/QPolygonF>
// AES-Handling for participants outside buildings
namespace CentralEffectSimulation
{
class SVCCESDDSCOMMON_EXPORT HandlerParticipant : public QObject
, protected TrainingAreaBase::Interface::Ftc::SendParticipantBeStillWarningReplyHandler
, protected ParticipantManagement::Interface::Ftc::ModifyStateReplyHandler
{
Q_OBJECT
public:
struct CesParticipantData : public ParticipantManagement::ParticipantPosition
{
ProjectDataManagement::VulnerabilityState vulnerabilityState = ProjectDataManagement::VulnerabilityState_def::CombatReady;
Core::GeoPosition lastGeoPosition;
bool positionValid{false};
bool lastPositionValid{false};
bool notfightMode{false};
bool insideBuildingValue{false};
mutable LtsCoordTrans::LtsCoordinate m_ltsCoordinate;
bool insideWlsArea() const { return reportingSource() == Core::PositionReportingSource::Wls; }
bool insideBuilding() const { return insideBuildingValue; }
LtsCoordTrans::LtsCoordinate &ltsCoordinate()
{
return m_ltsCoordinate;
}
const LtsCoordTrans::LtsCoordinate &ltsCoordinate() const
{
return m_ltsCoordinate;
}
CesParticipantData() = default;
explicit CesParticipantData(const ParticipantManagement::ParticipantPosition &p)
: ParticipantManagement::ParticipantPosition(p)
, lastGeoPosition(p.pos())
, positionValid(true)
{}
}; // struct CesParticipantData
using POSITIONS_CONST_ITER = QHash<int, CesParticipantData>::const_iterator;
protected:
void onSendParticipantBeStillWarningReply(const Core::FunctionReplyObject &replyObject) override final;
void onModifyStateReply(const Core::FunctionReplyObject &reply) override final;
public:
explicit HandlerParticipant(const std::shared_ptr<DdsHandler> &ddsHandler,
const std::shared_ptr<HandlerBuildingData> &handlerBuildingData,
int cheatingDistanceVehicle,
int cheatingDistanceSoldier,
QObject *parent = nullptr);
~HandlerParticipant();
/**
* Initialize the handler to manage information from player management
*/
bool init();
const QHash<int, CesParticipantData> &positions() const { return m_positionsMap; }
CesParticipantData position(int participantId) const { return m_positionsMap.value(participantId); }
ParticipantManagement::Participant participant(int participantId) const { return m_participantData.value(participantId); }
ParticipantManagement::TypeClass typeClassFromTypeId(int typeId) const { return m_typeMap.value(typeId); }
bool isOutdated(const CesParticipantData &pos) const
{
return LtsUtils::isPositionTimeOutdated(m_ddsHandler->currentPartitionTime(), pos.sampleTime());
}
QPolygonF getParticipantStep(int participantId, int zone) const;
QPointF getParticipantPositionUtm(int participantId, int zone) const;
HandlerParticipant::CesParticipantData getParticipantPosition(int participantId) const;
QHash<int, CesParticipantData> positionsAircraft() const;
QVector<int32_t> getParticipantsBuilding(const int32_t buildingId) const;
void setNotfightMode (const int participantId, const bool);
// Return Direction in [Degree]
long getDirection(int originatorParticipantId, int targetParticipantId);
// return Distance in [m]
long getDistance(int originatorParticipantId, int targetParticipantId);
int getParticipantId(int equipentNumber);
int getEquipmentNumber(int participantId) const;
signals:
void newIndoorPosition(const CesParticipantData &pos);
void newOutdoorPosition(const CesParticipantData &pos);
void participantLeavesBuilding(int participantId);
void newParticipantState(const CesParticipantData &pos);
void participantDecontaminated(const int participantId);
void newNotfightMode(const CesParticipantData &pos);
void restoreRadioReadinessChanged(const int participantId);
public slots:
void modifyStateRequest(
const int &participantId, const ProjectDataManagement::VulnerabilityState &state, const int &kind, const int &vitality
);
private slots:
/**
* Handle the signals from 'ParticipantManagement'
*/
void onParticipantPositionChanged(const ParticipantManagement::ParticipantPosition &data, DataModification modType);
void onDynamicParticipantDataChanged(const ParticipantManagement::DynamicParticipantData &data, DataModification modType);
void onParticipantChanged(const ParticipantManagement::Participant &data, DataModification modType);
void onTypeChanged(const ParticipantManagement::Type &data, DataModification modType);
void onRestoreRadioReadinessChanged(const TrainingAreaBase::RestoreRadioReadiness &data, DataModification modType);
void sendBeStillWarning(const int32_t participantId);
private: // methoden
bool handleCheating(const ParticipantManagement::TypeClass typeClass,
const ProjectDataManagement::VulnerabilityState newVulnerabilityState);
void checkCheating(const int participantId, const CesParticipantData &participantPosition,
const ProjectDataManagement::VulnerabilityState newVulnerabilityState);
void checkCheatingPosition(const int participantId);
private: // attributes
std::shared_ptr<DdsHandler> m_ddsHandler; ///< Pointer to VOM DDS handler
std::shared_ptr<HandlerBuildingData> m_handlerBuildingData;
QHash<int, CesParticipantData> m_positionsMap; ///key = participantId < Reference map participant (player) to room id (participantId, roomId) inside Building
QHash<int, ParticipantManagement::TypeClass> m_typeMap;
QHash<int, ParticipantManagement::Participant> m_participantData; /// key = participantId
QHash<int, CesParticipantData> m_positionsCheatingMap; ///key = participantId < Reference map participant for Cheating detection >
int m_cheatingDistanceVehicle; // Distance to hit-position from the vehicle
int m_cheatingDistanceSoldier; // Distance to hit-position from the soldier
CentralEffectSimulation::LOGGER_T &m_logger; ///< Interface to the Logging-Facility
};
SVCCESDDSCOMMON_EXPORT std::ostream &operator<< (std::ostream &stream,
const HandlerParticipant::CesParticipantData &value);
} // namespace CentralEffectSimulation2D