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:
1 parent
c143ff8a4f
commit
d5af8b9764
1244 files changed
+4266
-4633
No files matched your search
+72
-71
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user