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

100 lines
3.6 KiB
C++
Executable File

/**
* Handler for player data
* $Id: handler_functional_area.h 64170 2024-11-25 11:34:11Z fritsche_h $
* $HeadURL: svn://slssvn/TDS/branches/product/features/25_03_etb_uas/Lts/Services/CentralEffectSimulation/Plugins/FunctionalAreas/handler_functional_area.h $
* $Author: fritsche_h $
* Created by gr, SLSE, 2017-02-20
*/
#pragma once
#include <CentralEffectSimulation/logger.h>
#include <CentralEffectSimulation/dds_handler.h>
#include <CentralEffectSimulation/aes_item_view_utm.h>
#include <CentralEffectSimulation/handler_participant.h>
#include <CentralEffectSimulation/handler_building_data.h>
#include <AreaEffectSimulation/aes_dtc.h>
#include <QtCore/QHash>
#include <QtCore/QObject>
#include <QtCore/QQueue>
#include <QtCore/QPointF>
#include <QtGui/QPolygonF>
// AES-Handling for participants
namespace CES_JAMMING
{
struct ParticipantDistance
{
double squareDistance = 0;
CentralEffectSimulation::HandlerParticipant::CesParticipantData participantPosition;
};
struct EnterLeaveType
{
ProjectDataManagement::EventType eventType = ProjectDataManagement::EventType_def::Unknown;
bool isAlreadySupplied = false;
};
class HandlerJamming : public QObject
, protected TrainingAreaBase::Interface::Ftc::SendCesHitReplyHandler
{
Q_OBJECT
public:
explicit HandlerJamming(const std::shared_ptr<CentralEffectSimulation::DdsHandler> &ddsHandler,
const std::shared_ptr<CentralEffectSimulation::HandlerParticipant> &participantHandler,
const std::shared_ptr<CentralEffectSimulation::HandlerBuildingData> &handlerBuildingData,
QObject *parent = nullptr);
~HandlerJamming();
/**
* 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 'AES'
*/
// void onAesItemViewChanged(const AreaEffectSimulation::AesItemView &data, DataModification modType);
// void onJammingChanged(const AreaEffectSimulation::JammingArea &data, DataModification modType);
void onParticipantGearEventChanged(const ParticipantManagement::ParticipantGearEvent &data, DataModification modType);
private: // methoden
void sendCesHitRequest(const int chargeTypeId, const int originatorId,
const CentralEffectSimulation::HandlerParticipant::CesParticipantData &participantData);
ProjectDataManagement::EventType leaveEventTypeForAesType(AreaEffectSimulation::AesType aesTypeId);
private: // attributes
std::shared_ptr<CentralEffectSimulation::DdsHandler> m_ddsHandler; ///< Pointer to VOM DDS handler
std::shared_ptr<CentralEffectSimulation::HandlerParticipant> m_handlerParticipant;
std::shared_ptr<CentralEffectSimulation::HandlerBuildingData> m_handlerBuildingData;
QHash<int32_t, int> m_aesItemId2partIdMap;
// AES-Values
QHash<int, CentralEffectSimulation::AesItemViewUtm> m_aesItemViews; // key = aesItemId
QQueue<TrainingAreaBase::SendCesHitRequest> m_sendCesHitRequestQueue;
QQueue<TrainingAreaBase::DemandInitRequest> m_sendInitRequestQueue;
QHash<QPair<int, int>, EnterLeaveType> m_cesEnterLeaveFunctionalArea; // QPair < aesItemId, participantId> Last Event
QHash<int, QVector<int>> m_aesPolygonEncloseBuilding; // key = aesItemId value = BuildingIds inside form
int m_requestId = 1;
NGL::INGLLogger &m_logger; ///< Interface to the Logging-Facility
};
} // namespace CES_JAMMING