Files
qt5-legatus-legacy/Lts/Services/AreaEffectSimulation/EffectorFiringStrategy/default_firing_strategy.cpp
T
torstenandCopilot 3028302f7b Qt6 Migration: Merge latest Qt5 devel content and apply migration fixes
- 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>
2026-09-15 18:20:51 +00:00

79 lines
2.0 KiB
C++
Executable File

/**
* Default Effector Firing Strategy (RRohr)
* $Id$
* $HeadURL$
* $Author$
* Created by Hannes Fritsche, ESZS, 2026-05-11
*/
#include "default_firing_strategy.h"
#include "object_effector.h"
namespace AreaEffectSimulation
{
DefaultFiringStrategy::DefaultFiringStrategy(ObjectEffector *effector)
: BaseClass(effector)
{
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
DEBUG_LOG(m_logger) << "using DefaultFiringStrategy";
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
}
DefaultFiringStrategy::~DefaultFiringStrategy()
{
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
}
bool DefaultFiringStrategy::doFiring()
{
// 1: calculateDispersionTrajectory
if (!calculateDispersionTrajectory())
{
ERROR_LOG(m_logger) << LOGFUNCTION << " Error on calculateDispersionTrajectory";
return false;
}
if (m_transformedTrajectory.size() < 2)
{
ERROR_LOG(m_logger) << LOGFUNCTION << " transformedTrajectory is not sufficiant"
<< ", m_transformedTrajectory.size()" << m_transformedTrajectory.size();
return false;
}
// 2: getStartTime
const qint64 trajectoryStartTime = getStartTime();
// 3a buildTrajectoryGeometry
const auto geometry = buildTrajectoryGeometry(m_transformedTrajectory);
// 3b: buildTrajectoryTimeAware
const auto trajTimeAware = buildTrajectoryTimeAware(geometry, trajectoryStartTime);
// to be bullet-proof:
if (trajTimeAware.geometry().size() < 2)
{
ERROR_LOG(m_logger) << LOGFUNCTION << " trajTimeAware is empty";
return false;
}
// 4: sendChargeEffect
const int chargeEffectId = sendChargeEffect(trajTimeAware);
if (chargeEffectId < 0)
{
ERROR_LOG(m_logger) << LOGFUNCTION << " sendChargeEffect failed";
return false;
}
// 5: signalFired
emit signalFired(m_effector->participantId(), m_effector->aesItemId(), {chargeEffectId});
DEBUG_LOG(m_logger) << "created ChargeEffectId: " << chargeEffectId;
return true;
}
} //namespace AreaEffectSimulation