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
+70
-70
@@ -98,8 +98,8 @@ QJsonObject ParseBuildingXml::soundAreaToJson() const
|
||||
QJsonArray arrayGeometry;
|
||||
for (const auto &point : m_soundArea.geometry)
|
||||
{
|
||||
json[QStringLiteral("lat")] = point.lat();
|
||||
json[QStringLiteral("lon")] = point.lon();
|
||||
json[QStringLiteral("lat")] = point.lat;
|
||||
json[QStringLiteral("lon")] = point.lon;
|
||||
arrayGeometry.append(json);
|
||||
}
|
||||
QJsonArray arrayEgcus;
|
||||
@@ -120,7 +120,7 @@ bool ParseBuildingXml::parseXml()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "parseXml";
|
||||
m_request = MainStructureElementModifyRequest();
|
||||
m_request.properties("{}");
|
||||
m_request.properties = "{}";
|
||||
m_lastError.clear();
|
||||
bool bRet = true;
|
||||
|
||||
@@ -160,7 +160,7 @@ bool ParseBuildingXml::parseXml()
|
||||
properties[QStringLiteral("soundArea")] = soundAreaToJson();
|
||||
}
|
||||
|
||||
m_request.properties(QJsonDocument(properties).toJson(QJsonDocument::Compact).toStdString());
|
||||
m_request.properties = QJsonDocument(properties).toJson(QJsonDocument::Compact).toStdString();
|
||||
|
||||
DEBUG_LOG(m_logger) << "Finished import for file " << m_xmlFilename;
|
||||
return bRet;
|
||||
@@ -284,8 +284,8 @@ bool ParseBuildingXml::parseXmlSoundArea()
|
||||
INFO_LOG(m_logger) << "Point=" << point.tagName()
|
||||
<< " lat = " << point.firstChildElement(QStringLiteral("lat")).text().toDouble()
|
||||
<< " lon = " << point.firstChildElement(QStringLiteral("lon")).text().toDouble();
|
||||
geoPosition.lat(point.firstChildElement(QStringLiteral("lat")).text().toDouble());
|
||||
geoPosition.lon(point.firstChildElement(QStringLiteral("lon")).text().toDouble());
|
||||
geoPosition.lat = point.firstChildElement(QStringLiteral("lat")).text().toDouble();
|
||||
geoPosition.lon = point.firstChildElement(QStringLiteral("lon")).text().toDouble();
|
||||
m_soundArea.geometry.push_back(geoPosition);
|
||||
}
|
||||
|
||||
@@ -377,9 +377,9 @@ QVector<ParseBuildingXml::BuildingMetaInfo> ParseBuildingXml::parseMetaXml(const
|
||||
|
||||
info.geoPosition = positionFromElement<Core::GeoPosition>(posElem);
|
||||
|
||||
INFO_LOG(m_logger) << "Found Building position: (" << info.geoPosition.lon() << ", ("
|
||||
<< info.geoPosition.lat() << ", ("
|
||||
<< info.geoPosition.z() << ")";
|
||||
INFO_LOG(m_logger) << "Found Building position: (" << info.geoPosition.lon << ", ("
|
||||
<< info.geoPosition.lat << ", ("
|
||||
<< info.geoPosition.z << ")";
|
||||
|
||||
ret += info;
|
||||
}
|
||||
@@ -400,38 +400,38 @@ void ParseBuildingXml::parseXmlInternal()
|
||||
|
||||
DEBUG_LOG(m_logger) << "Start import for file " << m_xmlFilename;
|
||||
|
||||
m_request.angle(m_rotationAngleDegree);
|
||||
m_request.geoPosition(m_geoPosition);
|
||||
m_request.modelId(getInteger(getChildElement(baseGroupElem, QStringLiteral("ModelId")), QStringLiteral("Id")));
|
||||
m_request.name(getChildElement(baseGroupElem, QStringLiteral("Name")).text().toStdString());
|
||||
m_request.description(m_request.name());
|
||||
INFO_LOG(m_logger) << "Importing building with name: " << m_request.name();
|
||||
m_request.angle = m_rotationAngleDegree;
|
||||
m_request.geoPosition = m_geoPosition;
|
||||
m_request.modelId = getInteger(getChildElement(baseGroupElem, QStringLiteral("ModelId")), QStringLiteral("Id"));
|
||||
m_request.name = getChildElement(baseGroupElem, QStringLiteral("Name")).text().toStdString();
|
||||
m_request.description = m_request.name;
|
||||
INFO_LOG(m_logger) << "Importing building with name: " << m_request.name;
|
||||
|
||||
InfrastructureManagement::StructureElement seBuilding;
|
||||
seBuilding.name(m_request.name());
|
||||
seBuilding.displayName(m_request.name());
|
||||
seBuilding.structureElementTypeId(InfrastructureManagement::StructureElementType::Building);
|
||||
seBuilding.mountingPointTypeId(InfrastructureManagement::MountingPointType::Unknown);
|
||||
seBuilding.properties("{}");
|
||||
seBuilding.name = m_request.name;
|
||||
seBuilding.displayName = m_request.name;
|
||||
seBuilding.structureElementTypeId = InfrastructureManagement::StructureElementType::Building;
|
||||
seBuilding.mountingPointTypeId = InfrastructureManagement::MountingPointType::Unknown;
|
||||
seBuilding.properties = "{}";
|
||||
addElementToRequest(seBuilding, -1);
|
||||
|
||||
InfrastructureManagement::StructureElement seMPBuilding;
|
||||
seMPBuilding.name(m_request.name());
|
||||
seMPBuilding.displayName(m_request.name());
|
||||
m_buildingName = QString::fromStdString(seBuilding.displayName());
|
||||
seMPBuilding.structureElementTypeId(InfrastructureManagement::StructureElementType::MountingPoint);
|
||||
seMPBuilding.mountingPointTypeId(InfrastructureManagement::MountingPointType::BuildingControlUnit);
|
||||
seMPBuilding.properties("{}");
|
||||
seMPBuilding.name = m_request.name;
|
||||
seMPBuilding.displayName = m_request.name;
|
||||
m_buildingName = QString::fromStdString(seBuilding.displayName);
|
||||
seMPBuilding.structureElementTypeId = InfrastructureManagement::StructureElementType::MountingPoint;
|
||||
seMPBuilding.mountingPointTypeId = InfrastructureManagement::MountingPointType::BuildingControlUnit;
|
||||
seMPBuilding.properties = "{}";
|
||||
addElementToRequest(seMPBuilding, 0);
|
||||
|
||||
//SWPA 2/22 - GUEZE-1459 - IO 2022.11.10 - do not import GV for new Guez Buildings
|
||||
#ifndef GUEZ_MODE
|
||||
InfrastructureManagement::StructureElement seGVBuilding;
|
||||
seGVBuilding.name(m_request.name()+std::string("_gv"));
|
||||
seGVBuilding.displayName(m_request.name()+std::string("_gv"));
|
||||
seGVBuilding.structureElementTypeId(InfrastructureManagement::StructureElementType::MountingPoint);
|
||||
seGVBuilding.mountingPointTypeId(InfrastructureManagement::MountingPointType::BuildingNetworkSwitch);
|
||||
seGVBuilding.properties("{}");
|
||||
seGVBuilding.name = m_request.name + std::string("_gv");
|
||||
seGVBuilding.displayName = m_request.name + std::string("_gv");
|
||||
seGVBuilding.structureElementTypeId = InfrastructureManagement::StructureElementType::MountingPoint;
|
||||
seGVBuilding.mountingPointTypeId = InfrastructureManagement::MountingPointType::BuildingNetworkSwitch;
|
||||
seGVBuilding.properties = "{}";
|
||||
addElementToRequest(seGVBuilding, 0);
|
||||
#endif
|
||||
|
||||
@@ -464,13 +464,13 @@ void ParseBuildingXml::importFootprint(const QDomElement &parent)
|
||||
if (coordElem.isNull())
|
||||
continue;
|
||||
FootprintElement fpElem;
|
||||
fpElem.relPosition() = positionFromElement<Core::RelativePosition>(coordElem);
|
||||
fpElem.relPosition = positionFromElement<Core::RelativePosition>(coordElem);
|
||||
fp.resize(fp.size() + 1, fpElem);
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (fp.size() > 0)
|
||||
m_request.footprint(std::move(fp));
|
||||
m_request.footprint = std::move(fp);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------
|
||||
@@ -482,17 +482,17 @@ void ParseBuildingXml::importExternalReferences(const QDomElement &parent,
|
||||
{
|
||||
const StructureElement se = getStructureElement(extRefElem);
|
||||
// we don't care about BCU Mounting positions inside xml file - we create our own
|
||||
if (se.mountingPointTypeId() == MountingPointType::BuildingControlUnit)
|
||||
if (se.mountingPointTypeId == MountingPointType::BuildingControlUnit)
|
||||
{
|
||||
INFO_LOG(m_logger) << "Ignoring xml-internal BuildingControl mounting point - not needed";
|
||||
continue;
|
||||
}
|
||||
if (se.mountingPointTypeId() == MountingPointType::Unknown)
|
||||
if (se.mountingPointTypeId == MountingPointType::Unknown)
|
||||
{
|
||||
INFO_LOG(m_logger) << "Ignoring unknown mounting point type with subId " << se.mountingPointId();
|
||||
INFO_LOG(m_logger) << "Ignoring unknown mounting point type with subId " << se.mountingPointId;
|
||||
continue;
|
||||
}
|
||||
INFO_LOG(m_logger) << "importExternalReferences: " << se.displayName() << ", parentIdx = " << parentIdx;
|
||||
INFO_LOG(m_logger) << "importExternalReferences: " << se.displayName << ", parentIdx = " << parentIdx;
|
||||
addElementToRequest(se, parentIdx);
|
||||
}
|
||||
}
|
||||
@@ -511,11 +511,11 @@ void ParseBuildingXml::importFloors(const QDomElement &parent,
|
||||
INFO_LOG(m_logger) << "importFloors: " << nameElement.text() << ", parentIdx = " << parentIdx;
|
||||
|
||||
StructureElement se;
|
||||
se.name(nameElement.text().simplified().toStdString());
|
||||
se.displayName(se.name());
|
||||
se.structureElementTypeId(InfrastructureManagement::StructureElementType::Floor);
|
||||
se.mountingPointTypeId(InfrastructureManagement::MountingPointType::Unknown);
|
||||
se.properties("{}");
|
||||
se.name = nameElement.text().simplified().toStdString();
|
||||
se.displayName = se.name;
|
||||
se.structureElementTypeId = InfrastructureManagement::StructureElementType::Floor;
|
||||
se.mountingPointTypeId = InfrastructureManagement::MountingPointType::Unknown;
|
||||
se.properties = "{}";
|
||||
|
||||
// read base height from xml comment
|
||||
const QDomElement commentElement = getChildElement(floorElem, QStringLiteral("Comment"), false);
|
||||
@@ -525,11 +525,11 @@ void ParseBuildingXml::importFloors(const QDomElement &parent,
|
||||
if (comm.at(0) == QStringLiteral("base_height"))
|
||||
baseHeight = comm.at(1).toDouble();
|
||||
DEBUG_LOG(m_logger) << "base_height = " << baseHeight;
|
||||
se.relPosition().offsetZ(baseHeight);
|
||||
se.relPosition.offsetZ = baseHeight;
|
||||
|
||||
addElementToRequest(se, parentIdx);
|
||||
|
||||
const int curIdx = m_request.elements().size() - 1;
|
||||
const int curIdx = static_cast<int>(m_request.elements.size()) - 1;
|
||||
importRooms(floorElem, curIdx);
|
||||
}
|
||||
}
|
||||
@@ -547,30 +547,30 @@ void ParseBuildingXml::importRooms(const QDomElement &parent,
|
||||
const int subId = getInteger(getChildElement(roomElem, QStringLiteral("SubId")), QStringLiteral("ID"));
|
||||
|
||||
StructureElement se;
|
||||
se.name(nameElement.text().simplified().toStdString());
|
||||
se.name = nameElement.text().simplified().toStdString();
|
||||
|
||||
QString roomName = QString::fromStdString(se.name());
|
||||
QString roomName = QString::fromStdString(se.name);
|
||||
// displayed room names are too long
|
||||
roomName.replace(QStringLiteral("SW_room"), QStringLiteral("R"));
|
||||
|
||||
INFO_LOG(m_logger) << "importRooms: " << roomName << ", parentIdx = " << parentIdx;
|
||||
|
||||
se.displayName(roomName.toStdString());
|
||||
se.mountingPointId(subId);
|
||||
se.structureElementTypeId(InfrastructureManagement::StructureElementType::Room);
|
||||
se.mountingPointTypeId(InfrastructureManagement::MountingPointType::Unknown);
|
||||
se.properties("{}");
|
||||
se.displayName = roomName.toStdString();
|
||||
se.mountingPointId = subId;
|
||||
se.structureElementTypeId = InfrastructureManagement::StructureElementType::Room;
|
||||
se.mountingPointTypeId = InfrastructureManagement::MountingPointType::Unknown;
|
||||
se.properties = "{}";
|
||||
|
||||
QDomElement subRoomElem = roomElem.firstChildElement(QStringLiteral("Group"));
|
||||
if (!subRoomElem.isNull())
|
||||
{
|
||||
tryGetRoomBoundingBox(subRoomElem, se);
|
||||
addElementToRequest(se, parentIdx);
|
||||
const int curIdx = m_request.elements().size() - 1;
|
||||
const int curIdx = static_cast<int>(m_request.elements.size()) - 1;
|
||||
importExternalReferences(subRoomElem, curIdx);
|
||||
DEBUG_LOG(m_logger) << "Room=" << se.name()
|
||||
<< " Id=" << se.id()
|
||||
<< " mountingPointId=" << se.mountingPointId();
|
||||
DEBUG_LOG(m_logger) << "Room=" << se.name
|
||||
<< " Id=" << se.id
|
||||
<< " mountingPointId=" << se.mountingPointId;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -589,18 +589,18 @@ void ParseBuildingXml::tryGetRoomBoundingBox(const QDomElement &subRoomElem, Str
|
||||
return;
|
||||
const auto minPos(positionFromElement<Core::RelativePosition>(min));
|
||||
const auto maxPos(positionFromElement<Core::RelativePosition>(min));
|
||||
se.relPosition(Core::RelativePosition((minPos.offsetX() + maxPos.offsetX()) / 2,
|
||||
(minPos.offsetY() + maxPos.offsetY()) / 2,
|
||||
(minPos.offsetZ() + maxPos.offsetZ()) / 2));
|
||||
se.relPosition = Core::RelativePosition((minPos.offsetX + maxPos.offsetX) / 2,
|
||||
(minPos.offsetY + maxPos.offsetY) / 2,
|
||||
(minPos.offsetZ + maxPos.offsetZ) / 2);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------
|
||||
void ParseBuildingXml::addElementToRequest(const StructureElement &se,
|
||||
int parentIdx)
|
||||
{
|
||||
const size_t size = m_request.elements().size();
|
||||
m_request.elements().resize(size + 1, se);
|
||||
m_request.childParentRelations().resize(size + 1, parentIdx);
|
||||
const size_t size = m_request.elements.size();
|
||||
m_request.elements.resize(size + 1, se);
|
||||
m_request.childParentRelations.resize(size + 1, parentIdx);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------
|
||||
@@ -660,18 +660,18 @@ StructureElement ParseBuildingXml::getStructureElement(const QDomElement &elemen
|
||||
const int subId = getInteger(getChildElement(element, QStringLiteral("SubId")), QStringLiteral("ID"));
|
||||
|
||||
StructureElement se;
|
||||
se.relPosition(positionFromElement<Core::RelativePosition>(getChildElement(element, QStringLiteral("Coord"))));
|
||||
se.orientation(positionFromElement<Core::Orientation>(getChildElement(element, QStringLiteral("Dir")))); // xyz=hpr?
|
||||
se.mountingPointTypeId(mptFromSubId(subId));
|
||||
se.structureElementTypeId(InfrastructureManagement::StructureElementType::MountingPoint);
|
||||
se.name(element.firstChildElement(QStringLiteral("Name")).text().simplified().toStdString());
|
||||
se.relPosition = positionFromElement<Core::RelativePosition>(getChildElement(element, QStringLiteral("Coord")));
|
||||
se.orientation = positionFromElement<Core::Orientation>(getChildElement(element, QStringLiteral("Dir"))); // xyz=hpr?
|
||||
se.mountingPointTypeId = mptFromSubId(subId);
|
||||
se.structureElementTypeId = InfrastructureManagement::StructureElementType::MountingPoint;
|
||||
se.name = element.firstChildElement(QStringLiteral("Name")).text().simplified().toStdString();
|
||||
|
||||
QString displayName = m_buildingName;
|
||||
displayName.append(QLatin1String(" - "));
|
||||
displayName.append(QString::fromStdString(se.name()));
|
||||
se.displayName(displayName.toStdString());
|
||||
se.mountingPointId(subId);
|
||||
se.properties("{}");
|
||||
displayName.append(QString::fromStdString(se.name));
|
||||
se.displayName = displayName.toStdString();
|
||||
se.mountingPointId = subId;
|
||||
se.properties = "{}";
|
||||
return se;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user