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
+42
-40
@@ -22,7 +22,7 @@ ObjectStructureElement::ObjectStructureElement(MainHandler *mainHandler, ObjectM
|
||||
: Base(mainHandler, getLogger("ObjectStructureElement"))
|
||||
, m_objMse(objMse)
|
||||
{
|
||||
m_data.mainStructureElementId(objMse->getId());
|
||||
m_data.mainStructureElementId = objMse->getId();
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------
|
||||
@@ -31,19 +31,19 @@ ObjectStructureElement::ObjectStructureElement(const StructureElement &data, Mai
|
||||
, m_data(data)
|
||||
, m_objMse(objMse)
|
||||
{
|
||||
m_data.mainStructureElementId(objMse->getId());
|
||||
m_data.mainStructureElementId = objMse->getId();
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------
|
||||
bool ObjectStructureElement::isValid() const
|
||||
{
|
||||
return m_data.id() > 0;
|
||||
return m_data.id > 0;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------
|
||||
bool ObjectStructureElement::isUsed() const
|
||||
{
|
||||
return m_data.isUsed();
|
||||
return m_data.isUsed;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------
|
||||
@@ -51,16 +51,16 @@ Core::FunctionReplyObject ObjectStructureElement::createObject(const Database::I
|
||||
{
|
||||
m_data = Database::convert(dbData);
|
||||
|
||||
if (m_data.id() <= 0)
|
||||
if (m_data.id <= 0)
|
||||
{
|
||||
m_data.isUsed(false);
|
||||
m_data.isUsed = false;
|
||||
|
||||
Database::IsmStructureElement dbData2(dbData);
|
||||
if (!db()->insert(dbData2))
|
||||
return Core::FunctionReplyObject(0, tr_lts("dds", "Error inserting IsmStructureElement-data into database"));
|
||||
|
||||
m_data.id(dbData2.id);
|
||||
DEBUG_LOG(m_logger) << "New Id: " << m_data.id();
|
||||
m_data.id = dbData2.id;
|
||||
DEBUG_LOG(m_logger) << "New Id: " << m_data.id;
|
||||
}
|
||||
|
||||
updateGeoPosition();
|
||||
@@ -68,71 +68,71 @@ Core::FunctionReplyObject ObjectStructureElement::createObject(const Database::I
|
||||
// Publish Data via DTS
|
||||
//onPublishData();
|
||||
|
||||
return Core::FunctionReplyObject(m_data.id());
|
||||
return Core::FunctionReplyObject(m_data.id);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------
|
||||
Core::FunctionReplyObject ObjectStructureElement::updateObject(const StructureElement &data)
|
||||
{
|
||||
if (!isValid())
|
||||
return Core::FunctionReplyObject(data.id(), tr_lts("dds", "Object not valid/blocked"));
|
||||
return Core::FunctionReplyObject(data.id, tr_lts("dds", "Object not valid/blocked"));
|
||||
|
||||
if (!db()->update(toDbData(data)))
|
||||
return Core::FunctionReplyObject(data.id(), tr_lts("dds", "Error updating StructureElement with id %1 in database")).arg(data.id());
|
||||
return Core::FunctionReplyObject(data.id, tr_lts("dds", "Error updating StructureElement with id %1 in database")).arg(data.id);
|
||||
|
||||
m_data = data;
|
||||
TRACE_LOG(m_logger) << "Data changed for Id: " << m_data.id();
|
||||
TRACE_LOG(m_logger) << "Data changed for Id: " << m_data.id;
|
||||
|
||||
updateGeoPosition();
|
||||
|
||||
// Publish Data via DTS
|
||||
//onPublishData();
|
||||
|
||||
return Core::FunctionReplyObject(m_data.id());
|
||||
return Core::FunctionReplyObject(m_data.id);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------
|
||||
Core::FunctionReplyObject ObjectStructureElement::setUsed(bool isUsed)
|
||||
{
|
||||
if (!isValid())
|
||||
return Core::FunctionReplyObject(m_data.id(), tr_lts("dds", "Trying to update an already removed IsmStructureElement object"));
|
||||
return Core::FunctionReplyObject(m_data.id, tr_lts("dds", "Trying to update an already removed IsmStructureElement object"));
|
||||
|
||||
m_data.isUsed(isUsed);
|
||||
m_data.isUsed = isUsed;
|
||||
|
||||
// Publish Data via DTS
|
||||
//onPublishData();
|
||||
|
||||
return Core::FunctionReplyObject(m_data.id());
|
||||
return Core::FunctionReplyObject(m_data.id);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------
|
||||
Core::FunctionReplyObject ObjectStructureElement::removeObject()
|
||||
{
|
||||
if (isUsed())
|
||||
return Core::FunctionReplyObject(m_data.id(), tr_lts("dds", "StructureElement still in use"));
|
||||
return Core::FunctionReplyObject(m_data.id, tr_lts("dds", "StructureElement still in use"));
|
||||
|
||||
if (!db()->removeIsmStructureElement(m_data.id()))
|
||||
return Core::FunctionReplyObject(m_data.id(), tr_lts("dds", "StructureElement with id %1 can not be removed from DB")).arg(m_data.id());
|
||||
if (!db()->removeIsmStructureElement(m_data.id))
|
||||
return Core::FunctionReplyObject(m_data.id, tr_lts("dds", "StructureElement with id %1 can not be removed from DB")).arg(m_data.id);
|
||||
|
||||
return Core::FunctionReplyObject(m_data.id());
|
||||
return Core::FunctionReplyObject(m_data.id);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------
|
||||
void ObjectStructureElement::updateGeoPosition()
|
||||
{
|
||||
if (m_data.mainStructureElementId() <= 0)
|
||||
if (m_data.mainStructureElementId <= 0)
|
||||
return;
|
||||
const Core::GeoPosition &geoPositionBase = m_objMse->getData().geoPosition();
|
||||
const double angleDegree = m_objMse->getData().angle();
|
||||
updateGeoPosition(LtsCoordTrans::UtmCoordinate::fromGeographic(geoPositionBase.lon(), geoPositionBase.lat()), geoPositionBase.z(), angleDegree);
|
||||
const Core::GeoPosition &geoPositionBase = m_objMse->getData().geoPosition;
|
||||
const double angleDegree = m_objMse->getData().angle;
|
||||
updateGeoPosition(LtsCoordTrans::UtmCoordinate::fromGeographic(geoPositionBase.lon, geoPositionBase.lat), geoPositionBase.z, angleDegree);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------
|
||||
void ObjectStructureElement::updateGeoPosition(const LtsCoordTrans::UtmCoordinate &basePoint, double zBase, double angleDeg)
|
||||
{
|
||||
const QPointF offset = rotatePoint(m_data.relPosition().offsetX(), m_data.relPosition().offsetY(), angleDeg);
|
||||
const QPointF offset = rotatePoint(m_data.relPosition.offsetX, m_data.relPosition.offsetY, angleDeg);
|
||||
const QPointF geoPos = basePoint.geographic(offset);
|
||||
m_data.geoPosition() = Core::GeoPosition(geoPos.x(), geoPos.y(), m_data.relPosition().offsetZ() + zBase);
|
||||
m_data.geoPosition = Core::GeoPosition(geoPos.x(), geoPos.y(), m_data.relPosition.offsetZ + zBase);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------
|
||||
@@ -144,20 +144,22 @@ Database::IsmStructureElement ObjectStructureElement::toDbData(const StructureEl
|
||||
{
|
||||
Database::IsmStructureElement dbData;
|
||||
|
||||
dbData.id = ddsData.id();
|
||||
dbData.name = QString::fromStdString(ddsData.name());
|
||||
dbData.displayName = QString::fromStdString(ddsData.displayName());
|
||||
dbData.mainStructureElementId = ddsData.mainStructureElementId();
|
||||
dbData.structureElementTypeId = ddsData.structureElementTypeId();
|
||||
dbData.path = LtsUtils::IntArray(ddsData.path());
|
||||
dbData.mountingPointId = ddsData.mountingPointId();
|
||||
dbData.barcode = QString::fromStdString(ddsData.barcode());
|
||||
dbData.relPosition = LtsUtils::QPoint3D(ddsData.relPosition());
|
||||
dbData.mountingPointTypeId = ddsData.mountingPointTypeId();
|
||||
dbData.orientation = LtsUtils::QPoint3D(ddsData.orientation().heave(),
|
||||
ddsData.orientation().pitch(),
|
||||
ddsData.orientation().roll());
|
||||
dbData.properties = QString::fromStdString(ddsData.properties());
|
||||
dbData.id = ddsData.id;
|
||||
dbData.name = QString::fromStdString(ddsData.name);
|
||||
dbData.displayName = QString::fromStdString(ddsData.displayName);
|
||||
dbData.mainStructureElementId = ddsData.mainStructureElementId;
|
||||
dbData.structureElementTypeId = ddsData.structureElementTypeId;
|
||||
dbData.path = LtsUtils::IntArray(ddsData.path);
|
||||
dbData.mountingPointId = ddsData.mountingPointId;
|
||||
dbData.barcode = QString::fromStdString(ddsData.barcode);
|
||||
dbData.relPosition = LtsUtils::QPoint3D(ddsData.relPosition.offsetX,
|
||||
ddsData.relPosition.offsetY,
|
||||
ddsData.relPosition.offsetZ);
|
||||
dbData.mountingPointTypeId = ddsData.mountingPointTypeId;
|
||||
dbData.orientation = LtsUtils::QPoint3D(ddsData.orientation.heave,
|
||||
ddsData.orientation.pitch,
|
||||
ddsData.orientation.roll);
|
||||
dbData.properties = QString::fromStdString(ddsData.properties);
|
||||
|
||||
return dbData;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user