- Merged 292 changed files from dlbo snapshot - Fixed IDL enum collisions (PortType, PdmEventType) - Fixed Grantlee template for C++11 scoped enums - Fixed CMake VERSION_GREATER syntax - Added missing directories (THP, LtsRestClient, etc.) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
72 lines
2.2 KiB
C++
Executable File
72 lines
2.2 KiB
C++
Executable File
/**
|
|
* Base Class for Effector Firing Strategy
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
* Created by Hannes Fritsche, ESZS, 2026-05-11
|
|
*/
|
|
|
|
/*
|
|
* Diese Implementierung des Strategie- und Factory-Patterns ist ein Schritt, die Logik der Erzeugung der Trajektorien und der ChargeEffects von dem Effektor zu trennen.
|
|
* Aus zeitlichen Gründen ist die SW-technische Abhängigkeit Strategie und Effektor bidirektional.
|
|
*
|
|
* Bei zukünftigen Implementierungen sollte diese Abhängigkeit nur in einer Richtung bestehen.
|
|
* Oder anders gesagt: Die Strategie sollte möglichst UNABHÄNGIG (von ihren Vater) sein.
|
|
*
|
|
* Vorteile waeren:
|
|
* - Strategie kann unabhängig erstellt, gestestet und vielfältiger/flexibler ein gesetzt werden.
|
|
* - Es ist besser erkennbar, WAS die Strategie genau macht, da Ein- und Ausgangsdaten klar definiert sind.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AreaEffectSimulation/logger.h>
|
|
#include <QObject>
|
|
#include <Core/core.hpp>
|
|
#include <QJsonObject>
|
|
|
|
namespace Core
|
|
{
|
|
class GeoPosition;
|
|
}
|
|
|
|
namespace AreaEffectSimulation
|
|
{
|
|
class ObjectEffector;
|
|
class TrajectoryPoint;
|
|
class TrajectoryTimeAware;
|
|
|
|
class AbstractFiringStrategy : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit AbstractFiringStrategy(ObjectEffector *parent);
|
|
virtual ~AbstractFiringStrategy();
|
|
|
|
virtual bool doFiring() = 0;
|
|
|
|
Q_SIGNALS:
|
|
// Has to be emitted in doFiring() implementation!
|
|
void signalFired(int participantId, int aesItemId, const QVector<int> &chargeEffectIds);
|
|
|
|
protected:
|
|
// methods:
|
|
bool calculateDispersionTrajectory();
|
|
std::vector<Core::GeoPositionRelativeTime> buildTrajectoryGeometry(const QVector<TrajectoryPoint> &trajectory);
|
|
TrajectoryTimeAware buildTrajectoryTimeAware(const std::vector<Core::GeoPositionRelativeTime> &trajectoryGeometry, qint64 curTime, int index = 0);
|
|
|
|
int sendChargeEffect(const TrajectoryTimeAware &trajectoryTimeAware, const QJsonObject &properties = QJsonObject());
|
|
|
|
Core::GeoPosition participantPosition(int participantId);
|
|
int32_t gearTypeId(int chargeTypeId, int participantId);
|
|
qint64 getStartTime() const;
|
|
|
|
|
|
// attributes:
|
|
ObjectEffector *m_effector {nullptr};
|
|
QVector<TrajectoryPoint> m_transformedTrajectory;
|
|
LOGGER_T &m_logger;
|
|
}; // class ObjectEffector
|
|
} // namespace AreaEffectSimulation
|