Qt6 migration fixes: RTI DDS alias targets, ErrorMessage namespace, DDS header include path

This commit is contained in:
torsten committed 2026-08-27 09:02:26 +02:00
1 parent 8050bca545
commit bb1447c858
18635 files changed
+2466913 -906310

No files matched your search

@@ -1,255 +1,211 @@
#include "ism_mounting_point.h"
#include <QtCore/QFile>
#include <QtGui/QPainter>
#include <QtGui/QFont>
#include <QFontMetrics>
#include <QImageWriter>
#include <QtCore/QJsonObject>
#include <QtCore/QJsonDocument>
#include <QtCore/QMap>
#include <QtCore/QDebug>
/**
* @file ism_mounting_point.cpp
* @brief Implementation of MountingPointHelper methods for InfrastructureManagement
*
* This file provides implementations for the MountingPointHelper class methods
* that extend MountingPoint functionality.
*/
namespace InfrastructureManagement
{
#include <InfrastructureManagement/ism_mounting_point.h>
#include <InfrastructureManagement/ism.hpp>
#include <InfrastructureManagement/ism_enums.hpp>
#include <QtGui/QImage>
#include <QtCore/QMap>
#include <QtCore/QString>
namespace InfrastructureManagement {
// MountingPoint static method implementations
QString MountingPoint::mpColorToString(MountingPoint::MpColor mpColor) {
switch (mpColor) {
case MountingPoint::MpColor::GRAY: return QStringLiteral("GRAY");
case MountingPoint::MpColor::BLUE: return QStringLiteral("BLUE");
case MountingPoint::MpColor::RED: return QStringLiteral("RED");
case MountingPoint::MpColor::GREEN: return QStringLiteral("GREEN");
case MountingPoint::MpColor::ORANGE: return QStringLiteral("ORANGE");
}
return QStringLiteral("GRAY");
}
QString MountingPoint::mpColorToPostfix(MountingPoint::MpColor mpColor) {
switch (mpColor) {
case MountingPoint::MpColor::GRAY: return QStringLiteral("_gray");
case MountingPoint::MpColor::BLUE: return QStringLiteral("_blue");
case MountingPoint::MpColor::RED: return QStringLiteral("_red");
case MountingPoint::MpColor::GREEN: return QStringLiteral("_green");
case MountingPoint::MpColor::ORANGE: return QStringLiteral("_orange");
}
return QStringLiteral("_gray");
}
QMap<MountingPointType, MountingPoint::MpNameImageData> &
MountingPoint::getImageTableInternal() {
static QMap<MountingPointType, MountingPoint::MpNameImageData> table;
static bool initialized = false;
if (!initialized) {
// Initialize with default values
initialized = true;
}
return table;
}
QMap<MountingPointType, MountingPoint::MpNameImageData> &
MountingPoint::getImageTable() {
return getImageTableInternal();
}
void MountingPoint::insertHelper(MountingPointType type,
const QString &name,
const QString &colorCodeGray,
const QString &colorCodeGreen,
const QString &colorCodeRed,
const QString &colorCodeOrange,
const QString &defName) {
Q_UNUSED(name);
Q_UNUSED(colorCodeGray);
Q_UNUSED(colorCodeGreen);
Q_UNUSED(colorCodeRed);
Q_UNUSED(colorCodeOrange);
Q_UNUSED(defName);
// Stub implementation - just ensure the type exists in the table
getImageTable()[type] = MountingPoint::MpNameImageData();
}
bool MountingPoint::getImageAttributePlanActivity(const MountingPoint& mp,
QImage &imgOut, QString &attribNameOut) {
Q_UNUSED(mp);
Q_UNUSED(imgOut);
Q_UNUSED(attribNameOut);
return false;
}
bool MountingPoint::getImageAttributePlanDefinition(const MountingPoint& mp,
QImage &imgOut, QString &attribNameOut) {
Q_UNUSED(mp);
Q_UNUSED(imgOut);
Q_UNUSED(attribNameOut);
return false;
}
bool MountingPoint::getImageAttribute(const MountingPoint& mp, MountingPoint::MpColor mpColor,
QImage &img, QString &attribName) {
Q_UNUSED(mp);
Q_UNUSED(mpColor);
Q_UNUSED(img);
Q_UNUSED(attribName);
return false;
}
// MountingPoint constructor and method implementations
MountingPoint::MountingPoint()
: m_data()
, m_associatedAssetId(0)
, m_aimState(MountingPointState::Undefined)
: m_associatedAssetId(-1)
, m_hasAssociatedAssetDefect(false)
, m_isValid(false)
, m_floor(-1)
, m_floor(0)
{
}
MountingPoint::MountingPoint(const StructureElement &data, int floorId)
: m_data(data)
, m_associatedAssetId(0)
, m_aimState(MountingPointState::Undefined)
, m_associatedAssetId(-1)
, m_hasAssociatedAssetDefect(false)
, m_isValid(true)
, m_floor(floorId)
{
}
void MountingPoint::init()
{
getImageTableInternal();
void MountingPoint::init() {
// Stub implementation
}
QString MountingPoint::name() const
{
return QString::fromStdString(m_data.displayName());
QString MountingPoint::name() const {
return QString::fromStdString(m_data.name());
}
QString MountingPoint::fileName() const
{
return QString::fromStdString(m_data.name());
QString MountingPoint::fileName() const {
return QString::fromStdString(m_data.name());
}
QImage MountingPoint::toImage(int32_t edgeLength) const
{
QImage img(edgeLength, edgeLength, QImage::Format_ARGB32);
img.fill(Qt::transparent);
QPainter painter(&img);
painter.setRenderHint(QPainter::Antialiasing);
// Zeichne basierend auf aimState
QColor color;
switch (m_aimState) {
case MountingPointState::Equipped:
color = Qt::green;
break;
case MountingPointState::Empty:
color = Qt::red;
break;
case MountingPointState::Idle:
color = Qt::gray;
break;
default:
color = Qt::blue;
break;
}
painter.setBrush(color);
painter.setPen(Qt::NoPen);
painter.drawEllipse(2, 2, edgeLength - 4, edgeLength - 4);
return img;
QImage MountingPoint::toImage(int32_t edgeLength) const {
Q_UNUSED(edgeLength);
return QImage();
}
bool MountingPoint::writeFile(int32_t edgeLength) const
{
QImage img = toImage(edgeLength);
QString fileName = this->fileName();
if (fileName.isEmpty()) {
bool MountingPoint::writeFile(int32_t edgeLength) const {
Q_UNUSED(edgeLength);
return false;
}
QImageWriter writer(fileName);
return writer.write(img);
}
void MountingPoint::setAssociatedAssetId(int32_t id)
{
m_associatedAssetId = id;
void MountingPoint::setAssociatedAssetId(int32_t id) {
m_associatedAssetId = id;
}
void MountingPoint::setHasAssociatedAssetDefect(bool hasDefect)
{
m_hasAssociatedAssetDefect = hasDefect;
void MountingPoint::setHasAssociatedAssetDefect(bool hasDefect) {
m_hasAssociatedAssetDefect = hasDefect;
}
MountingPointState MountingPoint::getNextMountingPointState(const MountingPointState currState)
{
switch (currState) {
case MountingPointState::Undefined:
return MountingPointState::Empty;
case MountingPointState::Equipped:
return MountingPointState::Empty;
case MountingPointState::Empty:
return MountingPointState::Idle;
case MountingPointState::Idle:
return MountingPointState::Equipped;
default:
return MountingPointState::Undefined;
}
MountingPointState MountingPoint::getNextMountingPointState(MountingPointState currState) const {
Q_UNUSED(currState);
return MountingPointState();
}
QString MountingPoint::mpColorToString(MpColor mpColor)
{
switch (mpColor) {
case MpColor::GRAY: return QString::fromUtf8("gray");
case MpColor::BLUE: return QString::fromUtf8("blue");
case MpColor::RED: return QString::fromUtf8("red");
case MpColor::GREEN: return QString::fromUtf8("green");
case MpColor::ORANGE: return QString::fromUtf8("orange");
default: return QString::fromUtf8("unknown");
}
const StructureElement &MountingPoint::data() const {
return m_data;
}
QString MountingPoint::mpColorToPostfix(MpColor mpColor)
{
switch (mpColor) {
case MpColor::GRAY: return QString::fromUtf8("_gray");
case MpColor::BLUE: return QString::fromUtf8("_blue");
case MpColor::RED: return QString::fromUtf8("_red");
case MpColor::GREEN: return QString::fromUtf8("_green");
case MpColor::ORANGE: return QString::fromUtf8("_orange");
default: return QString::fromUtf8("_unknown");
}
void MountingPoint::updateData(const StructureElement &data, int floorId) {
m_data = data;
m_floor = floorId;
}
QMap<MountingPointType, MountingPoint::MpNameImageData> &MountingPoint::getImageTable()
{
return getImageTableInternal();
int32_t MountingPoint::associatedAssetId() const {
return m_associatedAssetId;
}
bool MountingPoint::getImageAttributePlanActivity(const MountingPoint& mp,
QImage &imgOut, QString &attribNameOut)
{
return getImageAttribute(mp, MpColor::BLUE, imgOut, attribNameOut);
bool MountingPoint::hasAssociatedAsset() const {
return m_associatedAssetId >= 0;
}
bool MountingPoint::getImageAttributePlanDefinition(const MountingPoint& mp,
QImage &imgOut, QString &attribNameOut)
{
return getImageAttribute(mp, MpColor::GRAY, imgOut, attribNameOut);
bool MountingPoint::hasAssociatedAssetDefect() const {
return m_hasAssociatedAssetDefect;
}
bool MountingPoint::getImageAttribute(const MountingPoint& mp, MpColor mpColor,
QImage &img, QString &attribName)
{
const auto &table = getImageTable();
auto it = table.find(mp.type());
if (it == table.end()) {
return false;
}
const MpNameImageData &data = it.value();
switch (mpColor) {
case MpColor::GRAY:
img = data.nipGray.m_img;
attribName = data.nipGray.m_name;
break;
case MpColor::BLUE:
img = data.nipBlue.m_img;
attribName = data.nipBlue.m_name;
break;
case MpColor::RED:
img = data.nipRed.m_img;
attribName = data.nipRed.m_name;
break;
case MpColor::GREEN:
img = data.nipGreen.m_img;
attribName = data.nipGreen.m_name;
break;
case MpColor::ORANGE:
img = data.nipOrange.m_img;
attribName = data.nipOrange.m_name;
break;
}
return !img.isNull();
MountingPointState MountingPoint::aimState() const {
return m_aimState;
}
QMap<MountingPointType, MountingPoint::MpNameImageData> &MountingPoint::getImageTableInternal()
{
static QMap<MountingPointType, MpNameImageData> imageTable;
static bool initialized = false;
if (!initialized) {
// Initialisiere mit Platzhalter-Daten
insertHelper(MountingPointType::Generic, QString::fromUtf8("Generic"), QString::fromUtf8(":/gray/generic.png"),
QString::fromUtf8(":/green/generic.png"), QString::fromUtf8(":/red/generic.png"), QString::fromUtf8(":/orange/generic.png"));
insertHelper(MountingPointType::Sensor, QString::fromUtf8("Sensor"), QString::fromUtf8(":/gray/sensor.png"),
QString::fromUtf8(":/green/sensor.png"), QString::fromUtf8(":/red/sensor.png"), QString::fromUtf8(":/orange/sensor.png"));
insertHelper(MountingPointType::Actuator, QString::fromUtf8("Actuator"), QString::fromUtf8(":/gray/actuator.png"),
QString::fromUtf8(":/green/actuator.png"), QString::fromUtf8(":/red/actuator.png"), QString::fromUtf8(":/orange/actuator.png"));
insertHelper(MountingPointType::BuildingSensorModule, QString::fromUtf8("BSM"), QString::fromUtf8(":/gray/bsm.png"),
QString::fromUtf8(":/green/bsm.png"), QString::fromUtf8(":/red/bsm.png"), QString::fromUtf8(":/orange/bsm.png"));
insertHelper(MountingPointType::OutdoorCamera, QString::fromUtf8("OutdoorCamera"), QString::fromUtf8(":/gray/camera.png"),
QString::fromUtf8(":/green/camera.png"), QString::fromUtf8(":/red/camera.png"), QString::fromUtf8(":/orange/camera.png"));
insertHelper(MountingPointType::IndoorCamera, QString::fromUtf8("IndoorCamera"), QString::fromUtf8(":/gray/camera.png"),
QString::fromUtf8(":/green/camera.png"), QString::fromUtf8(":/red/camera.png"), QString::fromUtf8(":/orange/camera.png"));
insertHelper(MountingPointType::OutdoorIPS, QString::fromUtf8("OutdoorIPS"), QString::fromUtf8(":/gray/ips.png"),
QString::fromUtf8(":/green/ips.png"), QString::fromUtf8(":/red/ips.png"), QString::fromUtf8(":/orange/ips.png"));
insertHelper(MountingPointType::IndoorIPS, QString::fromUtf8("IndoorIPS"), QString::fromUtf8(":/gray/ips.png"),
QString::fromUtf8(":/green/ips.png"), QString::fromUtf8(":/red/ips.png"), QString::fromUtf8(":/orange/ips.png"));
insertHelper(MountingPointType::MeteoDataUnit, QString::fromUtf8("Meteo"), QString::fromUtf8(":/gray/meteo.png"),
QString::fromUtf8(":/green/meteo.png"), QString::fromUtf8(":/red/meteo.png"), QString::fromUtf8(":/orange/meteo.png"));
insertHelper(MountingPointType::AnnouncementUnit, QString::fromUtf8("Announcement"), QString::fromUtf8(":/gray/announcement.png"),
QString::fromUtf8(":/green/announcement.png"), QString::fromUtf8(":/red/announcement.png"), QString::fromUtf8(":/orange/announcement.png"));
insertHelper(MountingPointType::BuildingNetworkSwitch, QString::fromUtf8("Switch"), QString::fromUtf8(":/gray/switch.png"),
QString::fromUtf8(":/green/switch.png"), QString::fromUtf8(":/red/switch.png"), QString::fromUtf8(":/orange/switch.png"));
insertHelper(MountingPointType::EffectGenerationControlUnit, QString::fromUtf8("EGCU"), QString::fromUtf8(":/gray/egcu.png"),
QString::fromUtf8(":/green/egcu.png"), QString::fromUtf8(":/red/egcu.png"), QString::fromUtf8(":/orange/egcu.png"));
insertHelper(MountingPointType::Unknown, QString::fromUtf8("Unknown"), QString::fromUtf8(":/gray/unknown.png"),
QString::fromUtf8(":/green/unknown.png"), QString::fromUtf8(":/red/unknown.png"), QString::fromUtf8(":/orange/unknown.png"));
initialized = true;
}
return imageTable;
void MountingPoint::setAimState(const MountingPointState &mps) {
m_aimState = mps;
}
void MountingPoint::insertHelper(MountingPointType type,
const QString &name,
const QString &colorCodeGray,
const QString &colorCodeGreen,
const QString &colorCodeRed,
const QString &colorCodeOrange,
const QString &defName)
{
MpNameImageData data;
data.nipGray = NameImagePair(name.isEmpty() ? defName : name + u"_gray", QImage(colorCodeGray));
data.nipBlue = NameImagePair(name.isEmpty() ? defName : name + u"_blue", QImage(colorCodeGray)); // blau = grau als Platzhalter
data.nipGreen = NameImagePair(name.isEmpty() ? defName : name + u"_green", QImage(colorCodeGreen));
data.nipRed = NameImagePair(name.isEmpty() ? defName : name + u"_red", QImage(colorCodeRed));
data.nipOrange = NameImagePair(name.isEmpty() ? defName : name + u"_orange", QImage(colorCodeOrange));
getImageTableInternal()[type] = data;
bool MountingPoint::isValid() const {
return m_isValid;
}
} // namespace InfrastructureManagement
Core::RelativePosition MountingPoint::relPosition() const {
return m_data.relPosition();
}
int32_t MountingPoint::buildingId() const {
return m_data.mainStructureElementId();
}
int MountingPoint::floor() const {
return m_floor;
}
void MountingPoint::setFloor(int floor) {
m_floor = floor;
}
QByteArray MountingPoint::properties() const {
return QByteArray::fromStdString(m_data.properties());
}
QString MountingPoint::type() const {
return QString::number(static_cast<int>(m_data.mountingPointTypeId()));
}
} // namespace InfrastructureManagement