Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
+71
@@ -0,0 +1,71 @@
|
||||
/**
|
||||
* 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 void doFiring() = 0;
|
||||
|
||||
Q_SIGNALS:
|
||||
// Has to be emitted in doFiring() implementation!
|
||||
void signalFired(int participantId, int aesItemId, const QVector<int> &chargeEffectIds);
|
||||
|
||||
protected:
|
||||
// methods:
|
||||
void 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
|
||||
Reference in new issue
Block a user