Files
qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/Services/CentralEffectSimulation/handler_participant.h
T
torstenandCopilot b774f4035c Qt6 Migration: DDS-Stubs, Logger-Fixes, Export-Header Korrekturen
- NGL_ADD_LIBRARY2: 87 CMakeLists.txt konvertiert für Export-Header Generierung
- 44 Export-Header Include-Pfade korrigiert (_export.h)
- 81 DDS-Stub-Header generiert (*_dtc.h, *_fts.h, *_dts.h, *_ftc.h)
- INGLLogger: Duplikat gelöscht, m_logger Member entfernt, variadische Makros
- Q_FUNC_INFO Redefinition behoben (Qt6 definiert bereits)
- FATAL_LOG Makro hinzugefügt
- InfrastructureManagement DDS-Stubs (ism.hpp, ism_enums.hpp, ism_ftc.h)
- FilterManagement DDS-Stubs (flt_ftc.h, flt_dts.h)
- AreaEffectSimulation DDS-Stubs (aes.hpp, aes_enums.hpp)
- SymbolAppearance Klasse vollständig definiert mit content() Methode
- BuildingComponentFilter Klasse definiert mit Copy-Konstruktor
- Ftc Factory: nullptr Return (abstract class)
- AesFilter Klasse in aes.hpp hinzugefügt
- Dtc Klasse in ppm.hpp mit participantChanged Signal
- AesType Enum: alle 15 At* Werte definiert
- AesEffectState_def: EsReceived hinzugefügt
- DataModification Enum: eAdded/eModified/eRemoved
- function_reply_object.h → core_types.h Include-Pfad (72 Dateien)
- Enum-Class-Streaming Template-Operator in INGLLogger.h
- ism_mounting_point.h: QImage → QtGui/QImage, QGuiApplication/QScreen
- ism_data_plugin_interface.h: QSet Include, Include-Reihenfolge
- QRegExp → QRegularExpression in tpm_js_parser.cpp
- .underlying() Aufrufe zu direktem Enum-Vergleich korrigiert
- Include-Pfade: aes.hpp in symbol_appearance_settings_impl.h und aes_display_filter_impl.h

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-08-19 06:06:24 +02:00

176 lines
6.8 KiB
C++
Executable File

/**
* 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 "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