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

@@ -13,10 +13,9 @@
#include <NGLLogger/NGLLoggerBootstrap.h>
Test::Test()
: m_api(new BuildingControlUnit::VWM::Api(this))
.getNGLLogger("BCU.VWM.Test"))
{
Test::Test() : m_api(new BuildingControlUnit::VWM::Api(this))
.getNGLLogger("BCU.VWM.Test")),
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {
connect(m_api, &BuildingControlUnit::VWM::Api::hitResult,
this, &Test::hitResult);
QTimer::singleShot(0, this, &Test::test1);
@@ -29,7 +28,7 @@ Test::~Test()
void Test::hitResult(const BuildingControlUnit::HitResult &result)
{
INFO_LOG() << "Hit Result: sensorId = " << result.sensorId
INFO_LOG(m_logger) << "Hit Result: sensorId = " << result.sensorId
<< ", originatorId = " << result.originatorId
<< ", chargeTypeId = " << result.chargeTypeId
<< ", dmgPercentOld = " << result.damagePercentOld
@@ -54,18 +53,18 @@ void Test::test1()
const auto hitPos = BuildingControlUnit::VWM::Math::checkBsmPosition(bsm.position, bsm.direction, rooms);
if (hitPos.state != BuildingControlUnit::VWM::HitPosition::State::OuterWall)
{
WARNING_LOG() << "Effect on bsm " << bsm.id << " does not hit building ! - position: "
WARNING_LOG(m_logger) << "Effect on bsm " << bsm.id << " does not hit building ! - position: "
<< bsm.position << ", direction: " << bsm.direction;
}
else if (hitPos.distance < 0)
{
WARNING_LOG() << "Effect on bsm " << bsm.id << " results in hit pos behind a wall ("
WARNING_LOG(m_logger) << "Effect on bsm " << bsm.id << " results in hit pos behind a wall ("
<< hitPos.distance << "m) instead in front - BSM is not modelled in the correct place: "
<< bsm.position << ", direction: " << bsm.direction << ", roomId which was hit: " << hitPos.roomId;
}
else
{
DEBUG_LOG() << "BSM with id " << bsm.id << " looks fine - room which will be hit: " << hitPos.roomId;
DEBUG_LOG(m_logger) << "BSM with id " << bsm.id << " looks fine - room which will be hit: " << hitPos.roomId;
}
}
@@ -24,4 +24,5 @@ private Q_SLOTS:
void test5();
void test6();
private:
NGL::INGLLogger &m_logger;
};
@@ -38,7 +38,7 @@ bool Api::init(const QString &chargesConfig,
const BuildingBsmConfig &bsmConfig,
const bool initBuilding)
{
DEBUG_LOG() << "chargesConfig=" << chargesConfig;
DEBUG_LOG(m_logger) << "chargesConfig=" << chargesConfig;
if (!XmlReader::readCharges(chargesConfig, m_chargeMap))
return false;
if (!XmlReader::readBuilding(vulBuildingConfig, m_building))
@@ -48,21 +48,21 @@ bool Api::init(const QString &chargesConfig,
QString fltXml = QString(QStringLiteral("/opt/BuildingModels/StaticMeshes/%1.flt.xml")).arg(m_building.name());
if (!XmlReader::readBuildingGeometry(fltXml, m_buildingRoomGeometry ))
{
ERROR_LOG() << "Error reading buildingRoomGeometry from file: " << fltXml << "'";
ERROR_LOG(m_logger) << "Error reading buildingRoomGeometry from file: " << fltXml << "'";
}
DEBUG_LOG() << "Building buildingRoomGeometry read successfully from file: " << fltXml << "'";
DEBUG_LOG(m_logger) << "Building buildingRoomGeometry read successfully from file: " << fltXml << "'";
int numberOfRemoved = m_building.cleanupPolygons();
int numberOfDuplicates = m_building.checkPolygons();
DEBUG_LOG() << "Building cleanupPolygons: " << m_building.name() << "' -> " << numberOfRemoved << " points removed";
DEBUG_LOG(m_logger) << "Building cleanupPolygons: " << m_building.name() << "' -> " << numberOfRemoved << " points removed";
if (numberOfDuplicates > 0)
ERROR_LOG() << "Building checkPolygons: " << m_building.name() << "' -> " << numberOfDuplicates << " duplicates";
ERROR_LOG(m_logger) << "Building checkPolygons: " << m_building.name() << "' -> " << numberOfDuplicates << " duplicates";
else
DEBUG_LOG() << "Building checkPolygons: " << m_building.name() << "' -> " << numberOfDuplicates << " duplicates";
DEBUG_LOG(m_logger) << "Building checkPolygons: " << m_building.name() << "' -> " << numberOfDuplicates << " duplicates";
m_bsmMap = bsmConfig.bsmMap;
@@ -85,7 +85,7 @@ void Api::onHitOptical(qint64 timeMSec, int sensorId, int originatorId, int char
if (!bsm.isValid())
{
WARNING_LOG() << "Given bsm id " << sensorId << " is not in our internal bsm list!";
WARNING_LOG(m_logger) << "Given bsm id " << sensorId << " is not in our internal bsm list!";
return;
}
@@ -105,7 +105,7 @@ void Api::onHitOptical(qint64 timeMSec, int sensorId, int originatorId, int char
void Api::onSetEffectStatesRequest(const QString &hostname, const QVector<BcuEffectState> &effectStates)
{
DEBUG_LOG() << "onSetEffectStatesRequest:"
DEBUG_LOG(m_logger) << "onSetEffectStatesRequest:"
<< " hostname= " << hostname
<< " effectStes.zize=" << effectStates.size();
@@ -120,7 +120,7 @@ void Api::onSetEffectStatesRequest(const QString &hostname, const QVector<BcuEff
if (es.effectOverride == BcuEffectOverride::BEO_Off)
{
overridesObj.insert(QStringLiteral("flash"), 0);
DEBUG_LOG() << "flash = 0";
DEBUG_LOG(m_logger) << "flash = 0";
}
}
}
@@ -137,14 +137,14 @@ void Api::onSetEffectStatesRequest(const QString &hostname, const QVector<BcuEff
{
QJsonObject relayStateObj;
relayStateObj[QString::number(es.id)]=es.effectOverride;
DEBUG_LOG() << "relay = " << QString::number(es.id)
DEBUG_LOG(m_logger) << "relay = " << QString::number(es.id)
<< " " << es.effectOverride;
relayStateArray.append(relayStateObj);
}
else if (es.type == BcuEffectType::BET_BackgroundSound)
{
overridesObj.insert(QStringLiteral("sound"), es.effectOverride);
DEBUG_LOG() << "sound=" << es.effectOverride;
DEBUG_LOG(m_logger) << "sound=" << es.effectOverride;
}
}
overridesObj.insert(QStringLiteral("relays"), relayStateArray);
@@ -154,7 +154,7 @@ void Api::onSetEffectStatesRequest(const QString &hostname, const QVector<BcuEff
propertiesObj[QStringLiteral("Overrides")] = overridesObj;
QString totalString = QString::fromLatin1(QJsonDocument(propertiesObj).toJson(QJsonDocument::Compact));
DEBUG_LOG() << "totalString=" << totalString;
DEBUG_LOG(m_logger) << "totalString=" << totalString;
m_building.setSegmentProperties(hostname,totalString);
StateStore::saveState(m_building, m_lastHitResult, m_contaminationStates);
}
@@ -264,15 +264,15 @@ void Api::onHitEcc(int originatorId, DamageState damageState, const QVector<int>
void Api::onSetContaminationState(const std::vector<ContaminationState> &contaminationStates)
{
DEBUG_LOG() << "contaminationStates.size=" << contaminationStates.size();
DEBUG_LOG(m_logger) << "contaminationStates.size=" << contaminationStates.size();
for (const auto &newcs : contaminationStates)
{
DEBUG_LOG() << "newcs.damagePercentNew=" << newcs.damagePercentNew
DEBUG_LOG(m_logger) << "newcs.damagePercentNew=" << newcs.damagePercentNew
<< " m_lastHitResult.damagePercentNew=" << m_lastHitResult.damagePercentNew;
if ( newcs.damagePercentNew > m_lastHitResult.damagePercentNew)
{
DEBUG_LOG() << "newcs.damagePercentNew=" << newcs.damagePercentNew;
DEBUG_LOG(m_logger) << "newcs.damagePercentNew=" << newcs.damagePercentNew;
m_lastHitResult.damagePercentNew = newcs.damagePercentNew;
}
if (m_contaminationStates.contains(newcs.aesId))
@@ -302,7 +302,7 @@ void Api::onSetContaminationState(const std::vector<ContaminationState> &contami
else
m_contaminationStates.insert(newcs.aesId, newcs);
}
DEBUG_LOG() << "onSetContaminationState emit hitResult "
DEBUG_LOG(m_logger) << "onSetContaminationState emit hitResult "
<< " m_lastHitResult.damagePercentNew=" << m_lastHitResult.damagePercentNew;
emit hitResult(m_lastHitResult, m_contaminationStates, false);
StateStore::saveState(m_building, m_lastHitResult, m_contaminationStates);
@@ -311,7 +311,7 @@ void Api::onSetContaminationState(const std::vector<ContaminationState> &contami
void Api::onResetContaminations()
{
m_contaminationStates.clear();
DEBUG_LOG() << "onResetContaminations emit hitResult";
DEBUG_LOG(m_logger) << "onResetContaminations emit hitResult";
m_lastHitResult.chargeTypeId = 0;
m_lastHitResult.originatorId = 0;
m_lastHitResult.originatorType = BuildingControlUnit::OriginatorType::ECC;
@@ -338,7 +338,7 @@ void Api::onHitCes(const qint64 effectTimeMSec, const int chargeTypeId,
hit.position.setZ(1);
INFO_LOG() << "XXXXX CES Hit = " << hit;
INFO_LOG(m_logger) << "XXXXX CES Hit = " << hit;
@@ -349,7 +349,7 @@ void Api::onHitCes(const qint64 effectTimeMSec, const int chargeTypeId,
posTmp.setZ(10000);
const LtsUtils::QPoint3D direction(0,0,1);
const auto hitPosTmp = BuildingControlUnit::VWM::Math::checkBsmPosition(posTmp, direction, m_building.rooms());
INFO_LOG() << "XXXXX hitPosTmp after checkBsmPosition = " << hitPosTmp;
INFO_LOG(m_logger) << "XXXXX hitPosTmp after checkBsmPosition = " << hitPosTmp;
if (hitPosTmp.state != BuildingControlUnit::VWM::HitPosition::State::NoHit)
{
auto room = m_building.rooms().value(hitPosTmp.roomId);
@@ -382,7 +382,7 @@ void Api::onHitCes(const qint64 effectTimeMSec, const int chargeTypeId,
NearestWall nearestWall;
if (hitPos.state == BuildingControlUnit::VWM::HitPosition::State::NoHit)
{
INFO_LOG() << "XXXXX CES Hit outside building - searching nearest wall ...";
INFO_LOG(m_logger) << "XXXXX CES Hit outside building - searching nearest wall ...";
double distanceOut = 0;
LtsUtils::QPoint3D directionWallElementPointToDetonationOut;
@@ -399,14 +399,14 @@ void Api::onHitCes(const qint64 effectTimeMSec, const int chargeTypeId,
if (hitPos.state == BuildingControlUnit::VWM::HitPosition::State::NoHit)
{
WARNING_LOG() << "Internal error - could not find impact position on building "
WARNING_LOG(m_logger) << "Internal error - could not find impact position on building "
<< m_building.name() << " with impact pos " << posImpactOnGround;
}
INFO_LOG() << "XXXXX Aes hit - hit pos: " << posImpactOnGround << " direction: " << hit.direction
INFO_LOG(m_logger) << "XXXXX Aes hit - hit pos: " << posImpactOnGround << " direction: " << hit.direction
<< " (p=" << hit.direction+posImpactOnGround << ")"
<< " ; nearestWall.roomId=" << nearestWall.roomId;
for (auto item : std::as_const(nearestWall.wallElement))
DEBUG_LOG() << "Aes hit - hit pos: " << posImpactOnGround << " direction: " << hit.direction
DEBUG_LOG(m_logger) << "Aes hit - hit pos: " << posImpactOnGround << " direction: " << hit.direction
<< " (p=" << hit.direction+posImpactOnGround
<< " - " << item;
@@ -417,7 +417,7 @@ void Api::onHitCes(const qint64 effectTimeMSec, const int chargeTypeId,
const LtsUtils::QPoint3D &center = centerOfWallElement3D(nearestWall.wallElement);
INFO_LOG() << "XXXXX Aes hit - hit pos: " << posImpactOnGround << " direction: " << hit.direction
INFO_LOG(m_logger) << "XXXXX Aes hit - hit pos: " << posImpactOnGround << " direction: " << hit.direction
<< ", m_building.name=" << m_building.name()
<< ", m_building.modelId=" << m_building.modelId()
<< ", nearestWall.roomId=" << nearestWall.roomId
@@ -436,7 +436,7 @@ NearestWall Api::findNearestWall(const LtsUtils::QPoint3D &detonationLocation, d
NearestWall nearestWall;
distanceOut = std::numeric_limits<double>::max();
INFO_LOG() << "XXXXX searching nearest wall ...";
INFO_LOG(m_logger) << "XXXXX searching nearest wall ...";
for (const Room &room : std::as_const(m_building.rooms()))
{
for (const OuterWall &wall : std::as_const(room.outerWalls()))
@@ -446,13 +446,13 @@ NearestWall Api::findNearestWall(const LtsUtils::QPoint3D &detonationLocation, d
for (const LtsUtils::QPoint3D &p : std::as_const(we))
{
const double dist = (detonationLocation - p).length();
DEBUG_LOG() << "Room[" << room.id() << "]: " << p << ", dist = " << dist;
DEBUG_LOG(m_logger) << "Room[" << room.id() << "]: " << p << ", dist = " << dist;
if (dist >= distanceOut)
continue;
distanceOut = dist;
INFO_LOG() << "New min distance " << dist << " Room[" << room.id() << "]: " << p;
INFO_LOG(m_logger) << "New min distance " << dist << " Room[" << room.id() << "]: " << p;
directionWallElementPointToDetonationOut = p - detonationLocation;
nearestWall.roomId = room.id();
@@ -486,7 +486,7 @@ void Api::onHitCes3D_Evaluation(const qint64 effectTimeMSec,
INFO_LOG() << "XXXXXXXXXX CES Hit 3D = " << hit
INFO_LOG(m_logger) << "XXXXXXXXXX CES Hit 3D = " << hit
<< ", detonationLocation = " << detonationLocation
<< ", detonationDistance = " << detonationDistance
<< ", chargeTypeId = " << chargeTypeId
@@ -514,16 +514,16 @@ void Api::onHitCes3D_Evaluation(const qint64 effectTimeMSec,
roomsWithDetonation = m_buildingRoomGeometry.pointIsInWhichRooms(detonationLocation);
if (roomsWithDetonation.isEmpty())
{
INFO_LOG() << "XXXX Building '" << m_building.name() << "'"
INFO_LOG(m_logger) << "XXXX Building '" << m_building.name() << "'"
<< ", detonationLocation = " << detonationLocation
<< " -> found no room";
} else {
if (roomsWithDetonation.size() == 1)
INFO_LOG() << "XXXX Building '" << m_building.name() << "'"
INFO_LOG(m_logger) << "XXXX Building '" << m_building.name() << "'"
<< ", detonationLocation = " << detonationLocation
<< " -> found just one room: " << roomsWithDetonation.first();
else
INFO_LOG() << "XXXX Building '" << m_building.name() << "'"
INFO_LOG(m_logger) << "XXXX Building '" << m_building.name() << "'"
<< ", detonationLocation = " << detonationLocation
<< " -> found several rooms, choose first: " << roomsWithDetonation.first();
@@ -541,7 +541,7 @@ void Api::onHitCes3D_Evaluation(const qint64 effectTimeMSec,
LtsUtils::QPoint3D directionWallElementPointToDetonationOut;
NearestWall nearestWall = findNearestWall(detonationLocation, distanceOut, directionWallElementPointToDetonationOut);
INFO_LOG() << "XXXXX CES Hit outside building - searching nearest wall ..."
INFO_LOG(m_logger) << "XXXXX CES Hit outside building - searching nearest wall ..."
<< ", detonationDistance = " << detonationDistance
<< ", nearestWall.roomId = " << nearestWall.roomId;
@@ -588,7 +588,7 @@ void Api::onHitCes3D_Evaluation(const qint64 effectTimeMSec,
bool hitSuccess = m_building.hit(LtsUtils::QPoint3D(), LtsUtils::QPoint3D(),
charge, &hitPosPreCalculated);
INFO_LOG() << "onHitCes3D_Evaluation hitSuccess=" << hitSuccess;
INFO_LOG(m_logger) << "onHitCes3D_Evaluation hitSuccess=" << hitSuccess;
result.rooms = m_building.roomStates();
result.damageState = m_building.damageState();
@@ -627,7 +627,7 @@ void Api::onFortifyFactorRequest(int originatorId, const QVector<FortifyInfo> &f
void Api::onRelayStatesRequest(const QString &hostname, const QVector<RelayStateInfo> &relayStateInfos)
{
DEBUG_LOG() << "onRelayStateRequest hostname=" << hostname
DEBUG_LOG(m_logger) << "onRelayStateRequest hostname=" << hostname
<< " only hanlde in svcBuildings"
<< " relayStateInfos.size()=" << relayStateInfos.size();
}
@@ -649,14 +649,14 @@ void Api::sendOverrides()
QJsonObject docObj = QJsonObject(doc.object());
DEBUG_LOG() << "sendOverrides hostname=" << hostname
DEBUG_LOG(m_logger) << "sendOverrides hostname=" << hostname
<< " properties=" << properties;
{
DEBUG_LOG() << "sendOverrides hostname=" << hostname
DEBUG_LOG(m_logger) << "sendOverrides hostname=" << hostname
<< " properties=" << properties << "BCU-Flash";
BcuEffectState bcuEffectState;
bcuEffectState.id = 1;
@@ -677,7 +677,7 @@ void Api::sendOverrides()
}
if (eo != BcuEffectOverride::BEO_Auto)
{
DEBUG_LOG() << "bcuEffectState.effectOverride = eo" << eo;
DEBUG_LOG(m_logger) << "bcuEffectState.effectOverride = eo" << eo;
bcuEffectState.effectOverride = eo;
emit newOverrides({}, {bcuEffectState});
}
@@ -726,7 +726,7 @@ void Api::sendHitToVwm(const Hit &hit)
{
m_hitsSinceLastInit += hit;
INFO_LOG() << " XXXXX sendHitToVwm, Incoming hit=" << hit
INFO_LOG(m_logger) << " XXXXX sendHitToVwm, Incoming hit=" << hit
<< " hit.chargeTypeId=" << hit.chargeTypeId
<< " originatorId=" << hit.originatorId
<< " typeOfHit=" << hit.typeOfHit;
@@ -753,7 +753,7 @@ void Api::sendHitToVwm(const Hit &hit)
charge.penetrationEffect = hit.penetrationFactor;
}
DEBUG_LOG() << "charge=" << charge.chargeTypeId
DEBUG_LOG(m_logger) << "charge=" << charge.chargeTypeId
<< " destructiveFactor" << charge.destructiveFactor
<< " penetrationEffect" << charge.penetrationEffect;
chargeOrg = charge;
@@ -770,23 +770,23 @@ void Api::sendHitToVwm(const Hit &hit)
LtsUtils::QPoint3D dummyDist = hit.position - hit.direction;
INFO_LOG() << " XXXX CES outside bulding, reduce charge: " << charge
INFO_LOG(m_logger) << " XXXX CES outside bulding, reduce charge: " << charge
<< ", hit.position " << hit.position
<< ", hit.direction " << hit.direction
<< ", dummyDist " << dummyDist.length();
charge.destructiveFactor *= 0.5;
charge.penetrationEffect *= 0.5;
INFO_LOG() << " XXXX CES outside bulding, reduce charge: " << charge;
INFO_LOG(m_logger) << " XXXX CES outside bulding, reduce charge: " << charge;
}
if (!charge.isValid())
{
if (hit.originatorType == OriginatorType::CesHit)
WARNING_LOG() << "Charge with id " << hit.chargeTypeId
WARNING_LOG(m_logger) << "Charge with id " << hit.chargeTypeId
<< " not configured - can not caluclate impact effect for this charge";
else
{
WARNING_LOG() << "Direct charge with id " << hit.chargeTypeId
WARNING_LOG(m_logger) << "Direct charge with id " << hit.chargeTypeId
<< " not configured - can not caluclate impact effect for this charge";
emit unknownDirectHit(hit.sensorId);
}
@@ -794,7 +794,7 @@ void Api::sendHitToVwm(const Hit &hit)
}
if (!m_building.hit(hit.position, hit.direction, charge))
{
WARNING_LOG() << "Detected hit was outside of the building - ignored";
WARNING_LOG(m_logger) << "Detected hit was outside of the building - ignored";
break;
}
result.rooms = m_building.roomStates();
@@ -832,7 +832,7 @@ void Api::sendHitToVwm(const Hit &hit)
{
case DamageState::NoDamage:
{
DEBUG_LOG() << "Hit OC/ECC with NoDamage";
DEBUG_LOG(m_logger) << "Hit OC/ECC with NoDamage";
m_building.init();
result.effectSoundId = Settings::effectSoundIdEccActivate();
@@ -855,7 +855,7 @@ void Api::sendHitToVwm(const Hit &hit)
}
case DamageState::Destroyed:
{
DEBUG_LOG() << "Hit OC/ECC with Destroyed";
DEBUG_LOG(m_logger) << "Hit OC/ECC with Destroyed";
const DamageState dsOld = m_building.damageState();
m_building.destroyAllRooms();
@@ -879,14 +879,14 @@ void Api::sendHitToVwm(const Hit &hit)
break;
}
default:
WARNING_LOG() << "Invalid damage state override given: " << hit.damageStateOverride;
WARNING_LOG(m_logger) << "Invalid damage state override given: " << hit.damageStateOverride;
result = HitResult();
break;
}
break;
}
case OriginatorType::Unknown:
WARNING_LOG() << "Unknown originator type given: " << hit.originatorType;
WARNING_LOG(m_logger) << "Unknown originator type given: " << hit.originatorType;
result = HitResult();
break;
}
@@ -905,7 +905,7 @@ const Charge Api::chargeFromChargeTypeId(int chargeTypeId) const
for (auto i = m_chargeMap.cbegin(), end = m_chargeMap.cend(); i != end; ++i)
{
TRACE_LOG() << "key=" << i.key() << " value=" << i.value();
TRACE_LOG(m_logger) << "key=" << i.key() << " value=" << i.value();
if ( chargeTypeId == i.value().id)
return m_chargeMap.value(i.key());
}
@@ -77,6 +77,7 @@ Q_SIGNALS:
void newOverrides( const QString &hostname, const QVector<BcuEffectState> &effectStates);
void unknownDirectHit(int sensorId);
private:
NGL::INGLLogger &m_logger;
void sendHitToVwm(const Hit &hit);
private:
QMap<int, Bsm> m_bsmMap;
@@ -354,7 +354,7 @@ int Building::cleanupDublicatePointsInPolygon(int roomId, int idx, int subIdx, c
auto p2 = points.at(j);
if (qFuzzyCompare(p1, p2))
{
DEBUG_LOG() << "Building '" << m_name << "' -> "
DEBUG_LOG(m_logger) << "Building '" << m_name << "' -> "
<< "Polygon point " << i << " (" << p1 << ") and " << j << " (" << p2
<< ") in room " << roomId << ", " << type << "[" << idx
<< "], element[" << subIdx << "] are the same! -> REMOVE";
@@ -410,7 +410,7 @@ QVector<HitRoom> Building::roomStates() const
hr.fortifyFactor = room.fortifyFactor();
hr.directHit = room.isDirectHit();
ret += hr;
DEBUG_LOG() << "HitRoom " << hr.roomId
DEBUG_LOG(m_logger) << "HitRoom " << hr.roomId
<< " damage: " << hr.damagePercent
<< "%, remainEffect: " << hr.remainingEffectPercent << "%"
<< ", remainingEffectChargeTypeId: " << hr.remainingEffectChargeTypeId << "%"
@@ -448,7 +448,7 @@ void Building::setRoomState(DamageState damageState, const QVector<int> &afffect
auto it = m_rooms.find(roomId);
if (it == m_rooms.end())
{
WARNING_LOG() << "Could not find room with id " << roomId;
WARNING_LOG(m_logger) << "Could not find room with id " << roomId;
continue;
}
if (damageState == DamageState::Destroyed)
@@ -465,7 +465,7 @@ void Building::setFortifyInfo(const QVector<FortifyInfo> &foritfyInfos)
auto it = m_rooms.find(info.roomId);
if (it == m_rooms.end())
{
WARNING_LOG() << "Could not find room with id " << info.roomId;
WARNING_LOG(m_logger) << "Could not find room with id " << info.roomId;
continue;
}
Room &room = it.value();
@@ -538,14 +538,14 @@ bool Building::hit(const LtsUtils::QPoint3D &pos, const LtsUtils::QPoint3D &dir,
const bool bBelowGround = isLastHitPositionBelowGroundHack();
if (bBelowGround)
{
INFO_LOG() << " XXXX CES belowGround, reduce charge: " << charge;
INFO_LOG(m_logger) << " XXXX CES belowGround, reduce charge: " << charge;
charge.destructiveFactor *= 0.25;
charge.penetrationEffect *= 0.25;
INFO_LOG() << " XXXX CES belowGround, reduce charge: " << charge;
INFO_LOG(m_logger) << " XXXX CES belowGround, reduce charge: " << charge;
}
INFO_LOG() << "XXXXX HitPosition: state=" << m_lastHitPosition.state
INFO_LOG(m_logger) << "XXXXX HitPosition: state=" << m_lastHitPosition.state
<< ", m_name=" << m_name
<< ", m_modelId=" << m_modelId
<< ", roomId=" << m_lastHitPosition.roomId
@@ -560,7 +560,7 @@ bool Building::hit(const LtsUtils::QPoint3D &pos, const LtsUtils::QPoint3D &dir,
Room &hitRoom = m_rooms[m_lastHitPosition.roomId];
if (!hitRoom.isValid())
{
ERROR_LOG() << "Internal error in hit calculation - could not find room with id " << m_lastHitPosition.roomId;
ERROR_LOG(m_logger) << "Internal error in hit calculation - could not find room with id " << m_lastHitPosition.roomId;
return false;
}
@@ -651,7 +651,7 @@ QMap<int, Building::NeighboursToCheck> Building::checkHitNeighbours(const QMap<i
auto itRoom = m_rooms.find(neighbourRoomId);
if (itRoom == m_rooms.end())
{
WARNING_LOG() << "Could not find room with id " << neighbourRoomId;
WARNING_LOG(m_logger) << "Could not find room with id " << neighbourRoomId;
continue;
}
@@ -670,7 +670,7 @@ QMap<int, Building::NeighboursToCheck> Building::checkHitNeighbours(const QMap<i
const double oldRe = neighbour.remainingEffect();
neighbour.setRemainingEffect(neighbourRoom.remainEffect * TF);
DEBUG_LOG() << "room " << neighbourRoomId << " remaining effect old: "
DEBUG_LOG(m_logger) << "room " << neighbourRoomId << " remaining effect old: "
<< oldRe << " -> new: " << neighbour.remainingEffect();
@@ -740,7 +740,7 @@ int Building::checkDublicatePointsInPolygon(int roomId, int idx, int subIdx, con
if (qFuzzyCompare(p1, p2))
{
++numberOfDuplicates;
WARNING_LOG() << "Building '" << m_name << "' -> "
WARNING_LOG(m_logger) << "Building '" << m_name << "' -> "
<< "Polygon point " << i << " (" << p1 << ") and " << j << " (" << p2
<< ") in room " << roomId << ", " << type << "[" << idx
<< "], element[" << subIdx << "] are the same! (size=" << points.size() << ")";
@@ -750,7 +750,7 @@ int Building::checkDublicatePointsInPolygon(int roomId, int idx, int subIdx, con
if (numberOfDuplicates > 0)
for (auto point : points)
WARNING_LOG() << "Building '" << m_name << "' -> " << "point =" << point << " (same points)";
WARNING_LOG(m_logger) << "Building '" << m_name << "' -> " << "point =" << point << " (same points)";
return numberOfDuplicates;
}
@@ -29,6 +29,8 @@ public:
private:
NGL::INGLLogger &m_logger;
int m_id = 0;
double m_transitionFactor = 0;
};
@@ -17,30 +17,30 @@ namespace VWM
BuildingRoomGeometry::BuildingRoomGeometry()
: m_logger(BuildingControlUnit::getLogger("VWM.BuildingRoomGeometry"))
{
TRACE_LOG() << Q_FUNC_INFO << " START";
TRACE_LOG() << Q_FUNC_INFO << " END";
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
}
BuildingRoomGeometry::~BuildingRoomGeometry()
{
TRACE_LOG() << Q_FUNC_INFO << " START";
TRACE_LOG() << Q_FUNC_INFO << " END";
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
}
bool BuildingRoomGeometry::init(const QDomElement &domRoot)
{
TRACE_LOG() << Q_FUNC_INFO << " START";
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
parse(domRoot);
TRACE_LOG() << Q_FUNC_INFO << " END";
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
return true;
}
QVector<int> BuildingRoomGeometry::pointIsInWhichRooms(const LtsUtils::QPoint3D &pointToFind)
{
TRACE_LOG() << Q_FUNC_INFO << " START, pointToFind" << pointToFind
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START, pointToFind" << pointToFind
<< ", m_roomOutlines.size() " << m_roomOutlines.size();
QVector<int> roomtIds;
@@ -52,26 +52,26 @@ QVector<int> BuildingRoomGeometry::pointIsInWhichRooms(const LtsUtils::QPoint3D
const int roomId = it.key();
const RoomOutlineData &rod = it.value();
DEBUG_LOG() << Q_FUNC_INFO << " check room " << roomId << " (check maxZ " << rod.maxZ << " ; minZ " << rod.minZ;
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " check room " << roomId << " (check maxZ " << rod.maxZ << " ; minZ " << rod.minZ;
if (m_logger.isDebugEnabled())
qCritical() << " check room " << roomId << ", outline: " << rod.outline;
if (rod.outline.containsPoint( {pointToFind.x(), pointToFind.y()}, Qt::OddEvenFill))
{
DEBUG_LOG() << Q_FUNC_INFO << " within room " << roomId;
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " within room " << roomId;
if ((rod.maxZ > pointToFind.z()) &&
(pointToFind.z() > rod.minZ))
{
DEBUG_LOG() << Q_FUNC_INFO << " found roomId: " << roomId
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " found roomId: " << roomId
<< " pointToFind: " << pointToFind.x() << " , " << pointToFind.y();
roomtIds.append(roomId);
}
}
}
TRACE_LOG() << Q_FUNC_INFO << " END, roomtIds.size() " << roomtIds.size();
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END, roomtIds.size() " << roomtIds.size();
return roomtIds;
}
@@ -36,6 +36,8 @@ public:
QVector<int> pointIsInWhichRooms(const LtsUtils::QPoint3D &pointToFind);
private:
NGL::INGLLogger &m_logger;
bool parse(const QDomElement &domGroup);