Files
qt5-legatus-legacy/Lts/Services/CentralEffectSimulation/Plugins/GasPipes/handler_participant_gas_pipe.h
T
2026-08-13 18:33:10 +02:00

96 lines
3.3 KiB
C++
Executable File

/**
* Handler for player data
* $Id$
* $HeadURL$
* $Author$
* Created by gr, SLSE, 2017-02-20
*/
#pragma once
#include <QObject>
#include <QHash>
#include <QRectF>
#include <QPolygonF>
#include <CentralEffectSimulation/dds_handler.h>
#include <handler_aes_data.h>
#include <CentralEffectSimulation/aes_item_view_utm.h>
#include <AreaEffectSimulation/aes_dtc.h>
#include <CentralEffectSimulation/handler_participant.h>
#include <QTimer>
// AES-Handling for participants
namespace CentralEffectSimulationGasPipes
{
class HandlerParticipantGasPipe final : public QObject
, protected TrainingAreaBase::Interface::Ftc::SendCesHitReplyHandler
{
Q_OBJECT
public:
HandlerParticipantGasPipe(const std::shared_ptr<CentralEffectSimulation::DdsHandler> &ddsHandler,
const std::shared_ptr<CentralEffectSimulation::HandlerParticipant> &participantHandler,
QObject *parent = nullptr);
~HandlerParticipantGasPipe();
/**
* Initialize the handler to manage information from player management
*/
bool init();
protected:
void onSendCesHitReply(const Core::FunctionReplyObject &replyObject) override final;
private Q_SLOTS:
/**
* Handle the signals from 'ParticipantHandler'
*/
void onParticipantPositionChanged(const CentralEffectSimulation::HandlerParticipant::CesParticipantData &partPos);
/**
* Handle the signals from 'AES'
*/
void onAesItemViewChanged(const AreaEffectSimulation::AesItemView &data, DataModification modType);
void onGasPipeChanged(const AreaEffectSimulation::GasPipe &data, DataModification modType);
/**
* Send Hit to participant
*/
void sendFtcCesHitRequestTimeout();
private: // methoden
void sendParticipantEvent(const CentralEffectSimulation::AesItemViewUtm &gasPipe,
const CentralEffectSimulation::HandlerParticipant::CesParticipantData &participantPosition,
const ProjectDataManagement::EventType eventType);
void sendParticipantHit(const CentralEffectSimulation::AesItemViewUtm &gasPipe,
const CentralEffectSimulation::HandlerParticipant::CesParticipantData &participantPosition,
const ProjectDataManagement::EventType eventType);
bool insideGasPipeArea(const QPolygonF &polygonf, const QPointF &participantPos) const;
void calculateGasPipeParticipant(const CentralEffectSimulation::AesItemViewUtm &gasPipe,
const CentralEffectSimulation::HandlerParticipant::CesParticipantData &participantPosition);
private: // attributes
std::shared_ptr<CentralEffectSimulation::DdsHandler> m_ddsHandler; ///< Pointer to VOM DDS handler
std::shared_ptr<CentralEffectSimulation::HandlerParticipant> m_handlerParticipant;
// std::shared_ptr<HandlerAesData> m_handlerAesData;
// AES-Values
QHash<int, CentralEffectSimulation::AesItemViewUtm> m_gasPipes; // key = aesItemId
QHash<int, TrainingAreaBase::SendCesHitRequest> m_requestMap; // Key = equipmentNumber
QTimer *m_timer;
CentralEffectSimulation::LOGGER_T &m_logger; ///< Interface to the Logging-Facility};
};
} // namespace CentralEffectSimulationGasPipes