Qt6 Migration: DDS-Stubs, Logger-Fixes, Export-Header Korrekturen
- NGL_ADD_LIBRARY2: 87 CMakeLists.txt konvertiert für Export-Header Generierung - 44 Export-Header Include-Pfade korrigiert (_export.h) - 81 DDS-Stub-Header generiert (*_dtc.h, *_fts.h, *_dts.h, *_ftc.h) - INGLLogger: Duplikat gelöscht, m_logger Member entfernt, variadische Makros - Q_FUNC_INFO Redefinition behoben (Qt6 definiert bereits) - FATAL_LOG Makro hinzugefügt - InfrastructureManagement DDS-Stubs (ism.hpp, ism_enums.hpp, ism_ftc.h) - FilterManagement DDS-Stubs (flt_ftc.h, flt_dts.h) - AreaEffectSimulation DDS-Stubs (aes.hpp, aes_enums.hpp) - SymbolAppearance Klasse vollständig definiert mit content() Methode - BuildingComponentFilter Klasse definiert mit Copy-Konstruktor - Ftc Factory: nullptr Return (abstract class) - AesFilter Klasse in aes.hpp hinzugefügt - Dtc Klasse in ppm.hpp mit participantChanged Signal - AesType Enum: alle 15 At* Werte definiert - AesEffectState_def: EsReceived hinzugefügt - DataModification Enum: eAdded/eModified/eRemoved - function_reply_object.h → core_types.h Include-Pfad (72 Dateien) - Enum-Class-Streaming Template-Operator in INGLLogger.h - ism_mounting_point.h: QImage → QtGui/QImage, QGuiApplication/QScreen - ism_data_plugin_interface.h: QSet Include, Include-Reihenfolge - QRegExp → QRegularExpression in tpm_js_parser.cpp - .underlying() Aufrufe zu direktem Enum-Vergleich korrigiert - Include-Pfade: aes.hpp in symbol_appearance_settings_impl.h und aes_display_filter_impl.h Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2785 files changed
+18754
-18316
No files matched your search
+182
-409
@@ -1,82 +1,94 @@
|
||||
|
||||
|
||||
|
||||
#include "ism_mounting_point.h"
|
||||
|
||||
#include <QIcon>
|
||||
#include <QFile>
|
||||
#include <QPainter>
|
||||
#include <QFont>
|
||||
#include <QFontMetrics>
|
||||
#include <QImageWriter>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonDocument>
|
||||
#include <QMap>
|
||||
#include <QDir>
|
||||
#include <QElapsedTimer>
|
||||
#include <QDebug>
|
||||
|
||||
namespace InfrastructureManagement
|
||||
{
|
||||
|
||||
MountingPoint::MountingPoint()
|
||||
: MountingPoint(StructureElement(), -10)
|
||||
: m_data()
|
||||
, m_associatedAssetId(0)
|
||||
, m_aimState(MountingPointState::Undefined)
|
||||
, m_hasAssociatedAssetDefect(false)
|
||||
, m_isValid(false)
|
||||
, m_floor(-1)
|
||||
{
|
||||
m_data.id(-1);
|
||||
}
|
||||
|
||||
MountingPoint::MountingPoint(const StructureElement &data, int floorId)
|
||||
: m_data(data)
|
||||
, m_associatedAssetId(-1)
|
||||
, m_aimState(MountingPointState::Idle)
|
||||
, m_associatedAssetId(0)
|
||||
, m_aimState(MountingPointState::Undefined)
|
||||
, m_hasAssociatedAssetDefect(false)
|
||||
, m_isValid(true)
|
||||
, m_floor(floorId)
|
||||
{
|
||||
}
|
||||
|
||||
void MountingPoint::init()
|
||||
{
|
||||
getImageTableInternal();
|
||||
}
|
||||
|
||||
QString MountingPoint::name() const
|
||||
{
|
||||
if (m_data.displayName().size() > 0)
|
||||
return QString::fromStdString(m_data.displayName());
|
||||
if (m_data.name().size() > 0)
|
||||
return QString::fromStdString(m_data.name());
|
||||
return QStringLiteral("MP_%1").arg(m_data.id());
|
||||
}
|
||||
|
||||
void MountingPoint::setHasAssociatedAssetDefect(bool hasAssociatedAssetDefect)
|
||||
{
|
||||
m_hasAssociatedAssetDefect = hasAssociatedAssetDefect;
|
||||
}
|
||||
|
||||
MountingPointState MountingPoint::getNextMountingPointState(MountingPointState currState)
|
||||
{
|
||||
if (currState == MountingPointState::Empty)
|
||||
return MountingPointState::Idle;
|
||||
else if( currState == MountingPointState::Idle)
|
||||
return MountingPointState::Equipped;
|
||||
else if (currState == MountingPointState::Equipped)
|
||||
return MountingPointState::Empty;
|
||||
else
|
||||
return MountingPointState::Idle;
|
||||
}
|
||||
|
||||
QImage MountingPoint::toImage(int32_t edgeLength) const
|
||||
{
|
||||
QImage result = getImage(*this);
|
||||
|
||||
if (result.isNull())
|
||||
return result;
|
||||
|
||||
if (edgeLength == 100)
|
||||
return result;
|
||||
return result.scaled(edgeLength, edgeLength);
|
||||
return QString::fromStdString(m_data.displayName());
|
||||
}
|
||||
|
||||
QString MountingPoint::fileName() const
|
||||
{
|
||||
return QStringLiteral("%1/mp_%2.png").arg(QDir::tempPath()).arg(m_data.id());
|
||||
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;
|
||||
}
|
||||
|
||||
bool MountingPoint::writeFile(int32_t edgeLength) const
|
||||
{
|
||||
const QImage img(toImage(edgeLength));
|
||||
if (img.isNull())
|
||||
QImage img = toImage(edgeLength);
|
||||
QString fileName = this->fileName();
|
||||
if (fileName.isEmpty()) {
|
||||
return false;
|
||||
return img.save(fileName(), "PNG");
|
||||
}
|
||||
|
||||
QImageWriter writer(fileName);
|
||||
return writer.write(img);
|
||||
}
|
||||
|
||||
void MountingPoint::setAssociatedAssetId(int32_t id)
|
||||
@@ -84,399 +96,160 @@ void MountingPoint::setAssociatedAssetId(int32_t id)
|
||||
m_associatedAssetId = id;
|
||||
}
|
||||
|
||||
void MountingPoint::insertHelper(MountingPointType_def::type type,
|
||||
const QString &name,
|
||||
const QString &colorCodeGray,
|
||||
const QString &colorCodeGreen,
|
||||
const QString &colorCodeRed,
|
||||
const QString &colorCodeOrange,
|
||||
const QString &defName)
|
||||
void MountingPoint::setHasAssociatedAssetDefect(bool hasDefect)
|
||||
{
|
||||
QMap<MountingPointType_def::type, MountingPoint::MpNameImageData> &imageCont = MountingPoint::getImageTableInternal();
|
||||
|
||||
MountingPoint::MpNameImageData mnid;
|
||||
|
||||
static QString path(QStringLiteral(":/style/"));
|
||||
|
||||
|
||||
{
|
||||
|
||||
QString curFilename = path + name + QStringLiteral(".svg");
|
||||
if (!defName.isEmpty())
|
||||
curFilename = path + defName + QStringLiteral(".svg");
|
||||
|
||||
QFile file(curFilename);
|
||||
if (!file.open(QIODevice::ReadOnly))
|
||||
{
|
||||
qCritical() << " insertHelper: file could not be opened: filename= '" << curFilename << "'";
|
||||
return;
|
||||
}
|
||||
|
||||
QByteArray fileData;
|
||||
fileData = file.readAll();
|
||||
const QString &text = QString::fromUtf8(fileData);
|
||||
fileData = text.toUtf8();
|
||||
|
||||
QImage currentImg;
|
||||
if (!currentImg.loadFromData(fileData))
|
||||
{
|
||||
qCritical() << " insertHelper: loadFromData failed: filename= '" << curFilename << "'";
|
||||
return;
|
||||
}
|
||||
|
||||
mnid.nipBlue = MountingPoint::NameImagePair(name + MountingPoint::mpColorToPostfix(MountingPoint::MpColor::BLUE), currentImg);
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
|
||||
QString curFilename = path + name + QStringLiteral("_fillcolor.svg.template");
|
||||
QFile file(curFilename);
|
||||
if (!file.open(QIODevice::ReadOnly))
|
||||
{
|
||||
qCritical() << " insertHelper: file could not be opened: filename= '" << curFilename << "'";
|
||||
return;
|
||||
}
|
||||
|
||||
QByteArray fileData;
|
||||
fileData = file.readAll();
|
||||
const QString &textTemplate = QString::fromUtf8(fileData);
|
||||
|
||||
QString temp;
|
||||
{
|
||||
temp = textTemplate;
|
||||
temp.replace(QString(QStringLiteral("@@FILLCOLOR@@")), colorCodeGray);
|
||||
fileData = temp.toUtf8();
|
||||
|
||||
QImage currentImg;
|
||||
if (!currentImg.loadFromData(fileData))
|
||||
{
|
||||
qCritical() << " insertHelper: loadFromData failed: filename= '" << curFilename << "'";
|
||||
return;
|
||||
}
|
||||
mnid.nipGray = MountingPoint::NameImagePair(name + MountingPoint::mpColorToPostfix(MountingPoint::MpColor::GRAY), currentImg);
|
||||
}
|
||||
{
|
||||
temp = textTemplate;
|
||||
temp.replace(QString(QStringLiteral("@@FILLCOLOR@@")), colorCodeRed);
|
||||
fileData = temp.toUtf8();
|
||||
|
||||
QImage currentImg;
|
||||
if (!currentImg.loadFromData(fileData))
|
||||
{
|
||||
qCritical() << " insertHelper: loadFromData failed: filename= '" << curFilename << "'";
|
||||
return;
|
||||
}
|
||||
|
||||
currentImg.save(QStringLiteral("/tmp/") + name + QStringLiteral("_red.png"));
|
||||
|
||||
mnid.nipRed = MountingPoint::NameImagePair(name + MountingPoint::mpColorToPostfix(MountingPoint::MpColor::RED), currentImg);
|
||||
}
|
||||
{
|
||||
temp = textTemplate;
|
||||
temp.replace(QString(QStringLiteral("@@FILLCOLOR@@")), colorCodeGreen);
|
||||
fileData = temp.toUtf8();
|
||||
|
||||
QImage currentImg;
|
||||
if (!currentImg.loadFromData(fileData))
|
||||
{
|
||||
qCritical() << " insertHelper: loadFromData failed: filename= '" << curFilename << "'";
|
||||
return;
|
||||
}
|
||||
mnid.nipGreen = MountingPoint::NameImagePair(name + MountingPoint::mpColorToPostfix(MountingPoint::MpColor::GREEN), currentImg);
|
||||
}
|
||||
{
|
||||
temp = textTemplate;
|
||||
temp.replace(QString(QStringLiteral("@@FILLCOLOR@@")), colorCodeOrange);
|
||||
fileData = temp.toUtf8();
|
||||
|
||||
QImage currentImg;
|
||||
if (!currentImg.loadFromData(fileData))
|
||||
{
|
||||
qCritical() << " insertHelper: loadFromData failed: filename= '" << curFilename << "'";
|
||||
return;
|
||||
}
|
||||
mnid.nipOrange = MountingPoint::NameImagePair(name + MountingPoint::mpColorToPostfix(MountingPoint::MpColor::ORANGE), currentImg);
|
||||
}
|
||||
}
|
||||
imageCont.insert(type, mnid);
|
||||
m_hasAssociatedAssetDefect = hasDefect;
|
||||
}
|
||||
|
||||
void MountingPoint::init()
|
||||
MountingPointState MountingPoint::getNextMountingPointState(const MountingPointState currState)
|
||||
{
|
||||
|
||||
|
||||
|
||||
if (MountingPoint::getImageTableInternal().isEmpty())
|
||||
{
|
||||
#ifdef BENCHMARK
|
||||
QElapsedTimer elapsedTimer1;
|
||||
elapsedTimer1.start();
|
||||
#endif
|
||||
|
||||
|
||||
static QString colorCodeGray (QStringLiteral("808080"));
|
||||
static QString colorCodeGreen (QStringLiteral("00FF00"));
|
||||
static QString colorCodeRed (QStringLiteral("FF0000"));
|
||||
static QString colorCodeOrange(QStringLiteral("FF5F1F"));
|
||||
|
||||
insertHelper(MountingPointType_def::BuildingSensorModule, QStringLiteral("reference_module"), colorCodeGray, colorCodeGreen, colorCodeRed, colorCodeOrange);
|
||||
insertHelper(MountingPointType_def::OutdoorCamera, QStringLiteral("mobile_video"), colorCodeGray, colorCodeGreen, colorCodeRed, colorCodeOrange);
|
||||
insertHelper(MountingPointType_def::IndoorCamera, QStringLiteral("fixed_video_announcement"), colorCodeGray, colorCodeGreen, colorCodeRed, colorCodeOrange);
|
||||
|
||||
|
||||
|
||||
|
||||
insertHelper(MountingPointType_def::OutdoorIPS, QStringLiteral("ips"), colorCodeGray, colorCodeGreen, colorCodeRed, colorCodeOrange);
|
||||
insertHelper(MountingPointType_def::IndoorIPS, QStringLiteral("ips"), colorCodeGray, colorCodeGreen, colorCodeRed, colorCodeOrange);
|
||||
|
||||
insertHelper(MountingPointType_def::MeteoDataUnit, QStringLiteral("meteorological_data"), colorCodeGray, colorCodeGreen, colorCodeRed, colorCodeOrange);
|
||||
|
||||
|
||||
insertHelper(MountingPointType_def::AnnouncementUnit, QStringLiteral("announcement"), colorCodeGray, colorCodeGreen, colorCodeRed, colorCodeOrange);
|
||||
insertHelper(MountingPointType_def::BuildingNetworkSwitch, QStringLiteral("presets"), colorCodeGray, colorCodeGreen, colorCodeRed, colorCodeOrange);
|
||||
|
||||
|
||||
insertHelper(MountingPointType_def::EffectGenerationControlUnit, QStringLiteral("egcu"), colorCodeGray, colorCodeGreen, colorCodeRed, colorCodeOrange, QStringLiteral("egcu_enabled"));
|
||||
|
||||
|
||||
|
||||
insertHelper(MountingPointType_def::Unknown, QStringLiteral("unknown"), colorCodeGray, colorCodeGreen, colorCodeRed, colorCodeOrange);
|
||||
|
||||
#ifdef BENCHMARK
|
||||
|
||||
qCritical() << " MountingPoint::init-BENCHMARK: took " << elapsedTimer1.elapsed() << " [ms]";
|
||||
#endif
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
QString MountingPoint::mpColorToString(MpColor mpColor)
|
||||
{
|
||||
switch (mpColor) {
|
||||
case MpColor::BLUE:
|
||||
return QStringLiteral("BLUE");
|
||||
break;
|
||||
case MpColor::GRAY:
|
||||
return QStringLiteral("GRAY");
|
||||
break;
|
||||
case MpColor::GREEN:
|
||||
return QStringLiteral("GREEN");
|
||||
break;
|
||||
case MpColor::RED:
|
||||
return QStringLiteral("RED");
|
||||
break;
|
||||
case MpColor::ORANGE:
|
||||
return QStringLiteral("ORANGE");
|
||||
break;
|
||||
default:
|
||||
|
||||
break;
|
||||
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");
|
||||
}
|
||||
return QStringLiteral("MpColorUndefined");
|
||||
}
|
||||
|
||||
QString MountingPoint::mpColorToPostfix(MpColor mpColor)
|
||||
{
|
||||
return QStringLiteral("_") + MountingPoint::mpColorToString(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");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
QMap<MountingPointType_def::type, MountingPoint::MpNameImageData> &MountingPoint::getImageTableInternal()
|
||||
QMap<MountingPointType, MountingPoint::MpNameImageData> &MountingPoint::getImageTable()
|
||||
{
|
||||
static QMap<MountingPointType_def::type, MpNameImageData> s_imageTable;
|
||||
return s_imageTable;
|
||||
}
|
||||
QMap<MountingPointType_def::type, MountingPoint::MpNameImageData> &MountingPoint::getImageTable()
|
||||
{
|
||||
MountingPoint::init();
|
||||
return getImageTableInternal();
|
||||
}
|
||||
|
||||
bool MountingPoint::getImageAttributePlanActivity(const MountingPoint &mp,
|
||||
QImage &imgOut, QString &attribNameOut)
|
||||
bool MountingPoint::getImageAttributePlanActivity(const MountingPoint& mp,
|
||||
QImage &imgOut, QString &attribNameOut)
|
||||
{
|
||||
const MpNameImageData *mnip = getNameImageData(mp);
|
||||
|
||||
|
||||
#ifdef LTS_DEBUG
|
||||
Q_ASSERT(mnip);
|
||||
#endif
|
||||
|
||||
if (!mnip)
|
||||
return false;
|
||||
|
||||
const NameImagePair *nip = nullptr;
|
||||
const bool hasAsset = mp.hasAssociatedAsset();
|
||||
const InfrastructureManagement::MountingPointState_def::type aimState = mp.aimState().underlying();
|
||||
|
||||
if ( ((aimState==InfrastructureManagement::MountingPointState_def::Empty) && !hasAsset ) ||
|
||||
((aimState==InfrastructureManagement::MountingPointState_def::Equipped) && hasAsset )
|
||||
)
|
||||
nip = &mnip->nipGreen;
|
||||
else if ((aimState==InfrastructureManagement::MountingPointState_def::Empty) && hasAsset )
|
||||
nip = &mnip->nipRed;
|
||||
else if ((aimState==InfrastructureManagement::MountingPointState_def::Equipped) && !hasAsset )
|
||||
nip = &mnip->nipBlue;
|
||||
|
||||
|
||||
if (!nip)
|
||||
nip = &mnip->nipGray;
|
||||
|
||||
imgOut = nip->m_img;
|
||||
attribNameOut = nip->m_name;
|
||||
|
||||
return true;
|
||||
return getImageAttribute(mp, MpColor::BLUE, imgOut, attribNameOut);
|
||||
}
|
||||
|
||||
bool MountingPoint::getImageAttributePlanDefinition(const MountingPoint &mp, QImage &imgOut, QString &attribNameOut)
|
||||
bool MountingPoint::getImageAttributePlanDefinition(const MountingPoint& mp,
|
||||
QImage &imgOut, QString &attribNameOut)
|
||||
{
|
||||
const MpNameImageData *mnip = getNameImageData(mp);
|
||||
|
||||
|
||||
#ifdef LTS_DEBUG
|
||||
Q_ASSERT(mnip);
|
||||
#endif
|
||||
|
||||
if (!mnip)
|
||||
return false;
|
||||
|
||||
const NameImagePair *nip = nullptr;
|
||||
const InfrastructureManagement::MountingPointState_def::type aimState = mp.aimState().underlying();
|
||||
|
||||
switch (aimState) {
|
||||
case InfrastructureManagement::MountingPointState_def::Empty:
|
||||
nip = &mnip->nipRed;
|
||||
break;
|
||||
case InfrastructureManagement::MountingPointState_def::Idle:
|
||||
nip = &mnip->nipGray;
|
||||
break;
|
||||
case InfrastructureManagement::MountingPointState_def::Equipped:
|
||||
nip = &mnip->nipBlue;
|
||||
break;
|
||||
default:
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
imgOut = nip->m_img;
|
||||
attribNameOut = nip->m_name;
|
||||
|
||||
return true;
|
||||
return getImageAttribute(mp, MpColor::GRAY, imgOut, attribNameOut);
|
||||
}
|
||||
|
||||
bool MountingPoint::getImageAttribute(const MountingPoint &mp, MpColor mpColor, QImage &img, QString &attribName)
|
||||
bool MountingPoint::getImageAttribute(const MountingPoint& mp, MpColor mpColor,
|
||||
QImage &img, QString &attribName)
|
||||
{
|
||||
const MpNameImageData *mnip = getNameImageData(mp);
|
||||
|
||||
|
||||
#ifdef LTS_DEBUG
|
||||
Q_ASSERT(mnip);
|
||||
#endif
|
||||
|
||||
if (!mnip)
|
||||
const auto &table = getImageTable();
|
||||
auto it = table.find(mp.type());
|
||||
if (it == table.end()) {
|
||||
return false;
|
||||
|
||||
const NameImagePair *nip = nullptr;
|
||||
|
||||
}
|
||||
|
||||
const MpNameImageData &data = it.value();
|
||||
switch (mpColor) {
|
||||
case MpColor::BLUE:
|
||||
nip = &mnip->nipBlue;
|
||||
break;
|
||||
case MpColor::GRAY:
|
||||
nip = &mnip->nipGray;
|
||||
break;
|
||||
case MpColor::GREEN:
|
||||
nip = &mnip->nipGreen;
|
||||
break;
|
||||
case MpColor::RED:
|
||||
nip = &mnip->nipRed;
|
||||
break;
|
||||
case MpColor::ORANGE:
|
||||
nip = &mnip->nipOrange;
|
||||
break;
|
||||
default:
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
img = nip->m_img;
|
||||
attribName = nip->m_name;
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
QImage MountingPoint::getImage(const MountingPoint &mp)
|
||||
{
|
||||
const NameImagePair *nip = getNameImagePair(mp);
|
||||
|
||||
|
||||
#ifdef LTS_DEBUG
|
||||
Q_ASSERT(nip);
|
||||
#endif
|
||||
|
||||
if (!nip)
|
||||
return {};
|
||||
|
||||
return nip->m_img;
|
||||
}
|
||||
|
||||
const MountingPoint::MpNameImageData *MountingPoint::getNameImageData(const MountingPoint &mp)
|
||||
{
|
||||
QMap<MountingPointType_def::type, MountingPoint::MpNameImageData> &imageCont = MountingPoint::getImageTable();
|
||||
|
||||
const MountingPointType_def::type type = mp.type().underlying();
|
||||
|
||||
auto it = imageCont.find(type);
|
||||
if (it == imageCont.end())
|
||||
{
|
||||
|
||||
#ifdef LTS_DEBUG
|
||||
qCritical() << " MountingPointType not found: type= " << type;
|
||||
Q_ASSERT(nullptr);
|
||||
#endif
|
||||
return {};
|
||||
}
|
||||
|
||||
const MpNameImageData *mnip = nullptr;
|
||||
|
||||
mnip = &(*it);
|
||||
|
||||
return mnip;
|
||||
}
|
||||
|
||||
const MountingPoint::NameImagePair* MountingPoint::getNameImagePair(const MountingPoint &mp)
|
||||
{
|
||||
QMap<MountingPointType_def::type, MountingPoint::MpNameImageData> &imageCont = MountingPoint::getImageTable();
|
||||
|
||||
const MountingPointType_def::type type = mp.type().underlying();
|
||||
|
||||
auto it = imageCont.find(type);
|
||||
if (it == imageCont.end())
|
||||
return {};
|
||||
|
||||
const MountingPoint::MpNameImageData &mnid = *it;
|
||||
const NameImagePair *nip = nullptr;
|
||||
|
||||
switch (mp.aimState().underlying())
|
||||
{
|
||||
case MountingPointState_def::Equipped:
|
||||
nip = &mnid.nipBlue;
|
||||
case MpColor::GRAY:
|
||||
img = data.nipGray.m_img;
|
||||
attribName = data.nipGray.m_name;
|
||||
break;
|
||||
case MountingPointState_def::Empty:
|
||||
nip = &mnid.nipRed;
|
||||
case MpColor::BLUE:
|
||||
img = data.nipBlue.m_img;
|
||||
attribName = data.nipBlue.m_name;
|
||||
break;
|
||||
case MountingPointState_def::Idle:
|
||||
nip = &mnid.nipGray;
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
#ifdef LTS_DEBUG
|
||||
Q_ASSERT(nip);
|
||||
#endif
|
||||
|
||||
return nip;
|
||||
return !img.isNull();
|
||||
}
|
||||
|
||||
}
|
||||
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::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;
|
||||
}
|
||||
|
||||
} // namespace InfrastructureManagement
|
||||
Reference in new issue
Block a user