Migrates InfrastructureManagement to generated rtiddsgen API
Converts accessor calls to plain member access across ism service.
This commit is contained in:
30 files changed
+1322
-1314
No files matched your search
+125
-125
@@ -160,13 +160,13 @@ void DtcImplCustom::updateStructureElementCache(const MainStructureElement &mse,
|
||||
bIsVeryFirstCall = false;
|
||||
}
|
||||
|
||||
const std::vector<InfrastructureManagement::StructureElement>& ses = mse.elements();
|
||||
const std::vector<InfrastructureManagement::StructureElement>& ses = mse.elements;
|
||||
for (const auto &se : ses)
|
||||
{
|
||||
if (modType==DataModification::eRemoved)
|
||||
d->structureElementCache.remove(se.id());
|
||||
d->structureElementCache.remove(se.id);
|
||||
else
|
||||
d->structureElementCache[se.id()] = se;
|
||||
d->structureElementCache[se.id] = se;
|
||||
} // for
|
||||
|
||||
DEBUG_LOG(m_logger) << "ISM::StructureElementCache updateStructureElementCache, new size = " << d->structureElementCache.size();
|
||||
@@ -180,11 +180,11 @@ long DtcImplCustom::structureElementCacheSize() const
|
||||
//---------------------------------------------------------------------------------------------------------------------------------------------
|
||||
bool DtcImplCustom::isElementAssignedToExercise(const MainStructureElement &mse, int exerciseId) const
|
||||
{
|
||||
const QJsonObject obj(LtsUtils::JsonObject::fromJson(mse.properties()));
|
||||
const QJsonObject obj(LtsUtils::JsonObject::fromJson(mse.properties));
|
||||
auto it = obj.find(QStringLiteral("available_in_exercise"));
|
||||
if (it == obj.end())
|
||||
{
|
||||
INFO_LOG(m_logger) << "Main structure element id " << mse.id() << ": Attribute \"available_in_exercise\" not found. Ignoring...";
|
||||
INFO_LOG(m_logger) << "Main structure element id " << mse.id << ": Attribute \"available_in_exercise\" not found. Ignoring...";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -192,7 +192,7 @@ bool DtcImplCustom::isElementAssignedToExercise(const MainStructureElement &mse,
|
||||
if (std::any_of(arr.begin(), arr.end(), [exerciseId](const QJsonValue & val) { return val.isDouble() && exerciseId == val.toInt(); }))
|
||||
return true;
|
||||
|
||||
INFO_LOG(m_logger) << "Main structure element id " << mse.id() << ": Not assigned (\"available_in_exercise\") to current exercise which has id " << exerciseId << ". Ignoring...";
|
||||
INFO_LOG(m_logger) << "Main structure element id " << mse.id << ": Not assigned (\"available_in_exercise\") to current exercise which has id " << exerciseId << ". Ignoring...";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -204,14 +204,14 @@ bool DtcImplCustom::getMountingPointAssetId(int structureElementId, int assetId,
|
||||
for (const auto &sample : m_dtcMountingPointAsset->readAlive())
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "getMountingPointAssetId: "
|
||||
<< " sample.data().structureElementId()=" << sample.data().structureElementId()
|
||||
<< " sample.data().structureElementId()=" << sample.data().structureElementId
|
||||
<< " structureElementId=" << structureElementId
|
||||
<< " sample.data().assetId()=" << sample.data().assetId()
|
||||
<< " sample.data().assetId()=" << sample.data().assetId
|
||||
<< " assetId" << assetId;
|
||||
if ((sample.data().structureElementId() == structureElementId || structureElementId <= 0) &&
|
||||
(sample.data().assetId() == assetId || assetId <= 0))
|
||||
if ((sample.data().structureElementId == structureElementId || structureElementId <= 0) &&
|
||||
(sample.data().assetId == assetId || assetId <= 0))
|
||||
{
|
||||
mountingPointAssetId = sample.data().id();
|
||||
mountingPointAssetId = sample.data().id;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -228,12 +228,12 @@ bool DtcImplCustom::getAssetIdFromMountingPoint(int structureElementId, int moun
|
||||
TRACE_LOG(m_logger) << "getAssetIdFromMountingPoint:"
|
||||
<< " structureElementId=" << structureElementId
|
||||
<< " mountingPointAssetId=" << mountingPointAssetId
|
||||
<< " sample.data().id()=" << sample.data().id()
|
||||
<< " sample.data().structureElementId()=" << sample.data().structureElementId()
|
||||
<< " sample.data().assetId()=" << sample.data().assetId();
|
||||
if (sample.data().structureElementId() == structureElementId)
|
||||
<< " sample.data().id()=" << sample.data().id
|
||||
<< " sample.data().structureElementId()=" << sample.data().structureElementId
|
||||
<< " sample.data().assetId()=" << sample.data().assetId;
|
||||
if (sample.data().structureElementId == structureElementId)
|
||||
{
|
||||
assetId = sample.data().assetId();
|
||||
assetId = sample.data().assetId;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -267,15 +267,15 @@ int DtcImplCustom::getOpticalCodeFromAssetId(int assetId) const
|
||||
for (const InfrastructureManagement::InstrumentationAsset &instrumentationAsset : m_dtcInstrumentationAsset->readAlive())
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "getAssetIdFromOpticalCode:"
|
||||
<< instrumentationAsset.properties();
|
||||
if ((instrumentationAsset.mountingPointTypeId() == InfrastructureManagement::MountingPointType_def::IndoorIPS)
|
||||
|| (instrumentationAsset.mountingPointTypeId() == InfrastructureManagement::MountingPointType_def::OutdoorIPS))
|
||||
<< instrumentationAsset.properties;
|
||||
if ((instrumentationAsset.mountingPointTypeId == InfrastructureManagement::MountingPointType::IndoorIPS)
|
||||
|| (instrumentationAsset.mountingPointTypeId == InfrastructureManagement::MountingPointType::OutdoorIPS))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "getOpticalCodeFromAsset:"
|
||||
<< " assetId=" << instrumentationAsset.id()
|
||||
<< " opticalCode=" << getOpsCodeFromJSon(instrumentationAsset.properties());
|
||||
if (assetId == instrumentationAsset.id())
|
||||
return getOpsCodeFromJSon(instrumentationAsset.properties());
|
||||
<< " assetId=" << instrumentationAsset.id
|
||||
<< " opticalCode=" << getOpsCodeFromJSon(instrumentationAsset.properties);
|
||||
if (assetId == instrumentationAsset.id)
|
||||
return getOpsCodeFromJSon(instrumentationAsset.properties);
|
||||
}
|
||||
}
|
||||
return assetId;
|
||||
@@ -292,15 +292,15 @@ int DtcImplCustom::getAssetIdFromOpticalCode(int opticalCode) const
|
||||
for (const InfrastructureManagement::InstrumentationAsset &instrumentationAsset : m_dtcInstrumentationAsset->readAlive())
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "getAssetIdFromOpticalCode:"
|
||||
<< instrumentationAsset.properties();
|
||||
if ((instrumentationAsset.mountingPointTypeId() == InfrastructureManagement::MountingPointType_def::IndoorIPS)
|
||||
|| (instrumentationAsset.mountingPointTypeId() == InfrastructureManagement::MountingPointType_def::OutdoorIPS))
|
||||
<< instrumentationAsset.properties;
|
||||
if ((instrumentationAsset.mountingPointTypeId == InfrastructureManagement::MountingPointType::IndoorIPS)
|
||||
|| (instrumentationAsset.mountingPointTypeId == InfrastructureManagement::MountingPointType::OutdoorIPS))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "getAssetIdFromOpticalCode:"
|
||||
<< instrumentationAsset.properties();
|
||||
int opticalCodeAsset = getOpsCodeFromJSon(instrumentationAsset.properties());
|
||||
<< instrumentationAsset.properties;
|
||||
int opticalCodeAsset = getOpsCodeFromJSon(instrumentationAsset.properties);
|
||||
if (opticalCodeAsset == opticalCode)
|
||||
return instrumentationAsset.id();
|
||||
return instrumentationAsset.id;
|
||||
}
|
||||
}
|
||||
return assetId;
|
||||
@@ -313,16 +313,16 @@ int DtcImplCustom::getAssetIdFromMountingPointId(int mainStructureElementId, in
|
||||
|
||||
for (const auto &sample : m_dtcMainStructureElement->readAlive())
|
||||
{
|
||||
if (sample.data().id() != mainStructureElementId)
|
||||
if (sample.data().id != mainStructureElementId)
|
||||
continue;
|
||||
|
||||
for (const StructureElement &elem : sample.data().elements())
|
||||
for (const StructureElement &elem : sample.data().elements)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "elem.id=" << elem.id()
|
||||
<< " elem.mountingPointId=" << elem.mountingPointId();
|
||||
if (elem.mountingPointId() == mountingPointId)
|
||||
DEBUG_LOG(m_logger) << "elem.id=" << elem.id
|
||||
<< " elem.mountingPointId=" << elem.mountingPointId;
|
||||
if (elem.mountingPointId == mountingPointId)
|
||||
{
|
||||
return (getMountedAssetId(elem.id()));
|
||||
return (getMountedAssetId(elem.id));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -339,19 +339,19 @@ bool DtcImplCustom::getOpsDataFromMseIdAndSeId(int mainStructureElementId, int s
|
||||
<< " structureElementId=" << structureElementId;
|
||||
for (const auto &sample : m_dtcMainStructureElement->readAlive())
|
||||
{
|
||||
if (sample.data().id() != mainStructureElementId)
|
||||
if (sample.data().id != mainStructureElementId)
|
||||
continue;
|
||||
|
||||
for (const StructureElement &elem : sample.data().elements())
|
||||
for (const StructureElement &elem : sample.data().elements)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "elem.id=" << elem.id()
|
||||
<< " elem.mountingPointId=" << elem.mountingPointId()
|
||||
<< " elem.path().size=" << elem.path().size();
|
||||
if (elem.id() == structureElementId)
|
||||
DEBUG_LOG(m_logger) << "elem.id=" << elem.id
|
||||
<< " elem.mountingPointId=" << elem.mountingPointId
|
||||
<< " elem.path().size=" << elem.path.size();
|
||||
if (elem.id == structureElementId)
|
||||
{
|
||||
if (elem.path().size() > 1)
|
||||
roomId = elem.path().at(elem.path().size() - 2);
|
||||
geoPosition = elem.geoPosition();
|
||||
if (elem.path.size() > 1)
|
||||
roomId = elem.path.at(elem.path.size() - 2);
|
||||
geoPosition = elem.geoPosition;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -409,9 +409,9 @@ bool DtcImplCustom::getStructureElementById(int structureElementId, StructureEle
|
||||
// fallback: old approach
|
||||
for (const auto &sample : m_dtcMainStructureElement->readAlive())
|
||||
{
|
||||
for (const StructureElement &elem : sample.data().elements())
|
||||
for (const StructureElement &elem : sample.data().elements)
|
||||
{
|
||||
if (elem.id() == structureElementId)
|
||||
if (elem.id == structureElementId)
|
||||
{
|
||||
structureElement = elem;
|
||||
return true;
|
||||
@@ -428,9 +428,9 @@ bool DtcImplCustom::getStructureElementInMntPointAssetByAssetId(int assetId, Str
|
||||
int structureElementId = 0;
|
||||
for (const auto &sample : m_dtcMountingPointAsset->readAlive())
|
||||
{
|
||||
if (sample.data().assetId() == assetId)
|
||||
if (sample.data().assetId == assetId)
|
||||
{
|
||||
structureElementId = sample.data().structureElementId();
|
||||
structureElementId = sample.data().structureElementId;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -440,9 +440,9 @@ bool DtcImplCustom::getStructureElementInMntPointAssetByAssetId(int assetId, Str
|
||||
|
||||
for (const auto &sample : m_dtcMainStructureElement->readAlive())
|
||||
{
|
||||
for (const StructureElement &elem : sample.data().elements())
|
||||
for (const StructureElement &elem : sample.data().elements)
|
||||
{
|
||||
if (elem.id() == structureElementId)
|
||||
if (elem.id == structureElementId)
|
||||
{
|
||||
structureElement = elem;
|
||||
return true;
|
||||
@@ -457,12 +457,12 @@ bool DtcImplCustom::getStructureElementByBuildingIdAndMountingPointId(int mainSt
|
||||
{
|
||||
for (const auto &sample : m_dtcMainStructureElement->readAlive())
|
||||
{
|
||||
if (sample.data().id() != mainStructureElementId)
|
||||
if (sample.data().id != mainStructureElementId)
|
||||
continue;
|
||||
|
||||
for (const StructureElement &elem : sample.data().elements())
|
||||
for (const StructureElement &elem : sample.data().elements)
|
||||
{
|
||||
if (elem.mountingPointId() == mountingPointId)
|
||||
if (elem.mountingPointId == mountingPointId)
|
||||
{
|
||||
structureElement = elem;
|
||||
return true;
|
||||
@@ -488,35 +488,35 @@ bool DtcImplCustom::getAllAssetsPerRoom(const std::function<bool(const Instrumen
|
||||
dds::sub::LoanedSamples<DATA_A> samples_a = m_dtcInstrumentationAsset->readAlive();
|
||||
std::unordered_map<int, LOANED_DATA_A> assetMap;
|
||||
for (const LOANED_DATA_A &asset : samples_a)
|
||||
assetMap.insert(std::make_pair(asset.data().id(), asset));
|
||||
assetMap.insert(std::make_pair(asset.data().id, asset));
|
||||
|
||||
dds::sub::LoanedSamples<DATA_MSE> samples_mse = m_dtcMainStructureElement->readAlive();
|
||||
std::unordered_map<int, InfrastructureManagement::StructureElement> structElementMap;
|
||||
for (const LOANED_DATA_MSE &mse : samples_mse)
|
||||
for (const auto &se : mse.data().elements())
|
||||
structElementMap.insert(std::make_pair(se.id(), se));
|
||||
for (const auto &se : mse.data().elements)
|
||||
structElementMap.insert(std::make_pair(se.id, se));
|
||||
|
||||
dds::sub::LoanedSamples<DATA_MPA> samples_mpa = m_dtcMountingPointAsset->readAlive();
|
||||
for (const LOANED_DATA_MPA &mpa : samples_mpa)
|
||||
{
|
||||
const int assetId = mpa.data().assetId();
|
||||
const int assetId = mpa.data().assetId;
|
||||
const auto assetIt = assetMap.find(assetId);
|
||||
if (assetIt == assetMap.end())
|
||||
continue;
|
||||
if (!predicate(assetIt->second))
|
||||
continue;
|
||||
|
||||
const int structureElementId = mpa.data().structureElementId();
|
||||
const int structureElementId = mpa.data().structureElementId;
|
||||
const auto structureElementIt = structElementMap.find(structureElementId);
|
||||
if (structureElementIt == structElementMap.end())
|
||||
continue;
|
||||
|
||||
const InfrastructureManagement::StructureElement &se = structureElementIt->second;
|
||||
if (se.structureElementTypeId() != InfrastructureManagement::StructureElementType::MountingPoint)
|
||||
if (se.structureElementTypeId != InfrastructureManagement::StructureElementType::MountingPoint)
|
||||
continue;
|
||||
int roomId = 0;
|
||||
if (se.path().size() > 1)
|
||||
roomId = se.path().at(se.path().size() - 2);
|
||||
if (se.path.size() > 1)
|
||||
roomId = se.path.at(se.path.size() - 2);
|
||||
allAssets[roomId].push_back(assetIt->second);
|
||||
}
|
||||
return true;
|
||||
@@ -535,12 +535,12 @@ bool DtcImplCustom::getAllAssetsPerBuilding(const std::function<bool(const Instr
|
||||
dds::sub::LoanedSamples<DATA_A> samples_a = m_dtcInstrumentationAsset->readAlive();
|
||||
std::unordered_map<int, LOANED_DATA_A> assetMap;
|
||||
for (const LOANED_DATA_A &asset : samples_a)
|
||||
assetMap.insert(std::make_pair(asset.data().id(), asset));
|
||||
assetMap.insert(std::make_pair(asset.data().id, asset));
|
||||
|
||||
dds::sub::LoanedSamples<DATA_MPA> samples_mpa = m_dtcMountingPointAsset->readAlive();
|
||||
for (const LOANED_DATA_MPA &mpa : samples_mpa)
|
||||
{
|
||||
const int assetId = mpa.data().assetId();
|
||||
const int assetId = mpa.data().assetId;
|
||||
DEBUG_LOG(m_logger) << "Found assetId = " << assetId;
|
||||
const auto assetIt = assetMap.find(assetId);
|
||||
if (assetIt == assetMap.end())
|
||||
@@ -548,7 +548,7 @@ bool DtcImplCustom::getAllAssetsPerBuilding(const std::function<bool(const Instr
|
||||
if (!predicate(assetIt->second))
|
||||
continue;
|
||||
|
||||
const int structureElementId = mpa.data().structureElementId();
|
||||
const int structureElementId = mpa.data().structureElementId;
|
||||
int buildingId = 0;
|
||||
if (getBuildingId(structureElementId, buildingId))
|
||||
{
|
||||
@@ -566,11 +566,11 @@ bool DtcImplCustom::getBuildingId(int structureElementId, int &buildingId) const
|
||||
{
|
||||
for (const auto &sample : m_dtcMainStructureElement->readAlive())
|
||||
{
|
||||
for (const auto &se : sample.data().elements())
|
||||
for (const auto &se : sample.data().elements)
|
||||
{
|
||||
if (se.id() == structureElementId)
|
||||
if (se.id == structureElementId)
|
||||
{
|
||||
buildingId = sample.data().id();
|
||||
buildingId = sample.data().id;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -585,8 +585,8 @@ QList<int> DtcImplCustom::getSections()
|
||||
QList<int> sections;
|
||||
for (const auto &sample : m_dtcMainStructureElement->readAlive())
|
||||
{
|
||||
if (!sections.contains(sample.data().groupId()))
|
||||
sections.append(sample.data().groupId());
|
||||
if (!sections.contains(sample.data().groupId))
|
||||
sections.append(sample.data().groupId);
|
||||
}
|
||||
return sections;
|
||||
}
|
||||
@@ -600,16 +600,16 @@ QString DtcImplCustom::getBuildingDisplayName(int buildingId)
|
||||
//---------------------------------------------------------------------------------------------------------------------------------------------
|
||||
QString DtcImplCustom::getBuildingDisplayName(const MainStructureElement &mse) const
|
||||
{
|
||||
for (const StructureElement &elem : mse.elements())
|
||||
for (const StructureElement &elem : mse.elements)
|
||||
{
|
||||
if ((elem.structureElementTypeId() == InfrastructureManagement::StructureElementType::Building) ||
|
||||
(elem.structureElementTypeId() == InfrastructureManagement::StructureElementType::Bridge))
|
||||
if ((elem.structureElementTypeId == InfrastructureManagement::StructureElementType::Building) ||
|
||||
(elem.structureElementTypeId == InfrastructureManagement::StructureElementType::Bridge))
|
||||
{
|
||||
if (elem.displayName().size() > 0)
|
||||
return QString::fromStdString(elem.displayName());
|
||||
if (elem.displayName.size() > 0)
|
||||
return QString::fromStdString(elem.displayName);
|
||||
}
|
||||
}
|
||||
return QString::fromStdString(mse.name());
|
||||
return QString::fromStdString(mse.name);
|
||||
}
|
||||
|
||||
|
||||
@@ -617,11 +617,11 @@ MountingPointPlan DtcImplCustom::getMountingPointPlan(int scheduleId, int struct
|
||||
{
|
||||
for (const auto &sample : m_dtcMainSchedule->readAlive())
|
||||
{
|
||||
if (sample.data().id() == scheduleId)
|
||||
if (sample.data().id == scheduleId)
|
||||
{
|
||||
for (auto &mpp : sample.data().elements())
|
||||
for (auto &mpp : sample.data().elements)
|
||||
{
|
||||
if (mpp.structureElementId() == structureElementId)
|
||||
if (mpp.structureElementId == structureElementId)
|
||||
return mpp;
|
||||
}
|
||||
}
|
||||
@@ -634,11 +634,11 @@ int DtcImplCustom::getBuildingRoomsCount(int buildingId)
|
||||
{
|
||||
int roomCount = 0;
|
||||
const MainStructureElement mse = mainStructureElement(buildingId);
|
||||
if (mse.id() > 0)
|
||||
if (mse.id > 0)
|
||||
{
|
||||
for (const StructureElement &elem : mse.elements())
|
||||
for (const StructureElement &elem : mse.elements)
|
||||
{
|
||||
if (elem.structureElementTypeId() == InfrastructureManagement::StructureElementType::Room)
|
||||
if (elem.structureElementTypeId == InfrastructureManagement::StructureElementType::Room)
|
||||
roomCount++;
|
||||
}
|
||||
}
|
||||
@@ -650,9 +650,9 @@ BridgeStatus DtcImplCustom::getBridgeStatus(int buildingId)
|
||||
{
|
||||
BridgeStatus ret = BridgeStatus::Intact;
|
||||
const MainStructureElement mse = mainStructureElement(buildingId);
|
||||
if (mse.id() > 0 && mse.structureElementTypeId() == StructureElementType::Bridge)
|
||||
if (mse.id > 0 && mse.structureElementTypeId == StructureElementType::Bridge)
|
||||
{
|
||||
const QJsonObject obj(LtsUtils::JsonObject::fromJson(mse.properties()));
|
||||
const QJsonObject obj(LtsUtils::JsonObject::fromJson(mse.properties));
|
||||
auto it = obj.find(QStringLiteral("bridgeStatus"));
|
||||
if (it == obj.end())
|
||||
return ret;
|
||||
@@ -668,14 +668,14 @@ BridgeStatus DtcImplCustom::getBridgeStatus(int buildingId)
|
||||
bool DtcImplCustom::checkSchedule(int scheduleId)
|
||||
{
|
||||
const MainSchedule schedule = mainSchedule(scheduleId);
|
||||
for (const MountingPointPlan &mpp : schedule.elements()) //
|
||||
for (const MountingPointPlan &mpp : schedule.elements) //
|
||||
{
|
||||
if (mpp.mountingPointState() == MountingPointState::Idle) // whatever mounted or unmounted should be ok ?
|
||||
if (mpp.mountingPointState == MountingPointState::Idle) // whatever mounted or unmounted should be ok ?
|
||||
continue;
|
||||
int assetId = getMountedAssetId(mpp.structureElementId());
|
||||
if (mpp.mountingPointState() == MountingPointState::Empty && assetId != -1) //mounted, but it should be empty
|
||||
int assetId = getMountedAssetId(mpp.structureElementId);
|
||||
if (mpp.mountingPointState == MountingPointState::Empty && assetId != -1) //mounted, but it should be empty
|
||||
return false;
|
||||
else if (mpp.mountingPointState() == MountingPointState::Equipped && assetId == -1) // not mounted, but it should be
|
||||
else if (mpp.mountingPointState == MountingPointState::Equipped && assetId == -1) // not mounted, but it should be
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -686,14 +686,14 @@ bool DtcImplCustom::checkSchedule(int scheduleId)
|
||||
bool DtcImplCustom::getScheduleDifferences(int scheduleId, QList<MountingPointPlan> &diffList)
|
||||
{
|
||||
const MainSchedule schedule = mainSchedule(scheduleId);
|
||||
for (const MountingPointPlan &mpp : schedule.elements()) //
|
||||
for (const MountingPointPlan &mpp : schedule.elements) //
|
||||
{
|
||||
if (mpp.mountingPointState() == MountingPointState::Idle) // whatever mounted or unmounted should be ok ?
|
||||
if (mpp.mountingPointState == MountingPointState::Idle) // whatever mounted or unmounted should be ok ?
|
||||
continue;
|
||||
int assetId = getMountedAssetId(mpp.structureElementId());
|
||||
if (mpp.mountingPointState() == MountingPointState::Empty && assetId != -1) //mounted, but it should be empty
|
||||
int assetId = getMountedAssetId(mpp.structureElementId);
|
||||
if (mpp.mountingPointState == MountingPointState::Empty && assetId != -1) //mounted, but it should be empty
|
||||
diffList.append(mpp);
|
||||
else if (mpp.mountingPointState() == MountingPointState::Equipped && assetId == -1) // not mounted, but it should be
|
||||
else if (mpp.mountingPointState == MountingPointState::Equipped && assetId == -1) // not mounted, but it should be
|
||||
diffList.append(mpp);
|
||||
}
|
||||
return diffList.isEmpty();
|
||||
@@ -714,8 +714,8 @@ int DtcImplCustom::getMountedAssetId(int structureElementId) const
|
||||
dds::sub::LoanedSamples<DATA_MPA> samples_mpa = m_dtcMountingPointAsset->readAlive();
|
||||
for (const LOANED_DATA_MPA &mpa : samples_mpa)
|
||||
{
|
||||
if (mpa.data().structureElementId() == structureElementId)
|
||||
return mpa.data().assetId();
|
||||
if (mpa.data().structureElementId == structureElementId)
|
||||
return mpa.data().assetId;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
@@ -730,11 +730,11 @@ int DtcImplCustom::getStructueElementIdFromAssetId(int assetId) const
|
||||
dds::sub::LoanedSamples<DATA_MPA> samples_mpa = m_dtcMountingPointAsset->readAlive();
|
||||
for (const LOANED_DATA_MPA &mpa : samples_mpa)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "mpa.data().assetId()=" << mpa.data().assetId()
|
||||
DEBUG_LOG(m_logger) << "mpa.data().assetId()=" << mpa.data().assetId
|
||||
<< " assetId=" << assetId
|
||||
<< " mpa.data().structureElementId()=" << mpa.data().structureElementId();
|
||||
if (mpa.data().assetId() == assetId)
|
||||
return mpa.data().structureElementId();
|
||||
<< " mpa.data().structureElementId()=" << mpa.data().structureElementId;
|
||||
if (mpa.data().assetId == assetId)
|
||||
return mpa.data().structureElementId;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
@@ -747,7 +747,7 @@ QMap<int, MainFootprint> DtcImplCustom::getFootprintsByExerciseId(int exerciseId
|
||||
const auto &buildings = mainStructureElements();
|
||||
for (const auto &building : buildings)
|
||||
{
|
||||
int mseId = building.id();
|
||||
int mseId = building.id;
|
||||
if (isElementAssignedToExercise(building, exerciseId))
|
||||
footprints.insert(mseId, mainFootprint(mseId));
|
||||
}
|
||||
@@ -763,16 +763,16 @@ QMap<int, QPolygonF> DtcImplCustom::getUtmFootprintsByExerciseId(int exerciseId,
|
||||
const auto &buildings = mainStructureElements();
|
||||
for (const auto &building : buildings)
|
||||
{
|
||||
const int mseId = building.id();
|
||||
const int mseId = building.id;
|
||||
const MainStructureElement &mse = mainStructureElement(mseId);
|
||||
DEBUG_LOG(m_logger) << "mseId: " << mseId;
|
||||
if (isElementAssignedToExercise(building, exerciseId))
|
||||
{
|
||||
// skip Bridges:
|
||||
const std::vector<InfrastructureManagement::StructureElement> &elementsRef = mse.elements();
|
||||
const std::vector<InfrastructureManagement::StructureElement> &elementsRef = mse.elements;
|
||||
// per definition, frontElement contains StructureElementType:
|
||||
if (elementsRef.empty() ||
|
||||
(elementsRef.front().structureElementTypeId() != InfrastructureManagement::StructureElementType_def::Building)
|
||||
(elementsRef.front().structureElementTypeId != InfrastructureManagement::StructureElementType::Building)
|
||||
)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Footprint: " << mseId << ", skip due to StructureElementType != Building";
|
||||
@@ -1031,13 +1031,13 @@ QVector <int> DtcImplCustom::getFloorIdsFromBuilding(int buildingId)
|
||||
QList <StructureElement> floors = getFloorsFromBuilding(buildingId);
|
||||
floorIds.reserve(floors.size());
|
||||
for (int i = 0; i < floors.size(); i++)
|
||||
floorIds.append(floors.at(i).id());
|
||||
floorIds.append(floors.at(i).id);
|
||||
return floorIds;
|
||||
}
|
||||
|
||||
bool structureElementHeightComparator(const StructureElement &a, const StructureElement &b)
|
||||
{
|
||||
return a.relPosition().offsetZ() < b.relPosition().offsetZ();
|
||||
return a.relPosition.offsetZ < b.relPosition.offsetZ;
|
||||
}
|
||||
|
||||
QList <StructureElement> DtcImplCustom::getFloorsFromBuilding(int buildingId)
|
||||
@@ -1045,15 +1045,15 @@ QList <StructureElement> DtcImplCustom::getFloorsFromBuilding(int buildingId)
|
||||
QList <StructureElement> floors;
|
||||
const MainStructureElement mse = mainStructureElement(buildingId);
|
||||
// Determine all floor heights
|
||||
if (mse.id() > 0)
|
||||
if (mse.id > 0)
|
||||
{
|
||||
for (const StructureElement &elem : mse.elements())
|
||||
for (const StructureElement &elem : mse.elements)
|
||||
{
|
||||
if (elem.structureElementTypeId() == InfrastructureManagement::StructureElementType::Floor)
|
||||
if (elem.structureElementTypeId == InfrastructureManagement::StructureElementType::Floor)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "getFloorsFromBuilding append "
|
||||
<< " id=" << elem.id()
|
||||
<< " Z=" << elem.relPosition().offsetZ();
|
||||
<< " id=" << elem.id
|
||||
<< " Z=" << elem.relPosition.offsetZ;
|
||||
floors.append(elem);
|
||||
}
|
||||
}
|
||||
@@ -1076,14 +1076,14 @@ double DtcImplCustom::getHalfFloorHeight(int buildingId, int floorId)
|
||||
for (int i = 0; i < floorHeights.size(); i++)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "i=" << i
|
||||
<< " id= " << floorHeights[i].id()
|
||||
<< " offsetZ()=" << floorHeights[i].relPosition().offsetZ();
|
||||
if (floorHeights[i].id() == floorId)
|
||||
<< " id= " << floorHeights[i].id
|
||||
<< " offsetZ()=" << floorHeights[i].relPosition.offsetZ;
|
||||
if (floorHeights[i].id == floorId)
|
||||
{
|
||||
if (floorHeights.size() > i + 1)
|
||||
return (floorHeights[i].relPosition().offsetZ() + floorHeights[i + 1].relPosition().offsetZ()) / 2.0;
|
||||
return (floorHeights[i].relPosition.offsetZ + floorHeights[i + 1].relPosition.offsetZ) / 2.0;
|
||||
else
|
||||
return floorHeights[i].relPosition().offsetZ() + 2.0;
|
||||
return floorHeights[i].relPosition.offsetZ + 2.0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1098,19 +1098,19 @@ QVector <int> DtcImplCustom::getRoomIdsFromFloorId(int buildingId, int floorId)
|
||||
|
||||
QVector <int> rooms;
|
||||
const MainStructureElement mse = mainStructureElement(buildingId);
|
||||
rooms.reserve(mse.elements().size());
|
||||
rooms.reserve(mse.elements.size());
|
||||
// Determine all floor heights
|
||||
if (mse.id() > 0)
|
||||
if (mse.id > 0)
|
||||
{
|
||||
for (const StructureElement &elem : mse.elements())
|
||||
for (const StructureElement &elem : mse.elements)
|
||||
{
|
||||
std::vector< int32_t > path = elem.path();
|
||||
std::vector< int32_t > path = elem.path;
|
||||
|
||||
if (std::find(path.begin(), path.end(), floorId) != path.end())
|
||||
if (elem.structureElementTypeId() == InfrastructureManagement::StructureElementType::Room)
|
||||
if (elem.structureElementTypeId == InfrastructureManagement::StructureElementType::Room)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << " rooms.append=" << elem.id();
|
||||
rooms.append(elem.id());
|
||||
DEBUG_LOG(m_logger) << " rooms.append=" << elem.id;
|
||||
rooms.append(elem.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1126,7 +1126,7 @@ QVector <int> DtcImplCustom::getBuildingIdsByExercise ( int exerciseId)
|
||||
for (const auto &building : buildings)
|
||||
{
|
||||
if (isElementAssignedToExercise(building, exerciseId))
|
||||
result.append(building.id());
|
||||
result.append(building.id);
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -1135,14 +1135,14 @@ QVector <int> DtcImplCustom::getBuildingIdsByExercise ( int exerciseId)
|
||||
QByteArray DtcImplCustom::getVulnerabilityModelData( int buildingId)
|
||||
{
|
||||
const MainStructureElement &mse = mainStructureElement(buildingId);
|
||||
if (mse.id() != buildingId)
|
||||
if (mse.id != buildingId)
|
||||
{
|
||||
WARNING_LOG(m_logger) << "mainStructureElement not found, id/buildingId = " << buildingId;
|
||||
return {};
|
||||
}
|
||||
|
||||
static const QString optPath = QStringLiteral("/opt/BuildingModels/StaticMeshes/");
|
||||
const QString &vulnerabilityModelFilename = optPath + QStringLiteral("%1.flt.VWM_Building.xml").arg(QString::fromStdString(mse.name()));
|
||||
const QString &vulnerabilityModelFilename = optPath + QStringLiteral("%1.flt.VWM_Building.xml").arg(QString::fromStdString(mse.name));
|
||||
|
||||
QFile f(vulnerabilityModelFilename);
|
||||
if (!f.open(QIODevice::ReadOnly))
|
||||
|
||||
Reference in new issue
Block a user