118 lines
5.4 KiB
C++
Executable File
118 lines
5.4 KiB
C++
Executable File
/**
|
|
* Send AES data to NGS
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
* Created by Hannes Baeuerle, SLSE, 2017-05-08
|
|
*/
|
|
#pragma once
|
|
|
|
#include <QObject>
|
|
#include <QHash>
|
|
#include <QSet>
|
|
|
|
#include <AreaEffectSimulation/aes_dtc.h>
|
|
#include <AreaEffectSimulation/aes_ftc.h>
|
|
#include <AreaEffectSimulation/Utils/aes_helper.h>
|
|
|
|
#include <LtsUtilsGuiDds/request_helper.h>
|
|
|
|
#include <Common/logger.h>
|
|
#include <Common/typestruct.h>
|
|
|
|
|
|
#define SUPPORT_AES_EFFECTS // GUEZE-2570 / EXPLOSION_CLUSTER
|
|
#define SUPPORT_EXPLOSION_CLUSTER_SINGLE_EFFECT // GUEZE-2570 / EXPLOSION_CLUSTER
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
// namespace HighLevelArchitecture
|
|
//------------------------------------------------------------------------------
|
|
namespace HighLevelArchitecture
|
|
{
|
|
|
|
class NgsHandler;
|
|
struct ParticipantPosition;
|
|
|
|
class AesHandler : public QObject
|
|
, protected AreaEffectSimulation::Interface::Ftc::MineAreaModifyReplyHandler
|
|
, protected AreaEffectSimulation::Interface::Ftc::MineAreaRemoveReplyHandler
|
|
, protected AreaEffectSimulation::Interface::Ftc::MineCorridorModifyReplyHandler
|
|
, protected AreaEffectSimulation::Interface::Ftc::MineCorridorRemoveReplyHandler
|
|
, protected AreaEffectSimulation::Interface::Ftc::ExplosionSingleModifyReplyHandler
|
|
#ifdef SUPPORT_EXPLOSION_CLUSTER_SINGLE_EFFECT
|
|
, protected AreaEffectSimulation::Interface::Ftc::ExplosionClusterSingleEffectOnlyModifyReplyHandler
|
|
#endif // SUPPORT_EXPLOSION_CLUSTER_SINGLE_EFFECT
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
explicit AesHandler(NgsHandler *ngsHandler);
|
|
|
|
void onMineAreaModifyReply(const Core::FunctionReplyObject &replyObject) override final;
|
|
void onMineAreaRemoveReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
|
|
|
|
void onMineCorridorModifyReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
|
|
void onMineCorridorRemoveReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
|
|
|
|
void onExplosionSingleModifyReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
|
|
#ifdef SUPPORT_EXPLOSION_CLUSTER_SINGLE_EFFECT
|
|
void onExplosionClusterSingleEffectOnlyModifyReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
|
|
#endif // SUPPORT_EXPLOSION_CLUSTER_SINGLE_EFFECT
|
|
|
|
int64_t externalId(int aesItemId) const;
|
|
bool init();
|
|
|
|
private Q_SLOTS:
|
|
void onAesItemViewChanged(const AreaEffectSimulation::AesItemView &data, DataModification modType);
|
|
void onTriggeredImpactsChanged(const AreaEffectSimulation::TriggeredImpacts &data, DataModification modType);
|
|
|
|
#ifdef SUPPORT_AES_EFFECTS
|
|
void onEffectsChanged(const AreaEffectSimulation::Effects &data, DataModification modType);
|
|
#endif // SUPPORT_AES_EFFECTS
|
|
|
|
void onAesExplosionSingleChanged(const AreaEffectSimulation::ExplosionSingle &data, DataModification modType);
|
|
void onAesMineAreaChanged(const AreaEffectSimulation::MineArea &data, DataModification modType);
|
|
void onAesMineCorridorChanged(const AreaEffectSimulation::MineCorridor &data, DataModification modType);
|
|
void onAesNContaminationChanged(const AreaEffectSimulation::NContamination &data, DataModification modType);
|
|
void onAesBCContaminationChanged(const AreaEffectSimulation::BCContamination &data, DataModification modType);
|
|
|
|
void onAesNameChanged(qint64 identifierInt, const std::string &newName);
|
|
void onAesActivationTimeChanged(qint64 identifierInt, qint64 msecsSinceEpoch);
|
|
void onAesForceIdentifierChanged(qint64 identifierInt, int partyId);
|
|
void onAesDurationChanged(qint64 identifierInt, quint32 u_time);
|
|
void onAesChargeChanged(qint64 identifierInt, int chargeTypeId);
|
|
void onAesPointsDataChanged(qint64 identifierInt, const std::vector<Core::GeoPosition2D> &pos);
|
|
void onAesRemoveItem(qint64 identifierInt);
|
|
|
|
bool onNewMinefield(const AreaEffectSimulation::MineAreaModifyRequest &ma);
|
|
bool onNewMinefieldBreach(const AreaEffectSimulation::MineCorridorModifyRequest &mc);
|
|
void onMunitionDetonation(const AreaEffectSimulation::ExplosionSingleModifyRequest &es);
|
|
#ifdef SUPPORT_EXPLOSION_CLUSTER_SINGLE_EFFECT
|
|
void onMunitionDetonationExplosionClusterSingleEffect(const AreaEffectSimulation::ExplosionClusterSingleEffectOnlyRequest &es);
|
|
#endif // SUPPORT_EXPLOSION_CLUSTER_SINGLE_EFFECT
|
|
|
|
private:
|
|
template <typename T>
|
|
void onSendRequest(const T &item);
|
|
template <typename T>
|
|
void addRequestToQueue(int aesItemId, T *request);
|
|
|
|
static bool isModifiable(const AreaEffectSimulation::AesItem &item);
|
|
private:
|
|
NgsHandler *m_ngsHandler;
|
|
std::shared_ptr<AreaEffectSimulation::Interface::Dtc> m_dtcAes;
|
|
std::shared_ptr<AreaEffectSimulation::Interface::Ftc> m_ftcAes;
|
|
QMap<int32_t, AreaEffectSimulation::AesItemView> m_aesItemViews;
|
|
QMap<int32_t, QVector<int32_t> > m_takenIndicesForAesItem; // Indices for ExplosionAreas that are already fired.
|
|
#ifdef SUPPORT_AES_EFFECTS
|
|
AreaEffectSimulation::HandledImpactsStorage m_handledImpactsStorage; // for ExplosionCluster
|
|
#endif // SUPPORT_AES_EFFECTS
|
|
|
|
QMap<int, void*> m_pendingRequests;
|
|
|
|
LtsUtils::RequestHelper *m_requestHelper;
|
|
|
|
NGL::INGLLogger &m_logger;
|
|
};
|
|
} // namespace HighLevelArchitecture
|