Files
qt-migration-legatus/qt5-before/dlbo/Lts/Services/InfrastructureManagement/object_special_area.cpp
T
torstenandCopilot 7173785915 Qt6 Migration: Complete migration with DDS/RTI support and build validation
Major Changes:
- Merged latest Qt5 devel content from dlbo (292 files changed, 7 new dirs)
- Consolidated forward-declarations and include folders
- Removed unneeded modules per Niklas' repo check list

Build System Fixes:
- Fixed CMake VERSION_GREATER syntax in ParticipantManagement/CMakeLists.txt
- Added VLC packages (libvlc-dev, vlc-plugin-base) to docker_build.sh
- Added PostgreSQL dev packages (libpq-dev, postgresql-server-dev-all) to Dockerfile
- Fixed locale warnings (ANSI_X3.4-1968 → C.UTF-8)
- Fixed ArcGIS SDK path warnings when BUILD_ARCGIS=OFF

Code Generation Fixes:
- Fixed IDL enum collisions (PortType→CorePortType/DdsutPortType, PdmEventType)
- Fixed Grantlee template svc_translation.cpp.grantlee:
  - Changed {{ idl_enum.name }}_def:: to {{ idl_enum.name }}::
  - Fixed .underlying() calls for C++11 scoped enums (enum class)
- Removed generated files from repo (moc_*, *_dtc.h, *_ftc.h)

Validation:
- BUILD_RTI=ON: SUCCESS
- BUILD_RTI=OFF: SUCCESS
- C++17 standard maintained for RTI 7.7 compatibility
- Ubuntu 26.04 Docker environment verified

Remaining Warnings (expected):
- BgViewer, KDChart, KDReports, Poppler-Qt6 not found (optional features)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-09-15 18:20:26 +00:00

108 lines
3.2 KiB
C++

/**
* @RDE_HEADER@
* ISM Object Sound Area
* $Id$
* $HeadURL$
* $Author$
* Created by Filip Biedziak, NLE, 2020-08-05
*/
#include "object_special_area.h"
#include <QJsonDocument>
#include <QPolygonF>
namespace InfrastructureManagement
{
ObjectSpecialArea::ObjectSpecialArea(MainHandler *mainHandler)
: Base(mainHandler, getLogger("ObjectSpecialArea"))
{
}
ObjectSpecialArea::~ObjectSpecialArea()
{
}
//-----------------------------------------------------------------------------------------------------------------------------
Core::FunctionReplyObject ObjectSpecialArea::createObject(const SpecialArea &data)
{
m_data = data;
onPublishData(); // publish data via DDS
return Core::FunctionReplyObject(m_data.id());
}
Core::FunctionReplyObject ObjectSpecialArea::updateObject(const SpecialArea &data)
{
m_data = data;
DEBUG_LOG(m_logger) << "Data changed for Id: " << m_data.id();
onPublishData(); // publish data via DTS
return Core::FunctionReplyObject(m_data.id());
}
Core::FunctionReplyObject ObjectSpecialArea::removeObject()
{
if (!dts()->removeSpecialAreaByKey(m_data.id()))
return Core::FunctionReplyObject(m_data.id(), tr_lts("dds", "SpecialArea with id %1 can not be removed from DDS")).arg(m_data.id());
return Core::FunctionReplyObject(m_data.id());
}
//-----------------------------------------------------------------------------------------------------------------------------
void ObjectSpecialArea::onPublishData()
{
INFO_LOG(m_logger) << "Publish IsmSpecialArea-data to dds (" << m_data.id() << ") ...";
if (!dts()->publish(m_data))
ERROR_LOG(m_logger) << "Error publishing IsmSpecialArea-data to dds";
}
// -------------------------------------------------------------------------------------------------------
// Database::IsmSpecialArea => InfrastructureManagement::SpecialArea
SpecialArea ObjectSpecialArea::toDdsData(const Database::IsmSpecialArea &dbData)
{
SpecialArea ddsData;
ddsData.id(dbData.id);
ddsData.name(dbData.name.toStdString());
ddsData.specialType(dbData.specialType.underlying());
const QJsonDocument doc(QJsonDocument::fromJson(dbData.polygon.toUtf8()));
const QJsonObject obj(doc.object());
const QJsonArray arrPoly = obj.value(QStringLiteral("polygon")).toArray();
ddsData.polygon().reserve(arrPoly.size());
for (const auto &ele : arrPoly)
{
const QJsonObject objSeg(ele.toObject());
Core::GeoPosition2D element;
element.lat(objSeg[QStringLiteral("lat")].toDouble());
element.lon(objSeg[QStringLiteral("lon")].toDouble());
ddsData.polygon().push_back(std::move(element));
}
//End elements
QPolygonF tmp;
tmp.reserve(ddsData.polygon().size());
for (const Core::GeoPosition2D &pos : qAsConst(ddsData.polygon()))
tmp.push_back(QPointF(pos.lon(),pos.lat()));
QRectF boundingBox = tmp.boundingRect();
ddsData.boundingBoxBottomLeft() = Core::GeoPosition2D(boundingBox.bottomLeft().x(), boundingBox.bottomLeft().y());
ddsData.boundingBoxTopRight() = Core::GeoPosition2D(boundingBox.topRight().x(), boundingBox.topRight().y());
// init data not in db
ddsData.isDeleted(false);
ddsData.isUsed(false);
return ddsData;
}
} // namespace InfrastructureManagement