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

70 lines
2.7 KiB
C++
Executable File

/**
* Handler for Mine Laying Artillery
* $Id$
* $HeadURL$
* $Author$
* Created by Nino Pinzer, ESZS, 12.03.2026
*/
#pragma once
#include <AreaEffectSimulation/aes_dtc.h>
#include <AreaEffectSimulation/aes_ftc.h>
#include <CentralEffectSimulation/aes_item_view_utm.h>
#include <CentralEffectSimulation/dds_handler.h>
#include <CentralEffectSimulation/handler_participant.h>
#include <CentralEffectSimulation/logger.h>
#include <QMap>
#include <QObject>
#include <QPolygonF>
#include <QQueue>
class QTimer;
namespace MineLayingArtillery
{
class HandlerMineLayingArtillery final
: public QObject
, protected AreaEffectSimulation::Interface::Ftc::ChargeEffectModifyReplyHandler
{
Q_OBJECT
public:
HandlerMineLayingArtillery(const std::shared_ptr<CentralEffectSimulation::DdsHandler> &ddsHandler, QObject *parent = nullptr);
~HandlerMineLayingArtillery();
bool init();
double calculateAngle(const AreaEffectSimulation::TrajectoryTimeAware &trajectory);
std::vector<AreaEffectSimulation::MineData> calculateImpacts(const QJsonObject &mineLayingPattern,
const Core::GeoPosition2D &impactPositon,
double angle,
qint64 time,
int patternCounter);
private slots:
void onChargeEffectChanged(const AreaEffectSimulation::ChargeEffect &data, DataModification modType);
void onChargeTypeChanged(const ProjectDataManagement::ChargeType &data, DataModification modType);
void onChargeEffectModifyReply(const Core::FunctionReplyObject &replyObject) override final;
void onEffectClusterTimerTimeout();
private: // methods
int patternCounterByImpactCount(const AreaEffectSimulation::EffectCluster &effectCluster, int patternCount, int impactCounter) const;
int effectorIndexByImpactCount(const AreaEffectSimulation::EffectCluster &effectCluster, int impactCounter) const;
private: // attributes
QTimer *m_effectClusterTimer {nullptr};
QQueue<AreaEffectSimulation::ChargeEffect> m_effectClusterQue;
std::shared_ptr<CentralEffectSimulation::DdsHandler> m_ddsHandler; ///< Pointer to VOM DDS handler
std::shared_ptr<ProjectDataManagement::Interface::Dtc> m_dtcPdm;
std::shared_ptr<AreaEffectSimulation::Interface::Dtc> m_dtcAes;
std::shared_ptr<AreaEffectSimulation::Interface::Ftc> m_ftcAes;
CentralEffectSimulation::LOGGER_T &m_logger; ///< Interface to the Logging-Facility
QMap<qint32, QJsonObject> m_mineLayingChargeTypes;
QMap<qint32, qint32> m_impactCounters; // key = aesItemId value = impactCounter
};
} // namespace MineLayingArtillery