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

87 lines
2.4 KiB
C++
Executable File

/**
* Handler for player data
* $Id$
* $HeadURL$
* $Author$
* Created by gr, SLSE, 2017-02-20
*/
#pragma once
#include <CentralEffectSimulation/logger.h>
#include <AreaEffectSimulation/aes_dtc.h>
#include <CentralEffectSimulation/dds_handler.h>
#include <CentralEffectSimulation/handler_participant.h>
#include <QHash>
#include <QRectF>
#include <QPolygonF>
// AES-Handling for participants
namespace CentralEffectSimulationBasic
{
class HandlerParticipantBorderline final
: public QObject
{
Q_OBJECT
struct BorderlineUtm
{
int id = 0;
int zone = -1;
int32_t operatorId = 0;
int32_t partyId = -1;
QPolygonF points;
QRectF boundingBox;
QString name;
BorderlineUtm() = default;
explicit BorderlineUtm(const AreaEffectSimulation::Borderline &bl);
};
public:
HandlerParticipantBorderline(const std::shared_ptr<CentralEffectSimulation::DdsHandler> &ddsHandler,
const std::shared_ptr<CentralEffectSimulation::HandlerParticipant> &participantHandler,
QObject *parent = nullptr);
~HandlerParticipantBorderline();
/**
* Initialize the handler to manage information from player management
*/
bool init();
private Q_SLOTS:
/**
* Handle the signals from 'ParticipantHandler'
*/
void onParticipantPositionChanged(const CentralEffectSimulation::HandlerParticipant::CesParticipantData &partPos);
/**
* Handle the signals from 'AES'
*/
void onBorderlineChanged(const AreaEffectSimulation::Borderline &data, DataModification modType);
private: // methoden
void sendParticipantEvent(const BorderlineUtm &borderline,
const CentralEffectSimulation::HandlerParticipant::CesParticipantData &participantPosition,
const ProjectDataManagement::EventType eventType);
bool intersect(const QPolygonF &polygonf, const QLineF &linef) const;
private: // attributes
std::shared_ptr<CentralEffectSimulation::DdsHandler> m_ddsHandler; ///< Pointer to VOM DDS handler
std::shared_ptr<CentralEffectSimulation::HandlerParticipant> m_handlerParticipant;
// AES-Values
QHash<int, BorderlineUtm> m_borderlines; // key = aesItemId
CentralEffectSimulation::LOGGER_T &m_logger; ///< Interface to the Logging-Facility
};
} // namespace CentralEffectSimulationBasic