Adds immediate migration results in progress

This commit is contained in:
torsten committed 2026-08-19 11:18:24 +02:00
1 parent 8453e104c5
commit 3bb6e89496
2102 files changed
+17482 -15071

No files matched your search

@@ -230,16 +230,16 @@ void BuildingManager::Tick(const dtEntity::Message &message)
dtEntityOSG::LayerAttachPointComponent *lac;
if (!mEntityManager->GetComponent(dspl.mAttachPointId, lac))
{
WARNING_LOG() << "NO sLayerAttachPointComponent";
WARNING_LOG(m_logger) << "NO sLayerAttachPointComponent";
return;
}
if( shotdspl.mGeode.valid())
{
DEBUG_LOG() << "displayTimeOver OVER KILL IT drawables: !" << shotdspl.mGeode->getNumDrawables();
DEBUG_LOG(m_logger) << "displayTimeOver OVER KILL IT drawables: !" << shotdspl.mGeode->getNumDrawables();
while (shotdspl.mGeode->getNumDrawables() > 0)
shotdspl.mGeode->removeDrawables(0, shotdspl.mGeode->getNumDrawables());
bool ret = lac->GetNode()->asGroup()->removeChild(shotdspl.mGeode);
DEBUG_LOG() << "displayTimeOver OVER KILL IT! result: " << ret;
DEBUG_LOG(m_logger) << "displayTimeOver OVER KILL IT! result: " << ret;
dtEntity::GetWindowInterface()->RequestRedraw(dspl.mContextId);
@@ -248,7 +248,7 @@ void BuildingManager::Tick(const dtEntity::Message &message)
if (lifeTimeOver)
{
DEBUG_LOG() << "lifeTimeOver OVER ERASE IT!";
DEBUG_LOG(m_logger) << "lifeTimeOver OVER ERASE IT!";
itShotDisplay = dspl.mShotDisplays.erase(itShotDisplay);
}
else
@@ -280,7 +280,7 @@ bool BuildingManager::getFloorOfRoom(const std::string &bdlgFeatureId, int roomN
void BuildingManager::updateShotDuration(unsigned int newDuration_s)
{
DEBUG_LOG() << Q_FUNC_INFO << " newDuration_s= " << newDuration_s;
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " newDuration_s= " << newDuration_s;
QMutexLocker locker(&m_mutexShots);
@@ -294,7 +294,7 @@ void BuildingManager::updateShotDuration(unsigned int newDuration_s)
if (!building->mDisplays.empty())
{
BuildingDisplay buildingDisplay = building->mDisplays.front();
DEBUG_LOG() << Q_FUNC_INFO << " buildingDisplay.mContextId " << buildingDisplay.mContextId;
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " buildingDisplay.mContextId " << buildingDisplay.mContextId;
updateShots(*building, buildingDisplay);
dtEntity::GetWindowInterface()->RequestRedraw(buildingDisplay.mContextId);
}
@@ -426,7 +426,7 @@ bool BuildingManager::displayBuilding(const std::string& featureId, unsigned int
bool BuildingManager::displayBuilding(unsigned int contextid, dtEntity::EntityId buildingid, const osg::Vec4& bgcolor, ViewMode viewmode, bool exactPos)
{
DEBUG_LOG() << "BuildingManager::displayBuilding";
DEBUG_LOG(m_logger) << "BuildingManager::displayBuilding";
mExactPos = exactPos;
dtEntity::EntityManager &em = *mEntityManager;
@@ -629,7 +629,7 @@ bool BuildingManager::displayBuilding(unsigned int contextid, dtEntity::EntityId
{
DEBUG_LOG() << "mDevices.size = " << building->mDevices.size();
DEBUG_LOG(m_logger) << "mDevices.size = " << building->mDevices.size();
if (!building->mDevices.empty())
{
for (Device *d : building->mDevices)
@@ -1333,7 +1333,7 @@ void BuildingManager::updatePlayerPosition(const std::string &navmeshgrpname, dt
osg::Vec3d BuildingManager::remapPosition(const Building &bd, const BuildingDisplay &dspl, const osg::Vec3d &world, int roomNumber)
{
DEBUG_LOG() << Q_FUNC_INFO << " mFeatureId = " << bd.mFeatureId.c_str()
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " mFeatureId = " << bd.mFeatureId.c_str()
<< ", roomNumber= " << roomNumber;
if (roomNumber > 0)
@@ -1349,7 +1349,7 @@ osg::Vec3d BuildingManager::remapPosition(const Building &bd, const BuildingDisp
if (level.mFloorId == floorOut)
{
const osg::Vec3d &l = world * bd.mWorldToLocal;
DEBUG_LOG() << Q_FUNC_INFO << " mFeatureId = " << bd.mFeatureId.c_str()
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " mFeatureId = " << bd.mFeatureId.c_str()
<< ", roomNumber= " << roomNumber
<< ", floorOut= " << floorOut
<< ", world.z()= " << world.z()
@@ -1369,7 +1369,7 @@ osg::Vec3d BuildingManager::remapPosition(const Building &bd, const BuildingDisp
if (i == (numlevels - 1) || (dspl.mLevels[i + 1].mHeightAboveGround - 0.1f) > l[2])
{
const BuildingLevel &level = dspl.mLevels[i];
DEBUG_LOG() << Q_FUNC_INFO
DEBUG_LOG(m_logger) << Q_FUNC_INFO
<< " remapXPosition"
<< ", l.z=" << l.z()
<< ", i=" << i
@@ -1603,11 +1603,11 @@ dtEntity::EntityId BuildingManager::getWorldPlayerIdFromLocalPlayer(dtEntity::En
void BuildingManager::removeShoot(int32_t id)
{
DEBUG_LOG() << "removeShoot id=" << id;
DEBUG_LOG(m_logger) << "removeShoot id=" << id;
QMutexLocker locker(&m_mutexShots);
for (Building *bldg : mBuildings)
{
DEBUG_LOG() << "Vorher: bldg->mShots.size()=" << bldg->mShots.size();
DEBUG_LOG(m_logger) << "Vorher: bldg->mShots.size()=" << bldg->mShots.size();
auto it = std::remove_if(bldg->mShots.begin(), bldg->mShots.end(),
[id]( Shot *shot)
{
@@ -1625,12 +1625,12 @@ void BuildingManager::removeShoot(int32_t id)
bool wasRemoved = (it != bldg->mShots.end());
bldg->mShots.erase(it, bldg->mShots.end());
DEBUG_LOG() << "Nachher: bldg->mShots.size()=" << bldg->mShots.size();
DEBUG_LOG(m_logger) << "Nachher: bldg->mShots.size()=" << bldg->mShots.size();
if (wasRemoved)
for (BuildingDisplay &dspl : bldg->mDisplays)
{
DEBUG_LOG() << "wasRemoved id=" << id;
DEBUG_LOG(m_logger) << "wasRemoved id=" << id;
updateShots(*bldg, dspl);
dtEntity::GetWindowInterface()->RequestRedraw(dspl.mContextId);
}
@@ -1694,13 +1694,13 @@ void BuildingManager::showShoot(int32_t id, dtEntity::EntityId shooter, dtEntity
}
}
bldg->mShots.push_back(shot);
DEBUG_LOG() << "XXXX SIM TIME CREATED = " << QString::number(_simTimeCreated, 'f', 5) << " and SIM TIME IS " <<QString::number(dtEntity::GetSystemInterface()->GetSimulationTime(), 'f', 5);
DEBUG_LOG(m_logger) << "XXXX SIM TIME CREATED = " << QString::number(_simTimeCreated, 'f', 5) << " and SIM TIME IS " <<QString::number(dtEntity::GetSystemInterface()->GetSimulationTime(), 'f', 5);
for (BuildingDisplay &bldgDispl : bldg->mDisplays)
{
ShotDisplay shotDispl;
shotDispl.mShot = shot;
DEBUG_LOG() << "mShotDisplays.push_back id=" << shot->getId();
DEBUG_LOG(m_logger) << "mShotDisplays.push_back id=" << shot->getId();
bldgDispl.mShotDisplays.push_back(std::move(shotDispl));
updateShots(*bldg, bldgDispl);
@@ -1715,7 +1715,7 @@ void BuildingManager::showShoot(int32_t id, dtEntity::EntityId shooter, dtEntity
void BuildingManager::updateShots(const Building &bd, BuildingDisplay &dspl)
{
DEBUG_LOG() << Q_FUNC_INFO << " Building= " << bd.mWorldBuildingId;
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " Building= " << bd.mWorldBuildingId;
dtEntityOSG::CameraComponent *camcomp;
if (!mEntityManager->GetComponent(dspl.mCameraId, camcomp))
@@ -1728,7 +1728,7 @@ void BuildingManager::updateShots(const Building &bd, BuildingDisplay &dspl)
const double simTime = dtEntity::GetSystemInterface()->GetSimulationTime();
DEBUG_LOG() << Q_FUNC_INFO << " dspl.mShotDisplays.size()= " << dspl.mShotDisplays.size()
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " dspl.mShotDisplays.size()= " << dspl.mShotDisplays.size()
<< ", simTime=" << (int)simTime;
for (ShotDisplay &shotdspl : dspl.mShotDisplays)
@@ -1754,7 +1754,7 @@ void BuildingManager::updateShots(const Building &bd, BuildingDisplay &dspl)
if (shotdspl.mGeode)
numParents = shotdspl.mGeode->getNumParents();
DEBUG_LOG() << Q_FUNC_INFO << " BB shotdspl.mShot->getId()= " << shotdspl.mShot->getId()
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " BB shotdspl.mShot->getId()= " << shotdspl.mShot->getId()
<< ", shotdspl.mGeode=" << shotdspl.mGeode
<< ", shotdspl.mGeode->getNumParents=" << numParents
<< ", bDisplay=" << bDisplay;
@@ -1762,7 +1762,7 @@ void BuildingManager::updateShots(const Building &bd, BuildingDisplay &dspl)
if ((!shotdspl.mGeode || shotdspl.mGeode->getNumParents() == 0) && bDisplay)
{
DEBUG_LOG() << "NEW mGeode! id " << shotdspl.mShot->getId();
DEBUG_LOG(m_logger) << "NEW mGeode! id " << shotdspl.mShot->getId();
if (!shotdspl.mGeode)
shotdspl.mGeode = new osg::Geode();
@@ -1770,7 +1770,7 @@ void BuildingManager::updateShots(const Building &bd, BuildingDisplay &dspl)
ss->setMode(GL_DEPTH_TEST, osg::StateAttribute::OFF);
ss->setRenderBinDetails(240001, "RenderBin");
osg::ref_ptr<osg::LineWidth> lw = new osg::LineWidth();
DEBUG_LOG() << "NEW LINE " << shotdspl.mShot->getLineType();
DEBUG_LOG(m_logger) << "NEW LINE " << shotdspl.mShot->getLineType();
if (shotdspl.mShot->getLineType() < 2 )
{
@@ -1806,7 +1806,7 @@ void BuildingManager::updateShots(const Building &bd, BuildingDisplay &dspl)
shooterpos[2] += 1;
targetpos[2] += 1;
DEBUG_LOG() << Q_FUNC_INFO << " shotdspl.mShot->getId()= " << shotdspl.mShot->getId()
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " shotdspl.mShot->getId()= " << shotdspl.mShot->getId()
<< ", getShooterPos.z()=" << shotdspl.mShot->getShooterPos().z()
<< ", BuildingIdSrc=" << shotdspl.mShot->getBuildingIdSrc() << ", RoomNumberSrc=" << shotdspl.mShot->getRoomNumberSrc()
<< ", shooterpos=" << shooterpos
@@ -1906,16 +1906,16 @@ void BuildingManager::updateDevices(const Building &bd, BuildingDisplay &dspl)
void BuildingManager::addDeviceToBuilding(dtEntity::EntityId iconmainid, dtEntity::EntityId buildingid,
const osg::Vec3d &pos, const std::string &iconpath)
{
DEBUG_LOG() << "addDeviceToBuilding";
DEBUG_LOG(m_logger) << "addDeviceToBuilding";
for (Building *building : mBuildings)
{
DEBUG_LOG() << "mWorldBuildingId=" << building->mWorldBuildingId
DEBUG_LOG(m_logger) << "mWorldBuildingId=" << building->mWorldBuildingId
<< " buildingid=" << buildingid;
if (building->mWorldBuildingId != buildingid)
continue;
DEBUG_LOG() << "addDeviceToBuilding 1";
DEBUG_LOG(m_logger) << "addDeviceToBuilding 1";
Device *device = new Device();
device->mWorldPlayerId = iconmainid;
@@ -1923,10 +1923,10 @@ void BuildingManager::addDeviceToBuilding(dtEntity::EntityId iconmainid, dtEntit
device->mPosition = pos;
building->mDevices.push_back(device);
DEBUG_LOG() << "building->mDisplays.size=" << building->mDisplays.size();
DEBUG_LOG(m_logger) << "building->mDisplays.size=" << building->mDisplays.size();
for (BuildingDisplay &dspl : building->mDisplays)
{
DEBUG_LOG() << "addDeviceToBuilding 2";
DEBUG_LOG(m_logger) << "addDeviceToBuilding 2";
DeviceDisplay dd;
dd.mDevice = device;
dd.mWorldPlayerId = iconmainid;
@@ -196,6 +196,7 @@ public:
int32_t getId() const { return mId; }
private:
NGL::INGLLogger &m_logger;
int32_t mId;
osg::Vec3d mShooterPos;
osg::Vec3d mTargetPos;
@@ -424,6 +425,7 @@ public:
void setCallbackCamPosChanged(const CallbackCamPosChanged &cb);
private:
NGL::INGLLogger &m_logger;
void updateShots(const Building &bd, BuildingDisplay &dspl);
void updateDevices(const Building &bd, BuildingDisplay &dspl);
void createRoomNames(dtEntity::EntityId buildingid, Building& building);
@@ -308,6 +308,8 @@ public:
}
private:
NGL::INGLLogger &m_logger;
bool open(const std::string& strFeatureID, bool exactPos);
bool open(const std::vector<std::string> &vecFeatureIDs, bool exactPos);
bool openAll(bool exactPos);
@@ -70,7 +70,7 @@ void CommunicationInterfaceInternal::playerPlace(int playerID, const LtsUtils::Q
auto it = m_playerId2String.find(playerID);
if (it == m_playerId2String.end())
{
WARNING_LOG() << "Trying to set player position for unknown (=not created) player with id " << playerID;
WARNING_LOG(m_logger) << "Trying to set player position for unknown (=not created) player with id " << playerID;
return;
}
@@ -148,7 +148,7 @@ void CommunicationInterfaceInternal::playerHit(const int32_t id, int playerIdSrc
int buildingIdSrc, int roomNumberSrc, int buildingIdDst, int roomNumberDst,
int lineType, int64_t time)
{
DEBUG_LOG() << "playerHit id= " << id;
DEBUG_LOG(m_logger) << "playerHit id= " << id;
const std::string playerIdStrDst = m_playerId2String.value(playerIdDst);
const std::string playerIdStrSrc = m_playerId2String.value(playerIdSrc);
const VCtrl::Vec3d src(posSrc.x(), posSrc.y(), posSrc.z());
@@ -162,7 +162,7 @@ void CommunicationInterfaceInternal::playerHit(const int32_t id, int playerIdSrc
void CommunicationInterfaceInternal::buildingHit(const int32_t id, int buildingId, int damagePercent, const QMap<int,int>& mapRoomDestructions)
{
DEBUG_LOG() << "buildingHit for building " << buildingId
DEBUG_LOG(m_logger) << "buildingHit for building " << buildingId
<< " id=" << id
<< " damagePercent " << damagePercent
<< " roomlist size: " << mapRoomDestructions.size();
@@ -181,12 +181,12 @@ void CommunicationInterfaceInternal::buildingHit(const int32_t id, int buildingI
for (auto it = mapRoomDestructions.begin(); it != mapRoomDestructions.end(); ++it)
{
const int roomNumber = it.key();
DEBUG_LOG() << "BuildingId " << buildingId
DEBUG_LOG(m_logger) << "BuildingId " << buildingId
<< ", room: "<< roomNumber
<< ", destruction: " << it.value();
std::string roomNumberStr = createRoomNumberString(roomNumber);
if (!m_pviewerInterface->SetRoomDestructionValue(buildingIdStr, roomNumberStr,it.value() / 100.f))
ERROR_LOG() << "SetRoomDestructionValue failed for room "<< roomNumber;
ERROR_LOG(m_logger) << "SetRoomDestructionValue failed for room "<< roomNumber;
}
}
}
@@ -201,7 +201,7 @@ void CommunicationInterfaceInternal::roomHit(const int32_t id, int playerIdSrc,
const std::string roomNumberStrDst = createRoomNumberString(roomNumber);
const VCtrl::Vec3d src(posSrc.x(), posSrc.y(), posSrc.z());
DEBUG_LOG() << "roomHit for building palyer " << playerIdStrSrc
DEBUG_LOG(m_logger) << "roomHit for building palyer " << playerIdStrSrc
<< " building " << buildingIdStrDst
<< " room " << roomNumberStrDst
<< " id=" << id;
@@ -212,7 +212,7 @@ void CommunicationInterfaceInternal::roomHit(const int32_t id, int playerIdSrc,
void CommunicationInterfaceInternal::removeRoomHit(const int32_t id)
{
DEBUG_LOG() << "removeRoomHit id=" << id;
DEBUG_LOG(m_logger) << "removeRoomHit id=" << id;
m_pviewerInterface->removeShoot(id);
}
@@ -285,21 +285,21 @@ void CommunicationInterfaceInternal::systemSetMountingPoint(const Infrastructure
if(!show)
{
DEBUG_LOG() << "Hiding mounting point \"" << mountingPointName<< "\"";
DEBUG_LOG(m_logger) << "Hiding mounting point \"" << mountingPointName<< "\"";
m_pviewerInterface->HideDeviceIcon(mountingPointName.toStdString());
return;
}
if(m_deviceMap.contains(mountingPointName))
{
WARNING_LOG() << "Trying to add a mounting point which was already added - trying to re-add";
WARNING_LOG(m_logger) << "Trying to add a mounting point which was already added - trying to re-add";
m_pviewerInterface->HideDeviceIcon(mountingPointName.toStdString());
}
const VCtrl::Vec3d position(x,y,z);
if(m_pviewerInterface->ShowDeviceIcon(mountingPointName.toStdString(), buildingIdStr, position, filename.toStdString())) {
DEBUG_LOG() << "Added mounting point to scene: " << mountingPointName;
DEBUG_LOG(m_logger) << "Added mounting point to scene: " << mountingPointName;
m_deviceMap[mountingPointName] = DeviceInfo(buildingId, mountingPointName);
}
}
@@ -333,7 +333,7 @@ void CommunicationInterfaceInternal::excDeleteBuildingList()
void CommunicationInterfaceInternal::excSetHitlineDuration(uint32_t duration_s)
{
DEBUG_LOG() << "excSetHitlineDuration=" << duration_s;
DEBUG_LOG(m_logger) << "excSetHitlineDuration=" << duration_s;
m_pviewerInterface->setHitLineDuration(duration_s);
}
@@ -451,7 +451,7 @@ void CommunicationInterfaceInternal::clearCameras()
if (!di.deviceName.startsWith(QLatin1String("Camera")))
continue;
if (!m_pviewerInterface->HideDeviceIcon(di.deviceName.toStdString()))
ERROR_LOG() << "Could not remove camera with id " << di.deviceName;
ERROR_LOG(m_logger) << "Could not remove camera with id " << di.deviceName;
}
m_deviceMap.clear();
}
@@ -497,10 +497,10 @@ void CommunicationInterfaceInternal::PlayerPicked(const std::string &strId)
QString str = QString::fromStdString(strId);
int structureElementId = str.remove(0, str.lastIndexOf(QStringLiteral("_")) + 1).toInt();
INFO_LOG() << "Picked mounting point with id " << strId
INFO_LOG(m_logger) << "Picked mounting point with id " << strId
<< " mountingPointId=" << structureElementId;
if(structureElementId < 0) {
WARNING_LOG() << "Picked mounting point with id " << strId;
WARNING_LOG(m_logger) << "Picked mounting point with id " << strId;
return;
}
@@ -137,6 +137,8 @@ Q_SIGNALS:
private:
NGL::INGLLogger &m_logger;
void clearCameras();
QHash<QString, DeviceInfo> m_deviceMap;
@@ -182,7 +182,7 @@ QString BgViewerController::buildingModelPath()
void BgViewerController::clearInterfaces(const LtsSession::DdsConnectionParams &conParams)
{
DEBUG_LOG() << "BgViewerControllerSingleton::clearInterfaces()";
DEBUG_LOG(m_logger) << "BgViewerControllerSingleton::clearInterfaces()";
if (m_pBgViewerDDSController && m_currentDdsConnParams == conParams)
{
m_pBgViewerDDSController->uninitialize();
@@ -219,13 +219,13 @@ PluginProvider *BgViewerController::activeSession() const
bool BgViewerController::init(PluginProvider *pSession, bool bStartRendering, const QString &modelPath)
{
DEBUG_LOG() << "getDdsController init: " << pSession->toString();
DEBUG_LOG(m_logger) << "getDdsController init: " << pSession->toString();
if (m_currentDdsConnParams == pSession->connParams())
{
if (m_initExerciseWasSuccessful)
{
DEBUG_LOG() << "BgViewerControllerSingleton::init Already initialized";
DEBUG_LOG(m_logger) << "BgViewerControllerSingleton::init Already initialized";
slotLoadBuilding();
@@ -251,7 +251,7 @@ bool BgViewerController::forceInit(PluginProvider *pSession)
delete m_pBgViewerDDSController;
m_pBgViewerDDSController = new BuildingViewerDdsController(m_comIfc, m_viewerInterface);
DEBUG_LOG() << "FORCE INIT! with " << pSession;
DEBUG_LOG(m_logger) << "FORCE INIT! with " << pSession;
return (m_pBgViewerDDSController->init(m_bgViewerBaseLayoutWidget, buildingModelPath(), pSession));
}
@@ -281,11 +281,11 @@ void BgViewerController::showBgViewerInfoMessageBox()
bool BgViewerController::startBgViewerAppInSession(PluginProvider* pStartingSession)
{
DEBUG_LOG() << std::hex << this << " startBgViewerAppInSession " << (m_currentDdsConnParams == pStartingSession->connParams());
DEBUG_LOG(m_logger) << std::hex << this << " startBgViewerAppInSession " << (m_currentDdsConnParams == pStartingSession->connParams());
if (m_bgvApp && (m_currentDdsConnParams == pStartingSession->connParams()))
{
INFO_LOG() << std::hex << this << " BuildingViewer already opened. Doing nothing...";
INFO_LOG(m_logger) << std::hex << this << " BuildingViewer already opened. Doing nothing...";
return true;
}
@@ -298,7 +298,7 @@ bool BgViewerController::startBgViewerAppInSession(PluginProvider* pStartingSess
if (m_bgvApp)
{
DEBUG_LOG() << std::hex << this << " Releasing m_bgvApp";
DEBUG_LOG(m_logger) << std::hex << this << " Releasing m_bgvApp";
delete m_bgvApp;
m_bgvApp = nullptr;
@@ -310,7 +310,7 @@ bool BgViewerController::startBgViewerAppInSession(PluginProvider* pStartingSess
m_bgvApp = LtsAppManager::LtsAppManager::getInstance()->createApp(LtsAppDescriptor::App::BuildingViewer, pStartingSession->connParams());
if (!m_bgvApp || !m_bgvApp->sessions().size())
{
ERROR_LOG() << std::hex << this << " m_bgvApp is nullptr or has no associated session!";
ERROR_LOG(m_logger) << std::hex << this << " m_bgvApp is nullptr or has no associated session!";
return false;
}
@@ -335,7 +335,7 @@ bool BgViewerController::startBgViewerAppInSession(PluginProvider* pStartingSess
connect(m_bgvApp, &LtsPluginManager::LtsPluginManager::destroyed,
this, [this]()
{
DEBUG_LOG() << std::hex << this << " LtsPluginManager destroyed m_bgvApp";
DEBUG_LOG(m_logger) << std::hex << this << " LtsPluginManager destroyed m_bgvApp";
m_tickTimer->stop();
clearInterfaces(m_currentDdsConnParams);
m_comIfc->excCloseAllViews();
@@ -102,6 +102,8 @@ private slots:
void slotWidgetReleased();
private:
NGL::INGLLogger &m_logger;
void showBgViewerInfoMessageBox();
private:
@@ -35,10 +35,9 @@ static inline QString gStrSymbolFolderPath()
return QDir::tempPath() + QStringLiteral("/excon_bgviewer_symbols/");
}
BuildingViewerDdsController::BuildingViewerDdsController(CommunicationInterfaceInternal *connection, VCtrl::ViewerInterface* viewerInterface)
: m_connection(connection)
, m_viewerInterface(viewerInterface)
{}
BuildingViewerDdsController::BuildingViewerDdsController(CommunicationInterfaceInternal *connection, VCtrl::ViewerInterface* viewerInterface) : m_connection(connection)
, m_viewerInterface(viewerInterface),
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {}
BuildingViewerDdsController::~BuildingViewerDdsController()
@@ -52,7 +51,7 @@ BuildingViewerDdsController::~BuildingViewerDdsController()
bool BuildingViewerDdsController::init(QWidget *irreplacableWidget, const QString &modelPath, PluginProvider *session)
{
DEBUG_LOG() << "BDV:: init";
DEBUG_LOG(m_logger) << "BDV:: init";
m_session = session;
m_irreplacableWidget = irreplacableWidget;
@@ -61,7 +60,7 @@ bool BuildingViewerDdsController::init(QWidget *irreplacableWidget, const QStrin
if (!m_session)
{
ERROR_LOG() << "No m_session for BuildingViewerController!";
ERROR_LOG(m_logger) << "No m_session for BuildingViewerController!";
return false;
}
@@ -71,7 +70,7 @@ bool BuildingViewerDdsController::init(QWidget *irreplacableWidget, const QStrin
{
m_session = nullptr;
DEBUG_LOG() << getSessionInfo() << "BDV:: BuildingViewerDdsController: m_session has been destroyed!";
DEBUG_LOG(m_logger) << getSessionInfo() << "BDV:: BuildingViewerDdsController: m_session has been destroyed!";
stopAndClearTimer();
uninitialize();
}
@@ -80,35 +79,35 @@ bool BuildingViewerDdsController::init(QWidget *irreplacableWidget, const QStrin
m_asbIfc = session->asbIfc();
if (!m_asbIfc)
{
ERROR_LOG() << "Fetching 'm_asbIfc' failed!";
ERROR_LOG(m_logger) << "Fetching 'm_asbIfc' failed!";
return false;
}
m_bldDtc = session->bldDtc();
if (!m_bldDtc)
{
ERROR_LOG() << "Fetching 'm_bldDtc' failed!";
ERROR_LOG(m_logger) << "Fetching 'm_bldDtc' failed!";
return false;
}
m_ismDtc = session->ismDtc();
if (!m_ismDtc)
{
ERROR_LOG() << "Fetching 'm_ismDtc' failed!";
ERROR_LOG(m_logger) << "Fetching 'm_ismDtc' failed!";
return false;
}
m_pdmDtc = session->pdmDtc();
if (!m_pdmDtc)
{
ERROR_LOG() << "Fetching 'm_pdmDtc' failed!";
ERROR_LOG(m_logger) << "Fetching 'm_pdmDtc' failed!";
return false;
}
m_ismIfc = session->ismDataIfc();
if (!m_ismIfc)
{
WARNING_LOG() << "Fetching 'm_ismIfc' failed!";
WARNING_LOG(m_logger) << "Fetching 'm_ismIfc' failed!";
return false;
}
connect(m_ismIfc.get(), &InfrastructureManagement::ForeignDataInterface::mountingPointChanged,
@@ -132,7 +131,7 @@ bool BuildingViewerDdsController::init(QWidget *irreplacableWidget, const QStrin
if (!dir.mkpath(QStringLiteral(".")))
{
ERROR_LOG() << getSessionInfo() << "Could not create path \"" << gStrSymbolFolderPath() << "\" which is required to store BgViewer symbol files!";
ERROR_LOG(m_logger) << getSessionInfo() << "Could not create path \"" << gStrSymbolFolderPath() << "\" which is required to store BgViewer symbol files!";
return false;
}
@@ -140,7 +139,7 @@ bool BuildingViewerDdsController::init(QWidget *irreplacableWidget, const QStrin
connect(m_connection, &CommunicationInterfaceInternal::signalAssetPicked, this, &BuildingViewerDdsController::onAssetPicked, Qt::UniqueConnection);
connect(m_connection, &CommunicationInterfaceInternal::signalBgViewerInitFinished, this, &BuildingViewerDdsController::onBgViewerInitFinished, Qt::UniqueConnection);
INFO_LOG() << getSessionInfo() << "BuildingViewerDdsController::init: The order of the following output must be [1],[2],[3],[4],[5],[6]";
INFO_LOG(m_logger) << getSessionInfo() << "BuildingViewerDdsController::init: The order of the following output must be [1],[2],[3],[4],[5],[6]";
@@ -169,10 +168,10 @@ bool BuildingViewerDdsController::init(QWidget *irreplacableWidget, const QStrin
void BuildingViewerDdsController::onBgViewerInitFinished()
{
DEBUG_LOG() << "onBgViewerInitFinished";
DEBUG_LOG(m_logger) << "onBgViewerInitFinished";
INFO_LOG() << getSessionInfo() << "[2] Training area initialization acknowledged by BgViewer";
INFO_LOG() << getSessionInfo() << "[3] Sending mounting points, teams, ..., to BgViewer";
INFO_LOG(m_logger) << getSessionInfo() << "[2] Training area initialization acknowledged by BgViewer";
INFO_LOG(m_logger) << getSessionInfo() << "[3] Sending mounting points, teams, ..., to BgViewer";
if (!m_pSimTimeSyncTimer)
{
@@ -192,7 +191,7 @@ void BuildingViewerDdsController::onBgViewerInitFinished()
const bool useExactPositioning = ps->value(QStringLiteral("bld"), QStringLiteral("useExactPositioning")).toBool();
m_connection->excUseExactPositioning(useExactPositioning);
INFO_LOG() << getSessionInfo() << "[4] Getting building DDS data ('mainStructureElements')";
INFO_LOG(m_logger) << getSessionInfo() << "[4] Getting building DDS data ('mainStructureElements')";
connect(m_ismDtc.get(), &InfrastructureManagement::Interface::Dtc::mainStructureElementChanged,
this, &BuildingViewerDdsController::onMainStructureElementChanged);
@@ -200,17 +199,17 @@ void BuildingViewerDdsController::onBgViewerInitFinished()
{
onMainStructureElementChanged(data, DataModification::eAdded);
});
INFO_LOG() << getSessionInfo() << "\t[4.1] Done";
INFO_LOG(m_logger) << getSessionInfo() << "\t[4.1] Done";
INFO_LOG() << getSessionInfo() << "[5] Creating participants";
INFO_LOG(m_logger) << getSessionInfo() << "[5] Creating participants";
createParticipants();
INFO_LOG() << getSessionInfo() << "\t[5.1] Done";
INFO_LOG() << getSessionInfo() << "[5] Creating Booby Trap";
INFO_LOG(m_logger) << getSessionInfo() << "\t[5.1] Done";
INFO_LOG(m_logger) << getSessionInfo() << "[5] Creating Booby Trap";
createBoobyTraps();
INFO_LOG() << getSessionInfo() << "\t[5.2] Done";
INFO_LOG(m_logger) << getSessionInfo() << "\t[5.2] Done";
INFO_LOG() << getSessionInfo() << "[6] Getting building DDS data ('buildingStates')";
INFO_LOG(m_logger) << getSessionInfo() << "[6] Getting building DDS data ('buildingStates')";
connect(m_bldDtc.get(), &Buildings::Interface::Dtc::buildingStateChanged,
this, &BuildingViewerDdsController::onBuildingStateChanged, Qt::UniqueConnection);
m_bldDtc->buildingStates([this](const Buildings::BuildingState & data)
@@ -219,7 +218,7 @@ void BuildingViewerDdsController::onBgViewerInitFinished()
});
connect(m_bldDtc.get(), &Buildings::Interface::Dtc::buildingHitLineInfoChanged,
this, &BuildingViewerDdsController::onBuildingHitLineInfoChanged, Qt::UniqueConnection);
INFO_LOG() << getSessionInfo() << "\t[6.1] Done";
INFO_LOG(m_logger) << getSessionInfo() << "\t[6.1] Done";
m_connection->excSetGlobalTransparency(LtsUtils::OperatorSettings::getInstance()->value(QStringLiteral("BgViewer"), QStringLiteral("GlobalTransparency"), 75).toInt() );
@@ -259,7 +258,7 @@ void BuildingViewerDdsController::onBgViewerInitFinished()
}
m_pBuildingHitlineCleanupTimer->start();
INFO_LOG() << getSessionInfo() << "[7] Emitting 'signalDdsInitFinished'";
INFO_LOG(m_logger) << getSessionInfo() << "[7] Emitting 'signalDdsInitFinished'";
m_ddsInitFinished = true;
emit signalDdsInitFinished();
onSynchronizeSimulationTime();
@@ -269,7 +268,7 @@ void BuildingViewerDdsController::onBgViewerInitFinished()
void BuildingViewerDdsController::stopAndClearTimer()
{
DEBUG_LOG() << "stopAndClearTimer";
DEBUG_LOG(m_logger) << "stopAndClearTimer";
if (m_pFireEventFlashTimer)
m_pFireEventFlashTimer->stop();
@@ -284,15 +283,15 @@ void BuildingViewerDdsController::stopAndClearTimer()
void BuildingViewerDdsController::uninitialize()
{
DEBUG_LOG() << "uninitialize";
DEBUG_LOG(m_logger) << "uninitialize";
if (!m_bldDtc)
return;
if (m_ddsInitFinished)
DEBUG_LOG() << "Flag 'm_ddsInitFinished' set which means that initialization had been finished completely";
DEBUG_LOG(m_logger) << "Flag 'm_ddsInitFinished' set which means that initialization had been finished completely";
else
WARNING_LOG() << "Flag 'm_ddsInitFinished' has not been set within timeout value, forcing quit!";
WARNING_LOG(m_logger) << "Flag 'm_ddsInitFinished' has not been set within timeout value, forcing quit!";
stopAndClearTimer();
@@ -321,7 +320,7 @@ void BuildingViewerDdsController::uninitialize()
m_ddsInitFinished = false;
m_buildingHeight.clear();
DEBUG_LOG() << "BuildingViewerDdsController::uninitialize() finished";
DEBUG_LOG(m_logger) << "BuildingViewerDdsController::uninitialize() finished";
}
QPointF BuildingViewerDdsController::toRelativePosition(const Core::GeoPosition &geoPos) const
@@ -344,7 +343,7 @@ LtsUtils::QPoint3D BuildingViewerDdsController::toRelative3D(const Core::GeoPosi
bool BuildingViewerDdsController::clear()
{
DEBUG_LOG() << "clear m_connection->playerClear();";
DEBUG_LOG(m_logger) << "clear m_connection->playerClear();";
m_connection->playerClear();
return true;
}
@@ -354,7 +353,7 @@ bool BuildingViewerDdsController::syncTeams()
{
if (!m_ppmDtc)
return false;
INFO_LOG() << "BuildingViewerDdsController::syncTeams";
INFO_LOG(m_logger) << "BuildingViewerDdsController::syncTeams";
m_connection->setTeamConfiguration(m_ppmDtc->partys());
return true;
@@ -386,7 +385,7 @@ bool BuildingViewerDdsController::calcBaseCoordinate(const QMap<qint32, Infrastr
}
if (!bAtLeasOneFound)
{
WARNING_LOG() << "No building available in exercise " << m_exerciseId;
WARNING_LOG(m_logger) << "No building available in exercise " << m_exerciseId;
return false;
}
m_baseCoordinate = LtsCoordTrans::UtmCoordinate::fromGeographic(geoPosition.lon(), geoPosition.lat());
@@ -405,7 +404,7 @@ bool BuildingViewerDdsController::writeBuildingDataToXML(const QString &modelPat
QFile f(getBuildingConfigurationXml());
if (!f.open(QIODevice::WriteOnly))
{
WARNING_LOG() << "Can not open file " << f.fileName() << " for writing: " << f.errorString();
WARNING_LOG(m_logger) << "Can not open file " << f.fileName() << " for writing: " << f.errorString();
return false;
}
m_knownBuildings.clear();
@@ -416,7 +415,7 @@ bool BuildingViewerDdsController::writeBuildingDataToXML(const QString &modelPat
if (!jsonConfig.exists())
jsonConfig.setFileName(modelPath + QStringLiteral("/../buildings.json"));
DEBUG_LOG() << "jsonConfig:" << jsonConfig.fileName();
DEBUG_LOG(m_logger) << "jsonConfig:" << jsonConfig.fileName();
if (jsonConfig.exists() && jsonConfig.open(QIODevice::ReadOnly))
{
m_ismDtc->disconnect(this);
@@ -444,17 +443,17 @@ bool BuildingViewerDdsController::writeBuildingDataToXML(const QString &modelPat
continue;
if (!m_ismDtc->isElementAssignedToExercise(mse, m_exerciseId))
{
DEBUG_LOG() << "Not writing mse with id " << mse.id() << " to building xml file since it is not assigned to the current exercise which has id " << m_exerciseId;
DEBUG_LOG(m_logger) << "Not writing mse with id " << mse.id() << " to building xml file since it is not assigned to the current exercise which has id " << m_exerciseId;
continue;
}
mseMap.insert(mse.id(), mse);
}
}
INFO_LOG() << getSessionInfo() << "writeBuildingDataToXML(): Identified Main Structure Elements: " << mseMap.size();
INFO_LOG(m_logger) << getSessionInfo() << "writeBuildingDataToXML(): Identified Main Structure Elements: " << mseMap.size();
if (!calcBaseCoordinate(mseMap))
{
WARNING_LOG() << "failed to calc base coordinate";
WARNING_LOG(m_logger) << "failed to calc base coordinate";
return false;
}
@@ -530,7 +529,7 @@ QString BuildingViewerDdsController::getBuildingConfigurationXml() const
void BuildingViewerDdsController::clearAssets()
{
INFO_LOG() << "clearAssets: Removing " << m_knownAssetsInBgViewer.size() << " assets";
INFO_LOG(m_logger) << "clearAssets: Removing " << m_knownAssetsInBgViewer.size() << " assets";
for (const auto &strUniqueAsset : std::as_const(m_knownAssetsInBgViewer))
m_connection->extHideMountingPointAsset(strUniqueAsset);
@@ -635,13 +634,13 @@ void BuildingViewerDdsController::handleMountingPoint(const InfrastructureManage
QString strfeatureID = BuildingViewer::databaseId2FeatureId(mp.buildingId());
QString strMountingPointID = strfeatureID + QStringLiteral("_MountingPoint_") + QString::number(mountingPointId);
DEBUG_LOG() << "Sending asset for building id " << mp.buildingId() << " ("<<strfeatureID<<")"
DEBUG_LOG(m_logger) << "Sending asset for building id " << mp.buildingId() << " ("<<strfeatureID<<")"
<< " with asset_id " << mp.associatedAssetId()
<< " matched to structure_element_id " << mp.id() << " as \"" << strMountingPointID <<" \""
<< " with asset type \"" << strAssetType << "\"";
if (m_mountingPointId2AssetType.contains(mountingPointId))
WARNING_LOG() << "Mounting point id " << mountingPointId << " already used for other asset?! Overriding...";
WARNING_LOG(m_logger) << "Mounting point id " << mountingPointId << " already used for other asset?! Overriding...";
m_mountingPointId2AssetType[mountingPointId] = assetType;
m_knownAssetsInBgViewer[mountingPointId] = strMountingPointID;
@@ -653,24 +652,24 @@ void BuildingViewerDdsController::setCurrentTrainingAreaMap(const QString &model
{
if (!m_connection)
{
WARNING_LOG() << "BuildingViewerDdsController::setCurrentTrainingAreaMap: (!m_connection)";
WARNING_LOG(m_logger) << "BuildingViewerDdsController::setCurrentTrainingAreaMap: (!m_connection)";
return;
}
m_connection->excDeleteBuildingList();
INFO_LOG() << getSessionInfo() << "[1] Initializing BgViewer with training area...";
INFO_LOG(m_logger) << getSessionInfo() << "[1] Initializing BgViewer with training area...";
if (modelPath.isEmpty())
{
QString strErr = tr("Error initializing Building Viewer - can not find map directory.");
DEBUG_LOG() << getSessionInfo() << "setCurrentTrainingAreaMap: " << strErr;
DEBUG_LOG(m_logger) << getSessionInfo() << "setCurrentTrainingAreaMap: " << strErr;
QWidget *parentWidgetx = (m_viewerInterface ? m_viewerInterface->getMainWindow() : nullptr);
LtsWidgets::LtsMessageDialog::showMessage(parentWidgetx, strErr, tr("Error"));
return;
}
INFO_LOG() << "Map path for building viewer: " << modelPath;
INFO_LOG(m_logger) << "Map path for building viewer: " << modelPath;
writeBuildingDataToXML(modelPath);
@@ -715,14 +714,14 @@ bool BuildingViewerDdsController::isValidParticipant(const ParticipantManagement
if (participant.id() == 0)
{
if (m_logger.isDebugEnabled())
DEBUG_LOG() << getSessionInfo() << "isValidParticipant: Not handling invalid participant with invalid id (0)";
DEBUG_LOG(m_logger) << getSessionInfo() << "isValidParticipant: Not handling invalid participant with invalid id (0)";
return false;
}
if (participant.isDeleted())
{
DEBUG_LOG() << getSessionInfo() << "isValidParticipant: Not handling participant with id "
DEBUG_LOG(m_logger) << getSessionInfo() << "isValidParticipant: Not handling participant with id "
<< participant.id() << " since it is marked as 'deleted'";
return false;
}
@@ -733,7 +732,7 @@ bool BuildingViewerDdsController::isValidParticipant(const ParticipantManagement
if (!m_session->isVisibleParty(participant.partyId()))
{
DEBUG_LOG() << getSessionInfo() << "isValidParticipant: Not handling participant with id "
DEBUG_LOG(m_logger) << getSessionInfo() << "isValidParticipant: Not handling participant with id "
<< participant.id() << " since it is not visible for party with id " << participant.partyId();
return false;
}
@@ -746,7 +745,7 @@ bool BuildingViewerDdsController::isValidParticipant(const ParticipantManagement
if(tc == ParticipantManagement::TypeClass_def::SupportUnit ||
tc == ParticipantManagement::TypeClass_def::Unit)
{
DEBUG_LOG() << getSessionInfo() << "isValidParticipant: Not handling participant with id "
DEBUG_LOG(m_logger) << getSessionInfo() << "isValidParticipant: Not handling participant with id "
<< participant.id() << " since its type is 'SupportUnit', 'Unit' or 'Structure'";
return false;
}
@@ -758,7 +757,7 @@ void BuildingViewerDdsController::createBoobyTraps()
{
if (!m_aesDtc)
return;
DEBUG_LOG() << "BDV:: create Booby Traps: "<< m_session->exerciseId() << " is replay: " << m_session->isReplayPartition();
DEBUG_LOG(m_logger) << "BDV:: create Booby Traps: "<< m_session->exerciseId() << " is replay: " << m_session->isReplayPartition();
m_aesDtc->enableBoobyTrap();
@@ -787,7 +786,7 @@ void BuildingViewerDdsController::createParticipants()
{
if (!m_ppmDtc)
return;
DEBUG_LOG() << "BDV:: create participants: "<< m_session->exerciseId() << " is replay: " << m_session->isReplayPartition();
DEBUG_LOG(m_logger) << "BDV:: create participants: "<< m_session->exerciseId() << " is replay: " << m_session->isReplayPartition();
const int sizeL = LtsUtils::OperatorSettings::getInstance()->value(QStringLiteral("BgViewer"), QStringLiteral("PlayerSymbolSize"), 20).toInt();
@@ -906,11 +905,11 @@ void BuildingViewerDdsController::onDynParticipantChanged(const ParticipantManag
void BuildingViewerDdsController::onHitLineInfoChanged(const ParticipantManagement::HitLineInfo &hli, DataModification modType)
{
DEBUG_LOG() << "X 0000 onHitLineInfoChanged id=" << hli.id();
DEBUG_LOG(m_logger) << "X 0000 onHitLineInfoChanged id=" << hli.id();
if (modType == DataModification::eRemoved)
{
DEBUG_LOG() << "onHitLineInfoChanged removeHit id=" << hli.id();
DEBUG_LOG(m_logger) << "onHitLineInfoChanged removeHit id=" << hli.id();
m_connection->removeRoomHit(hli.id());
return;
}
@@ -923,14 +922,14 @@ void BuildingViewerDdsController::onHitLineInfoChanged(const ParticipantManageme
const ParticipantManagement::Participant &partDst = m_ppmDtc->participant(hli.injuryParticipantId());
if (partSrc.id() == 0 || partDst.id() == 0)
{
ERROR_LOG() << "no knownn part: " << partSrc.id() << " dst: " << partDst.id();
ERROR_LOG(m_logger) << "no knownn part: " << partSrc.id() << " dst: " << partDst.id();
return;
}
const QString &strFeatureID = BuildingViewer::databaseId2FeatureId(hli.injuryBuildingId());
if (!m_viewerInterface->isViewOpen(strFeatureID.toStdString()))
{
DEBUG_LOG() << "building not opened: hli.buildingId()=" << hli;
DEBUG_LOG(m_logger) << "building not opened: hli.buildingId()=" << hli;
return;
}
@@ -946,14 +945,14 @@ void BuildingViewerDdsController::onHitLineInfoChanged(const ParticipantManageme
{
const QVector<BuildingHit> &bHits = itBuildingHit.value();
DEBUG_LOG() << "Got Hit lines to add? " << bHits.size();
DEBUG_LOG(m_logger) << "Got Hit lines to add? " << bHits.size();
for (const BuildingHit &bh : bHits)
{
const bool testFlag = (bh.chargeTypeId == hli.chargeTypeId() &&
bh.originatorParticipantId == hli.originatorParticipantId() &&
hli.sampleTime() - m_hitlineDuration_ms < bh.sampleTime);
DEBUG_LOG() << "testFlag " << testFlag;
DEBUG_LOG(m_logger) << "testFlag " << testFlag;
if (bh.chargeTypeId == hli.chargeTypeId() &&
@@ -964,10 +963,10 @@ void BuildingViewerDdsController::onHitLineInfoChanged(const ParticipantManageme
}
}
DEBUG_LOG() << "onHitLineInfoChanged: " << hli;
DEBUG_LOG(m_logger) << "onHitLineInfoChanged: " << hli;
int sizeL = LtsUtils::OperatorSettings::getInstance()->value(QStringLiteral("BgViewer"), QStringLiteral("PlayerSymbolSize"), 20).toInt();
DEBUG_LOG() << "onHitLineInfoChanged createPlayerSymbols";
DEBUG_LOG(m_logger) << "onHitLineInfoChanged createPlayerSymbols";
createPlayerSymbols(partDst, sizeL);
@@ -975,7 +974,7 @@ void BuildingViewerDdsController::onHitLineInfoChanged(const ParticipantManageme
LtsUtils::QPoint3D originatorSrc = toRelative3D(hli.originatorPos());
LtsUtils::QPoint3D injuryDest = toRelative3D(hli.injuryPos());
DEBUG_LOG() << "onHitLineInfoChanged playerHit"
DEBUG_LOG(m_logger) << "onHitLineInfoChanged playerHit"
<< " hli.originatorPos() z=" << hli.originatorPos().z()
<< " hli.injuryPos() z=" <<hli.injuryPos().z()
<< " Src=" << originatorSrc.x() << "/" << originatorSrc.y() << "/" << originatorSrc.z()
@@ -986,7 +985,7 @@ void BuildingViewerDdsController::onHitLineInfoChanged(const ParticipantManageme
<< " hli.injuryRoomId=" << hli.injuryRoomId();
DEBUG_LOG() << "Before z-correction:"
DEBUG_LOG(m_logger) << "Before z-correction:"
<< " Src=" << originatorSrc.x() << "/" << originatorSrc.y() << "/" << originatorSrc.z()
<< " Dest= " << injuryDest.x() << "/" << injuryDest.y() << "/" << injuryDest.z();
@@ -999,8 +998,8 @@ void BuildingViewerDdsController::onHitLineInfoChanged(const ParticipantManageme
double zAddOriginator = m_buildingHeight.value(hli.originatorBuildingId(), 0);
double zAddInjury = m_buildingHeight.value(hli.injuryBuildingId(), 0);
DEBUG_LOG() << "z-correction: zAddOriginator=" << zAddOriginator;
DEBUG_LOG() << "z-correction: zAddInjury=" << zAddInjury;
DEBUG_LOG(m_logger) << "z-correction: zAddOriginator=" << zAddOriginator;
DEBUG_LOG(m_logger) << "z-correction: zAddInjury=" << zAddInjury;
if (hli.originatorBuildingId() <= 0)
zAddOriginator = zAddInjury;
@@ -1011,7 +1010,7 @@ void BuildingViewerDdsController::onHitLineInfoChanged(const ParticipantManageme
originatorSrc.setZ(originatorSrc.z() + zAddInjury);
injuryDest.setZ(injuryDest.z() + zAddInjury);
DEBUG_LOG() << "After z-correction:"
DEBUG_LOG(m_logger) << "After z-correction:"
<< " Src=" << originatorSrc.x() << "/" << originatorSrc.y() << "/" << originatorSrc.z()
<< " Dest= " << injuryDest.x() << "/" << injuryDest.y() << "/" << injuryDest.z();
@@ -1033,7 +1032,7 @@ void BuildingViewerDdsController::onHitLineInfoChanged(const ParticipantManageme
roomNumberSrc = itRoom.value();
}
else
WARNING_LOG() << "onHitLineInfoChanged: Room id can not be mapped! Building id: " << hli.injuryBuildingId()<<", originatorRoomId: "<< hli.originatorRoomId();
WARNING_LOG(m_logger) << "onHitLineInfoChanged: Room id can not be mapped! Building id: " << hli.injuryBuildingId()<<", originatorRoomId: "<< hli.originatorRoomId();
}
}
@@ -1051,11 +1050,11 @@ void BuildingViewerDdsController::onHitLineInfoChanged(const ParticipantManageme
roomNumberDst = itRoom.value();
}
else
WARNING_LOG() << "onHitLineInfoChanged: Room id can not be mapped! Building id: " << hli.injuryBuildingId()<<", room id: "<< hli.injuryRoomId();
WARNING_LOG(m_logger) << "onHitLineInfoChanged: Room id can not be mapped! Building id: " << hli.injuryBuildingId()<<", room id: "<< hli.injuryRoomId();
}
}
DEBUG_LOG() << "After translate buildingId, roomId:"
DEBUG_LOG(m_logger) << "After translate buildingId, roomId:"
<< " hli.originatorBuildingId=" << hli.originatorBuildingId() << " -> " << buildingIdSrc
<< " hli.originatorRoomId=" << hli.originatorRoomId() << " -> " << roomNumberSrc
<< " hli.injuryBuildingId=" << hli.injuryBuildingId() << " -> " << buildingIdDst
@@ -1097,7 +1096,7 @@ void BuildingViewerDdsController::onPositionChanged(const ParticipantManagement:
return;
}
DEBUG_LOG() << "onPositionChanged: " << position;
DEBUG_LOG(m_logger) << "onPositionChanged: " << position;
@@ -1117,7 +1116,7 @@ void BuildingViewerDdsController::onPositionChanged(const ParticipantManagement:
}
else
{
WARNING_LOG() << "onPositionChanged: Room id can not be mapped! Building id: " << position.buildingId()<<", room id: "<< position.roomId();
WARNING_LOG(m_logger) << "onPositionChanged: Room id can not be mapped! Building id: " << position.buildingId()<<", room id: "<< position.roomId();
}
}
@@ -1156,7 +1155,7 @@ void BuildingViewerDdsController::onPositionChanged(const ParticipantManagement:
if (!m_baseCoordinate.isValid())
{
WARNING_LOG() << "not calling playerPlace as there is no base coordinate set - are there no buildings in this exercise?";
WARNING_LOG(m_logger) << "not calling playerPlace as there is no base coordinate set - are there no buildings in this exercise?";
return;
}
@@ -1195,7 +1194,7 @@ void BuildingViewerDdsController::createParticipant(const ParticipantManagement:
{
if (!m_baseCoordinate.isValid())
{
WARNING_LOG() << "not calling playerPlace as there is no base coordinate set - are there no buildings in this exercise?";
WARNING_LOG(m_logger) << "not calling playerPlace as there is no base coordinate set - are there no buildings in this exercise?";
return;
}
@@ -1240,8 +1239,8 @@ void BuildingViewerDdsController::createBoobyTrap(const AreaEffectSimulation::Bo
pos.lat() = trap.impactPosition().lat();
pos.lon() = trap.impactPosition().lon();
DEBUG_LOG() << "Try create Booby trap with id " << trap.id() << " internal id " << participant.id();
DEBUG_LOG() << "Try create Booby trap with pos " << pos.lat() << " " << pos.lon();
DEBUG_LOG(m_logger) << "Try create Booby trap with id " << trap.id() << " internal id " << participant.id();
DEBUG_LOG(m_logger) << "Try create Booby trap with pos " << pos.lat() << " " << pos.lon();
m_connection->playerCreate(participant.id(), participant.partyId(),
buildPlayerSymbolFilePath(participant.id()),
toRelative3D(pos),
@@ -1321,7 +1320,7 @@ void BuildingViewerDdsController::createSymbolResultWatcher(const ParticipantMan
std::shared_ptr<int> symbolWatcherDeleter(nullptr, [this, pSymbolWatcher, symbolWatcherBenchmark](int *)
{
if (symbolWatcherBenchmark && pSymbolWatcher->m_et != nullptr)
DEBUG_LOG() << "Symbol creation took " << pSymbolWatcher->m_et->elapsed() << " ms";
DEBUG_LOG(m_logger) << "Symbol creation took " << pSymbolWatcher->m_et->elapsed() << " ms";
pSymbolWatcher->deleteLater();
});
@@ -1329,7 +1328,7 @@ void BuildingViewerDdsController::createSymbolResultWatcher(const ParticipantMan
if (!pSymbolWatcher->symbolResult()->symbolImage().isValid())
{
WARNING_LOG() << getSessionInfo() << "'slot_SymbolWatcherResultReady': Symbol creation failed -> '!symbolImage.isValid()', BgViewer might not display symbol(s)!";
WARNING_LOG(m_logger) << getSessionInfo() << "'slot_SymbolWatcherResultReady': Symbol creation failed -> '!symbolImage.isValid()', BgViewer might not display symbol(s)!";
return;
}
@@ -1338,7 +1337,7 @@ void BuildingViewerDdsController::createSymbolResultWatcher(const ParticipantMan
if (writeParticipantSymbols)
if (!pSymbolWatcher->symbolResult()->symbolImage().image().save(symbolInfo.strPathToSymbolFile))
{
WARNING_LOG() << getSessionInfo() << "Could not write symbol file for BgViewer: \"" << symbolInfo.strPathToSymbolFile << "\", BgViewer might not display symbol(s)!";
WARNING_LOG(m_logger) << getSessionInfo() << "Could not write symbol file for BgViewer: \"" << symbolInfo.strPathToSymbolFile << "\", BgViewer might not display symbol(s)!";
return;
}
@@ -1388,7 +1387,7 @@ void BuildingViewerDdsController::onSynchronizeSimulationTime()
m_connection->systemSetSimulationTime(m_session->partitionTime());
}
else
WARNING_LOG() << getSessionInfo() << "'slotSynchronizeSimulationTime': m_session is nullptr, could not query partitionTime!";
WARNING_LOG(m_logger) << getSessionInfo() << "'slotSynchronizeSimulationTime': m_session is nullptr, could not query partitionTime!";
}
void BuildingViewerDdsController::updateBuildingRoomNames(const InfrastructureManagement::MainStructureElement& building)
@@ -1421,7 +1420,7 @@ void BuildingViewerDdsController::onPlayerPicked(int playerId)
if (m_ppmGuiIfc)
m_ppmGuiIfc->showParticipantInfoWindow(playerId, true);
else
INFO_LOG() << "No m_ppmGuiIfc";
INFO_LOG(m_logger) << "No m_ppmGuiIfc";
}
@@ -1430,13 +1429,13 @@ void BuildingViewerDdsController::effectGenerationUnitPicked(int structureElemen
if (m_blgGuiIfc)
m_blgGuiIfc->showEffectGenerationUnitWindow(structureElementId);
else
INFO_LOG() << "No m_blgGuiIfc";
INFO_LOG(m_logger) << "No m_blgGuiIfc";
}
void BuildingViewerDdsController::onAssetPicked(int structureElementId)
{
DEBUG_LOG() << "User clicked on asset with structureElementId " << structureElementId << " from " << QString::number((quintptr)m_session->adr(), 16);
DEBUG_LOG(m_logger) << "User clicked on asset with structureElementId " << structureElementId << " from " << QString::number((quintptr)m_session->adr(), 16);
if (m_session->isReplayPartition())
return;
@@ -1446,7 +1445,7 @@ void BuildingViewerDdsController::onAssetPicked(int structureElementId)
auto it = m_mountingPointId2AssetType.find(structureElementId);
if (it == m_mountingPointId2AssetType.end())
{
WARNING_LOG() << "onAssetPicked: User clicked on asset mounted to structureElementId " << structureElementId << " which was not added beforehand?! Ignoring...";
WARNING_LOG(m_logger) << "onAssetPicked: User clicked on asset mounted to structureElementId " << structureElementId << " which was not added beforehand?! Ignoring...";
return;
}
@@ -1454,18 +1453,18 @@ void BuildingViewerDdsController::onAssetPicked(int structureElementId)
switch (assetType)
{
case BuildingViewer::AssetTypes::AnnouncementUnit:
DEBUG_LOG() << "Clicked asset is of type is AnnouncementUnit";
DEBUG_LOG(m_logger) << "Clicked asset is of type is AnnouncementUnit";
if (m_avmIfc)
m_avmIfc->showAnnouncementUnit(structureElementId);
return;
case BuildingViewer::AssetTypes::EffectGenerationUnit:
DEBUG_LOG() << "Clicked asset is of type is EffectGenerationUnit";
DEBUG_LOG(m_logger) << "Clicked asset is of type is EffectGenerationUnit";
effectGenerationUnitPicked(structureElementId);
return;
case BuildingViewer::AssetTypes::IndoorCameraWithSpeaker:
DEBUG_LOG() << "Clicked asset is of type is IndoorCameraWithSpeaker";
DEBUG_LOG(m_logger) << "Clicked asset is of type is IndoorCameraWithSpeaker";
if (m_avmIfc)
{
m_avmIfc->showCamera(m_irreplacableWidget, structureElementId);
@@ -1474,12 +1473,12 @@ void BuildingViewerDdsController::onAssetPicked(int structureElementId)
return;
case BuildingViewer::AssetTypes::IndoorCamera:
DEBUG_LOG() << "Clicked asset is of type is IndoorCamera";
DEBUG_LOG(m_logger) << "Clicked asset is of type is IndoorCamera";
if (m_avmIfc)
m_avmIfc->showCamera(m_irreplacableWidget, structureElementId);
return;
}
WARNING_LOG() << "onAssetPicked: BuildingViewer::AssetTypes is unknown: " << assetType;
WARNING_LOG(m_logger) << "onAssetPicked: BuildingViewer::AssetTypes is unknown: " << assetType;
}
@@ -1514,12 +1513,12 @@ void BuildingViewerDdsController::onBuildingHitLineInfoChanged(const Buildings::
{
int topidId = static_cast <int>(hli.id());
DEBUG_LOG() << "onBuildingHitLineInfoChanged: " << hli;
DEBUG_LOG(m_logger) << "onBuildingHitLineInfoChanged: " << hli;
const QString &strFeatureID = BuildingViewer::databaseId2FeatureId(hli.buildingId());
if (!m_viewerInterface->isViewOpen(strFeatureID.toStdString()))
{
DEBUG_LOG() << "building not opened: hli.buildingId()=" << hli.buildingId() ;
DEBUG_LOG(m_logger) << "building not opened: hli.buildingId()=" << hli.buildingId() ;
return;
}
@@ -1529,11 +1528,11 @@ void BuildingViewerDdsController::onBuildingHitLineInfoChanged(const Buildings::
const bool isRemove = (modType == DataModification::eRemoved);
DEBUG_LOG() << "isRemove=" << isRemove;
DEBUG_LOG(m_logger) << "isRemove=" << isRemove;
if (isRemove)
{
DEBUG_LOG() << "onBuildingHitLineInfoChanged: remove ";
DEBUG_LOG(m_logger) << "onBuildingHitLineInfoChanged: remove ";
QVector<BuildingHit> &bhl = m_buildingHits[hli.buildingId()];
auto it = std::find_if(bhl.begin(), bhl.end(), [hli](const BuildingHit &bh)
@@ -1543,7 +1542,7 @@ void BuildingViewerDdsController::onBuildingHitLineInfoChanged(const Buildings::
if (it != bhl.end())
{
DEBUG_LOG() << "bhl.erase(it)";
DEBUG_LOG(m_logger) << "bhl.erase(it)";
bhl.erase(it);
}
m_connection->removeRoomHit(hli.id());
@@ -1578,7 +1577,7 @@ void BuildingViewerDdsController::onBuildingHitLineInfoChanged(const Buildings::
void BuildingViewerDdsController::onCleanupBuildingHitlines()
{
DEBUG_LOG() << "onCleanupBuildingHitlines: ";
DEBUG_LOG(m_logger) << "onCleanupBuildingHitlines: ";
const qint64 tNow = QDateTime::currentMSecsSinceEpoch();
const auto isOutdated = [tNow](const BuildingHit &bh)
{
@@ -1600,7 +1599,7 @@ void BuildingViewerDdsController::onMainStructureElementChanged(const Infrastruc
{
if (mse.modelId() != 0 && m_ismDtc->isElementAssignedToExercise(mse, m_exerciseId))
{
DEBUG_LOG() << "m_buildingHeight.insert id=" << mse.id() << " z=" << mse.geoPosition().z();
DEBUG_LOG(m_logger) << "m_buildingHeight.insert id=" << mse.id() << " z=" << mse.geoPosition().z();
m_buildingHeight.insert(mse.id(), mse.geoPosition().z());
QHash<int, int> roomId2RoomNumber;
for (const InfrastructureManagement::StructureElement &se : mse.elements())
@@ -1638,7 +1637,7 @@ void BuildingViewerDdsController::onFireEventFlashTimer()
if (m_session == nullptr)
{
DEBUG_LOG() << getSessionInfo() << "onFireEventFlashTimer: Session is not available, flashing not possible!";
DEBUG_LOG(m_logger) << getSessionInfo() << "onFireEventFlashTimer: Session is not available, flashing not possible!";
return;
}
@@ -54,6 +54,7 @@ public:
signals:
void signalDdsInitFinished();
private:
NGL::INGLLogger &m_logger;
void setCurrentTrainingAreaMap(const QString &modelPath);
private slots:
void onPartyChanged(const ParticipantManagement::Party &party, DataModification modType);