Close bld/OSG floor: OSG 3.4.1 from source + port osgQt to Qt6 + wire BgViewer dtEntity
Migrate BuildingViewer (16 files: DDS members, m_logger inits, QOpenGLWidget); gui:3:bld.info + gui:3:bdv now load
This commit is contained in:
17 files changed
+360
-219
No files matched your search
+164
-163
@@ -322,11 +322,11 @@ void BuildingViewerDdsController::uninitialize()
|
||||
|
||||
QPointF BuildingViewerDdsController::toRelativePosition(const Core::GeoPosition& geoPos) const
|
||||
{
|
||||
if (std::isnan(geoPos.lon()) || std::isnan(geoPos.lat()) || qIsNull(geoPos.lon()) || qIsNull(geoPos.lat()))
|
||||
if (std::isnan(geoPos.lon) || std::isnan(geoPos.lat) || qIsNull(geoPos.lon) || qIsNull(geoPos.lat))
|
||||
return {};
|
||||
|
||||
LtsCoordTrans::UtmCoordinate coord(
|
||||
LtsCoordTrans::UtmCoordinate::fromGeographic(geoPos.lon(), geoPos.lat(), m_baseCoordinate.zone));
|
||||
LtsCoordTrans::UtmCoordinate::fromGeographic(geoPos.lon, geoPos.lat, m_baseCoordinate.zone));
|
||||
return coord.relativeTo(m_baseCoordinate);
|
||||
}
|
||||
|
||||
@@ -335,7 +335,7 @@ LtsUtils::QPoint3D BuildingViewerDdsController::toRelative3D(const Core::GeoPosi
|
||||
const auto ret = toRelativePosition(geoPos);
|
||||
if (ret.isNull())
|
||||
return {};
|
||||
return LtsUtils::QPoint3D(ret.x(), ret.y(), geoPos.z());
|
||||
return LtsUtils::QPoint3D(ret.x(), ret.y(), geoPos.z);
|
||||
}
|
||||
|
||||
bool BuildingViewerDdsController::clear()
|
||||
@@ -371,12 +371,12 @@ bool BuildingViewerDdsController::calcBaseCoordinate(
|
||||
if (!bAtLeasOneFound)
|
||||
{
|
||||
bAtLeasOneFound = true;
|
||||
geoPosition = mse.geoPosition();
|
||||
geoPosition = mse.geoPosition;
|
||||
}
|
||||
else
|
||||
{
|
||||
geoPosition.lat() = std::min(geoPosition.lat(), mse.geoPosition().lat());
|
||||
geoPosition.lon() = std::min(geoPosition.lon(), mse.geoPosition().lon());
|
||||
geoPosition.lat = std::min(geoPosition.lat, mse.geoPosition.lat);
|
||||
geoPosition.lon = std::min(geoPosition.lon, mse.geoPosition.lon);
|
||||
}
|
||||
}
|
||||
if (!bAtLeasOneFound)
|
||||
@@ -384,7 +384,7 @@ bool BuildingViewerDdsController::calcBaseCoordinate(
|
||||
WARNING_LOG(m_logger) << "No building available in exercise " << m_exerciseId;
|
||||
return false;
|
||||
}
|
||||
m_baseCoordinate = LtsCoordTrans::UtmCoordinate::fromGeographic(geoPosition.lon(), geoPosition.lat());
|
||||
m_baseCoordinate = LtsCoordTrans::UtmCoordinate::fromGeographic(geoPosition.lon, geoPosition.lat);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -422,11 +422,11 @@ bool BuildingViewerDdsController::writeBuildingDataToXML(const QString& modelPat
|
||||
const auto bi = BuildingInfo::fromJson(ele.toObject());
|
||||
if (!bi.isValid())
|
||||
continue;
|
||||
mse.id(bi.id);
|
||||
mse.angle(bi.angleDegree);
|
||||
mse.geoPosition(Core::GeoPosition(bi.position.x(), bi.position.y(), bi.position.z()));
|
||||
mse.name(bi.name.toStdString());
|
||||
mseMap.insert(mse.id(), mse);
|
||||
mse.id = bi.id;
|
||||
mse.angle = bi.angleDegree;
|
||||
mse.geoPosition = Core::GeoPosition(bi.position.x(), bi.position.y(), bi.position.z());
|
||||
mse.name = bi.name.toStdString();
|
||||
mseMap.insert(mse.id, mse);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -435,17 +435,17 @@ bool BuildingViewerDdsController::writeBuildingDataToXML(const QString& modelPat
|
||||
const auto mMap = m_ismDtc->mainStructureElements();
|
||||
for (const auto& mse : mMap)
|
||||
{
|
||||
if (mse.modelId() == 0)
|
||||
if (mse.modelId == 0)
|
||||
continue;
|
||||
if (!m_ismDtc->isElementAssignedToExercise(mse, m_exerciseId))
|
||||
{
|
||||
DEBUG_LOG(m_logger)
|
||||
<< "Not writing mse with id " << mse.id()
|
||||
<< "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);
|
||||
mseMap.insert(mse.id, mse);
|
||||
}
|
||||
}
|
||||
INFO_LOG(m_logger) << getSessionInfo()
|
||||
@@ -460,7 +460,7 @@ bool BuildingViewerDdsController::writeBuildingDataToXML(const QString& modelPat
|
||||
QXmlStreamWriter sw(&f);
|
||||
sw.setAutoFormatting(true);
|
||||
sw.setAutoFormattingIndent(2);
|
||||
sw.setCodec("UTF-8");
|
||||
// Qt6: QXmlStreamWriter::setCodec removed; it writes UTF-8 by default.
|
||||
sw.writeStartDocument(QStringLiteral("1.0"), true);
|
||||
sw.writeStartElement(QStringLiteral("MetaData"));
|
||||
{
|
||||
@@ -478,28 +478,28 @@ bool BuildingViewerDdsController::writeBuildingDataToXML(const QString& modelPat
|
||||
|
||||
for (const InfrastructureManagement::MainStructureElement& mse : std::as_const(mseMap))
|
||||
{
|
||||
m_knownBuildings += mse.id();
|
||||
m_knownBuildings += mse.id;
|
||||
|
||||
sw.writeStartElement(QStringLiteral("Model"));
|
||||
sw.writeAttribute(QStringLiteral("Type"), QStringLiteral("House"));
|
||||
{
|
||||
const QString name(QString::fromStdString(mse.name()));
|
||||
const QString name(QString::fromStdString(mse.name));
|
||||
sw.writeStartElement(QStringLiteral("Description"));
|
||||
sw.writeAttribute(QStringLiteral("Name"), name);
|
||||
sw.writeEndElement();
|
||||
sw.writeStartElement(QStringLiteral("Feature"));
|
||||
sw.writeAttribute(QStringLiteral("Id"), BuildingViewer::databaseId2FeatureId(mse.id()));
|
||||
sw.writeAttribute(QStringLiteral("Id"), BuildingViewer::databaseId2FeatureId(mse.id));
|
||||
sw.writeEndElement();
|
||||
sw.writeStartElement(QStringLiteral("Orientation"));
|
||||
|
||||
sw.writeAttribute(QStringLiteral("Angle"), QString::number(360 - mse.angle()));
|
||||
sw.writeAttribute(QStringLiteral("Angle"), QString::number(360 - mse.angle));
|
||||
sw.writeEndElement();
|
||||
|
||||
const QPointF offset(toRelativePosition(mse.geoPosition()));
|
||||
const QPointF offset(toRelativePosition(mse.geoPosition));
|
||||
sw.writeStartElement(QStringLiteral("Position"));
|
||||
sw.writeAttribute(QStringLiteral("X"), QString::number(offset.x(), 'f', 13));
|
||||
sw.writeAttribute(QStringLiteral("Y"), QString::number(offset.y(), 'f', 13));
|
||||
sw.writeAttribute(QStringLiteral("Z"), QString::number(mse.geoPosition().z(), 'f', 13));
|
||||
sw.writeAttribute(QStringLiteral("Z"), QString::number(mse.geoPosition.z, 'f', 13));
|
||||
sw.writeEndElement();
|
||||
sw.writeStartElement(QStringLiteral("File"));
|
||||
sw.writeAttribute(QStringLiteral("Name"), name + QStringLiteral(".flt"));
|
||||
@@ -552,7 +552,7 @@ void BuildingViewerDdsController::onReplayChanged(const SituationReplay::SitRepl
|
||||
{
|
||||
Q_UNUSED(modType)
|
||||
|
||||
switch (srp.state())
|
||||
switch (srp.state)
|
||||
{
|
||||
case SituationReplay::SrpState::Stopped:
|
||||
m_connection->setSimuationPace(1.0);
|
||||
@@ -560,7 +560,7 @@ void BuildingViewerDdsController::onReplayChanged(const SituationReplay::SitRepl
|
||||
break;
|
||||
case SituationReplay::SrpState::Started:
|
||||
case SituationReplay::SrpState::Resumed:
|
||||
m_connection->setSimuationPace(srp.pace());
|
||||
m_connection->setSimuationPace(srp.pace);
|
||||
|
||||
break;
|
||||
case SituationReplay::SrpState::Paused:
|
||||
@@ -629,7 +629,7 @@ void BuildingViewerDdsController::handleMountingPoint(const InfrastructureManage
|
||||
return;
|
||||
}
|
||||
|
||||
QVector3D position(mp.relPosition().offsetX(), mp.relPosition().offsetY(), mp.relPosition().offsetZ());
|
||||
QVector3D position(mp.relPosition().offsetX, mp.relPosition().offsetY, mp.relPosition().offsetZ);
|
||||
QString strfeatureID = BuildingViewer::databaseId2FeatureId(mp.buildingId());
|
||||
QString strMountingPointID = strfeatureID + QStringLiteral("_MountingPoint_") + QString::number(mountingPointId);
|
||||
|
||||
@@ -712,7 +712,7 @@ void BuildingViewerDdsController::setCurrentTrainingAreaMap(const QString& model
|
||||
|
||||
bool BuildingViewerDdsController::isValidParticipant(const ParticipantManagement::Participant& participant) const
|
||||
{
|
||||
if (participant.id() == 0)
|
||||
if (participant.id == 0)
|
||||
{
|
||||
if (m_logger.isDebugEnabled())
|
||||
DEBUG_LOG(m_logger) << getSessionInfo()
|
||||
@@ -720,32 +720,32 @@ bool BuildingViewerDdsController::isValidParticipant(const ParticipantManagement
|
||||
return false;
|
||||
}
|
||||
|
||||
if (participant.isDeleted())
|
||||
if (participant.isDeleted)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << getSessionInfo() << "isValidParticipant: Not handling participant with id "
|
||||
<< participant.id() << " since it is marked as 'deleted'";
|
||||
<< participant.id << " since it is marked as 'deleted'";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_session == nullptr)
|
||||
return false;
|
||||
|
||||
if (!m_session->isVisibleParty(participant.partyId()))
|
||||
if (!m_session->isVisibleParty(participant.partyId))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << getSessionInfo() << "isValidParticipant: Not handling participant with id "
|
||||
<< participant.id() << " since it is not visible for party with id "
|
||||
<< participant.partyId();
|
||||
<< participant.id << " since it is not visible for party with id "
|
||||
<< participant.partyId;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!m_ppmDtc)
|
||||
return false;
|
||||
|
||||
ParticipantManagement::TypeClass tc = m_ppmDtc->type(participant.typeId()).typeClass();
|
||||
ParticipantManagement::TypeClass tc = m_ppmDtc->type(participant.typeId).typeClass;
|
||||
if (tc == ParticipantManagement::TypeClass::SupportUnit || tc == ParticipantManagement::TypeClass::Unit)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << getSessionInfo() << "isValidParticipant: Not handling participant with id "
|
||||
<< participant.id() << " since its type is 'SupportUnit', 'Unit' or 'Structure'";
|
||||
<< participant.id << " since its type is 'SupportUnit', 'Unit' or 'Structure'";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -787,7 +787,7 @@ void BuildingViewerDdsController::createParticipants()
|
||||
auto cb = [this, &positionMap, sizeL](const ParticipantManagement::Participant& part) {
|
||||
if (!isValidParticipant(part))
|
||||
return;
|
||||
createParticipant(part, positionMap.value(part.id()), sizeL);
|
||||
createParticipant(part, positionMap.value(part.id), sizeL);
|
||||
};
|
||||
m_ppmDtc->participants(cb);
|
||||
|
||||
@@ -826,7 +826,7 @@ void BuildingViewerDdsController::onBoobyTrapChanged(const AreaEffectSimulation:
|
||||
switch (modType)
|
||||
{
|
||||
case DataModification::eModified:
|
||||
deleteParticipant(990000 + boobyTrap.id());
|
||||
deleteParticipant(990000 + boobyTrap.id);
|
||||
Q_FALLTHROUGH();
|
||||
case DataModification::eAdded: {
|
||||
int sizeL = LtsUtils::OperatorSettings::getInstance()
|
||||
@@ -836,7 +836,7 @@ void BuildingViewerDdsController::onBoobyTrapChanged(const AreaEffectSimulation:
|
||||
break;
|
||||
}
|
||||
case DataModification::eRemoved: {
|
||||
deleteParticipant(990000 + boobyTrap.id());
|
||||
deleteParticipant(990000 + boobyTrap.id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -851,17 +851,17 @@ void BuildingViewerDdsController::onParticipantChanged(const ParticipantManageme
|
||||
switch (modType)
|
||||
{
|
||||
case DataModification::eModified:
|
||||
deleteParticipant(participant.id());
|
||||
deleteParticipant(participant.id);
|
||||
Q_FALLTHROUGH();
|
||||
case DataModification::eAdded: {
|
||||
int sizeL = LtsUtils::OperatorSettings::getInstance()
|
||||
->value(QStringLiteral("BgViewer"), QStringLiteral("PlayerSymbolSize"), 20)
|
||||
.toInt();
|
||||
createParticipant(participant, m_ppmDtc->participantPosition(participant.id()), sizeL);
|
||||
createParticipant(participant, m_ppmDtc->participantPosition(participant.id), sizeL);
|
||||
break;
|
||||
}
|
||||
case DataModification::eRemoved: {
|
||||
deleteParticipant(participant.id());
|
||||
deleteParticipant(participant.id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -878,8 +878,8 @@ void BuildingViewerDdsController::onDynParticipantChanged(const ParticipantManag
|
||||
case DataModification::eAdded:
|
||||
case DataModification::eModified:
|
||||
if (m_ppmDtc)
|
||||
createParticipant(m_ppmDtc->participant(data.participantId()),
|
||||
m_ppmDtc->participantPosition(data.participantId()), sizeL);
|
||||
createParticipant(m_ppmDtc->participant(data.participantId),
|
||||
m_ppmDtc->participantPosition(data.participantId), sizeL);
|
||||
break;
|
||||
case DataModification::eRemoved: {
|
||||
break;
|
||||
@@ -890,12 +890,12 @@ void BuildingViewerDdsController::onDynParticipantChanged(const ParticipantManag
|
||||
void BuildingViewerDdsController::onHitLineInfoChanged(const ParticipantManagement::HitLineInfo& hli,
|
||||
DataModification modType)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "X 0000 onHitLineInfoChanged id=" << hli.id();
|
||||
DEBUG_LOG(m_logger) << "X 0000 onHitLineInfoChanged id=" << hli.id;
|
||||
|
||||
if (modType == DataModification::eRemoved)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onHitLineInfoChanged removeHit id=" << hli.id();
|
||||
m_connection->removeRoomHit(hli.id());
|
||||
DEBUG_LOG(m_logger) << "onHitLineInfoChanged removeHit id=" << hli.id;
|
||||
m_connection->removeRoomHit(hli.id);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -903,24 +903,24 @@ void BuildingViewerDdsController::onHitLineInfoChanged(const ParticipantManageme
|
||||
return;
|
||||
m_ppmDtc->waitForHistoricalDataParticipant();
|
||||
|
||||
const ParticipantManagement::Participant& partSrc = m_ppmDtc->participant(hli.originatorParticipantId());
|
||||
const ParticipantManagement::Participant& partDst = m_ppmDtc->participant(hli.injuryParticipantId());
|
||||
if (partSrc.id() == 0 || partDst.id() == 0)
|
||||
const ParticipantManagement::Participant& partSrc = m_ppmDtc->participant(hli.originatorParticipantId);
|
||||
const ParticipantManagement::Participant& partDst = m_ppmDtc->participant(hli.injuryParticipantId);
|
||||
if (partSrc.id == 0 || partDst.id == 0)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "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());
|
||||
const QString& strFeatureID = BuildingViewer::databaseId2FeatureId(hli.injuryBuildingId);
|
||||
if (!m_viewerInterface->isViewOpen(strFeatureID.toStdString()))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "building not opened: hli.buildingId()=" << hli;
|
||||
return;
|
||||
}
|
||||
|
||||
if (hli.injuryBuildingId() != 0)
|
||||
if (hli.injuryBuildingId != 0)
|
||||
{
|
||||
auto itBuildingHit = m_buildingHits.constFind(hli.injuryBuildingId());
|
||||
auto itBuildingHit = m_buildingHits.constFind(hli.injuryBuildingId);
|
||||
if (itBuildingHit != m_buildingHits.constEnd())
|
||||
{
|
||||
const QVector<BuildingHit>& bHits = itBuildingHit.value();
|
||||
@@ -929,14 +929,14 @@ void BuildingViewerDdsController::onHitLineInfoChanged(const ParticipantManageme
|
||||
for (const BuildingHit& bh : bHits)
|
||||
{
|
||||
|
||||
const bool testFlag = (bh.chargeTypeId == hli.chargeTypeId() &&
|
||||
bh.originatorParticipantId == hli.originatorParticipantId() &&
|
||||
hli.sampleTime() - m_hitlineDuration_ms < bh.sampleTime);
|
||||
const bool testFlag = (bh.chargeTypeId == hli.chargeTypeId &&
|
||||
bh.originatorParticipantId == hli.originatorParticipantId &&
|
||||
hli.sampleTime - m_hitlineDuration_ms < bh.sampleTime);
|
||||
DEBUG_LOG(m_logger) << "testFlag " << testFlag;
|
||||
|
||||
if (bh.chargeTypeId == hli.chargeTypeId() &&
|
||||
bh.originatorParticipantId == hli.originatorParticipantId() &&
|
||||
hli.sampleTime() - m_hitlineDuration_ms < bh.sampleTime)
|
||||
if (bh.chargeTypeId == hli.chargeTypeId &&
|
||||
bh.originatorParticipantId == hli.originatorParticipantId &&
|
||||
hli.sampleTime - m_hitlineDuration_ms < bh.sampleTime)
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -950,32 +950,32 @@ void BuildingViewerDdsController::onHitLineInfoChanged(const ParticipantManageme
|
||||
DEBUG_LOG(m_logger) << "onHitLineInfoChanged createPlayerSymbols";
|
||||
createPlayerSymbols(partDst, sizeL);
|
||||
|
||||
LtsUtils::QPoint3D originatorSrc = toRelative3D(hli.originatorPos());
|
||||
LtsUtils::QPoint3D injuryDest = toRelative3D(hli.injuryPos());
|
||||
LtsUtils::QPoint3D originatorSrc = toRelative3D(hli.originatorPos);
|
||||
LtsUtils::QPoint3D injuryDest = toRelative3D(hli.injuryPos);
|
||||
|
||||
DEBUG_LOG(m_logger) << "onHitLineInfoChanged playerHit"
|
||||
<< " hli.originatorPos() z=" << hli.originatorPos().z()
|
||||
<< " hli.injuryPos() z=" << hli.injuryPos().z() << " Src=" << originatorSrc.x() << "/"
|
||||
<< " hli.originatorPos() z=" << hli.originatorPos.z
|
||||
<< " hli.injuryPos() z=" << hli.injuryPos.z << " Src=" << originatorSrc.x() << "/"
|
||||
<< originatorSrc.y() << "/" << originatorSrc.z() << " Dest= " << injuryDest.x() << "/"
|
||||
<< injuryDest.y() << "/" << injuryDest.z()
|
||||
<< " hli.originatorBuildingId=" << hli.originatorBuildingId()
|
||||
<< " hli.originatorRoomId=" << hli.originatorRoomId()
|
||||
<< " hli.injuryBuildingId=" << hli.injuryBuildingId()
|
||||
<< " hli.injuryRoomId=" << hli.injuryRoomId();
|
||||
<< " hli.originatorBuildingId=" << hli.originatorBuildingId
|
||||
<< " hli.originatorRoomId=" << hli.originatorRoomId
|
||||
<< " hli.injuryBuildingId=" << hli.injuryBuildingId
|
||||
<< " hli.injuryRoomId=" << hli.injuryRoomId;
|
||||
|
||||
DEBUG_LOG(m_logger) << "Before z-correction:"
|
||||
<< " Src=" << originatorSrc.x() << "/" << originatorSrc.y() << "/" << originatorSrc.z()
|
||||
<< " Dest= " << injuryDest.x() << "/" << injuryDest.y() << "/" << injuryDest.z();
|
||||
|
||||
double zAddOriginator = m_buildingHeight.value(hli.originatorBuildingId(), 0);
|
||||
double zAddInjury = m_buildingHeight.value(hli.injuryBuildingId(), 0);
|
||||
double zAddOriginator = m_buildingHeight.value(hli.originatorBuildingId, 0);
|
||||
double zAddInjury = m_buildingHeight.value(hli.injuryBuildingId, 0);
|
||||
DEBUG_LOG(m_logger) << "z-correction: zAddOriginator=" << zAddOriginator;
|
||||
DEBUG_LOG(m_logger) << "z-correction: zAddInjury=" << zAddInjury;
|
||||
|
||||
if (hli.originatorBuildingId() <= 0)
|
||||
if (hli.originatorBuildingId <= 0)
|
||||
zAddOriginator = zAddInjury;
|
||||
|
||||
if (hli.injuryBuildingId() <= 0)
|
||||
if (hli.injuryBuildingId <= 0)
|
||||
zAddInjury = zAddOriginator;
|
||||
|
||||
originatorSrc.setZ(originatorSrc.z() + zAddInjury);
|
||||
@@ -988,54 +988,55 @@ void BuildingViewerDdsController::onHitLineInfoChanged(const ParticipantManageme
|
||||
int buildingIdSrc = -1;
|
||||
int roomNumberSrc = -1;
|
||||
{
|
||||
auto itId2Number = m_roomId2RoomNumber.constFind(hli.originatorBuildingId());
|
||||
auto itId2Number = m_roomId2RoomNumber.constFind(hli.originatorBuildingId);
|
||||
if (itId2Number != m_roomId2RoomNumber.constEnd())
|
||||
{
|
||||
const auto& mapRooms = itId2Number.value();
|
||||
const auto itRoom = mapRooms.constFind(hli.originatorRoomId());
|
||||
const auto itRoom = mapRooms.constFind(hli.originatorRoomId);
|
||||
if (itRoom != mapRooms.constEnd())
|
||||
{
|
||||
buildingIdSrc = hli.originatorBuildingId();
|
||||
buildingIdSrc = hli.originatorBuildingId;
|
||||
roomNumberSrc = itRoom.value();
|
||||
}
|
||||
else
|
||||
WARNING_LOG(m_logger) << "onHitLineInfoChanged: Room id can not be mapped! Building id: "
|
||||
<< hli.injuryBuildingId() << ", originatorRoomId: " << hli.originatorRoomId();
|
||||
<< hli.injuryBuildingId << ", originatorRoomId: " << hli.originatorRoomId;
|
||||
}
|
||||
}
|
||||
|
||||
int buildingIdDst = -1;
|
||||
int roomNumberDst = -1;
|
||||
{
|
||||
auto itId2Number = m_roomId2RoomNumber.constFind(hli.injuryBuildingId());
|
||||
auto itId2Number = m_roomId2RoomNumber.constFind(hli.injuryBuildingId);
|
||||
if (itId2Number != m_roomId2RoomNumber.constEnd())
|
||||
{
|
||||
const auto& mapRooms = itId2Number.value();
|
||||
const auto itRoom = mapRooms.constFind(hli.injuryRoomId());
|
||||
const auto itRoom = mapRooms.constFind(hli.injuryRoomId);
|
||||
if (itRoom != mapRooms.constEnd())
|
||||
{
|
||||
buildingIdDst = hli.injuryBuildingId();
|
||||
buildingIdDst = hli.injuryBuildingId;
|
||||
roomNumberDst = itRoom.value();
|
||||
}
|
||||
else
|
||||
WARNING_LOG(m_logger) << "onHitLineInfoChanged: Room id can not be mapped! Building id: "
|
||||
<< hli.injuryBuildingId() << ", room id: " << hli.injuryRoomId();
|
||||
<< hli.injuryBuildingId << ", room id: " << hli.injuryRoomId;
|
||||
}
|
||||
}
|
||||
|
||||
DEBUG_LOG(m_logger) << "After translate buildingId, roomId:"
|
||||
<< " hli.originatorBuildingId=" << hli.originatorBuildingId() << " -> " << buildingIdSrc
|
||||
<< " hli.originatorRoomId=" << hli.originatorRoomId() << " -> " << roomNumberSrc
|
||||
<< " hli.injuryBuildingId=" << hli.injuryBuildingId() << " -> " << buildingIdDst
|
||||
<< " hli.injuryRoomId=" << hli.injuryBuildingId() << " -> " << roomNumberDst
|
||||
<< " hli.sampleTime=" << hli.sampleTime();
|
||||
<< " hli.originatorBuildingId=" << hli.originatorBuildingId << " -> " << buildingIdSrc
|
||||
<< " hli.originatorRoomId=" << hli.originatorRoomId << " -> " << roomNumberSrc
|
||||
<< " hli.injuryBuildingId=" << hli.injuryBuildingId << " -> " << buildingIdDst
|
||||
<< " hli.injuryRoomId=" << hli.injuryBuildingId << " -> " << roomNumberDst
|
||||
<< " hli.sampleTime=" << hli.sampleTime;
|
||||
int lineType = 2;
|
||||
m_pdmDtc->chargeType(hli.chargeTypeId());
|
||||
m_pdmDtc->chargeType(hli.chargeTypeId);
|
||||
|
||||
lineType = m_pdmDtc->getChargeTypeSpecialProperty(hli.chargeTypeId(), 0, 0);
|
||||
// DDS enums are enum class; lineType is int.
|
||||
lineType = static_cast<int>(m_pdmDtc->getChargeTypeSpecialProperty(hli.chargeTypeId, 0, 0));
|
||||
|
||||
m_connection->playerHit(hli.id(), partSrc.id(), partDst.id(), originatorSrc, injuryDest, buildingIdSrc,
|
||||
roomNumberSrc, buildingIdDst, roomNumberDst, lineType, hli.sampleTime());
|
||||
m_connection->playerHit(hli.id, partSrc.id, partDst.id, originatorSrc, injuryDest, buildingIdSrc,
|
||||
roomNumberSrc, buildingIdDst, roomNumberDst, lineType, hli.sampleTime);
|
||||
}
|
||||
|
||||
void BuildingViewerDdsController::onPartyChanged(const ParticipantManagement::Party& party, DataModification modType)
|
||||
@@ -1046,7 +1047,7 @@ void BuildingViewerDdsController::onPartyChanged(const ParticipantManagement::Pa
|
||||
int sizeL = LtsUtils::OperatorSettings::getInstance()
|
||||
->value(QStringLiteral("BgViewer"), QStringLiteral("PlayerSymbolSize"), 20)
|
||||
.toInt();
|
||||
updatePlayerSymbols(sizeL, party.id());
|
||||
updatePlayerSymbols(sizeL, party.id);
|
||||
syncTeams();
|
||||
}
|
||||
|
||||
@@ -1063,35 +1064,35 @@ void BuildingViewerDdsController::onPositionChanged(const ParticipantManagement:
|
||||
|
||||
int buildingID = -1;
|
||||
int roomNumber = -1;
|
||||
auto itId2Number = m_roomId2RoomNumber.constFind(position.buildingId());
|
||||
auto itId2Number = m_roomId2RoomNumber.constFind(position.buildingId);
|
||||
if (itId2Number != m_roomId2RoomNumber.constEnd())
|
||||
{
|
||||
const auto& mapRooms = itId2Number.value();
|
||||
const auto itRoom = mapRooms.constFind(position.roomId());
|
||||
const auto itRoom = mapRooms.constFind(position.roomId);
|
||||
if (itRoom != mapRooms.constEnd())
|
||||
{
|
||||
buildingID = position.buildingId();
|
||||
buildingID = position.buildingId;
|
||||
roomNumber = itRoom.value();
|
||||
}
|
||||
else
|
||||
{
|
||||
WARNING_LOG(m_logger) << "onPositionChanged: Room id can not be mapped! Building id: "
|
||||
<< position.buildingId() << ", room id: " << position.roomId();
|
||||
<< position.buildingId << ", room id: " << position.roomId;
|
||||
}
|
||||
}
|
||||
|
||||
if ((roomNumber < 0) && (buildingID <= 0) && (position.buildingId() > 0) &&
|
||||
(position.reportingSource() == Core::PositionReportingSource::Ops ||
|
||||
position.reportingSource() == Core::PositionReportingSource::Wls))
|
||||
if ((roomNumber < 0) && (buildingID <= 0) && (position.buildingId > 0) &&
|
||||
(position.reportingSource == Core::PositionReportingSource::Ops ||
|
||||
position.reportingSource == Core::PositionReportingSource::Wls))
|
||||
{
|
||||
buildingID = position.buildingId();
|
||||
buildingID = position.buildingId;
|
||||
}
|
||||
|
||||
const int playerId = position.participantId();
|
||||
const int playerId = position.participantId;
|
||||
auto it = m_lastPositionTime.find(playerId);
|
||||
if (it == m_lastPositionTime.end())
|
||||
{
|
||||
m_lastPositionTime.insert(playerId, position.sampleTime());
|
||||
m_lastPositionTime.insert(playerId, position.sampleTime);
|
||||
if (isOutdatedPosition(position))
|
||||
m_connection->setPlayerVisible(playerId, false);
|
||||
}
|
||||
@@ -1099,7 +1100,7 @@ void BuildingViewerDdsController::onPositionChanged(const ParticipantManagement:
|
||||
{
|
||||
if (isOutdatedPosition(it.value()) && !isOutdatedPosition(position))
|
||||
m_connection->setPlayerVisible(playerId, true);
|
||||
it.value() = position.sampleTime();
|
||||
it.value() = position.sampleTime;
|
||||
}
|
||||
|
||||
if (buildingID <= 0 && roomNumber <= 0)
|
||||
@@ -1118,8 +1119,8 @@ void BuildingViewerDdsController::onPositionChanged(const ParticipantManagement:
|
||||
return;
|
||||
}
|
||||
|
||||
m_connection->playerPlace(position.participantId(), toRelative3D(position.pos()), buildingID, roomNumber,
|
||||
position.reportingSource());
|
||||
m_connection->playerPlace(position.participantId, toRelative3D(position.pos), buildingID, roomNumber,
|
||||
position.reportingSource);
|
||||
}
|
||||
|
||||
void BuildingViewerDdsController::onParticipantGearEventChanged(const ParticipantManagement::ParticipantGearEvent& data,
|
||||
@@ -1129,12 +1130,12 @@ void BuildingViewerDdsController::onParticipantGearEventChanged(const Participan
|
||||
{
|
||||
case DataModification::eAdded:
|
||||
case DataModification::eModified: {
|
||||
m_participantGearEvents[data.participantId()] = data.sampleTime();
|
||||
m_participantGearEvents[data.participantId] = data.sampleTime;
|
||||
break;
|
||||
}
|
||||
case DataModification::eRemoved: {
|
||||
|
||||
const int playerId = data.participantId();
|
||||
const int playerId = data.participantId;
|
||||
m_participantGearEvents.remove(playerId);
|
||||
m_connection->playerUpdatePlayerSymbol(playerId, buildPlayerSymbolFilePath(playerId, cColorSymbolId));
|
||||
break;
|
||||
@@ -1158,44 +1159,44 @@ void BuildingViewerDdsController::createParticipant(const ParticipantManagement:
|
||||
|
||||
createPlayerSymbols(participant, sizeL);
|
||||
|
||||
m_connection->playerCreate(participant.id(), participant.partyId(), buildPlayerSymbolFilePath(participant.id()),
|
||||
toRelative3D(position.pos()), position.buildingId(),
|
||||
m_roomId2RoomNumber.value(position.buildingId()).value(position.roomId()),
|
||||
position.reportingSource());
|
||||
m_connection->playerCreate(participant.id, participant.partyId, buildPlayerSymbolFilePath(participant.id),
|
||||
toRelative3D(position.pos), position.buildingId,
|
||||
m_roomId2RoomNumber.value(position.buildingId).value(position.roomId),
|
||||
position.reportingSource);
|
||||
|
||||
const bool isOutdated = isOutdatedPosition(position);
|
||||
const int participantId = participant.id();
|
||||
const int participantId = participant.id;
|
||||
const bool isValid =
|
||||
(position.buildingId() > 0 && m_roomId2RoomNumber.value(position.buildingId()).value(position.roomId()) > 0);
|
||||
(position.buildingId > 0 && m_roomId2RoomNumber.value(position.buildingId).value(position.roomId) > 0);
|
||||
m_connection->setPlayerVisible(participantId, (!isOutdated && isValid));
|
||||
m_lastPositionTime.insert(participantId, position.sampleTime());
|
||||
m_lastPositionTime.insert(participantId, position.sampleTime);
|
||||
}
|
||||
|
||||
void BuildingViewerDdsController::createBoobyTrap(const AreaEffectSimulation::BoobyTrap& trap, int sizeL)
|
||||
{
|
||||
if (trap.effectStateId() != AreaEffectSimulation::AesEffectState::EsActivated &&
|
||||
trap.effectStateId() != AreaEffectSimulation::AesEffectState::EsPrepared)
|
||||
if (trap.effectStateId != AreaEffectSimulation::AesEffectState::EsActivated &&
|
||||
trap.effectStateId != AreaEffectSimulation::AesEffectState::EsPrepared)
|
||||
return;
|
||||
|
||||
ParticipantManagement::Participant participant;
|
||||
if (trap.partyId().has_value())
|
||||
participant.partyId() = trap.partyId().get();
|
||||
participant.designator() = trap.name();
|
||||
participant.designator() = trap.name();
|
||||
participant.id() = trap.id() + 990000;
|
||||
participant.sampleTime() = trap.sampleTime();
|
||||
participant.symbol() = "AP6D|CMPL|10011500002104000000";
|
||||
if (trap.partyId.has_value())
|
||||
participant.partyId = trap.partyId.get();
|
||||
participant.designator = trap.name;
|
||||
participant.designator = trap.name;
|
||||
participant.id = trap.id + 990000;
|
||||
participant.sampleTime = trap.sampleTime;
|
||||
participant.symbol = "AP6D|CMPL|10011500002104000000";
|
||||
|
||||
createPlayerSymbols(participant, sizeL);
|
||||
Core::GeoPosition pos;
|
||||
pos.lat() = trap.impactPosition().lat();
|
||||
pos.lon() = trap.impactPosition().lon();
|
||||
pos.lat = trap.impactPosition.lat;
|
||||
pos.lon = trap.impactPosition.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()),
|
||||
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), -1, -1, Core::PositionReportingSource::External);
|
||||
m_connection->setPlayerVisible(participant.id(), true);
|
||||
m_connection->setPlayerVisible(participant.id, true);
|
||||
}
|
||||
|
||||
void BuildingViewerDdsController::updatePlayerSymbols(const int sizeL, const int forParty)
|
||||
@@ -1207,7 +1208,7 @@ void BuildingViewerDdsController::updatePlayerSymbols(const int sizeL, const int
|
||||
if (!isValidParticipant(participant))
|
||||
return;
|
||||
|
||||
if (forParty == -1 || participant.partyId() == forParty)
|
||||
if (forParty == -1 || participant.partyId == forParty)
|
||||
createPlayerSymbols(participant, sizeL);
|
||||
};
|
||||
m_ppmDtc->participants(cb);
|
||||
@@ -1219,9 +1220,9 @@ void BuildingViewerDdsController::createPlayerSymbols(const ParticipantManagemen
|
||||
SymbolInfo symbolinfo;
|
||||
for (int i = 0; i < m_vecFlashColors.size(); ++i)
|
||||
{
|
||||
Q_ASSERT(participant.id() != 0);
|
||||
symbolinfo.participantId = participant.id();
|
||||
symbolinfo.strPathToSymbolFile = buildPlayerSymbolFilePath(participant.id(), i);
|
||||
Q_ASSERT(participant.id != 0);
|
||||
symbolinfo.participantId = participant.id;
|
||||
symbolinfo.strPathToSymbolFile = buildPlayerSymbolFilePath(participant.id, i);
|
||||
symbolinfo.color = m_vecFlashColors.at(i);
|
||||
symbolinfo.useThisSymbolNow = !symbolinfo.color.isValid();
|
||||
createSymbolResultWatcher(participant, symbolinfo, sizeL);
|
||||
@@ -1304,7 +1305,7 @@ void BuildingViewerDdsController::reCheckHitLine()
|
||||
|
||||
for (const auto& hli : hitMap)
|
||||
{
|
||||
if (hli.sampleTime() < (m_session->partitionTime() - 3000))
|
||||
if (hli.sampleTime < (m_session->partitionTime() - 3000))
|
||||
onBuildingHitLineInfoChanged(hli, DataModification::eAdded);
|
||||
}
|
||||
}
|
||||
@@ -1332,17 +1333,17 @@ void BuildingViewerDdsController::updateBuildingRoomNames(
|
||||
const InfrastructureManagement::MainStructureElement& building)
|
||||
{
|
||||
|
||||
const std::vector<InfrastructureManagement::StructureElement>& vecElements = building.elements();
|
||||
const std::vector<InfrastructureManagement::StructureElement>& vecElements = building.elements;
|
||||
|
||||
int32_t buildingDatabaseId = building.id();
|
||||
int32_t buildingDatabaseId = building.id;
|
||||
QString featureID = BuildingViewer::databaseId2FeatureId(buildingDatabaseId);
|
||||
for (const auto& se : vecElements)
|
||||
{
|
||||
if (se.structureElementTypeId() == InfrastructureManagement::StructureElementType::Building)
|
||||
m_connection->excSetBuildingDisplayName(featureID, QString::fromStdString(se.displayName()));
|
||||
if (se.structureElementTypeId() == InfrastructureManagement::StructureElementType::Room)
|
||||
m_connection->excSetRoomDisplayName(featureID, QString::number(se.mountingPointId()),
|
||||
QString::fromStdString(se.displayName()));
|
||||
if (se.structureElementTypeId == InfrastructureManagement::StructureElementType::Building)
|
||||
m_connection->excSetBuildingDisplayName(featureID, QString::fromStdString(se.displayName));
|
||||
if (se.structureElementTypeId == InfrastructureManagement::StructureElementType::Room)
|
||||
m_connection->excSetRoomDisplayName(featureID, QString::number(se.mountingPointId),
|
||||
QString::fromStdString(se.displayName));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1429,25 +1430,25 @@ void BuildingViewerDdsController::onBuildingStateChanged(const Buildings::Buildi
|
||||
return;
|
||||
|
||||
QMap<int, int> roomDestructions;
|
||||
for (const Buildings::RoomState& rs : data.roomStates())
|
||||
for (const Buildings::RoomState& rs : data.roomStates)
|
||||
{
|
||||
roomDestructions.insert(rs.mountingPointId(), rs.damagePercent());
|
||||
roomDestructions.insert(rs.mountingPointId, rs.damagePercent);
|
||||
}
|
||||
|
||||
m_connection->buildingHit(data.id(), data.id(), data.damagePercent(), roomDestructions);
|
||||
m_connection->buildingHit(data.id, data.id, data.damagePercent, roomDestructions);
|
||||
}
|
||||
|
||||
void BuildingViewerDdsController::onBuildingHitLineInfoChanged(const Buildings::BuildingHitLineInfo& hli,
|
||||
DataModification modType)
|
||||
{
|
||||
int topidId = static_cast<int>(hli.id());
|
||||
int topidId = static_cast<int>(hli.id);
|
||||
|
||||
DEBUG_LOG(m_logger) << "onBuildingHitLineInfoChanged: " << hli;
|
||||
|
||||
const QString& strFeatureID = BuildingViewer::databaseId2FeatureId(hli.buildingId());
|
||||
const QString& strFeatureID = BuildingViewer::databaseId2FeatureId(hli.buildingId);
|
||||
if (!m_viewerInterface->isViewOpen(strFeatureID.toStdString()))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "building not opened: hli.buildingId()=" << hli.buildingId();
|
||||
DEBUG_LOG(m_logger) << "building not opened: hli.buildingId()=" << hli.buildingId;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1457,28 +1458,28 @@ void BuildingViewerDdsController::onBuildingHitLineInfoChanged(const Buildings::
|
||||
if (isRemove)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onBuildingHitLineInfoChanged: remove ";
|
||||
QVector<BuildingHit>& bhl = m_buildingHits[hli.buildingId()];
|
||||
QVector<BuildingHit>& bhl = m_buildingHits[hli.buildingId];
|
||||
|
||||
auto it = std::find_if(bhl.begin(), bhl.end(), [hli](const BuildingHit& bh) { return (bh.id == hli.id()); });
|
||||
auto it = std::find_if(bhl.begin(), bhl.end(), [hli](const BuildingHit& bh) { return (bh.id == hli.id); });
|
||||
|
||||
if (it != bhl.end())
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "bhl.erase(it)";
|
||||
bhl.erase(it);
|
||||
}
|
||||
m_connection->removeRoomHit(hli.id());
|
||||
m_connection->removeRoomHit(hli.id);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
BuildingHit bh;
|
||||
bh.id = hli.id();
|
||||
bh.sampleTime = hli.sampleTime();
|
||||
bh.originatorParticipantId = hli.originatorParticipantId();
|
||||
bh.chargeTypeId = hli.chargeTypeId();
|
||||
bh.id = hli.id;
|
||||
bh.sampleTime = hli.sampleTime;
|
||||
bh.originatorParticipantId = hli.originatorParticipantId;
|
||||
bh.chargeTypeId = hli.chargeTypeId;
|
||||
|
||||
bool contains = false;
|
||||
for (const auto& it : m_buildingHits[hli.buildingId()])
|
||||
for (const auto& it : m_buildingHits[hli.buildingId])
|
||||
{
|
||||
if (it.id == bh.id)
|
||||
contains = true;
|
||||
@@ -1486,13 +1487,13 @@ void BuildingViewerDdsController::onBuildingHitLineInfoChanged(const Buildings::
|
||||
if (!contains)
|
||||
{
|
||||
|
||||
m_buildingHits[hli.buildingId()].push_back(bh);
|
||||
m_buildingHits[hli.buildingId].push_back(bh);
|
||||
}
|
||||
}
|
||||
int lineType = 2;
|
||||
|
||||
m_connection->roomHit(topidId, hli.originatorParticipantId(), hli.buildingId(), hli.hitOnRoomId(),
|
||||
toRelative3D(hli.originatorPos()), lineType, isRemove ? 0 : hli.sampleTime());
|
||||
m_connection->roomHit(topidId, hli.originatorParticipantId, hli.buildingId, hli.hitOnRoomId,
|
||||
toRelative3D(hli.originatorPos), lineType, isRemove ? 0 : hli.sampleTime);
|
||||
}
|
||||
|
||||
void BuildingViewerDdsController::onCleanupBuildingHitlines()
|
||||
@@ -1509,33 +1510,33 @@ void BuildingViewerDdsController::onCleanupBuildingHitlines()
|
||||
void BuildingViewerDdsController::onMainStructureElementChanged(
|
||||
const InfrastructureManagement::MainStructureElement& mse, DataModification modType)
|
||||
{
|
||||
if (!isBuildingKnown(mse.id()))
|
||||
if (!isBuildingKnown(mse.id))
|
||||
return;
|
||||
|
||||
switch (modType)
|
||||
{
|
||||
case DataModification::eAdded:
|
||||
case DataModification::eModified: {
|
||||
if (mse.modelId() != 0 && m_ismDtc->isElementAssignedToExercise(mse, m_exerciseId))
|
||||
if (mse.modelId != 0 && m_ismDtc->isElementAssignedToExercise(mse, m_exerciseId))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "m_buildingHeight.insert id=" << mse.id() << " z=" << mse.geoPosition().z();
|
||||
m_buildingHeight.insert(mse.id(), 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())
|
||||
for (const InfrastructureManagement::StructureElement& se : mse.elements)
|
||||
{
|
||||
if (se.structureElementTypeId() != InfrastructureManagement::StructureElementType::Room)
|
||||
if (se.structureElementTypeId != InfrastructureManagement::StructureElementType::Room)
|
||||
continue;
|
||||
roomId2RoomNumber[se.id()] = se.mountingPointId();
|
||||
roomId2RoomNumber[se.id] = se.mountingPointId;
|
||||
}
|
||||
m_roomId2RoomNumber[mse.id()] = roomId2RoomNumber;
|
||||
m_roomId2RoomNumber[mse.id] = roomId2RoomNumber;
|
||||
|
||||
updateBuildingRoomNames(mse);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case DataModification::eRemoved:
|
||||
m_roomId2RoomNumber.remove(mse.id());
|
||||
m_buildingHeight.remove(mse.id());
|
||||
m_roomId2RoomNumber.remove(mse.id);
|
||||
m_buildingHeight.remove(mse.id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user