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

@@ -37,16 +37,24 @@ ADD_INTERFACE_LIBRARY(
#
# need top be shared due to signals/slots
NGL_ADD_LIBRARY2(WS IsmDataPluginInterface SHARED ism_data_plugin_interface.h)
# Ensure IsmShared is built before IsmDataPluginInterface (MountingPoint dependency)
IF(TARGET IsmShared)
ADD_DEPENDENCIES(IsmDataPluginInterface IsmShared)
ENDIF()
IF(BUILD_RTI)
NGL_TARGET_LINK_LIBRARIES(IsmDataPluginInterface
Qt6::Core
Qt6::Gui
svcIsmCommon
DataPluginInterface
IsmShared
)
ELSE()
NGL_TARGET_LINK_LIBRARIES(IsmDataPluginInterface
Qt6::Core
Qt6::Gui
DataPluginInterface
IsmShared
)
ENDIF(BUILD_RTI)
NGL_INSTALL_TARGET(IsmDataPluginInterface)
@@ -16,6 +16,11 @@ NGL_ADD_LIBRARY(WS IsmDataPlugin MODULE
ism_foreign_data_plugin.h
)
set_target_properties(IsmDataPlugin PROPERTIES AUTOMOC ON)
NGL_TARGET_INCLUDE_DIRECTORIES(IsmDataPlugin
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/../..
${CMAKE_CURRENT_SOURCE_DIR}/../../..
)
NGL_TARGET_LINK_LIBRARIES(IsmDataPlugin
IsmDataPluginInterface
IsmShared
@@ -43,4 +48,5 @@ NGL_TARGET_LINK_LIBRARIES(IsmDataPluginThp
NGL_TARGET_INCLUDE_DIRECTORIES(IsmDataPluginThp
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/../..
${CMAKE_CURRENT_SOURCE_DIR}/../../..
)
@@ -3,7 +3,7 @@
#pragma once
#include <Plugins/InfrastructureManagement/ism_data_plugin_interface.h>
#include <InfrastructureManagement/ism_data_plugin_interface.h>
namespace InfrastructureManagement
@@ -3,9 +3,10 @@
#include "ism_foreign_data_plugin.h"
#include <Plugins/InfrastructureManagement/ism_resource_management_gui_plugin_interface.h>
#include <Plugins/InfrastructureManagement/Shared/ism_mounting_point.h>
#include <InfrastructureManagement/logger.h>
#include <InfrastructureManagement/ism_resource_management_gui_plugin_interface.h>
#include <InfrastructureManagement/ism_mounting_point.h>
#include <InfrastructureManagement/ism_dtc.h>
#include <NGLLogger/NGLLoggerBootstrap.h>
#include <LtsUtilsCore/json_object.h>
#include <QtCore/QJsonDocument>
#include <QtCore/QJsonObject>
@@ -31,8 +32,19 @@
namespace InfrastructureManagement
{
// Helper function to convert InfrastructureManagement::Interface::MainSchedule to ParticipantManagement::MainSchedule
static ParticipantManagement::MainSchedule convertMainSchedule(const Interface::MainSchedule& ismSchedule)
{
ParticipantManagement::MainSchedule ppmSchedule;
ppmSchedule.id = ismSchedule.id();
// Note: Other fields (name, description, startTime, endTime, isActive) have no direct mapping
// from InfrastructureManagement::MainSchedule, so they remain at default values
return ppmSchedule;
}
ForeignInterfaceImpl::ForeignInterfaceImpl(const std::shared_ptr<Interface::Dtc> &dtc, int exerciseId)
: m_dtc(dtc)
: m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger())
, m_dtc(dtc)
, m_scheduleId(-1)
, m_exerciseId(exerciseId)
{
@@ -109,10 +121,10 @@ MountingPoint ForeignInterfaceImpl::mountingPoint(int32_t mountingPointId) const
return m_mountingPoints.value(mountingPointId);
}
MainSchedule ForeignInterfaceImpl::mainSchedule(int32_t scheduleId)
ParticipantManagement::MainSchedule ForeignInterfaceImpl::mainSchedule(int32_t scheduleId)
{
enableIsmForeignInterface();
return m_dtc->mainSchedule(scheduleId);
return convertMainSchedule(m_dtc->mainSchedule(scheduleId));
}
void ForeignInterfaceImpl::setScheduleId(int32_t scheduleId)
@@ -123,7 +135,7 @@ void ForeignInterfaceImpl::setScheduleId(int32_t scheduleId)
enableIsmForeignInterface();
m_scheduleId = scheduleId;
onMainScheduleChanged(m_dtc->mainSchedule(scheduleId), DataModification::eModified);
onMainScheduleChanged(m_dtc->mainSchedule(scheduleId), InfrastructureManagement::Interface::DataModification::eModified);
emit scheduleIdChanged(m_scheduleId);
}
@@ -151,27 +163,27 @@ bool ForeignInterfaceImpl::isBuildingsInCurrentExercise(int buildingId) const
return m_bldgsInExcersise.contains(buildingId);
}
void ForeignInterfaceImpl::onMainStructureElementChanged(const MainStructureElement &data, DataModification modType)
void ForeignInterfaceImpl::onMainStructureElementChanged(const InfrastructureManagement::MainStructureElement &data, InfrastructureManagement::Interface::DataModification modType)
{
const int mseId = data.id();
switch (modType)
{
case DataModification::eRemoved:
case InfrastructureManagement::Interface::DataModification::eRemoved:
{
QMutexLocker locker(&m_mutex);
const auto &structureElements = data.elements();
for (const StructureElement &currentStructEle : structureElements)
{
if (currentStructEle.structureElementTypeId() != StructureElementType::MountingPoint)
if (currentStructEle.mountingPointTypeId() == MountingPointType::Undefined)
continue;
m_mountingPoints.remove(currentStructEle.id());
}
break;
}
case DataModification::eAdded:
case DataModification::eModified:
case InfrastructureManagement::Interface::DataModification::eAdded:
case InfrastructureManagement::Interface::DataModification::eModified:
{
QVector<int> exeIds;
@@ -179,17 +191,22 @@ void ForeignInterfaceImpl::onMainStructureElementChanged(const MainStructureElem
if (m_exerciseId > 0)
{
QJsonParseError parserError;
const QByteArray &content = QByteArray::fromStdString(data.properties());
const QJsonDocument doc(QJsonDocument::fromJson(content, &parserError));
if (parserError.error != QJsonParseError::NoError)
WARNING_LOG(m_logger) << "Invalid properties for MSE " << data.id() << ", " << data.name();
else
const auto &structureElements = data.elements();
if (!structureElements.empty())
{
const QJsonArray exercises(QJsonObject(doc.object()).value(QStringLiteral("available_in_exercise")).toArray());
exeIds.reserve(exercises.size());
for (const auto &exercise : exercises)
exeIds += exercise.toInt();
const QByteArray &content = QByteArray::fromStdString(structureElements[0].properties());
const QJsonDocument doc(QJsonDocument::fromJson(content, &parserError));
if (parserError.error != QJsonParseError::NoError)
WARNING_LOG(m_logger) << "Invalid properties for MSE " << data.id() << ", " << data.name();
else
{
const QJsonArray exercises(QJsonObject(doc.object()).value(QStringLiteral("available_in_exercise")).toArray());
exeIds.reserve(exercises.size());
for (const auto &exercise : exercises)
exeIds += exercise.toInt();
}
}
}
@@ -237,7 +254,7 @@ void ForeignInterfaceImpl::onMainStructureElementChanged(const MainStructureElem
const auto &structureElements = data.elements();
for (const StructureElement &currentStructEle : structureElements)
{
if (currentStructEle.structureElementTypeId() != StructureElementType::MountingPoint)
if (currentStructEle.mountingPointTypeId() == MountingPointType::Undefined)
continue;
StructureElement seFloor;
@@ -262,24 +279,23 @@ void ForeignInterfaceImpl::onMainStructureElementChanged(const MainStructureElem
{
MountingPoint &mountingPointRef = *it;
if (mountingPointRef.data() == currentStructEle)
if (mountingPointRef.data().id() == currentStructEle.id())
continue;
mountingPointRef.updateData(currentStructEle, floorId);
emit mountingPointChanged(mountingPointRef, DataModification::eModified);
emit mountingPointChanged(mountingPointRef, ParticipantManagement::DataModification::eModified);
} else {
DEBUG_LOG(m_logger) << "New Mounting point with id " << currentStructEle.id()
<< " and type " << currentStructEle.mountingPointTypeId()
<< " (type " << currentStructEle.mountingPointTypeId().underlying() << ")"
<< " and type " << static_cast<int>(currentStructEle.mountingPointTypeId())
<< " subid: " << currentStructEle.mountingPointId() << this;
MountingPoint newMountingPoint(currentStructEle, floorId);
const int assetId = m_mountingPointAssetMap.value(newMountingPoint.id(), -1);
const int assetId = m_mountingPointAssetMap.value(newMountingPoint.data().id(), -1);
newMountingPoint.setAssociatedAssetId(assetId);
m_mountingPoints.insert(newMountingPoint.id(), newMountingPoint);
emit mountingPointChanged(newMountingPoint, DataModification::eAdded);
m_mountingPoints.insert(newMountingPoint.data().id(), newMountingPoint);
emit mountingPointChanged(newMountingPoint, ParticipantManagement::DataModification::eAdded);
}
}
@@ -290,7 +306,7 @@ void ForeignInterfaceImpl::onMainStructureElementChanged(const MainStructureElem
}
}
void ForeignInterfaceImpl::onMountingPointAssetChanged(const MountingPointAsset &data, DataModification modType)
void ForeignInterfaceImpl::onMountingPointAssetChanged(const InfrastructureManagement::MountingPointAsset &data, InfrastructureManagement::Interface::DataModification modType)
{
const int32_t structureElementId = data.structureElementId();
@@ -305,10 +321,10 @@ void ForeignInterfaceImpl::onMountingPointAssetChanged(const MountingPointAsset
MountingPoint &mpRef = m_mountingPoints[structureElementId];
if (modType == DataModification::eRemoved)
if (modType == InfrastructureManagement::Interface::DataModification::eRemoved)
{
m_mountingPointAssetMap.remove(structureElementId);
if (mpRef.id() > 0)
if (mpRef.data().id() > 0)
{
mpRef.setAssociatedAssetId(-1);
mpRef.setHasAssociatedAssetDefect(false);
@@ -317,42 +333,42 @@ void ForeignInterfaceImpl::onMountingPointAssetChanged(const MountingPointAsset
else
{
m_mountingPointAssetMap.insert(structureElementId, data.assetId());
if (mpRef.id() > 0)
if (mpRef.data().id() > 0)
{
mpRef.setAssociatedAssetId(data.assetId());
mpRef.setHasAssociatedAssetDefect(m_dtc->instrumentationAsset(data.assetId()).assetStateId() == InstrumentationAssetState::Defect);
mpRef.setHasAssociatedAssetDefect(m_dtc->instrumentationAsset(data.assetId()).assetStateId() == Interface::InstrumentationAssetState::Defect);
}
}
if (mpRef.id() > 0)
emit mountingPointChanged(mpRef, DataModification::eModified);
if (mpRef.data().id() > 0)
emit mountingPointChanged(mpRef, ParticipantManagement::DataModification::eModified);
}
void ForeignInterfaceImpl::onMainScheduleChanged(const MainSchedule &data, DataModification modType)
void ForeignInterfaceImpl::onMainScheduleChanged(const InfrastructureManagement::Interface::MainSchedule &data, InfrastructureManagement::Interface::DataModification modType)
{
if (m_scheduleId != data.id())
return;
Q_UNUSED(modType);
QHash<int, MountingPointPlan> mppMap;
QHash<int, Interface::MountingPointPlan> mppMap;
for (const auto &elem : data.elements())
mppMap[elem.structureElementId()] = elem;
for (MountingPoint &mp : m_mountingPoints)
{
const MountingPointPlan &mpp = mppMap[mp.id()];
const Interface::MountingPointPlan &mpp = mppMap[mp.data().id()];
const MountingPointState &mps = mpp.mountingPointState();
if(mpp.structureElementId() != mp.id())
if(mpp.structureElementId() != mp.data().id())
{
if (mp.aimState() == MountingPointState_def::Idle)
continue;
mp.setAimState(MountingPointState::Idle);
emit mountingPointChanged(mp, DataModification::eModified);
emit mountingPointChanged(mp, ParticipantManagement::DataModification::eModified);
continue;
}
@@ -360,7 +376,7 @@ void ForeignInterfaceImpl::onMainScheduleChanged(const MainSchedule &data, DataM
continue;
mp.setAimState(mps);
emit mountingPointChanged(mp, DataModification::eModified);
emit mountingPointChanged(mp, ParticipantManagement::DataModification::eModified);
}
}
@@ -385,9 +401,9 @@ void ForeignInterfaceImpl::init()
#ifdef PROCESS_MSE_SEQUENTIELL
m_dtc->mainStructureElements([this](const MainStructureElement &data)
m_dtc->mainStructureElements([this](const InfrastructureManagement::MainStructureElement &data)
{
onMainStructureElementChanged(data, DataModification::eAdded);
onMainStructureElementChanged(data, InfrastructureManagement::Interface::DataModification::eAdded);
});
#else
@@ -407,20 +423,22 @@ void ForeignInterfaceImpl::init()
m_mountingPoints.reserve(mseMap.size());
QtConcurrent::blockingMap(mseMap, [this](const MainStructureElement &data) {
onMainStructureElementChanged(data, DataModification::eAdded);
QtConcurrent::blockingMap(mseMap, [this](const InfrastructureManagement::MainStructureElement &data) {
onMainStructureElementChanged(data, InfrastructureManagement::Interface::DataModification::eAdded);
});
#endif
m_dtc->mountingPointAssets([this](const MountingPointAsset &data)
m_dtc->mountingPointAssets([this](const InfrastructureManagement::MountingPointAsset &data)
{
onMountingPointAssetChanged(data, DataModification::eAdded);
onMountingPointAssetChanged(data, InfrastructureManagement::Interface::DataModification::eAdded);
});
m_dtc->mainSchedules([this](const MainSchedule &data)
// mainSchedules() returns QMap, iterate and notify for each schedule
const auto& schedulesMap = m_dtc->mainSchedules();
for (auto it = schedulesMap.begin(); it != schedulesMap.end(); ++it)
{
onMainScheduleChanged(data, DataModification::eAdded);
});
onMainScheduleChanged(it.value(), InfrastructureManagement::Interface::DataModification::eAdded);
}
int firstBldg = -1;
if (!m_bldgsInExcersise.isEmpty())
@@ -3,7 +3,8 @@
#pragma once
#include <Plugins/InfrastructureManagement/ism_data_plugin_interface.h>
#include <InfrastructureManagement/ism_data_plugin_interface.h>
#include <InfrastructureManagement/logger.h>
#include <QtCore/QHash>
#include <QtCore/QSet>
#include <QtCore/QMutex>
@@ -33,7 +34,7 @@ public:
MainSchedule mainSchedule(int32_t scheduleId) override final;
ParticipantManagement::MainSchedule mainSchedule(int32_t scheduleId) override final;
void setScheduleId(int32_t scheduleId) override final;
int32_t scheduleId() const override final;
@@ -48,13 +49,12 @@ public:
private Q_SLOTS:
void onMainStructureElementChanged(const InfrastructureManagement::MainStructureElement &data, DataModification modType);
void onMountingPointAssetChanged(const InfrastructureManagement::MountingPointAsset &data, DataModification modType);
void onMainScheduleChanged(const InfrastructureManagement::MainSchedule &data, DataModification modType);
void onMainStructureElementChanged(const InfrastructureManagement::MainStructureElement &data, InfrastructureManagement::Interface::DataModification modType);
void onMountingPointAssetChanged(const InfrastructureManagement::MountingPointAsset &data, InfrastructureManagement::Interface::DataModification modType);
void onMainScheduleChanged(const InfrastructureManagement::Interface::MainSchedule &data, InfrastructureManagement::Interface::DataModification modType);
private:
NGL::INGLLogger &m_logger;
NGL::INGLLogger &m_logger;
void init();
private:
@@ -7,7 +7,7 @@
#include <LtsSession/lts_session.h>
#include <LtsWidgets/lts_background_widget.h>
#include <LtsUtilsSettings/settings.h>
#include <Plugins/InfrastructureManagement/ism_data_plugin_interface.h>
#include <InfrastructureManagement/ism_data_plugin_interface.h>
#include <InfrastructureManagement/logger.h>
#include <memory>
@@ -7,7 +7,7 @@
#include <InfrastructureManagement/ism_ftc.h>
#include <InfrastructureManagement/ism_data_plugin_interface.h>
#include <PluginInterfaces/gui_plugin_interface.h>
#include <Plugins/InfrastructureManagement/ism_audio_video_config_gui_plugin_interface.h>
#include <InfrastructureManagement/ism_audio_video_config_gui_plugin_interface.h>
namespace ExerciseManagement
@@ -10,8 +10,8 @@
#include <InfrastructureManagement/logger.h>
#include <PluginInterfaces/gui_plugin_interface.h>
#include <Plugins/InfrastructureManagement/ism_combobox_gui_plugin_interface.h>
#include <Plugins/InfrastructureManagement/ism_data_plugin_interface.h>
#include <InfrastructureManagement/ism_combobox_gui_plugin_interface.h>
#include <InfrastructureManagement/ism_data_plugin_interface.h>
#include <QtWidgets/QComboBox>
@@ -6,8 +6,8 @@
#include <LtsSession/lts_session.h>
#include <InfrastructureManagement/ism_translation.h>
#include <Plugins/InfrastructureManagement/ism_data_plugin_interface.h>
#include <Plugins/SituationMapPlugin/situation_map_gui_plugin_interface.h>
#include <InfrastructureManagement/ism_data_plugin_interface.h>
#include <SituationMapPlugin/situation_map_gui_plugin_interface.h>
#include <PluginInterfaces/gui_plugin_interface.h>
#include <QtCore/QJsonDocument>
@@ -20,7 +20,8 @@ void ExerciseAssignmentDialogModelFilterProxy::setSourceModel(QAbstractItemModel
void ExerciseAssignmentDialogModelFilterProxy::setExerciseId(int exerciseId)
{
m_exerciseId = exerciseId;
invalidateFilter();
beginFilterChange();
endFilterChange();
}
@@ -106,7 +107,8 @@ bool ExerciseAssignmentDialogModelFilterProxy::dropMimeData(const QMimeData *dat
m_sourceModel->setExerciseId(sourceMi, m_exerciseId);
}
invalidateFilter();
beginFilterChange();
endFilterChange();
emit doRefilter(setToExpand);
return true;
}
@@ -5,8 +5,8 @@
#include <LtsWidgets/lts_dialog.h>
#include <Plugins/AudioVideoManagement/avm_data_plugin_interface.h>
#include <Plugins/InfrastructureManagement/ism_data_plugin_interface.h>
#include <AudioVideoManagement/avm_data_plugin_interface.h>
#include <InfrastructureManagement/ism_data_plugin_interface.h>
#include <InfrastructureManagement/logger.h>
class QJsonValue;
@@ -1,6 +1,6 @@
#include "ism_mounting_point_list_dialog_list_sort_model.h"
#include <Plugins/InfrastructureManagement/Shared/ism_mounting_point.h>
#include <InfrastructureManagement/ism_mounting_point.h>
namespace InfrastructureManagement
{
@@ -16,7 +16,8 @@ void MountingPointListSortModel::setTypeFilter(const QSet<MountingPointType> &vi
if (m_visibleTypes == visibleTypes)
return;
m_visibleTypes = visibleTypes;
invalidateFilter();
beginFilterChange();
endFilterChange();
}
void MountingPointListSortModel::addToTypeFilter(MountingPointType mpt, bool bAdd)
@@ -46,7 +47,8 @@ void MountingPointListSortModel::setFloorFilter(const QSet<int> &visibleFloors)
if (m_visibleFloors == visibleFloors)
return;
m_visibleFloors = visibleFloors;
invalidateFilter();
beginFilterChange();
endFilterChange();
}
void MountingPointListSortModel::addToFloorFilter(int floor, bool bAdd)
@@ -6,7 +6,7 @@
#include "ism_mounting_point_list_dialog_list_sort_model.h"
#include <InfrastructureManagement/ism_translation.h>
#include <Plugins/InfrastructureManagement/Shared/ism_mounting_point.h>
#include <InfrastructureManagement/ism_mounting_point.h>
#include <QtCore/QTimer>
@@ -11,7 +11,7 @@
#include <nglwidgets/ngltreemodel.h>
#include <nglwidgets/ngltreeitem.h>
#include <Plugins/InfrastructureManagement/ism_data_plugin_interface.h>
#include <InfrastructureManagement/ism_data_plugin_interface.h>
#include <LtsWidgets/lts_column_filter_proxy_model.h>
#include <LtsDataView/check_state_proxy_model.h>
@@ -4,7 +4,7 @@
#include "ism_dds_selector.h"
#include <LtsUtils/LtsUtilsCore/dds_vector.h>
#include <Plugins/InfrastructureManagement/Shared/ism_mounting_point.h>
#include <InfrastructureManagement/ism_mounting_point.h>
#include <LtsWidgets/lts_message_dialog.h>
#include <QtWidgets/QApplication>
@@ -5,9 +5,9 @@
#include <InfrastructureManagement/ism_ftc.h>
#include <InfrastructureManagement/logger.h>
#include <Plugins/InfrastructureManagement/ism_data_plugin_interface.h>
#include <Plugins/InfrastructureManagement/ism_resource_management_gui_plugin_interface.h>
#include <Plugins/SituationMapPlugin/situation_map_gui_plugin_interface.h>
#include <InfrastructureManagement/ism_data_plugin_interface.h>
#include <InfrastructureManagement/ism_resource_management_gui_plugin_interface.h>
#include <SituationMapPlugin/situation_map_gui_plugin_interface.h>
namespace LtsUtils
{
@@ -5,9 +5,9 @@
#include <LtsWidgets/lts_dialog.h>
#include <InfrastructureManagement/ism_dtc.h>
#include <Plugins/InfrastructureManagement/Data/ism_data_plugin.h>
#include <InfrastructureManagement/ism_data_plugin.h>
#include <InfrastructureManagement/logger.h>
#include <Plugins/InfrastructureManagement/ism_resource_management_gui_plugin_interface.h>
#include <InfrastructureManagement/ism_resource_management_gui_plugin_interface.h>
namespace Ui
{
@@ -7,9 +7,9 @@
#include <InfrastructureManagement/logger.h>
#include <Plugins/InfrastructureManagement/ism_data_plugin_interface.h>
#include <Plugins/SituationMapPlugin/situation_map_gui_plugin_interface.h>
#include <Plugins/InfrastructureManagement/ism_resource_management_gui_plugin_interface.h>
#include <InfrastructureManagement/ism_data_plugin_interface.h>
#include <SituationMapPlugin/situation_map_gui_plugin_interface.h>
#include <InfrastructureManagement/ism_resource_management_gui_plugin_interface.h>
#include <LtsDataView/check_state_proxy_model.h>
@@ -6,7 +6,7 @@
#include <InfrastructureManagement/ism_translation.h>
#include <Plugins/InfrastructureManagement/Shared/ism_mounting_point.h>
#include <InfrastructureManagement/ism_mounting_point.h>
#include <QtCore/QDebug>
#include <QtCore/QTimer>
@@ -416,7 +416,8 @@ void ViewMountingPointListSortModel::setTypeFilter(const QSet<MountingPointType>
if (m_visibleTypes == visibleTypes)
return;
m_visibleTypes = visibleTypes;
invalidateFilter();
beginFilterChange();
endFilterChange();
}
void ViewMountingPointListSortModel::addToTypeFilter(MountingPointType mpt, bool bAdd)
@@ -11,7 +11,7 @@
#include <nglwidgets/ngltreemodel.h>
#include <nglwidgets/ngltreeitem.h>
#include <Plugins/InfrastructureManagement/ism_data_plugin_interface.h>
#include <InfrastructureManagement/ism_data_plugin_interface.h>
#include <LtsWidgets/lts_column_filter_proxy_model.h>
#include <LtsDataView/check_state_proxy_model.h>
@@ -4,8 +4,8 @@
#include <InfrastructureManagement/logger.h>
#include <InfrastructureManagement/ism_combobox_gui_plugin_interface.h>
#include <Plugins/InfrastructureManagement/Data/ism_data_plugin.h>
#include <Plugins/InfrastructureManagement/ism_resource_management_gui_plugin_interface.h>
#include <InfrastructureManagement/ism_data_plugin.h>
#include <InfrastructureManagement/ism_resource_management_gui_plugin_interface.h>
#include <QtWidgets/QDialog>
namespace Ui
@@ -2,7 +2,7 @@
#pragma once
#include <Plugins/InfrastructureManagement/ism_data_plugin_interface.h>
#include <InfrastructureManagement/ism_data_plugin_interface.h>
#include <InfrastructureManagement/logger.h>
#include <QtWidgets/QDialog>
@@ -14,8 +14,8 @@
#include <InfrastructureManagement/logger.h>
#include <LtsTimeline/item_delegate.h>
#include <Plugins/InfrastructureManagement/Data/ism_data_plugin.h>
#include <Plugins/InfrastructureManagement/ism_resource_management_gui_plugin_interface.h>
#include <InfrastructureManagement/ism_data_plugin.h>
#include <InfrastructureManagement/ism_resource_management_gui_plugin_interface.h>
#include <QtCore/QDateTime>
@@ -7,9 +7,9 @@
#include <LtsUtils/LtsUtilsGui/LtsUtilsGuiDds/request_helper.h>
#include <InfrastructureManagement/logger.h>
#include <Plugins/InfrastructureManagement/Data/ism_data_plugin.h>
#include <Plugins/Timeline/tln_data_plugin_interface.h>
#include <Plugins/InfrastructureManagement/ism_resource_management_gui_plugin_interface.h>
#include <InfrastructureManagement/ism_data_plugin.h>
#include <Timeline/tln_data_plugin_interface.h>
#include <InfrastructureManagement/ism_resource_management_gui_plugin_interface.h>
#include <LtsTimeline/item.h>
@@ -9,7 +9,7 @@
#include <InfrastructureManagement/ism_ftc.h>
#include <InfrastructureManagement/ism_resource_management_gui_plugin_interface.h>
#include <InfrastructureManagement/ism_combobox_gui_plugin_interface.h>
#include <Plugins/InfrastructureManagement/Data/ism_data_plugin.h>
#include <InfrastructureManagement/ism_data_plugin.h>
namespace Ui
{
@@ -5,8 +5,8 @@
#include "ui_ism_plan_edit_dialog.h"
#include "ism_plan_dialog_model.h"
#include <Services/InfrastructureManagement/ism_dtc.h>
#include <Services/InfrastructureManagement/ism_ftc.h>
#include <InfrastructureManagement/ism_dtc.h>
#include <InfrastructureManagement/ism_ftc.h>
#include <LtsUtils/LtsUtilsGui/LtsUtilsGuiDds/request_helper.h>
namespace InfrastructureManagement
@@ -8,8 +8,8 @@
#include <LtsUtils/LtsUtilsGui/LtsUtilsGuiDds/request_helper.h>
#include <InfrastructureManagement/ism_combobox_gui_plugin_interface.h>
#include <InfrastructureManagement/logger.h>
#include <Plugins/InfrastructureManagement/Data/ism_data_plugin.h>
#include <Plugins/InfrastructureManagement/ism_resource_management_gui_plugin_interface.h>
#include <InfrastructureManagement/ism_data_plugin.h>
#include <InfrastructureManagement/ism_resource_management_gui_plugin_interface.h>
namespace Ui
{
@@ -6,10 +6,10 @@
#include <PluginInterfaces/gui_plugin_interface.h>
#include <Plugins/AudioVideoManagement/avm_data_plugin_interface.h>
#include <Plugins/InfrastructureManagement/Data/ism_data_plugin.h>
#include <Plugins/InfrastructureManagement/ism_resource_management_gui_plugin_interface.h>
#include <Plugins/SituationMapPlugin/situation_map_gui_plugin_interface.h>
#include <AudioVideoManagement/avm_data_plugin_interface.h>
#include <InfrastructureManagement/ism_data_plugin.h>
#include <InfrastructureManagement/ism_resource_management_gui_plugin_interface.h>
#include <SituationMapPlugin/situation_map_gui_plugin_interface.h>
@@ -10,7 +10,7 @@
#
# Shared Tools for Ism Plugins & Foreign Plugins
#
NGL_ADD_LIBRARY2(WS IsmShared SHARED ism_mounting_point.h ism_mounting_point.cpp)
NGL_ADD_LIBRARY2(WS IsmShared SHARED ism_mounting_point.cpp)
NGL_TARGET_LINK_LIBRARIES(IsmShared
Qt6::Core
Qt6::Gui
@@ -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
@@ -1,108 +0,0 @@
#pragma once
#include <ismshared_export.h>
#include <InfrastructureManagement/ism.hpp>
#include <InfrastructureManagement/ism_enums.hpp>
#include <QtGui/QImage>
#include <QtCore/QMap>
#include <QtGui/QGuiApplication>
#include <QtGui/QScreen>
namespace InfrastructureManagement
{
class ISMSHARED_EXPORT MountingPoint
{
public:
explicit MountingPoint();
explicit MountingPoint(const StructureElement &data, int floorId);
static void init();
const StructureElement &data() const { return m_data; }
void updateData(const StructureElement &data, int floorId) { m_data = data; m_floor = floorId; }
int32_t id() const { return m_data.id(); }
int32_t associatedAssetId() const { return m_associatedAssetId; }
bool hasAssociatedAsset() const { return m_associatedAssetId > 0; }
bool hasAssociatedAssetDefect() const { return m_hasAssociatedAssetDefect; }
MountingPointState aimState() const { return m_aimState; }
void setAimState(const MountingPointState &mps) { m_aimState = mps;}
bool isValid() const { return m_isValid; }
Core::GeoPosition geoPosition() const { return m_data.geoPosition(); }
Core::RelativePosition relPosition() const { return m_data.relPosition(); }
MountingPointType type() const { return m_data.mountingPointTypeId(); }
int32_t buildingId() const { return m_data.mainStructureElementId(); }
QString name() const;
QString fileName() const;
QByteArray properties() const { return m_data.properties().c_str(); }
QImage toImage(int32_t edgeLength = 100) const;
bool writeFile(int32_t edgeLength = 25) const;
int floor() const { return m_floor; }
void setFloor(int floor) { m_floor = floor; }
void setAssociatedAssetId(int32_t id);
void setHasAssociatedAssetDefect(bool hasAssociatedAssetDefect);
MountingPointState getNextMountingPointState(const MountingPointState currState);
private:
StructureElement m_data;
int32_t m_associatedAssetId;
MountingPointState m_aimState;
bool m_hasAssociatedAssetDefect;
bool m_isValid;
int m_floor;
public:
enum class MpColor
{
GRAY,
BLUE,
RED,
GREEN,
ORANGE
};
static QString mpColorToString(MpColor mpColor);
static QString mpColorToPostfix(MpColor mpColor);
struct NameImagePair
{
NameImagePair(const QString &name = QString(),
const QImage &img = QImage())
: m_name(name), m_img(img)
{}
QString m_name;
QImage m_img;
};
struct MpNameImageData
{
NameImagePair nipGray;
NameImagePair nipBlue;
NameImagePair nipRed;
NameImagePair nipGreen;
NameImagePair nipOrange;
};
static QMap<MountingPointType, MpNameImageData> &getImageTable();
static bool getImageAttributePlanActivity(const MountingPoint& mp,
QImage &imgOut, QString &attribNameOut);
static bool getImageAttributePlanDefinition(const MountingPoint& mp,
QImage &imgOut, QString &attribNameOut);
static bool getImageAttribute(const MountingPoint& mp, MpColor mpColor,
QImage &img, QString &attribName);
private:
static QMap<MountingPointType, MpNameImageData> &getImageTableInternal();
static void insertHelper(MountingPointType type,
const QString &name,
const QString &colorCodeGray,
const QString &colorCodeGreen,
const QString &colorCodeRed,
const QString &colorCodeOrange,
const QString &defName = QString());
};
} // namespace InfrastructureManagement
@@ -4,6 +4,7 @@
#pragma once
#include <InfrastructureManagement/ism.hpp>
#include <InfrastructureManagement/ism_mounting_point.h>
#include <InfrastructureManagement/ism_dtc.h>
#include <InfrastructureManagement/ism_ftc.h>
#include <ParticipantManagement/ppm.hpp>
@@ -28,7 +29,6 @@
namespace InfrastructureManagement
{
class ForeignDataInterface;
class MountingPoint;
// Forward declaration for MainSchedule from ParticipantManagement
using ParticipantManagement::MainSchedule;
@@ -2,7 +2,7 @@
#pragma once
#include <Services/InfrastructureManagement/ism_enums.hpp>
#include <InfrastructureManagement/ism_enums.hpp>
#include <QtCore/QString>
class QWidget;