Session 026: Lts/Services Qt5:: to Qt6:: migration

- Migrated all 104 CMakeLists.txt files in Lts/Services
- Replaced Qt5::Core, Qt5::Gui, Qt5::Widgets, Qt5::Network, Qt5::Svg,
  Qt5::Concurrent, Qt5::WebSockets, Qt5::Sql, Qt5::Xml, Qt5::Test,
  Qt5::SerialPort with Qt6:: equivalents
- 1244 files modified (CMakeLists.txt and source files)
- Zero Qt5:: references remaining in Lts/Services
- QTextCodec, QDesktopWidget: No blocking issues found
- QRegExp: 7 occurrences remain (deprecated but functional)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
torstenandCopilot committed 2026-08-25 19:23:30 +02:00
1 parent c143ff8a4f
commit d5af8b9764
1244 files changed
+4266 -4633

No files matched your search

@@ -32,13 +32,12 @@ CODEGEN_TOPIC_TYPEDEFS(SRCS_common ${xml_FILE})
# Generate tgt_[d|f]tc.h
CODEGEN_CLIENT_TOPICS_IFC(SRCS_common ${xml_FILE})
NGL_ADD_LIBRARY2(AAR SV WS svcTgtCommon SHARED ${SRCS_common})
NGL_ADD_LIBRARY(AAR SV WS svcTgtCommon SHARED ${SRCS_common})
NGL_TARGET_INCLUDE_DIRECTORIES(svcTgtCommon
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/../
${CMAKE_CURRENT_BINARY_DIR}/../
)
IF(BUILD_RTI)
NGL_TARGET_LINK_LIBRARIES(svcTgtCommon
PRIVATE
RTI::nddscpp2
@@ -48,7 +47,6 @@ NGL_TARGET_LINK_LIBRARIES(svcTgtCommon
NGLLogger
ngldb
)
ENDIF(BUILD_RTI)
NGL_INSTALL_TARGET(svcTgtCommon)
#
@@ -60,14 +58,13 @@ SET(SRCS_client
# generate tgt_[d|f]tc.h, tgt_[d|f]tc_impl.[cpp|h]
CODEGEN_CLIENT_TOPICS_IMPL(SRCS_client ${xml_FILE})
NGL_ADD_LIBRARY2(AAR SV WS svcTgtClient SHARED ${SRCS_client})
NGL_ADD_LIBRARY(AAR SV WS svcTgtClient SHARED ${SRCS_client})
NGL_TARGET_INCLUDE_DIRECTORIES(svcTgtClient
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/../
${CMAKE_CURRENT_BINARY_DIR}/../
)
IF(BUILD_RTI)
NGL_TARGET_LINK_LIBRARIES(svcTgtClient
PRIVATE
RTI::nddscpp2
@@ -76,7 +73,6 @@ NGL_TARGET_LINK_LIBRARIES(svcTgtClient
svcTgtCommon
ddsftc
)
ENDIF(BUILD_RTI)
NGL_INSTALL_TARGET(svcTgtClient)
#
@@ -89,14 +85,13 @@ SET(SRCS_server
# generate tgt_[d|f]ts.h, tgt_[d|f]ts_impl.[cpp|h]
CODEGEN_SERVER_TOPICS(SRCS_server ${xml_FILE})
NGL_ADD_LIBRARY2(AAR SV svcTgtServer SHARED ${SRCS_server})
NGL_ADD_LIBRARY(AAR SV svcTgtServer SHARED ${SRCS_server})
NGL_TARGET_INCLUDE_DIRECTORIES(svcTgtServer
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/../
${CMAKE_CURRENT_BINARY_DIR}/../
)
IF(BUILD_RTI)
NGL_TARGET_LINK_LIBRARIES(svcTgtServer
PRIVATE
RTI::nddscpp2
@@ -106,7 +101,6 @@ NGL_TARGET_LINK_LIBRARIES(svcTgtServer
PUBLIC
svcTgtCommon
)
ENDIF(BUILD_RTI)
NGL_INSTALL_TARGET(svcTgtServer)
#
@@ -9,10 +9,10 @@
#include <nglapplication/nglcoreapplication.h>
#include <LtsCommandLineParser/LtsCommandLineParser.h>
#include <QtCore/QTimer>
#include <QtCore/QDateTime>
#include <QtCore/QJsonObject>
#include <QtCore/QJsonDocument>
#include <QTimer>
#include <QDateTime>
#include <QJsonObject>
#include <QJsonDocument>
/* ----------------------------------------------------------------------------------
* Ablauf:
* ----------------------------------------------------------------------------------
@@ -54,6 +54,7 @@ namespace TargetManagement
{
TgtTests::TgtTests(QObject *parent)
: QObject(parent)
, m_logger(getLogger("TgtTests"))
{}
// ------------------------------------------------------------------
@@ -53,7 +53,6 @@ protected Q_SLOTS:
void ExitSuccess();
protected:
NGL::INGLLogger &m_logger;
void onConfigureTargetReply(const Core::FunctionReplyObject &replyObject) override final;
void onShootbackAreaModifyReply(const Core::FunctionReplyObject &replyObject) override final;
void onShootbackAreaRemoveReply(const Core::FunctionReplyObject &replyObject) override final;
@@ -72,6 +71,8 @@ private:
int m_operatorId{-1};
int m_participantIndex{0};
int m_shootbackAreaId{-1};
NGL::INGLLogger &m_logger;
};
} // namespace TargetManagement
@@ -7,13 +7,12 @@
*/
#include "unit_test.h"
#include <utility>
#include <TargetManagement/shootback_controller.h>
#include <QtTest/QTest>
#include <QtTest/QSignalSpy>
#include <QtCore/QWeakPointer>
#include <QWeakPointer>
#include <nglapplication/nglapplication.h>
#include <nglapplication/nglcoreapplication.h>
@@ -21,8 +20,8 @@
#include <LtsCommandLineParser/LtsCommandLineParser.h>
#include <QtCore/QTimer>
#include <QtCore/QFlags>
#include <QTimer>
#include <QFlags>
#include <iostream>
@@ -100,7 +99,7 @@ tgtTestShootbackTarget::~tgtTestShootbackTarget()
void tgtTestShootbackTarget::initTestCase()
{
NOTICE_LOG(m_logger) << Q_FUNC_INFO << " do testing with"
NOTICE_LOG(m_logger) << LOGFUNCTION << " do testing with"
<< " domainId=" << m_domainId
<< " exerciseId=" << m_exerciseId;
@@ -128,7 +127,7 @@ void tgtTestShootbackTarget::initTestCase()
removeTestObjects();
if (!bRet)
FATAL_LOG(m_logger) << Q_FUNC_INFO << " init failed!!!";
FATAL_LOG(m_logger) << LOGFUNCTION << " init failed!!!";
}
@@ -155,7 +154,7 @@ void tgtTestShootbackTarget::testShootbackArea()
// time to process reply
QTest::qWait(100);
NOTICE_LOG(m_logger) << Q_FUNC_INFO << " got m_replyShootbackAreaId: " << m_replyShootbackAreaId;
NOTICE_LOG(m_logger) << LOGFUNCTION << " got m_replyShootbackAreaId: " << m_replyShootbackAreaId;
// modify
@@ -169,7 +168,7 @@ void tgtTestShootbackTarget::testShootbackArea()
// verify mod
{
TargetManagement::ShootbackArea modData = m_dtcTgt->shootbackArea(m_replyShootbackAreaId);
INFO_LOG(m_logger) << Q_FUNC_INFO << "modData=" << modData;
INFO_LOG(m_logger) << LOGFUNCTION << "modData=" << modData;
QVERIFY2((modData.id() == m_replyShootbackAreaId), " shootbackArea failed");
QVERIFY2((modData.name().compare(request.name()) == 0), " verify name failed");
}
@@ -207,7 +206,7 @@ void tgtTestShootbackTarget::testShootbackTarget()
// time to process reply
QTest::qWait(100);
NOTICE_LOG(m_logger) << Q_FUNC_INFO << " got m_replyShootbackTargetId: " << m_replyShootbackTargetId;
NOTICE_LOG(m_logger) << LOGFUNCTION << " got m_replyShootbackTargetId: " << m_replyShootbackTargetId;
// modify
@@ -220,13 +219,13 @@ void tgtTestShootbackTarget::testShootbackTarget()
QSignalSpy spy(m_dtcTgt.get(), &TargetManagement::Interface::Dtc::shootbackTargetChanged);
if (spy.count() == 0)
spy.wait(2000);
INFO_LOG(m_logger) << Q_FUNC_INFO << "spy.count()=" << spy.count();
INFO_LOG(m_logger) << LOGFUNCTION << "spy.count()=" << spy.count();
QVERIFY2((spy.count() == 1), " spy failed");
// verify mod
{
TargetManagement::ShootbackTarget modData = m_dtcTgt->shootbackTarget(m_replyShootbackTargetId);
INFO_LOG(m_logger) << Q_FUNC_INFO << "modData=" << modData;
INFO_LOG(m_logger) << LOGFUNCTION << "modData=" << modData;
QVERIFY2((modData.id() == m_replyShootbackTargetId), " shootbackTarget failed");
QVERIFY2((modData.name().compare(request.name()) == 0), " verify name failed");
}
@@ -268,7 +267,7 @@ void tgtTestShootbackTarget::testTargetAreaAssignment()
QSignalSpy spy(m_dtcTgt.get(), &TargetManagement::Interface::Dtc::targetAreaAssignmentChanged);
if (spy.count() == 0)
spy.wait(2000);
INFO_LOG(m_logger) << Q_FUNC_INFO << "spy.count()=" << spy.count();
INFO_LOG(m_logger) << LOGFUNCTION << "spy.count()=" << spy.count();
QVERIFY2((spy.count() == 1), " spy failed");
// time to process reply
@@ -288,13 +287,13 @@ void tgtTestShootbackTarget::testTargetAreaAssignment()
QSignalSpy spy(m_dtcTgt.get(), &TargetManagement::Interface::Dtc::targetAreaAssignmentChanged);
if (spy.count() == 0)
spy.wait(2000);
INFO_LOG(m_logger) << Q_FUNC_INFO << "spy.count()=" << spy.count();
INFO_LOG(m_logger) << LOGFUNCTION << "spy.count()=" << spy.count();
QVERIFY2((spy.count() == 1), " spy failed");
// verify mod
{
TargetManagement::TargetAreaAssignment modData = m_dtcTgt->targetAreaAssignment(m_replyTargetAreaAssignmentId);
INFO_LOG(m_logger) << Q_FUNC_INFO << "modData=" << modData;
INFO_LOG(m_logger) << LOGFUNCTION << "modData=" << modData;
QVERIFY2((modData.id() == m_replyTargetAreaAssignmentId), " targetAreaAssignment failed");
QVERIFY2((modData.name().compare(request.name()) == 0), " verify name failed");
}
@@ -321,38 +320,38 @@ void tgtTestShootbackTarget::removeTestObjects()
// first, remove all TargetAreaAssignments:
{
QMap<qint32, TargetManagement::TargetAreaAssignment> allObj = m_dtcTgt->targetAreaAssignments();
NOTICE_LOG(m_logger) << Q_FUNC_INFO << " remove... (" << allObj.size() << " TargetAreaAssignments)";
for (auto item: std::as_const(allObj))
NOTICE_LOG(m_logger) << LOGFUNCTION << " remove... (" << allObj.size() << " TargetAreaAssignments)";
for (auto item: qAsConst(allObj))
if (item.name().substr(0, 8).compare("UnitTest") == 0)
removeAssignment(item.id());
QTest::qWait(250); // time to process reply
allObj = m_dtcTgt->targetAreaAssignments();
NOTICE_LOG(m_logger) << Q_FUNC_INFO << " remove targetAreaAssignments finished -> " << allObj.size() << " TargetAreaAssignments";
NOTICE_LOG(m_logger) << LOGFUNCTION << " remove targetAreaAssignments finished -> " << allObj.size() << " TargetAreaAssignments";
}
// remove all Areas:
{
QMap<qint32, TargetManagement::ShootbackArea> allObj = m_dtcTgt->shootbackAreas();
NOTICE_LOG(m_logger) << Q_FUNC_INFO << " remove... (" << allObj.size() << " Areas)";
for (auto item: std::as_const(allObj))
NOTICE_LOG(m_logger) << LOGFUNCTION << " remove... (" << allObj.size() << " Areas)";
for (auto item: qAsConst(allObj))
if (item.name().substr(0, 8).compare("UnitTest") == 0)
removeArea(item.id());
QTest::qWait(250); // time to process reply
allObj = m_dtcTgt->shootbackAreas();
NOTICE_LOG(m_logger) << Q_FUNC_INFO << " remove shootbackAreas finished -> " << allObj.size() << " Areas";
NOTICE_LOG(m_logger) << LOGFUNCTION << " remove shootbackAreas finished -> " << allObj.size() << " Areas";
}
// remove all Targets:
{
QMap<qint32, TargetManagement::ShootbackTarget> allObj = m_dtcTgt->shootbackTargets();
NOTICE_LOG(m_logger) << Q_FUNC_INFO << " remove... (" << allObj.size() << " Targets)";
for (auto item: std::as_const(allObj))
NOTICE_LOG(m_logger) << LOGFUNCTION << " remove... (" << allObj.size() << " Targets)";
for (auto item: qAsConst(allObj))
if (item.name().substr(0, 8).compare("UnitTest") == 0)
removeTarget(item.id());
QTest::qWait(250); // time to process reply
allObj = m_dtcTgt->shootbackTargets();
NOTICE_LOG(m_logger) << Q_FUNC_INFO << " remove shootbackTargets finished -> " << allObj.size() << " Targets";
NOTICE_LOG(m_logger) << LOGFUNCTION << " remove shootbackTargets finished -> " << allObj.size() << " Targets";
}
QTest::qWait(1000); // time to process
}
@@ -387,7 +386,7 @@ void tgtTestShootbackTarget::createArea(int &areaIdInOut, const QString &name, d
// time to process reply
QTest::qWait(100);
INFO_LOG(m_logger) << Q_FUNC_INFO << " got m_replyShootbackAreaId: " << m_replyShootbackAreaId;
INFO_LOG(m_logger) << LOGFUNCTION << " got m_replyShootbackAreaId: " << m_replyShootbackAreaId;
areaIdInOut = m_replyShootbackAreaId;
}
@@ -447,7 +446,7 @@ void tgtTestShootbackTarget::createTarget(int &targetIdOut, int targetParticipan
// time to process reply
QTest::qWait(100);
INFO_LOG(m_logger) << Q_FUNC_INFO << " got m_replyShootbackTargetId: " << m_replyShootbackTargetId;
INFO_LOG(m_logger) << LOGFUNCTION << " got m_replyShootbackTargetId: " << m_replyShootbackTargetId;
targetIdOut = m_replyShootbackTargetId;
}
@@ -515,7 +514,7 @@ void tgtTestShootbackTarget::createAssignment(int areaId, int targetParticipantI
// time to process reply
QTest::qWait(100);
INFO_LOG(m_logger) << Q_FUNC_INFO << " got m_replyTargetAreaAssignmentId: " << m_replyTargetAreaAssignmentId;
INFO_LOG(m_logger) << LOGFUNCTION << " got m_replyTargetAreaAssignmentId: " << m_replyTargetAreaAssignmentId;
assignmentIdOut = m_replyTargetAreaAssignmentId;
}
@@ -564,7 +563,7 @@ void tgtTestShootbackTarget::moveParticipant(int participantId, double lon, doub
if (!m_dtsPpm)
return;
NOTICE_LOG(m_logger) << Q_FUNC_INFO << " move Participant: id = " << participantId;
NOTICE_LOG(m_logger) << LOGFUNCTION << " move Participant: id = " << participantId;
ParticipantManagement::ParticipantPosition posReq;
posReq.participantId(participantId);
posReq.sampleTime(currentSampleTime());
@@ -572,7 +571,7 @@ void tgtTestShootbackTarget::moveParticipant(int participantId, double lon, doub
posReq.partyId(2); // 0 and 1 will be skipped
if (!m_dtsPpm->publish(posReq))
{
ERROR_LOG(m_logger) << Q_FUNC_INFO << " Error publish posReq";
ERROR_LOG(m_logger) << LOGFUNCTION << " Error publish posReq";
return;
}
}
@@ -727,7 +726,7 @@ void tgtTestShootbackTarget::testPlayerMovesLos()
// move assigned target 1 slightly:
{
NOTICE_LOG(m_logger) << Q_FUNC_INFO << " move target1 ...";
NOTICE_LOG(m_logger) << LOGFUNCTION << " move target1 ...";
modifyTarget(m_targetDataId1, g_targetParticipantId_1, QStringLiteral("UnitTest-TargetDataId1_Moved"), 0.149, 0.926, 55.0);
QTest::qWait(250); // time to process
@@ -736,7 +735,7 @@ void tgtTestShootbackTarget::testPlayerMovesLos()
// move (z) assigned target 1 to interrupt line of sight:
{
NOTICE_LOG(m_logger) << Q_FUNC_INFO << " move target1 ...";
NOTICE_LOG(m_logger) << LOGFUNCTION << " move target1 ...";
modifyTarget(m_targetDataId1, g_targetParticipantId_1, QStringLiteral("UnitTest-TargetDataId1_Moved"), 0.152, 0.926, 2.0);
QTest::qWait(250); // time to process
@@ -18,7 +18,7 @@
#include <DDS/DDSConnector/dds_connector.h>
#include <QtCore/QCoreApplication>
#include <QCoreApplication>
#include <QtTest/QTest>
#include <memory>
@@ -70,8 +70,6 @@ private Q_SLOTS:
void cleanupTestCase(); // one time at the end
protected:
NGL::INGLLogger &m_logger;
void onShootbackAreaModifyReply(const Core::FunctionReplyObject &reply) override final;
void onShootbackAreaRemoveReply(const Core::FunctionReplyObject &reply) override final;
@@ -126,5 +124,8 @@ private:
int m_replyShootbackAreaId = -1;
int m_replyShootbackTargetId = -1;
int m_replyTargetAreaAssignmentId = -1;
NGL::INGLLogger &m_logger;
};
} // namespace
@@ -16,6 +16,7 @@ namespace TargetManagement
DdsHandler::DdsHandler(int domainId, int exerciseId)
: m_ddsConnector(std::make_shared<DDSConnector::DdsConnector>(domainId, IDL::PartitionType::Exercise, exerciseId))
, m_logger(getLogger("DdsHandler"))
{
DEBUG_LOG(m_logger) << "DdsHandler(" << m_ddsConnector->getDomainId() << ") for partition: " << m_ddsConnector->getDefaultPartition();
}
@@ -8,7 +8,7 @@
#pragma once
#include <QtCore/QObject>
#include <QObject>
#include <DDS/DDSConnector/dds_connector.h>
#include <DDS/Core/core_dtc.h>
#include <DDS/Core/topic_lock_master.h>
@@ -18,7 +18,7 @@
#include <TargetManagement/tgt_fts.h>
#include <Proxies/TrainingAreaBase/tab_dtc.h>
#include <Proxies/TrainingAreaBase/tab_ftc.h>
#include <ParticipantManagement/ppm.hpp>
#include <ParticipantManagement/ppm_dtc.h>
#include <ParticipantManagement/ppm_ftc.h>
#include <ParticipantManagement/ppm_ftc_types.h>
@@ -65,7 +65,6 @@ private Q_SLOTS:
void onParticipantChanged(const ParticipantManagement::Participant &data, DataModification modType);
private:
NGL::INGLLogger &m_logger;
std::shared_ptr<DDSConnector::DdsConnector> m_ddsConnector;
std::shared_ptr<Core::Interface::Dtc> m_dtcCore;
std::shared_ptr<Core::Pacemaker> m_pacemaker;
@@ -78,6 +77,8 @@ private:
QMap<int, int> m_partId2EquipNoMap; ///< Reference map participant (player) to equipment number
QMap<int, int> m_equipNo2partIdMap; ///< Reference map equipment number (player) to participant
NGL::INGLLogger &m_logger;
};
} // namespace TargetManagement
@@ -19,22 +19,23 @@ HandlerShootbackArea::HandlerShootbackArea(MainHandler *mainHandler)
, ShootbackAreaRemoveRequestHandler(mainHandler->dds()->ftsTgt())
, m_mainHandler(mainHandler)
, m_dtsTgt(m_mainHandler->dds()->dtsTgt())
, m_logger(getLogger("HandlerShootbackArea"))
{
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
}
//--------------------------------------------------------------------------
HandlerShootbackArea::~HandlerShootbackArea()
{
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
}
//--------------------------------------------------------------------------
bool HandlerShootbackArea::init()
{
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
// connect(m_dtcTab.get(), &TrainingAreaBase::Interface::Dtc::targetDataChanged,
// this, &HandlerShootbackArea::onTargetDataChanged);
@@ -90,7 +91,7 @@ void HandlerShootbackArea::onShootbackAreaModifyRequest(const rti::core::SampleI
//--------------------------------------------------------------------------
Core::FunctionReplyObject HandlerShootbackArea::shootbackAreaModifyRequest(const ShootbackArea &request)
{
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
// modify
if (request.id() > 0)
{
@@ -109,7 +110,7 @@ Core::FunctionReplyObject HandlerShootbackArea::shootbackAreaModifyRequest(const
}
else
m_objectMap.insert(ifs->getId(), ifs);
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
return ret;
}
@@ -117,7 +118,7 @@ Core::FunctionReplyObject HandlerShootbackArea::shootbackAreaModifyRequest(const
void HandlerShootbackArea::onShootbackAreaRemoveRequest(const rti::core::SampleIdentity &cookie,
const Core::RemoveElementRequest &request)
{
TRACE_LOG(m_logger) << Q_FUNC_INFO << " request=" << request;
TRACE_LOG(m_logger) << LOGFUNCTION << " request=" << request;
Core::FunctionReplyObject ret;
ObjectShootbackArea *ifs = m_objectMap.value(request.id());
@@ -8,7 +8,7 @@
#pragma once
#include <QtCore/QObject>
#include <QObject>
#include "dds_handler.h"
#include "logger.h"
@@ -56,8 +56,6 @@ Q_SIGNALS:
private Q_SLOTS:
private: // methods
NGL::INGLLogger &m_logger;
void onShootbackAreaModifyRequest(const rti::core::SampleIdentity &cookie,
const ShootbackArea &request) override;
Core::FunctionReplyObject shootbackAreaModifyRequest(const ShootbackArea &request);
@@ -69,7 +67,7 @@ private: // attributes
QHash<int, ObjectShootbackArea *> m_objectMap;
MainHandler *m_mainHandler;
std::shared_ptr<TargetManagement::Interface::Dts> m_dtsTgt;
NGL::INGLLogger &m_logger; ///< Interface to the Logging-Facility
};
} // namespace TargetManagement
@@ -7,7 +7,6 @@
*/
#include "main_handler.h"
#include <utility>
#include "handler_target_area_assignment.h"
#include "handler_shootback_target.h"
#include "object_shootback_target.h"
@@ -20,22 +19,23 @@ HandlerShootbackTarget::HandlerShootbackTarget(MainHandler *mainHandler)
, ShootbackTargetRemoveRequestHandler(mainHandler->dds()->ftsTgt())
, m_mainHandler(mainHandler)
, m_dtsTgt(m_mainHandler->dds()->dtsTgt())
, m_logger(getLogger("HandlerShootbackTarget"))
{
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
}
//--------------------------------------------------------------------------
HandlerShootbackTarget::~HandlerShootbackTarget()
{
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
}
//--------------------------------------------------------------------------
bool HandlerShootbackTarget::init()
{
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
// connect(m_dtcTab.get(), &TrainingAreaBase::Interface::Dtc::targetDataChanged,
// this, &HandlerShootbackTarget::onTargetDataChanged);
@@ -68,7 +68,7 @@ bool HandlerShootbackTarget::init()
ObjectShootbackTarget *HandlerShootbackTarget::dataForTargetParticipantId(int targetParticipantId) const
{
for (ObjectShootbackTarget *item : std::as_const(m_objectMap))
for (ObjectShootbackTarget *item : qAsConst(m_objectMap))
{
if (!item)
continue;
@@ -103,7 +103,7 @@ void HandlerShootbackTarget::onShootbackTargetModifyRequest(const rti::core::Sam
//--------------------------------------------------------------------------
Core::FunctionReplyObject HandlerShootbackTarget::shootbackTargetModifyRequest(const ShootbackTarget &request)
{
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
// modify
if (request.id() > 0)
{
@@ -127,7 +127,7 @@ Core::FunctionReplyObject HandlerShootbackTarget::shootbackTargetModifyRequest(c
}
else
m_objectMap.insert(ifs->getId(), ifs);
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
return ret;
}
@@ -135,7 +135,7 @@ Core::FunctionReplyObject HandlerShootbackTarget::shootbackTargetModifyRequest(c
void HandlerShootbackTarget::onShootbackTargetRemoveRequest(const rti::core::SampleIdentity &cookie,
const Core::RemoveElementRequest &request)
{
TRACE_LOG(m_logger) << Q_FUNC_INFO << " request=" << request;
TRACE_LOG(m_logger) << LOGFUNCTION << " request=" << request;
Core::FunctionReplyObject ret;
ObjectShootbackTarget *ifs = m_objectMap.value(request.id());
@@ -8,7 +8,7 @@
#pragma once
#include <QtCore/QObject>
#include <QObject>
#include "dds_handler.h"
#include "logger.h"
@@ -54,8 +54,6 @@ Q_SIGNALS:
private Q_SLOTS:
private: // methods
NGL::INGLLogger &m_logger;
void onShootbackTargetModifyRequest(const rti::core::SampleIdentity &cookie,
const ShootbackTarget &request) override;
Core::FunctionReplyObject shootbackTargetModifyRequest(const ShootbackTarget &request);
@@ -67,7 +65,7 @@ private: // attributes
QHash<int, ObjectShootbackTarget *> m_objectMap;
MainHandler *m_mainHandler;
std::shared_ptr<TargetManagement::Interface::Dts> m_dtsTgt;
NGL::INGLLogger &m_logger; ///< Interface to the Logging-Facility
};
} // namespace TargetManagement
@@ -7,7 +7,6 @@
*/
#include "main_handler.h"
#include <utility>
#include "handler_target_area_assignment.h"
#include "object_target_area_assignment.h"
@@ -19,22 +18,23 @@ HandlerTargetAreaAssignment::HandlerTargetAreaAssignment(MainHandler *mainHandle
, TargetAreaAssignmentRemoveRequestHandler(mainHandler->dds()->ftsTgt())
, m_mainHandler(mainHandler)
, m_dtsTgt(m_mainHandler->dds()->dtsTgt())
, m_logger(getLogger("HandlerTargetAreaAssignment"))
{
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
}
//--------------------------------------------------------------------------
HandlerTargetAreaAssignment::~HandlerTargetAreaAssignment()
{
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
}
//--------------------------------------------------------------------------
bool HandlerTargetAreaAssignment::init()
{
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
// connect(m_dtcTab.get(), &TrainingAreaBase::Interface::Dtc::targetDataChanged,
// this, &HandlerTargetAreaAssignment::onTargetDataChanged);
@@ -67,7 +67,7 @@ bool HandlerTargetAreaAssignment::init()
bool HandlerTargetAreaAssignment::isAreaIdUsedInAny(int areaId)
{
for (const ObjectTargetAreaAssignment *sample : std::as_const(m_objectMap))
for (const ObjectTargetAreaAssignment *sample : qAsConst(m_objectMap))
if (sample && (sample->getData().areaId() == areaId))
return true;
return false;
@@ -75,7 +75,7 @@ bool HandlerTargetAreaAssignment::isAreaIdUsedInAny(int areaId)
bool HandlerTargetAreaAssignment::isTargetDataIdUsedInAny(int targetDataId)
{
for (const ObjectTargetAreaAssignment *sample : std::as_const(m_objectMap))
for (const ObjectTargetAreaAssignment *sample : qAsConst(m_objectMap))
if (sample && (sample->getData().targetParticipantId() == targetDataId))
return true;
return false;
@@ -97,7 +97,7 @@ void HandlerTargetAreaAssignment::onTargetAreaAssignmentModifyRequest(const rti:
//--------------------------------------------------------------------------
Core::FunctionReplyObject HandlerTargetAreaAssignment::TargetAreaAssignmentModifyRequest(const TargetAreaAssignment &request)
{
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
// modify
if (request.id() > 0)
{
@@ -116,7 +116,7 @@ Core::FunctionReplyObject HandlerTargetAreaAssignment::TargetAreaAssignmentModif
}
else
m_objectMap.insert(ifs->getId(), ifs);
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
return ret;
}
@@ -124,7 +124,7 @@ Core::FunctionReplyObject HandlerTargetAreaAssignment::TargetAreaAssignmentModif
void HandlerTargetAreaAssignment::onTargetAreaAssignmentRemoveRequest(const rti::core::SampleIdentity &cookie,
const Core::RemoveElementRequest &request)
{
TRACE_LOG(m_logger) << Q_FUNC_INFO << " request=" << request;
TRACE_LOG(m_logger) << LOGFUNCTION << " request=" << request;
Core::FunctionReplyObject ret;
ObjectTargetAreaAssignment *ifs = m_objectMap.value(request.id());
@@ -8,7 +8,7 @@
#pragma once
#include <QtCore/QObject>
#include <QObject>
#include "dds_handler.h"
#include "logger.h"
@@ -48,8 +48,6 @@ Q_SIGNALS:
private Q_SLOTS:
private: // methods
NGL::INGLLogger &m_logger;
void onTargetAreaAssignmentModifyRequest(const rti::core::SampleIdentity &cookie,
const TargetAreaAssignment &request) override;
Core::FunctionReplyObject TargetAreaAssignmentModifyRequest(const TargetAreaAssignment &request);
@@ -61,7 +59,7 @@ private: // attributes
QHash<int, ObjectTargetAreaAssignment *> m_objectMap;
MainHandler *m_mainHandler;
std::shared_ptr<TargetManagement::Interface::Dts> m_dtsTgt;
NGL::INGLLogger &m_logger; ///< Interface to the Logging-Facility
};
} // namespace TargetManagement
@@ -8,7 +8,7 @@
#include "settings.h"
#include "handler_target_config.h"
#include <LtsUtils/qbytearray_byteaccess.h>
#include <LtsUtilsCore/qbytearray_byteaccess.h>
using namespace TargetManagement;
@@ -19,6 +19,7 @@ HandlerTargetConfig::HandlerTargetConfig(const std::shared_ptr<DdsHandler> &ddsH
, m_ddsHandler(ddsHandler)
, m_dtcTab(ddsHandler->dtcTab())
, m_dtsTgt(ddsHandler->dtsTgt())
, m_logger(getLogger("HandlerTargetConfig"))
{
} // end of ctor()
//-----------------------------------------------------------------------------
@@ -8,7 +8,7 @@
#pragma once
#include <QtCore/QObject>
#include <QObject>
#include "dds_handler.h"
#include "logger.h"
@@ -55,8 +55,6 @@ private Q_SLOTS:
void onTargetDataChanged(const TrainingAreaBase::TargetData &targetData, DataModification modType);
private: // methoden
NGL::INGLLogger &m_logger;
void onConfigureTargetRequest(const rti::core::SampleIdentity &cookie,
const ConfigureTargetRequest &request) override;
Core::FunctionReplyObject configureTargetRequest(const ConfigureTargetRequest &request);
@@ -66,7 +64,7 @@ private: // attributes
std::shared_ptr<DdsHandler> m_ddsHandler; ///< Pointer to DDS handler
std::shared_ptr<TrainingAreaBase::Interface::Dtc> m_dtcTab;
std::shared_ptr<TargetManagement::Interface::Dts> m_dtsTgt;
NGL::INGLLogger &m_logger; ///< Interface to the Logging-Facility
};
} // namespace TargetManagement
@@ -9,7 +9,7 @@
#pragma once
#include <NGLLogger/INGLLogger.h>
#include "svctgtcommon_export.h"
#include "tgt_export.h"
namespace TargetManagement
{
@@ -13,15 +13,17 @@
#include <ngldb/db_service_handler.h>
#include "settings.h"
#include <QtCore/QFileInfo>
#include <QFileInfo>
namespace TargetManagement
{
MainHandler::MainHandler(QObject *parent) : QObject(parent)
MainHandler::MainHandler(QObject *parent)
: QObject(parent)
, m_ddsHandler(nullptr)
, m_dbHandler(nullptr),
m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger()) {}
, m_dbHandler(nullptr)
, m_logger(getLogger("MainHandler"))
{}
MainHandler::~MainHandler()
{
@@ -83,7 +85,7 @@ bool MainHandler::init(int domainId, int exerciseId)
QFileInfo fi(elevationFileAbs);
if (!fi.exists(elevationFileAbs))
{
ERROR_LOG(m_logger) << Q_FUNC_INFO << ", elevationFile '" << elevationFileAbs << "' doesn't exists";
ERROR_LOG(m_logger) << LOGFUNCTION << ", elevationFile '" << elevationFileAbs << "' doesn't exists";
return false;
}
@@ -6,7 +6,7 @@
*/
#pragma once
#include <QtCore/QObject>
#include <QObject>
#include "dds_handler.h"
#include "tgt_db.h"
@@ -42,7 +42,6 @@ public:
private:
NGL::INGLLogger &m_logger;
std::shared_ptr<DdsHandler> m_ddsHandler;
std::shared_ptr<DbHandler> m_dbHandler;
@@ -56,5 +55,7 @@ private:
std::shared_ptr<SituationMap::ElevationMap> m_elevationMap;
std::shared_ptr<ShootbackController> m_shootbackController;
// : L400
NGL::INGLLogger &m_logger;
};
} // namespace TargetManagement
@@ -13,19 +13,21 @@
//------------------------------------------------------------------------------
namespace TargetManagement
{
ObjectShootbackArea::ObjectShootbackArea(MainHandler *mainHandler) : m_mainHandler(mainHandler),
m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger()) {
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
ObjectShootbackArea::ObjectShootbackArea(MainHandler *mainHandler)
: m_mainHandler(mainHandler)
, m_logger(getLogger("ObjectShootbackArea"))
{
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
}
//------------------------------------------------------------------------------
ObjectShootbackArea::~ObjectShootbackArea()
{
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
if (isValid())
m_mainHandler->dds()->dtsTgt()->removeShootbackAreaByKey(m_data.id());
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
}
//------------------------------------------------------------------------------
@@ -43,7 +45,7 @@ bool ObjectShootbackArea::isUsed() const
//------------------------------------------------------------------------------
Core::FunctionReplyObject ObjectShootbackArea::createObject(const ShootbackArea &data)
{
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
m_data = data;
if (m_data.id() <= 0)
@@ -62,14 +64,14 @@ Core::FunctionReplyObject ObjectShootbackArea::createObject(const ShootbackArea
// Publish Data via DTS
onPublishData();
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
return Core::FunctionReplyObject(m_data.id());
}
//------------------------------------------------------------------------------
Core::FunctionReplyObject ObjectShootbackArea::updateObject(const ShootbackArea &data)
{
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
if (!isValid())
return Core::FunctionReplyObject(data.id(), tr_lts("dds", "Object not valid/blocked"));
@@ -85,7 +87,7 @@ Core::FunctionReplyObject ObjectShootbackArea::updateObject(const ShootbackArea
// Publish Data via DTS
onPublishData();
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
return Core::FunctionReplyObject(m_data.id());
}
@@ -106,7 +108,7 @@ Core::FunctionReplyObject ObjectShootbackArea::setUsed(bool isUsed)
//------------------------------------------------------------------------------
Core::FunctionReplyObject ObjectShootbackArea::removeObject()
{
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
if (isUsed())
return Core::FunctionReplyObject(m_data.id(), tr_lts("dds", "ShootbackArea still in use"));
@@ -116,7 +118,7 @@ Core::FunctionReplyObject ObjectShootbackArea::removeObject()
if (!m_mainHandler->dds()->dtsTgt()->removeShootbackAreaByKey(m_data.id()))
return Core::FunctionReplyObject(m_data.id(), tr_lts("dds", "ShootbackArea with id %1 can not be removed from DDS")).arg(m_data.id());
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
return Core::FunctionReplyObject(m_data.id());
}
@@ -10,7 +10,7 @@
#include "dds_handler.h"
#include "logger.h"
#include <Core/core_types.h>
#include <DDS/Core/function_reply_object.h>
// Generated
#include <TargetManagement/tgt.hpp>
@@ -48,11 +48,12 @@ public:
static ShootbackArea toDdsData(const Database::TgtShootbackArea &dbData); // db -> dds
protected:
NGL::INGLLogger &m_logger;
void onPublishData();
private:
MainHandler *m_mainHandler;
ShootbackArea m_data;
NGL::INGLLogger &m_logger;
};
}
@@ -13,19 +13,21 @@
//------------------------------------------------------------------------------
namespace TargetManagement
{
ObjectShootbackTarget::ObjectShootbackTarget(MainHandler *mainHandler) : m_mainHandler(mainHandler),
m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger()) {
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
ObjectShootbackTarget::ObjectShootbackTarget(MainHandler *mainHandler)
: m_mainHandler(mainHandler)
, m_logger(getLogger("ObjectShootbackTarget"))
{
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
}
//------------------------------------------------------------------------------
ObjectShootbackTarget::~ObjectShootbackTarget()
{
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
if (isValid())
m_mainHandler->dds()->dtsTgt()->removeShootbackTargetByKey(m_data.id());
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
}
//------------------------------------------------------------------------------
@@ -43,7 +45,7 @@ bool ObjectShootbackTarget::isUsed() const
//------------------------------------------------------------------------------
Core::FunctionReplyObject ObjectShootbackTarget::createObject(const ShootbackTarget &data)
{
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
m_data = data;
if (m_data.id() <= 0)
@@ -62,14 +64,14 @@ Core::FunctionReplyObject ObjectShootbackTarget::createObject(const ShootbackTar
// Publish Data via DTS
onPublishData();
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
return Core::FunctionReplyObject(m_data.id());
}
//------------------------------------------------------------------------------
Core::FunctionReplyObject ObjectShootbackTarget::updateObject(const ShootbackTarget &data)
{
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START, id=" << data.id()
TRACE_LOG(m_logger) << LOGFUNCTION << " START, id=" << data.id()
<< " size =" << data.visibleParticipants().size();
if (!isValid())
return Core::FunctionReplyObject(data.id(), tr_lts("dds", "Object not valid/blocked"));
@@ -89,7 +91,7 @@ Core::FunctionReplyObject ObjectShootbackTarget::updateObject(const ShootbackTar
// Publish Data via DTS
onPublishData();
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END, id=" << data.id()
TRACE_LOG(m_logger) << LOGFUNCTION << " END, id=" << data.id()
<< " size =" << data.visibleParticipants().size();
return Core::FunctionReplyObject(m_data.id());
}
@@ -111,7 +113,7 @@ Core::FunctionReplyObject ObjectShootbackTarget::setUsed(bool isUsed)
//------------------------------------------------------------------------------
Core::FunctionReplyObject ObjectShootbackTarget::removeObject()
{
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
if (isUsed())
return Core::FunctionReplyObject(m_data.id(), tr_lts("dds", "ShootbackTarget still in use"));
@@ -121,7 +123,7 @@ Core::FunctionReplyObject ObjectShootbackTarget::removeObject()
if (!m_mainHandler->dds()->dtsTgt()->removeShootbackTargetByKey(m_data.id()))
return Core::FunctionReplyObject(m_data.id(), tr_lts("dds", "ShootbackTarget with id %1 can not be removed from DDS")).arg(m_data.id());
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
return Core::FunctionReplyObject(m_data.id());
}
@@ -10,7 +10,7 @@
#include "dds_handler.h"
#include "logger.h"
#include <Core/core_types.h>
#include <DDS/Core/function_reply_object.h>
// Generated
#include <TargetManagement/tgt.hpp>
@@ -54,11 +54,12 @@ public:
bool isDifferent(const Database::TgtShootbackTarget &dbData);
protected:
NGL::INGLLogger &m_logger;
void onPublishData();
private:
MainHandler *m_mainHandler;
ShootbackTarget m_data;
NGL::INGLLogger &m_logger;
};
}
@@ -13,19 +13,21 @@
//------------------------------------------------------------------------------
namespace TargetManagement
{
ObjectTargetAreaAssignment::ObjectTargetAreaAssignment(MainHandler *mainHandler) : m_mainHandler(mainHandler),
m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger()) {
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
ObjectTargetAreaAssignment::ObjectTargetAreaAssignment(MainHandler *mainHandler)
: m_mainHandler(mainHandler)
, m_logger(getLogger("ObjectTargetAreaAssignment"))
{
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
}
//------------------------------------------------------------------------------
ObjectTargetAreaAssignment::~ObjectTargetAreaAssignment()
{
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
if (isValid())
m_mainHandler->dds()->dtsTgt()->removeTargetAreaAssignmentByKey(m_data.id());
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
}
//------------------------------------------------------------------------------
@@ -43,7 +45,7 @@ bool ObjectTargetAreaAssignment::isUsed() const
//------------------------------------------------------------------------------
Core::FunctionReplyObject ObjectTargetAreaAssignment::createObject(const TargetAreaAssignment &data)
{
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
m_data = data;
if (m_data.id() <= 0)
@@ -69,14 +71,14 @@ Core::FunctionReplyObject ObjectTargetAreaAssignment::createObject(const TargetA
// Publish Data via DTS
onPublishData();
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
return Core::FunctionReplyObject(m_data.id());
}
//------------------------------------------------------------------------------
Core::FunctionReplyObject ObjectTargetAreaAssignment::updateObject(const TargetAreaAssignment &data)
{
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
if (!isValid())
return Core::FunctionReplyObject(data.id(), tr_lts("dds", "Object not valid/blocked"));
@@ -92,7 +94,7 @@ Core::FunctionReplyObject ObjectTargetAreaAssignment::updateObject(const TargetA
// Publish Data via DTS
onPublishData();
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
return Core::FunctionReplyObject(m_data.id());
}
@@ -113,7 +115,7 @@ Core::FunctionReplyObject ObjectTargetAreaAssignment::setUsed(bool isUsed)
//------------------------------------------------------------------------------
Core::FunctionReplyObject ObjectTargetAreaAssignment::removeObject()
{
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
if (isUsed())
return Core::FunctionReplyObject(m_data.id(), tr_lts("dds", "TargetAreaAssignment still in use"));
@@ -123,7 +125,7 @@ Core::FunctionReplyObject ObjectTargetAreaAssignment::removeObject()
if (!m_mainHandler->dds()->dtsTgt()->removeTargetAreaAssignmentByKey(m_data.id()))
return Core::FunctionReplyObject(m_data.id(), tr_lts("dds", "TargetAreaAssignment with id %1 can not be removed from DDS")).arg(m_data.id());
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
return Core::FunctionReplyObject(m_data.id());
}
@@ -10,7 +10,7 @@
#include "dds_handler.h"
#include "logger.h"
#include <Core/core_types.h>
#include <DDS/Core/function_reply_object.h>
// Generated
#include <TargetManagement/tgt.hpp>
@@ -48,11 +48,12 @@ public:
static TargetAreaAssignment toDdsData(const Database::TgtTargetAreaAssignment &dbData); // db -> dds
protected:
NGL::INGLLogger &m_logger;
void onPublishData();
private:
MainHandler *m_mainHandler;
TargetAreaAssignment m_data;
NGL::INGLLogger &m_logger;
};
}
@@ -6,7 +6,7 @@
*/
#pragma once
#include <QtCore/QString>
#include <QString>
namespace NGL
{
@@ -7,19 +7,18 @@
*/
#include "shootback_controller.h"
#include <utility>
#include "object_shootback_area.h"
#include "object_shootback_target.h"
#include "object_target_area_assignment.h"
#include "main_handler.h"
#include <LtsUtils/LtsUtilsCore/outdated_position.h> // isPositionTimeOutdated
#include <LtsUtilsCore/outdated_position.h> // isPositionTimeOutdated
#include <LtsCoordTrans/lts_coord_trans.h>
#include <ElevationMap/elevation_map.h>
#include <ElevationMap/line_of_sight_calculation.h>
#include <QtCore/QDebug>
#include <QDebug>
#include <QMapIterator>
//------------------------------------------------------------------------------
@@ -67,18 +66,20 @@ QString toString(const std::vector<int> &cont)
//
// class ShootbackController
//
ShootbackController::ShootbackController(MainHandler *mainHandler) : BaseClass(mainHandler)
ShootbackController::ShootbackController(MainHandler *mainHandler)
: BaseClass(mainHandler)
, m_mainHandler(mainHandler)
, m_elevationMap(nullptr)
, m_losCalculation(nullptr),
m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger()) {
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
, m_losCalculation(nullptr)
, m_logger(getLogger("ShootbackController"))
{
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
}
ShootbackController::~ShootbackController()
{
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
// disconnect external "signals"..
disconnect(m_mainHandler->dds()->dtcPpm().get());
@@ -90,27 +91,27 @@ ShootbackController::~ShootbackController()
delete m_losCalculation;
m_losCalculation = nullptr;
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
}
bool ShootbackController::initLOS(SituationMap::ElevationMap *elevationMap)
{
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START, elevationMap = " << elevationMap
TRACE_LOG(m_logger) << LOGFUNCTION << " START, elevationMap = " << elevationMap
<< " isValid = " << elevationMap->isValid();
if (!elevationMap->isValid())
{
ERROR_LOG(m_logger) << Q_FUNC_INFO << " elevationMap not valid -> return";
ERROR_LOG(m_logger) << LOGFUNCTION << " elevationMap not valid -> return";
return false;
}
delete m_losCalculation;
m_elevationMap = elevationMap;
INFO_LOG(m_logger) << Q_FUNC_INFO << " m_elevationMap.isValid() =" << m_elevationMap->isValid();
INFO_LOG(m_logger) << LOGFUNCTION << " m_elevationMap.isValid() =" << m_elevationMap->isValid();
m_losCalculation = new SituationMap::LineOfSightCalculation(m_elevationMap);
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
return true;
}
@@ -150,7 +151,7 @@ bool ShootbackController::initDds(std::shared_ptr<HandlerShootbackArea> handlerA
void ShootbackController::onShootbackAreaChanged1(qint32 areaId, bool removed)
{
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START" << " shootbackAreaId=" << areaId << " removed=" << removed;
TRACE_LOG(m_logger) << LOGFUNCTION << " START" << " shootbackAreaId=" << areaId << " removed=" << removed;
if (removed)
{
@@ -167,7 +168,7 @@ void ShootbackController::onShootbackAreaChanged1(qint32 areaId, bool removed)
auto it = areaMap.find(areaId);
if (it == areaMap.end())
{
ERROR_LOG(m_logger) << Q_FUNC_INFO << " obj changes, but connot be found" << " shootbackAreaId=" << areaId;
ERROR_LOG(m_logger) << LOGFUNCTION << " obj changes, but connot be found" << " shootbackAreaId=" << areaId;
return;
}
onShootbackAreaChanged2(*(it.value()));
@@ -175,13 +176,13 @@ void ShootbackController::onShootbackAreaChanged1(qint32 areaId, bool removed)
}
syncExternal();
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END" << " shootbackAreaId=" << areaId << " removed=" << removed;
TRACE_LOG(m_logger) << LOGFUNCTION << " END" << " shootbackAreaId=" << areaId << " removed=" << removed;
}
void ShootbackController::onShootbackAreaChanged2(const TargetManagement::ObjectShootbackArea &area)
{
const int areaId = area.getId();
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START" << " shootbackAreaId=" << areaId;
TRACE_LOG(m_logger) << LOGFUNCTION << " START" << " shootbackAreaId=" << areaId;
// handle new/modified area and check all participants:
const QMap<qint32, ParticipantManagement::ParticipantPosition> &participantPositions =
@@ -192,12 +193,12 @@ void ShootbackController::onShootbackAreaChanged2(const TargetManagement::Object
updateInternal_participantPerArea(area, posData);
} // for
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END" << " shootbackAreaId=" << areaId;
TRACE_LOG(m_logger) << LOGFUNCTION << " END" << " shootbackAreaId=" << areaId;
}
void ShootbackController::onShootbackTargetChanged(qint32 targetId, bool removed)
{
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START" << ", targetId=" << targetId << ", removed=" << removed;
TRACE_LOG(m_logger) << LOGFUNCTION << " START" << ", targetId=" << targetId << ", removed=" << removed;
// Note:
// updateInternalLos is not required if (removed == true)
@@ -213,12 +214,12 @@ void ShootbackController::onShootbackTargetChanged(qint32 targetId, bool removed
updateInternalLos({}, {}, {targetId});
syncExternal();
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END" << " targetId=" << targetId << " removed=" << removed;
TRACE_LOG(m_logger) << LOGFUNCTION << " END" << " targetId=" << targetId << " removed=" << removed;
}
void ShootbackController::onTargetAreaAssignmentChanged(qint32 assignmentId, bool removed)
{
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START" << " assignmentId=" << assignmentId << " removed=" << removed;
TRACE_LOG(m_logger) << LOGFUNCTION << " START" << " assignmentId=" << assignmentId << " removed=" << removed;
// Note:
// updateInternalLos is not required on removed == true
@@ -230,16 +231,16 @@ void ShootbackController::onTargetAreaAssignmentChanged(qint32 assignmentId, boo
updateInternalLos({assignmentId}, {}, {});
syncExternal();
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END" << " assignmentId=" << assignmentId << " removed=" << removed;
TRACE_LOG(m_logger) << LOGFUNCTION << " END" << " assignmentId=" << assignmentId << " removed=" << removed;
}
void ShootbackController::onParticipantPositionChanged(const ParticipantManagement::ParticipantPosition &posData, DataModification modType)
{
TRACE_LOG(m_logger) << Q_FUNC_INFO << " participantId changed, participantId=" << posData << " mod=" << modType;
TRACE_LOG(m_logger) << LOGFUNCTION << " participantId changed, participantId=" << posData << " mod=" << modType;
if (!participantPositionTopicIsValid(posData))
{
// DEBUG_LOG(m_logger) << Q_FUNC_INFO << " NOT VALID, participantId=" << posData.participantId();
// DEBUG_LOG(m_logger) << LOGFUNCTION << " NOT VALID, participantId=" << posData.participantId();
return;
}
@@ -248,24 +249,24 @@ void ShootbackController::onParticipantPositionChanged(const ParticipantManageme
bool bIsTarget = false;
if (isTarget(participantId, bIsTarget) && bIsTarget)
{
INFO_LOG(m_logger) << Q_FUNC_INFO << " TARGET, participantId=" << participantId;
INFO_LOG(m_logger) << LOGFUNCTION << " TARGET, participantId=" << participantId;
ObjectShootbackTarget *osbTarget = m_handlerShootbackTarget->dataForTargetParticipantId(participantId);
if (!osbTarget)
{
ERROR_LOG(m_logger) << Q_FUNC_INFO << " ObjectShootbackTarget not found for participantId=" << participantId;
ERROR_LOG(m_logger) << LOGFUNCTION << " ObjectShootbackTarget not found for participantId=" << participantId;
return;
}
osbTarget->updateVolatileData(posData.pos());
}
INFO_LOG(m_logger) << Q_FUNC_INFO << " participantId=" << participantId << ", isTarget=" << bIsTarget;
INFO_LOG(m_logger) << LOGFUNCTION << " participantId=" << participantId << ", isTarget=" << bIsTarget;
if ((modType == DataModification::eAdded) || (modType == DataModification::eModified))
{
// update
const QHash<int, ObjectShootbackArea *> &objMap = m_handlerShootbackArea->getObjectMap();
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " objMap.size" << objMap.size();
DEBUG_LOG(m_logger) << LOGFUNCTION << " objMap.size" << objMap.size();
QMapIterator< int, QSet<int>> it(m_participantsPerArea);
while (it.hasNext())
@@ -274,7 +275,7 @@ void ShootbackController::onParticipantPositionChanged(const ParticipantManageme
DEBUG_LOG(m_logger) << " areaId = " << it.key() << "-> partIdRef VORHERXX" << toString(it.value());
}
for (const auto &area : std::as_const(objMap))
for (const auto &area : qAsConst(objMap))
{
if (area)
updateInternal_participantPerArea(*area, posData);
@@ -321,7 +322,7 @@ bool ShootbackController::isTarget(qint32 participantId, bool &bIsTarget) const
std::shared_ptr<ParticipantManagement::Interface::Dtc> dtcPpm = m_mainHandler->dds()->dtcPpm();
if (!dtcPpm)
{
ERROR_LOG(m_logger) << Q_FUNC_INFO << " no dtcPpm, return";
ERROR_LOG(m_logger) << LOGFUNCTION << " no dtcPpm, return";
return false;
}
@@ -373,7 +374,7 @@ void ShootbackController::updateInternal_participantPerArea(const ObjectShootbac
DEBUG_LOG(m_logger) << " areaId = " << area.getId() << " ---> partIdRef VORHER" << toString(partIdRef);
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " "
DEBUG_LOG(m_logger) << LOGFUNCTION << " "
<< " shootbackAreaId=" << areaId
<< " shootbackAreaName=" << area.getName()
<< " area.position=" << area.getData().position()
@@ -386,13 +387,13 @@ void ShootbackController::updateInternal_participantPerArea(const ObjectShootbac
{
// ENTER
partIdRef.insert(participantId);
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " ENTER: participantId=" << participantId << " areaId=" << areaId;
DEBUG_LOG(m_logger) << LOGFUNCTION << " ENTER: participantId=" << participantId << " areaId=" << areaId;
}
else if (!contains && alreadyInCont)
{
// LEAVE
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " ENTER: participantId=" << participantId << " areaId=" << areaId;
DEBUG_LOG(m_logger) << LOGFUNCTION << " ENTER: participantId=" << participantId << " areaId=" << areaId;
partIdRef.remove(participantId);
}
@@ -452,7 +453,7 @@ QSet<int> ShootbackController::areasWithParticipant(qint32 participantId) const
QSet<int> ShootbackController::assignmentsWithTargetParticipantId(qint32 targetParticipantId) const
{
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START" << " targetParticipantId=" << targetParticipantId;
TRACE_LOG(m_logger) << LOGFUNCTION << " START" << " targetParticipantId=" << targetParticipantId;
QSet<int> ret;
// all assignments
@@ -466,7 +467,7 @@ QSet<int> ShootbackController::assignmentsWithTargetParticipantId(qint32 targetP
ret += targetAreaAssignment->getId();
} // for
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END" << " areaId=" << targetParticipantId;
TRACE_LOG(m_logger) << LOGFUNCTION << " END" << " areaId=" << targetParticipantId;
return ret;
}
@@ -482,7 +483,7 @@ void ShootbackController::updateInternalLos(const QSet<int> &changingAssignmentI
const QSet<int> &changingTartgetIds, // ~dynamic
int changedParticipantId) // ~dynamic
{
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " START"
DEBUG_LOG(m_logger) << LOGFUNCTION << " START"
<< ", changingAssigmentIds=" << toString(changingAssignmentIds)
<< ", changingAreaIds=" << toString(changingAreaIds)
<< ", changingTartgetIds=" << toString(changingTartgetIds)
@@ -490,13 +491,13 @@ void ShootbackController::updateInternalLos(const QSet<int> &changingAssignmentI
// loop over every assignment
const QHash<int, ObjectTargetAreaAssignment *> &allAssignments = m_handlerTargetAreaAssignment->getObjectMap();
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " allAssignments.size() " << allAssignments.size();
DEBUG_LOG(m_logger) << LOGFUNCTION << " allAssignments.size() " << allAssignments.size();
for (ObjectTargetAreaAssignment *assignment : allAssignments)
{
if (!assignment)
{
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " continue, curAssignment " << assignment->getId();
DEBUG_LOG(m_logger) << LOGFUNCTION << " continue, curAssignment " << assignment->getId();
continue;
}
@@ -504,7 +505,7 @@ void ShootbackController::updateInternalLos(const QSet<int> &changingAssignmentI
const int assignmentId = assignment->getId();
if (!idIsRelevantHelper(changingAssignmentIds, assignmentId))
{
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " continue, curAssignment " << assignment->getId();
DEBUG_LOG(m_logger) << LOGFUNCTION << " continue, curAssignment " << assignment->getId();
continue;
}
@@ -514,7 +515,7 @@ void ShootbackController::updateInternalLos(const QSet<int> &changingAssignmentI
const int areaId = assignmentData.areaId();
if (!idIsRelevantHelper(changingAreaIds, areaId))
{
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " continue, curAssignment " << assignment->getId();
DEBUG_LOG(m_logger) << LOGFUNCTION << " continue, curAssignment " << assignment->getId();
continue;
}
@@ -523,7 +524,7 @@ void ShootbackController::updateInternalLos(const QSet<int> &changingAssignmentI
const int targetDataId = m_handlerShootbackTarget->targetDataIdForTargetParticipantId(targetParticpantId);
if (!idIsRelevantHelper(changingTartgetIds, targetDataId))
{
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " continue, curAssignment " << assignment->getId()
DEBUG_LOG(m_logger) << LOGFUNCTION << " continue, curAssignment " << assignment->getId()
<< ", changingTartgetIds=" << toString(changingTartgetIds)
<< ", targetParticpantId=" << targetParticpantId
<< ", targetDataId=" << targetDataId;
@@ -535,13 +536,13 @@ void ShootbackController::updateInternalLos(const QSet<int> &changingAssignmentI
{
// Note: m_participantsPerArea is up-to-date
QSet<int> areasWithPart = areasWithParticipant(changedParticipantId);
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " areasWithPart=" << areasWithPart.size();
for (auto curAreaId : std::as_const(areasWithPart))
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " -> curAreaId=" << curAreaId;
DEBUG_LOG(m_logger) << LOGFUNCTION << " areasWithPart=" << areasWithPart.size();
for (auto curAreaId : qAsConst(areasWithPart))
DEBUG_LOG(m_logger) << LOGFUNCTION << " -> curAreaId=" << curAreaId;
if (!idIsRelevantHelper(areasWithPart, areaId))
{
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " continue, curAssignment " << assignment->getId();
DEBUG_LOG(m_logger) << LOGFUNCTION << " continue, curAssignment " << assignment->getId();
continue;
}
}
@@ -550,11 +551,11 @@ void ShootbackController::updateInternalLos(const QSet<int> &changingAssignmentI
// one assignment -> single target, single area, some participants (which are in that single area):
if (!updateInternalLosSingleAssignment(assignment))
ERROR_LOG(m_logger) << Q_FUNC_INFO << " updateInternalLosSingleAssignment failed, assignmentId=" << assignment->getId();
ERROR_LOG(m_logger) << LOGFUNCTION << " updateInternalLosSingleAssignment failed, assignmentId=" << assignment->getId();
} // for
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END"
TRACE_LOG(m_logger) << LOGFUNCTION << " END"
<< ", changingAssigmentIds=" << changingAssignmentIds.size()
<< ", changingAreaIds=" << changingAreaIds.size()
<< ", changingTartgetIds=" << changingTartgetIds.size()
@@ -566,14 +567,14 @@ bool ShootbackController::updateInternalLosSingleAssignment(ObjectTargetAreaAssi
if (!assignment)
return false;
const int assignmentId = assignment->getId();
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START, assignmentId=" << assignmentId;
TRACE_LOG(m_logger) << LOGFUNCTION << " START, assignmentId=" << assignmentId;
const TargetAreaAssignment &assignmentData = assignment->getData();
const int areaId = assignmentData.areaId();
const int targetParticipantId = assignmentData.targetParticipantId();
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " START, assignmentId=" << assignmentId
DEBUG_LOG(m_logger) << LOGFUNCTION << " START, assignmentId=" << assignmentId
<< ", areaId = " << areaId
<< ", targetParticipantId = " << targetParticipantId;
@@ -584,14 +585,14 @@ bool ShootbackController::updateInternalLosSingleAssignment(ObjectTargetAreaAssi
// Neverless, for this assignment -> area there are no participants visible:
// clear container:
m_visibleParticipantsPerAssignment[assignmentId] = {};
ERROR_LOG(m_logger) << Q_FUNC_INFO << " no area for areaId=" << areaId;
ERROR_LOG(m_logger) << LOGFUNCTION << " no area for areaId=" << areaId;
return false;
}
ObjectShootbackTarget *target = m_handlerShootbackTarget->dataForTargetParticipantId(targetParticipantId);
if (!target)
{
ERROR_LOG(m_logger) << Q_FUNC_INFO << " no target for targetParticipantId=" << targetParticipantId;
ERROR_LOG(m_logger) << LOGFUNCTION << " no target for targetParticipantId=" << targetParticipantId;
return false;
}
@@ -600,10 +601,10 @@ bool ShootbackController::updateInternalLosSingleAssignment(ObjectTargetAreaAssi
if (m_participantsPerArea.contains(areaId))
{
QSet<int> &partIdRef = m_participantsPerArea[areaId];
for (auto participantId : std::as_const(partIdRef))
for (auto participantId : qAsConst(partIdRef))
{
// check lineOfSight:
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " check lineOfSight for: assignmentId=" << assignmentId
DEBUG_LOG(m_logger) << LOGFUNCTION << " check lineOfSight for: assignmentId=" << assignmentId
<< ", areaId = " << areaId
<< ", targetParticipantId = " << targetParticipantId
<< ", participantId=" << participantId;
@@ -618,13 +619,13 @@ bool ShootbackController::updateInternalLosSingleAssignment(ObjectTargetAreaAssi
if (participantPos.participantId() != participantId)
{
ERROR_LOG(m_logger) << Q_FUNC_INFO << " no position for participantId=" << participantId;
ERROR_LOG(m_logger) << LOGFUNCTION << " no position for participantId=" << participantId;
return false;
}
const Core::GeoPosition &participantGeoPos = participantPos.pos();
bool visi = lineOfSight(sbTargetGeoPos, participantGeoPos);
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " current targetId = " << target->getId() << " visi = " << visi;
DEBUG_LOG(m_logger) << LOGFUNCTION << " current targetId = " << target->getId() << " visi = " << visi;
if (visi)
visiPartCont.insert(participantId);
@@ -634,19 +635,19 @@ bool ShootbackController::updateInternalLosSingleAssignment(ObjectTargetAreaAssi
} // if (m_participantsPerArea.contains(areaId))
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " assignmentId = " << assignmentId
DEBUG_LOG(m_logger) << LOGFUNCTION << " assignmentId = " << assignmentId
<< " visiPartCont.size() " << visiPartCont.size();
// store at member
m_visibleParticipantsPerAssignment[assignmentId] = visiPartCont;
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END, assignmentId=" << assignmentId;
TRACE_LOG(m_logger) << LOGFUNCTION << " END, assignmentId=" << assignmentId;
return true;
}
QSet<int> ShootbackController::visibleParticipantsPerTargetParticipantId(int targetParticipantId)
{
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START, targetParticipantId = " << targetParticipantId;
TRACE_LOG(m_logger) << LOGFUNCTION << " START, targetParticipantId = " << targetParticipantId;
QSet<int> visiPartPerTarget;
@@ -657,19 +658,19 @@ QSet<int> ShootbackController::visibleParticipantsPerTargetParticipantId(int tar
visiPartPerTarget += m_visibleParticipantsPerAssignment[assignmentId];
}
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END, targetParticipantId = " << targetParticipantId
TRACE_LOG(m_logger) << LOGFUNCTION << " END, targetParticipantId = " << targetParticipantId
<< ", visiPartPerTarget = " << toString(visiPartPerTarget);
return visiPartPerTarget;
}
void ShootbackController::syncExternal()
{
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
// loop over all targets
const QHash<int, ObjectShootbackTarget *> &allTargets = m_handlerShootbackTarget->getObjectMap();
INFO_LOG(m_logger) << Q_FUNC_INFO << " allTargets.size() " << allTargets.size();
INFO_LOG(m_logger) << LOGFUNCTION << " allTargets.size() " << allTargets.size();
for (ObjectShootbackTarget *target : allTargets)
{
@@ -679,8 +680,8 @@ void ShootbackController::syncExternal()
const QSet<int> &visiPartPerTarget = visibleParticipantsPerTargetParticipantId(target->getTargetParticipantId()); // QSet -> unique and sorted
std::vector<int32_t> visiPartPerTargetStd;
visiPartPerTargetStd.reserve(visiPartPerTarget.size());
INFO_LOG(m_logger) << Q_FUNC_INFO << " targetId " << target->getId() << ", visiPartPerTarget = " << toString(visiPartPerTarget);
for (auto id : std::as_const(visiPartPerTarget))
INFO_LOG(m_logger) << LOGFUNCTION << " targetId " << target->getId() << ", visiPartPerTarget = " << toString(visiPartPerTarget);
for (auto id : qAsConst(visiPartPerTarget))
visiPartPerTargetStd.push_back(id);
@@ -688,26 +689,26 @@ void ShootbackController::syncExternal()
if (visiPartPerTargetStd != sbTarget.visibleParticipants())
{
// data has changed
INFO_LOG(m_logger) << Q_FUNC_INFO << " targetId differ -> updateObject..";
INFO_LOG(m_logger) << Q_FUNC_INFO << " visiOld =" << toString(sbTarget.visibleParticipants());
INFO_LOG(m_logger) << Q_FUNC_INFO << " visiNew =" << toString(visiPartPerTargetStd);
INFO_LOG(m_logger) << LOGFUNCTION << " targetId differ -> updateObject..";
INFO_LOG(m_logger) << LOGFUNCTION << " visiOld =" << toString(sbTarget.visibleParticipants());
INFO_LOG(m_logger) << LOGFUNCTION << " visiNew =" << toString(visiPartPerTargetStd);
target->updateVolatileData(visiPartPerTargetStd); // update and publish
}
} // for
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
}
bool ShootbackController::lineOfSight(const Core::GeoPosition &observerPos, const Core::GeoPosition &targetPos) const
{
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " calculate m_losCalculation = " << m_losCalculation
DEBUG_LOG(m_logger) << LOGFUNCTION << " calculate m_losCalculation = " << m_losCalculation
<< ", observerPos=" << observerPos
<< ", targetPos=" << targetPos;
if (!m_losCalculation)
{
ERROR_LOG(m_logger) << Q_FUNC_INFO << " Error: no m_losCalculation";
ERROR_LOG(m_logger) << LOGFUNCTION << " Error: no m_losCalculation";
return false;
}
@@ -719,7 +720,7 @@ bool ShootbackController::lineOfSight(const Core::GeoPosition &observerPos, cons
if (!success)
{
ERROR_LOG(m_logger) << Q_FUNC_INFO << " calculate failed:"
ERROR_LOG(m_logger) << LOGFUNCTION << " calculate failed:"
<< " observerPos=" << observerPos
<< " targetPos=" << targetPos;
return false;
@@ -14,7 +14,7 @@
#include "handler_shootback_target.h"
#include "handler_target_area_assignment.h"
#include <QtCore/QMap>
#include <QMap>
namespace NGL
{
@@ -61,7 +61,6 @@ protected Q_SLOTS:
void onParticipantPositionChanged(const ParticipantManagement::ParticipantPosition &posData, DataModification modType);
protected:
NGL::INGLLogger &m_logger;
bool participantPositionTopicIsValid(const ParticipantManagement::ParticipantPosition &posData);
bool isTarget(qint32 participantId, bool &bIsTarget) const;
@@ -98,6 +97,9 @@ private:
SituationMap::ElevationMap *m_elevationMap; // do not delete at dtor
SituationMap::LineOfSightCalculation *m_losCalculation;
NGL::INGLLogger &m_logger;
};
} // namespace TargetManagement