Files
qt5-legatus-legacy/Lts/Services/AreaEffectSimulation/object_dus_single_mine.cpp
T
2026-08-13 18:33:10 +02:00

72 lines
2.0 KiB
C++
Executable File

/**
* Handler for the HMI language
* $Id$
* $HeadURL$
* $Author$
*/
#include "object_dus_single_mine.h"
namespace AreaEffectSimulation
{
ObjectDusSingleMine::ObjectDusSingleMine(MainHandler *mainHandler,
QObject *parent)
: ObjectBaseTmpl(mainHandler, QStringLiteral("DusSingleMine"), parent)
{
}
ObjectDusSingleMine::~ObjectDusSingleMine()
{
}
void ObjectDusSingleMine::setExpired()
{
m_data.effectDuration = 1;
const QDateTime tdNow = QDateTime::currentDateTimeUtc();
if (m_data.effectStart > tdNow)
m_data.effectStart = tdNow;
if (!m_mainHandler->db()->update(m_data))
ERROR_LOG(m_logger) << "Error updating DUS single mine in db.";
checkEnterNewState();
}
void ObjectDusSingleMine::onPublishData()
{
DusSingleMine ddsData(m_data.id,
m_data.name.toStdString(),
effectState() == AesEffectState::EsRemoved,
false,
partitionTimeMSec(),
{m_data.chargeTypeId,0,0},
m_data.effectDuration,
toOptional(m_data.effectStart),
m_data.effectStateId,
m_data.effectSourceId,
toOptional(m_data.partyId),
toOptional(m_data.participantId),
m_data.effectMarkingInTa,
m_data.externalId,
m_data.isCentral,
m_data.properties.toStdString(),
m_data.mineId,
Core::GeoPosition2D(m_data.position.x(),
m_data.position.y())
);
INFO_LOG(m_logger) << "Publish AesDusSingleMine-data to dds (" << m_data.id << ") ...";
if (!m_mainHandler->dds()->dts()->publish(ddsData))
{
ERROR_LOG(m_logger) << "Error publishing AesDusSingleMine-data to dds";
}
}
QPolygonF ObjectDusSingleMine::generateForm()
{
return QPolygonF();
}
} // Namespace AreaEffectSimulation