Prune the source tree to the Release 2 build closure

Keep only what the Release 2 scope (46 targets) compiles and the build
pipeline needs, derived from the run-5 build.ninja closure (46 targets +
transitive deps) and a header scan resolved against the real -I roots of
the compile rules:

- 14133 tracked files removed (1.25 GB), incl. include/ArcGIS (1.03 GB),
  include/rti stubs (identical copies of the external RTI headers),
  out-of-scope Lts/Application, Lts/Viewer, Lts/Services/*, Lts/Tools
  generators, src/, tests/, specs/, translations/, external/
- kept: the 46 scope modules + their transitive service deps, codegen
  inputs (.xml, .grantlee), doxygen/ (configure_file at configure time),
  include/GeographicLib (libGeographicLib.so linked from the source tree),
  the 12 referenced include/ stub headers, pipeline files
  (new_docker_build_release2.sh, rpmbuild/, jenkins-ci-rme/, cmake/)
- 7 CMakeLists updated: drop add_subdirectory calls of the removed dirs
  (tests, translations, Lts/Plugins/ProjectDataManagement, qav, scripts,
  CommonUnitTestsPlaceholder, httq, LtsRestClient, LtsWebSocket,
  TopicEditorBase, ConnectDialog, StyleManager, Routing, DdsUnitTests,
  DdsUnitTestsPlaceholder, Light, Dark, Test, ExerciseManagement,
  ParticipantManagement, the 3 tools generators)

Result: 2157 tracked files (was 16290).
This commit is contained in:
berrux-dev committed 2026-11-13 23:33:32 +01:00
1 parent 2b1c3dc241
commit 7fc6f66649
14140 files changed
+8 -2803418

No files matched your search

@@ -1,49 +0,0 @@
#
# $Id$
# $HeadURL$
# $Author$
# Created by Christian Ehrlicher, SLSE, 2016-03-01
#
# Make ${Qt6_Gui} optional
if(QT6_GUI_AVAILABLE AND TARGET Qt6::Gui)
set(Qt6_Gui ${Qt6_Gui})
else()
set(Qt6_Gui "")
endif()
ADD_SUBDIRECTORY(Data)
ADD_SUBDIRECTORY(Gui)
ADD_SUBDIRECTORY(Helper)
#
# Data Plugin Interface
#
ADD_INTERFACE_LIBRARY(AsbDataPluginInterface
${CMAKE_CURRENT_SOURCE_DIR}/asb_data_plugin_interface.h
${CMAKE_CURRENT_SOURCE_DIR}/..
DataPluginInterface
advancedSymbology
${Qt6_Gui}
)
#
# Gui Plugin Interface (Symbol Editor)
#
ADD_INTERFACE_LIBRARY(AsbGuiPluginInterface
${CMAKE_CURRENT_SOURCE_DIR}/asb_gui_plugin_interface.h
${CMAKE_CURRENT_SOURCE_DIR}/..
GuiPluginInterface
Qt6::Core
)
#
# Gui Plugin Interface (SymbolProxy)
#
ADD_INTERFACE_LIBRARY(AsbSymbolProxyGuiPluginInterface
${CMAKE_CURRENT_SOURCE_DIR}/asb_symbol_proxy_gui_plugin_interface.h
${CMAKE_CURRENT_SOURCE_DIR}/..
GuiPluginInterface
${Qt6_Gui}
)
@@ -1,85 +0,0 @@
#
# $Id$
# $HeadURL: svn://slssvn/TDS/branches/product/devel/trunk/Lts/Plugins/AdvancedSymbology/CMakeLists.txt
# $Author$
# Created by Mike Wille, SLSE, 2016-09-05
#
# Make ${Qt6_Widgets} optional
if(QT6_GUI_AVAILABLE AND TARGET Qt6::Widgets)
set(Qt6_Widgets ${Qt6_Widgets})
else()
set(Qt6_Widgets "")
endif()
NGL_ADD_LIBRARY(WS AsbData STATIC
asb_foreign_interface_impl.cpp
asb_foreign_interface_impl.h
logger.cpp
logger.h
)
TARGET_INCLUDE_DIRECTORIES(AsbData PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/../../..
${CMAKE_CURRENT_SOURCE_DIR}/../../../Viewer/SituationMap
${CMAKE_CURRENT_SOURCE_DIR}/../../../Viewer/SituationMap/Symbology
${CMAKE_CURRENT_SOURCE_DIR}/../../../../Z/src
)
if(QT6_GUI_AVAILABLE)
NGL_TARGET_LINK_LIBRARIES(AsbData
GimDataPluginInterface
AsbDataPluginInterface
AesDataPluginInterface
PpmDataPluginInterface
advancedSymbology
${Qt6_Widgets}
)
endif()
#
# Data Plugin
#
NGL_ADD_LIBRARY(WS AsbDataPlugin MODULE
asb_data_plugin.cpp
asb_data_plugin.h
asb_foreign_interface_impl.cpp
asb_foreign_interface_impl.h
logger.cpp
logger.h
)
NGL_TARGET_LINK_LIBRARIES(AsbDataPlugin
AsbData
Qt6::Core
AsbDataPluginInterface
GimDataPluginInterface
svcAesCommon
advancedSymbology
NGLLogger
LtsSessionDataDds
)
NGL_INSTALL_TARGET(AsbDataPlugin)
NGL_ADD_LIBRARY(WS AsbForeignDataPluginThp STATIC
asb_foreign_interface_impl.cpp
asb_foreign_interface_impl.h
logger.cpp
logger.h
)
TARGET_INCLUDE_DIRECTORIES(AsbForeignDataPluginThp PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/../../..
${CMAKE_CURRENT_SOURCE_DIR}/../../../Viewer/SituationMap
${CMAKE_CURRENT_SOURCE_DIR}/../../../Viewer/SituationMap/Symbology
${CMAKE_CURRENT_SOURCE_DIR}/../../../../Z/src
)
NGL_TARGET_LINK_LIBRARIES(AsbForeignDataPluginThp
AsbData
Qt6::Core
AsbDataPluginInterface
GimDataPluginInterface
svcAesCommon
advancedSymbology
NGLLogger
LtsSessionDataDds
)
@@ -1,76 +0,0 @@
#include "asb_data_plugin.h"
#include "asb_foreign_interface_impl.h"
#include "logger.h"
#include <AreaEffectSimulation/aes_data_plugin_interface.h>
#include <ParticipantManagement/ppm_data_plugin_interface.h>
#include <GuezIedManagement/gim_data_plugin_interface.h>
#include <SymbologyImpl/advanced_symbology_logging.h>
#include <Symbology/symbol_data_to_render_role.h>
#include <LtsSession/lts_session.h>
namespace AdvancedSymbology
{
AdvancedSymbology::SidcDefinitions::Identity roleToIdentity(const ParticipantManagement::Role role)
{
AdvancedSymbology::SidcDefinitions::Identity identity = AdvancedSymbology::SidcDefinitions::Identity::Unknown;
switch (role) {
case ParticipantManagement::Role::Unknown:
identity = AdvancedSymbology::SidcDefinitions::Identity::Unknown;
break;
case ParticipantManagement::Role::Friend:
identity = AdvancedSymbology::SidcDefinitions::Identity::Friend;
break;
case ParticipantManagement::Role::Neutral:
identity = AdvancedSymbology::SidcDefinitions::Identity::Neutral;
break;
case ParticipantManagement::Role::Enemy:
identity = AdvancedSymbology::SidcDefinitions::Identity::HostileFaker;
break;
case ParticipantManagement::Role::Pending:
identity = AdvancedSymbology::SidcDefinitions::Identity::Pending;
break;
case ParticipantManagement::Role::AssumedFriend:
identity = AdvancedSymbology::SidcDefinitions::Identity::AssumedFriend;
break;
case ParticipantManagement::Role::Suspect:
identity = AdvancedSymbology::SidcDefinitions::Identity::SuspectJoker;
break;
}
return identity;
}
std::shared_ptr<DataPluginBase::Interface> DataPlugin::createDataInterface(LtsSession::LtsSessionDataDds *session)
{
return std::make_shared<DataInterfaceImpl>(session);
}
DataInterfaceImpl::DataInterfaceImpl(LtsSession::LtsSessionDataDds *session)
: DataInterface()
, m_foreignInterface(nullptr)
, m_session(session)
{}
std::shared_ptr<ForeignDataInterface> DataInterfaceImpl::getForeignDataInterface()
{
if (!m_foreignInterface)
{
std::shared_ptr<ParticipantManagement::Interface::Dtc> ppmDtc;
std::shared_ptr<AreaEffectSimulation::Interface::Dtc> aesDtc;
std::shared_ptr<GuezIedManagement::Interface::Dtc> gimDtc;
m_session->getDtc<ParticipantManagement::DataInterface>(ppmDtc);
m_session->getDtc<AreaEffectSimulation::DataInterface>(aesDtc);
m_session->getDtc<GuezIedManagement::DataInterface>(gimDtc);
m_foreignInterface = std::make_shared<ForeignInterfaceImpl>(ppmDtc, aesDtc, gimDtc);
}
return m_foreignInterface;
}
}
@@ -1,38 +0,0 @@
#pragma once
#include <PluginInterfaces/data_plugin_interface.h>
#include <AdvancedSymbology/asb_data_plugin_interface.h>
namespace AdvancedSymbology
{
class DataPlugin final : public DataPluginBase::Plugin
{
Q_PLUGIN_METADATA(IID "data:3:asb")
Q_OBJECT
public:
DataPlugin() = default;
~DataPlugin() = default;
QString pluginName() const override { return QStringLiteral("AdvancedSymbology"); }
std::shared_ptr<DataPluginBase::Interface> createDataInterface(LtsSession::LtsSessionDataDds *session) override;
bool availableInPartition(IDL::PartitionType partition) const override { Q_UNUSED(partition); return true; }
};
class DataInterfaceImpl final : public DataInterface
{
public:
explicit DataInterfaceImpl(LtsSession::LtsSessionDataDds *session);
std::shared_ptr<ForeignDataInterface> getForeignDataInterface() override;
private:
std::shared_ptr<ForeignDataInterface> m_foreignInterface;
LtsSession::LtsSessionDataDds *m_session;
};
}
@@ -1,216 +0,0 @@
#include "asb_foreign_interface_impl.h"
#include "logger.h"
#ifdef BUILD_WITH_EXTERNAL_DDS
#include "AreaEffectSimulation/aes_dtc.h"
#include "ParticipantManagement/ppm_dtc.h"
#endif
#include "Symbology/symbol_data_to_render_role.h"
#include "SymbologyImpl/advanced_symbology_logging.h"
namespace AdvancedSymbology
{
#ifdef BUILD_WITH_EXTERNAL_DDS
ForeignInterfaceImpl::ForeignInterfaceImpl(const std::shared_ptr<ParticipantManagement::Interface::Dtc>& ppmDtc,
const std::shared_ptr<AreaEffectSimulation::Interface::Dtc>& aesDtc,
const std::shared_ptr<GuezIedManagement::Interface::Dtc>& guezIedDtc)
: m_ppmDtc(ppmDtc), m_aesDtc(aesDtc), m_guezIedDtc(guezIedDtc)
, m_logger(getLogger("AdvancedSymbologyPlugin"))
{
if (!m_ppmDtc)
{
WARNING_LOG(m_logger)
<< "m_ppmDtc not available, No color and injury information will be included in created symbols";
Q_ASSERT(false);
}
}
AdvancedSymbology::SymbolDictionary&
ForeignInterfaceImpl::getSymbolDictionary(AdvancedSymbology::SymbologyType type) const
{
return AdvancedSymbology::SymbolDictionary::dictionary(type);
}
AdvancedSymbology::SymbologyType ForeignInterfaceImpl::defaultSymbologyType() const
{
return AdvancedSymbology::SymbolDictionary::defaultSymbologyType();
}
QSharedPointer<SymbolResult> ForeignInterfaceImpl::findImage(const SymbolDictionary& dict,
const SymbolDataToRender& symDataToRender) const
{
return dict.findImage(symDataToRender);
}
QSharedPointer<SymbolResult> ForeignInterfaceImpl::findImage(const SymbolDataToRender& symDataToRender) const
{
return AdvancedSymbology::SymbolDictionary::dictionary(defaultSymbologyType()).findImage(symDataToRender);
}
QSharedPointer<SymbolResult> ForeignInterfaceImpl::findImage(const ParticipantManagement::Participant& participant,
int sizeL, const QColor& desiredColor) const
{
AdvancedSymbology::SymbolDataToRender symDataToRender(QString::fromStdString(participant.symbol), sizeL);
if (!m_ppmDtc)
return findImage(symDataToRender);
const ParticipantManagement::Party& party = m_ppmDtc->party(participant.partyId);
symDataToRender.role = AdvancedSymbology::roleToRole<>(party.role);
symDataToRender.fillColor = desiredColor.isValid() ? desiredColor : QColor::fromRgb(QRgb(party.color));
symDataToRender.fillColorReplace = true;
QColor injuryColor = QColor(100, 100, 0);
ProjectDataManagement::VulnerabilityState currentState = ProjectDataManagement::VulnerabilityState::VulnerabilityState_CombatReady;
const ParticipantManagement::DynamicParticipantData dData = m_ppmDtc->dynamicParticipantData(participant.id);
if (dData.stateHistory.size())
{
const ParticipantManagement::StateInformation& lastState =
m_ppmDtc->youngestStateInformation(dData.stateHistory);
currentState = lastState.vulnerabilityState;
switch (lastState.originatorType)
{
case ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_ImprovisedExplosiveDevice: {
if (m_guezIedDtc)
{
const GuezIedManagement::Ied& gIed = m_guezIedDtc->iedForEquipmentNumber(lastState.originatorId);
if (gIed.id > 0)
{
int injuryPartyId = gIed.partyId;
if (injuryPartyId >= 0)
injuryColor = m_ppmDtc->party(injuryPartyId).color;
}
}
break;
}
case ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_DusMine: {
if (!m_aesDtc)
{
WARNING_LOG(m_logger) << "Fetching 'm_aesDtc' failed, No color and injury information will be "
"included in symbol created for participant.id() "
<< participant.id;
return findImage(symDataToRender);
}
const int partyId = m_aesDtc->partyForDusMine(lastState.originatorId);
if (partyId >= 0)
injuryColor = m_ppmDtc->party(partyId).color;
break;
}
case ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_AreaEffectSimulation:
case ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_FunctionalArea: {
if (!m_aesDtc)
{
WARNING_LOG(m_logger) << "Fetching 'm_aesDtc' failed, No color and injury information will be "
"included in symbol created for participant.id() "
<< participant.id;
return findImage(symDataToRender);
}
AreaEffectSimulation::AesItem aesItem;
m_aesDtc->aesItemFromId(lastState.originatorId, aesItem);
if (aesItem.partyId.has_value())
injuryColor = m_ppmDtc->party(aesItem.partyId.get()).color;
break;
}
case ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_Participant: {
const ParticipantManagement::Participant& participantOrigin =
m_ppmDtc->participant(lastState.originatorId);
if (participantOrigin.id)
injuryColor = m_ppmDtc->party(participantOrigin.partyId).color;
break;
}
case ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_Party: {
const ParticipantManagement::Party& partyOrigin = m_ppmDtc->party(lastState.originatorId);
if (partyOrigin.id)
injuryColor = partyOrigin.color;
break;
}
case ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_ObserverController:
case ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_ExerciseControl:
case ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_Initialization:
injuryColor = m_ppmDtc->party(1).color;
break;
case ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_WoundTreatmentDevice:
case ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_MedicalTimeout:
case ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_Sanitation:
case ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_MaintainanceDevice:
case ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_Unknown:
break;
}
}
symDataToRender.injury = stateToInjury(currentState);
symDataToRender.injuryColor = injuryColor;
return findImage(symDataToRender);
}
AdvancedSymbology::Injury ForeignInterfaceImpl::stateToInjury(const ProjectDataManagement::VulnerabilityState& state)
{
switch (state)
{
case ProjectDataManagement::VulnerabilityState::VulnerabilityState_CombatReady:
case ProjectDataManagement::VulnerabilityState::VulnerabilityState_TemporarySeverance:
case ProjectDataManagement::VulnerabilityState::VulnerabilityState_NearMiss:
case ProjectDataManagement::VulnerabilityState::VulnerabilityState_HitWithNoEffect:
return AdvancedSymbology::Injury::NoInjury;
case ProjectDataManagement::VulnerabilityState::VulnerabilityState_LightDamage:
case ProjectDataManagement::VulnerabilityState::VulnerabilityState_MediumDamage:
case ProjectDataManagement::VulnerabilityState::VulnerabilityState_HeavyDamage:
case ProjectDataManagement::VulnerabilityState::VulnerabilityState_NotReady:
return AdvancedSymbology::Injury::Hit;
case ProjectDataManagement::VulnerabilityState::VulnerabilityState_MobilityKill:
case ProjectDataManagement::VulnerabilityState::VulnerabilityState_VisibleMobilityKill:
return AdvancedSymbology::Injury::MobilityKill;
case ProjectDataManagement::VulnerabilityState::VulnerabilityState_WeaponSystemDamage:
case ProjectDataManagement::VulnerabilityState::VulnerabilityState_VisibleWeaponSystemDamage:
return AdvancedSymbology::Injury::WeaponKill;
case ProjectDataManagement::VulnerabilityState::VulnerabilityState_CatastrophicKill:
return AdvancedSymbology::Injury::TotalKill;
case ProjectDataManagement::VulnerabilityState::VulnerabilityState_NContamination:
case ProjectDataManagement::VulnerabilityState::VulnerabilityState_BContamination:
case ProjectDataManagement::VulnerabilityState::VulnerabilityState_CContamination:
case ProjectDataManagement::VulnerabilityState::VulnerabilityState_VulnerabilityBitsChanged:
case ProjectDataManagement::VulnerabilityState::VulnerabilityState_Reserved:
case ProjectDataManagement::VulnerabilityState::VulnerabilityState_NoChange:
break;
}
return AdvancedSymbology::Injury::NoInjury;
}
QSharedPointer<SymbolResult> ForeignInterfaceImpl::findPreview(const SymbolDictionary& dict, const QString& sidc) const
{
return dict.findPreview(sidc);
}
QSharedPointer<SymbolResult> ForeignInterfaceImpl::findPreview(const QString& sidc) const
{
return AdvancedSymbology::SymbolDictionary::dictionary(defaultSymbologyType()).findPreview(sidc);
}
QSharedPointer<SymbolResult> ForeignInterfaceImpl::findBaseSymbol(const SymbolDictionary& dict,
const QString& sidc) const
{
return dict.findBaseSymbol(sidc);
}
QSharedPointer<SymbolResult> ForeignInterfaceImpl::findBaseSymbol(const QString& sidc) const
{
return AdvancedSymbology::SymbolDictionary::dictionary(defaultSymbologyType()).findBaseSymbol(sidc);
}
#endif
} // namespace AdvancedSymbology
@@ -1,135 +0,0 @@
#pragma once
#include <AdvancedSymbology/asb_data_plugin_interface.h>
#include <PluginInterfaces/data_plugin_interface.h>
#ifdef BUILD_WITH_EXTERNAL_DDS
#include <GuezIedManagement/gim_data_plugin_interface.h>
#include <ProjectDataManagement/pdm_enums.hpp>
#endif
#include <Symbology/symbol_dictionary.h>
#ifdef BUILD_WITH_EXTERNAL_DDS
namespace AreaEffectSimulation
{
namespace Interface
{
class Dtc;
}
} // namespace AreaEffectSimulation
namespace ParticipantManagement
{
namespace Interface
{
class Dtc;
}
} // namespace ParticipantManagement
#endif
namespace AdvancedSymbology
{
#ifdef BUILD_WITH_EXTERNAL_DDS
class ForeignInterfaceImpl final : public QObject, public ForeignDataInterface
{
Q_OBJECT
public:
explicit ForeignInterfaceImpl(const std::shared_ptr<ParticipantManagement::Interface::Dtc>& ppmDtc,
const std::shared_ptr<AreaEffectSimulation::Interface::Dtc>& aesDtc,
const std::shared_ptr<GuezIedManagement::Interface::Dtc>& guezIedDtc);
AdvancedSymbology::SymbolDictionary& getSymbolDictionary(AdvancedSymbology::SymbologyType type) const override;
QSharedPointer<SymbolResult> findImage(const SymbolDictionary& dict,
const SymbolDataToRender& symDataToRender) const override;
QSharedPointer<SymbolResult> findImage(const SymbolDataToRender& symDataToRender) const override;
QSharedPointer<SymbolResult> findImage(const ParticipantManagement::Participant& participant, int sizeL = 100,
const QColor& desiredColor = QColor()) const override;
QSharedPointer<SymbolResult> findPreview(const SymbolDictionary& dict, const QString& sidc) const override;
QSharedPointer<SymbolResult> findPreview(const QString& sidc) const override;
QSharedPointer<SymbolResult> findBaseSymbol(const SymbolDictionary& dict, const QString& sidc) const override;
QSharedPointer<SymbolResult> findBaseSymbol(const QString& sidc) const override;
AdvancedSymbology::SymbologyType defaultSymbologyType() const override;
private:
NGL::INGLLogger& m_logger;
static AdvancedSymbology::Injury stateToInjury(const ProjectDataManagement::VulnerabilityState& state);
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_ppmDtc;
std::shared_ptr<AreaEffectSimulation::Interface::Dtc> m_aesDtc;
std::shared_ptr<GuezIedManagement::Interface::Dtc> m_guezIedDtc;
};
#else
// Stub implementation when external DDS dependencies are not available
class ForeignInterfaceImpl final : public QObject, public ForeignDataInterface
{
Q_OBJECT
public:
explicit ForeignInterfaceImpl() = default;
AdvancedSymbology::SymbolDictionary& getSymbolDictionary(AdvancedSymbology::SymbologyType type) const override
{
Q_UNUSED(type)
// STUB: No external DDS - return nullptr reference (should not be called in stub mode)
static AdvancedSymbology::SymbolDictionary* dummy = nullptr;
Q_ASSERT_X(dummy, "ForeignInterfaceImpl::getSymbolDictionary", "Stub implementation should not be called");
return *dummy;
}
QSharedPointer<SymbolResult> findImage(const SymbolDictionary& dict,
const SymbolDataToRender& symDataToRender) const override
{
Q_UNUSED(dict)
Q_UNUSED(symDataToRender)
return nullptr;
}
QSharedPointer<SymbolResult> findImage(const SymbolDataToRender& symDataToRender) const override
{
Q_UNUSED(symDataToRender)
return nullptr;
}
QSharedPointer<SymbolResult> findImage(const ParticipantManagement::Participant& participant, int sizeL,
const QColor& desiredColor) const override
{
Q_UNUSED(participant)
Q_UNUSED(sizeL)
Q_UNUSED(desiredColor)
return nullptr;
}
QSharedPointer<SymbolResult> findPreview(const SymbolDictionary& dict, const QString& sidc) const override
{
Q_UNUSED(dict)
Q_UNUSED(sidc)
return nullptr;
}
QSharedPointer<SymbolResult> findPreview(const QString& sidc) const override
{
Q_UNUSED(sidc)
return nullptr;
}
QSharedPointer<SymbolResult> findBaseSymbol(const SymbolDictionary& dict, const QString& sidc) const override
{
Q_UNUSED(dict)
Q_UNUSED(sidc)
return nullptr;
}
QSharedPointer<SymbolResult> findBaseSymbol(const QString& sidc) const override
{
Q_UNUSED(sidc)
return nullptr;
}
AdvancedSymbology::SymbologyType defaultSymbologyType() const override
{
// STUB: No external DDS - return valid default
return AdvancedSymbology::SymbologyType::APP6B;
}
};
#endif
} // namespace AdvancedSymbology
@@ -1,32 +0,0 @@
#include "logger.h"
#include <NGLLoggerBootstrap.h>
namespace BuildingViewer
{
LOGGER_T getLogger(const char *name)
{
static const char ns[] = "ASB.";
std::string loggerName;
const size_t len = strlen(name);
loggerName.reserve(sizeof(ns) + len);
loggerName.append(ns, sizeof(ns) - 1);
loggerName.append(name, len);
try
{
return NGL::NGLLoggerBootstrap::getNGLRootLogger().
getNGLLogger(loggerName);
}
catch (const std::exception &ex)
{
fprintf(stderr, "Error retrieving logger: %s", ex.what());
abort();
}
}
}
@@ -1,17 +0,0 @@
#pragma once
#include <NGLLogger/INGLLogger.h>
namespace BuildingViewer
{
typedef NGL::INGLLogger &LOGGER_T;
LOGGER_T getLogger(const char *name);
inline LOGGER_T getLogger(const QString &loggerName)
{
return getLogger(loggerName.toUtf8().constData());
}
}
@@ -1,10 +0,0 @@
#
# $Id$
# $HeadURL$
# $Author$
#
# Created by Hannes Baeuerle, SLSE, 2017-06-13
#
add_subdirectory(SymbolEditor)
add_subdirectory(SymbolProxy)
@@ -1,77 +0,0 @@
# CMake script for SymbolEditor
# Make ${Qt6_Gui} optional
if(QT6_GUI_AVAILABLE AND TARGET Qt6::Gui)
set(Qt6_Gui ${Qt6_Gui})
else()
set(Qt6_Gui "")
endif()
# Make ${Qt6_Widgets} optional
if(QT6_GUI_AVAILABLE AND TARGET Qt6::Widgets)
set(Qt6_Widgets ${Qt6_Widgets})
else()
set(Qt6_Widgets "")
endif()
SET(symboleditor_SRCS
asb_save_as_symbol.cpp
asb_save_as_symbol.h
asb_symbol_editor_gui_plugin.cpp
asb_symbol_editor_gui_plugin.h
asb_save_as_symbol.cpp
asb_save_as_symbol.h
asb_delete_elements_dialog.cpp
asb_delete_elements_dialog.h
asb_resize_dialog.cpp
asb_resize_dialog.h
asb_rotate_dialog.cpp
asb_rotate_dialog.h
asb_select_text_dialog.cpp
asb_select_text_dialog.h
asb_symbol_editor.cpp
asb_symbol_editor.h
asb_symbol_edit_scene.cpp
asb_symbol_edit_scene.h
flm_reply_handler.cpp
flm_reply_handler.h
)
SET(symboleditor_UICS
forms/asb_select_text_dialog.ui
forms/asb_delete_elements_dialog.ui
forms/asb_symbol_editor.ui
forms/asb_save_as_symbol.ui
forms/asb_rotate_dialog.ui
forms/asb_resize_dialog.ui
)
# Fuer die Icons
QT5_ADD_RESOURCES(symboleditor_SRCS application.qrc)
NGL_WRAP_UI(symboleditor_SRCS ${symboleditor_UICS})
NGL_ADD_LIBRARY(WS AsbSymEditGuiPlugin MODULE ${symboleditor_SRCS} ${symboleditor_UICS})
set_target_properties(AsbSymEditGuiPlugin PROPERTIES AUTOUIC ON)
set_target_properties(AsbSymEditGuiPlugin PROPERTIES AUTOUIC_SEARCH_PATHS "${CMAKE_CURRENT_SOURCE_DIR}/forms")
TARGET_INCLUDE_DIRECTORIES(AsbSymEditGuiPlugin PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/../../../../Viewer/SituationMap
${CMAKE_CURRENT_SOURCE_DIR}/../../../../Viewer/SituationMap/Symbology
)
if(QT6_GUI_AVAILABLE)
NGL_TARGET_LINK_LIBRARIES(AsbSymEditGuiPlugin
NGLLogger
LtsWidgets
FlmDataPluginInterface
PpmDataPluginInterface
advancedSymbology
advancedSymbologyXML
LtsSession
LtsSessionData
LtsUtilsGuiDds
Qt6::Core
${Qt6_Gui}
${Qt6_Widgets}
)
endif()
NGL_INSTALL_TARGET(AsbSymEditGuiPlugin)
@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE symboltable SYSTEM "symbole.dtd">
<symbol version="1.0" id="0x00001003" dimen="land_units" affil="enemy" bcdab="undefined" command_level="undefined" mob="wheel">
<name>LinienOben</name>
<graphic scale="1.0">
<line transform="false" rotate="0" linewidth="0.1" linestyle="solid">
<point x="1.1" y="1.9"/>
<point x="1.1" y="1.9"/>
</line>
</graphic>
</symbol>
@@ -1,15 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE symboltable SYSTEM "symbole.dtd">
<symbol version="1.0" id="0x00001003" dimen="undefined" affil="neutral" bcdab="undefined" command_level="undefined" mob="undefined">
<name>LinienOben</name>
<graphic scale="1">
<line transform="false" rotate="0" linewidth="0.05" linestyle="solid">
<point x="-1.6" y="1.6"/>
<point x="-0.1" y="1.6"/>
</line>
<line transform="false" rotate="0" linewidth="0.05" linestyle="solid">
<point x="0.1" y="1.6"/>
<point x="1.6" y="1.6"/>
</line>
</graphic>
</symbol>
@@ -1,15 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE symboltable SYSTEM "symbole.dtd">
<symbol version="1.0" id="0x00001011" dimen="undefined" affil="neutral" bcdab="undefined" command_level="undefined" mob="undefined">
<name>Manipulation</name>
<graphic scale="1">
<line transform="false" rotate="0" color="#ffffffff" linewidth="0.1" linestyle="solid">
<point x="-1.2" y="-1.4"/>
<point x="1.2" y="-1.4"/>
</line>
<line transform="false" rotate="0" color="#000000ff" linewidth="0.1" linestyle="solid">
<point x="-1.2" y="-1.5"/>
<point x="1.2" y="-1.5"/>
</line>
</graphic>
</symbol>
@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE symboltable SYSTEM "symbole.dtd">
<symbol version="1.0" id="0x00001012" dimen="undefined" affil="neutral" bcdab="undefined" command_level="undefined" mob="undefined">
<name>NoPosition</name>
<graphic scale="1">
<line transform="false" rotate="0" color="#ff0000ff" linewidth="0.1" linestyle="solid">
<point x="-1.6" y="-1.6"/>
<point x="1.6" y="-1.6"/>
</line>
</graphic>
</symbol>
@@ -1,16 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE symboltable SYSTEM "symbole.dtd">
<symbol version="1.0" id="0x1000" dimen="land_units" affil="neutral" bcdab="crew" command_level="undefined" mob="wheel">
<name>/shd/guez/int/WorkSpace/trunk/GDW/addOnSymbols/TestSymbol.xml</name>
<branch class="infantry" />
<text1 maxdatalength="9">
<data align="center">Test</data>
</text1>
<graphic scale="0.5">
<rect transform="false" rotate="45" linewidth="0.05" linestyle="dotted"
fill="0" color="#FF0000FF">
<point x="-0.543103" y="0.568966"/>
<point x="0.577586" y="-0.551724"/>
</rect>
</graphic>
</symbol>
@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE symboltable SYSTEM "symbole.dtd">
<symbol version="1.0" id="0x00001002" dimen="undefined" affil="neutral" bcdab="undefined" command_level="undefined" mob="undefined">
<name>vbgFireKill</name>
<graphic scale="1">
<line transform="false" rotate="0" linewidth="0.15" linestyle="solid">
<point x="-1.6" y="-1.6"/>
<point x="1.6" y="1.6"/>
</line>
</graphic>
</symbol>
@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE symboltable SYSTEM "symbole.dtd">
<symbol version="1.0" id="0x00001001" dimen="undefined" affil="neutral" bcdab="undefined" command_level="undefined" mob="undefined">
<name>vbgFireKill</name>
<graphic scale="1">
<line transform="false" rotate="0" linewidth="0.15" linestyle="solid">
<point x="-1.6" y="1.6"/>
<point x="1.6" y="-1.6"/>
</line>
</graphic>
</symbol>
@@ -1,5 +0,0 @@
<RCC>
<qresource prefix="/">
<file>icons/previewBackground.xpm</file>
</qresource>
</RCC>
@@ -1,58 +0,0 @@
#include "asb_delete_elements_dialog.h"
#include "ui_asb_delete_elements_dialog.h"
namespace AdvancedSymbology
{
DeleteElementsDialog::DeleteElementsDialog(QWidget *parent)
: LtsWidgets::LtsFramelessDialog(parent)
, ui(new Ui_DeleteElementsDialog)
{
ui->setupUi(this);
initWidgets();
enaDisa();
}
DeleteElementsDialog::~DeleteElementsDialog()
{
delete ui;
}
void DeleteElementsDialog::initWidgets()
{
connect(ui->checkBoxPrims, &QCheckBox::toggled, this, &DeleteElementsDialog::enaDisa);
connect(ui->checkBoxPrimsSectorText, &QCheckBox::toggled, this, &DeleteElementsDialog::enaDisa);
connect(ui->checkBoxAttributes, &QCheckBox::toggled, this, &DeleteElementsDialog::enaDisa);
connect(ui->buttonBox->getButton(LtsWidgets::DialogButton::Ok), &QPushButton::clicked, this, &DeleteElementsDialog::accept);
connect(ui->buttonBox->getButton(LtsWidgets::DialogButton::Close), &QPushButton::clicked, this, &DeleteElementsDialog::reject);
}
void DeleteElementsDialog::enaDisa()
{
bool enabled = false;
if (ui->checkBoxPrims->isChecked() ||
ui->checkBoxPrimsSectorText->isChecked() ||
ui->checkBoxAttributes->isChecked())
enabled = true;
ui->buttonBox->getButton(LtsWidgets::DialogButton::Ok)->setEnabled(enabled);
}
void DeleteElementsDialog::getCheckedElements(bool &checkedPrims,
bool &checkedPrimsSectorText,
bool &checkedAttributes)
{
checkedPrims = ui->checkBoxPrims->isChecked();
checkedPrimsSectorText = ui->checkBoxPrimsSectorText->isChecked();
checkedAttributes = ui->checkBoxAttributes->isChecked();
}
}
@@ -1,33 +0,0 @@
#pragma once
#include <LtsWidgets/lts_frameless_dialog.h>
class Ui_DeleteElementsDialog;
namespace AdvancedSymbology
{
class DeleteElementsDialog final : public LtsWidgets::LtsFramelessDialog
{
Q_OBJECT
public:
explicit DeleteElementsDialog(QWidget *parent);
~DeleteElementsDialog();
void getCheckedElements(bool &checkedPrims,
bool &checkedPrimsSectorText,
bool &checkedAttributes);
private Q_SLOTS :
void enaDisa();
protected:
void initWidgets();
Ui_DeleteElementsDialog *ui;
};
}
@@ -1,58 +0,0 @@
#include "asb_resize_dialog.h"
#include "asb_symbol_edit_scene.h"
#include "ui_asb_resize_dialog.h"
namespace AdvancedSymbology
{
ResizeDialog::ResizeDialog(bool lockChecked, bool lockEnabled, QWidget *parent)
: LtsWidgets::LtsFramelessDialog(parent, LtsWidgets::Behaviour::Popup)
, m_ui(new Ui_ResizeDialog)
{
m_ui->setupUi(this);
connect(m_ui->sliderHScale, &QSlider::valueChanged, this, &ResizeDialog::handleChange);
connect(m_ui->sliderVScale, &QSlider::valueChanged, this, &ResizeDialog::handleChange);
connect(m_ui->buttonBox->getButton(LtsWidgets::DialogButton::Close), &QPushButton::clicked, this, &LtsWidgets::LtsFramelessDialog::reject);
connect(m_ui->buttonBox->getButton(LtsWidgets::DialogButton::Ok), &QPushButton::clicked, this, &LtsWidgets::LtsFramelessDialog::accept);
m_ui->checkBoxLock->setEnabled(lockEnabled);
m_ui->checkBoxLock->setChecked(lockChecked);
}
ResizeDialog::~ResizeDialog()
{
delete m_ui;
}
void ResizeDialog::handleChange(int val)
{
double hVal = double(val) / 100;
double vVal = double(val) / 100;
if (!m_ui->checkBoxLock->isChecked())
{
hVal = double(m_ui->sliderHScale->value()) / 100;
vVal = double(m_ui->sliderVScale->value()) / 100;
}
else
sync(val);
m_ui->spinBoxHScale->setValue(hVal);
m_ui->spinBoxVScale->setValue(vVal);
emit primitiveScaled(hVal, vVal);
}
void ResizeDialog::sync(int val)
{
m_ui->sliderHScale->setValue(val);
m_ui->sliderVScale->setValue(val);
}
}
@@ -1,34 +0,0 @@
#pragma once
#include <LtsWidgets/lts_frameless_dialog.h>
class Ui_ResizeDialog;
namespace AdvancedSymbology
{
class ResizeDialog final : public LtsWidgets::LtsFramelessDialog
{
Q_OBJECT
public:
ResizeDialog(bool lockChecked, bool lockEnabled, QWidget *parent = nullptr);
~ResizeDialog();
signals:
void primitiveScaled(double xScale, double yScale);
private slots:
void handleChange(int val);
private:
void sync(int val);
Ui_ResizeDialog *m_ui;
};
}
@@ -1,42 +0,0 @@
#include "asb_rotate_dialog.h"
#include "ui_asb_rotate_dialog.h"
namespace AdvancedSymbology
{
RotateDialog::RotateDialog(QWidget *parent)
: LtsWidgets::LtsFramelessDialog(parent, LtsWidgets::Behaviour::Popup)
, m_ui(new Ui_RotateDialog)
{
m_ui->setupUi(this);
m_ui->spinBoxDegree->setSuffix(QStringLiteral(" °"));
connect(m_ui->sliderHDegree, &QSlider::valueChanged, this, &RotateDialog::handleValue);
connect(m_ui->spinBoxDegree, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &RotateDialog::handleValue);
connect(m_ui->buttonBox->getButton(LtsWidgets::DialogButton::Close), &QPushButton::clicked, this, &LtsWidgets::LtsFramelessDialog::reject);
connect(m_ui->buttonBox->getButton(LtsWidgets::DialogButton::Ok), &QPushButton::clicked, this, &LtsWidgets::LtsFramelessDialog::accept);
}
RotateDialog::~RotateDialog()
{
delete m_ui;
}
void RotateDialog::handleValue(double val)
{
sync(val);
emit rotationValueChanged(val);
}
void RotateDialog::sync(double val)
{
m_ui->sliderHDegree->setValue(int(val));
m_ui->spinBoxDegree->setValue(val);
}
}
@@ -1,34 +0,0 @@
#pragma once
#include <LtsWidgets/lts_frameless_dialog.h>
class Ui_RotateDialog;
namespace AdvancedSymbology
{
class RotateDialog final : public LtsWidgets::LtsFramelessDialog
{
Q_OBJECT
public:
explicit RotateDialog(QWidget *parent = nullptr);
~RotateDialog();
private slots:
void handleValue(double val);
signals:
void rotationValueChanged(double val);
private:
void sync(double val);
Ui_RotateDialog *m_ui;
};
}
@@ -1,84 +0,0 @@
#include "asb_save_as_symbol.h"
#include "ui_asb_save_as_symbol.h"
#include <LtsWidgets/lts_dialog_button_box.h>
namespace AdvancedSymbology
{
SaveAsSymbol::SaveAsSymbol(QVariant &dlgData, const std::shared_ptr<FileManagement::Interface::Dtc> &flmDtc, QWidget *parent)
: LtsWidgets::LtsFramelessDialog(parent)
, m_ui(new Ui_SaveAsSymbol)
, m_buttonBox(new LtsWidgets::LtsDialogButtonBox(this))
, m_flmDtc(flmDtc)
, m_dlgData(dlgData)
{
m_ui->setupUi(this);
m_ui->verticalLayout->addWidget(m_buttonBox);
connect(m_buttonBox->getButton(LtsWidgets::DialogButton::Close), &QPushButton::clicked,
this, &SaveAsSymbol::reject);
connect(m_buttonBox->getButton(LtsWidgets::DialogButton::Ok), &QPushButton::clicked,
this, &SaveAsSymbol::accept);
connect(m_ui->leName, &QLineEdit::textChanged,
this, &SaveAsSymbol::onInputChanged);
connect(m_flmDtc.get(), &FileManagement::Interface::Dtc::fileContentChanged,
this, &SaveAsSymbol::onFileContentChanged);
onInputChanged(m_ui->leName->text());
m_flmDtc->fileContents([this](const FileManagement::FileContent & data)
{
onFileContentChanged(data, DataModification::eAdded);
});
}
SaveAsSymbol::~SaveAsSymbol()
{
delete m_ui;
}
void SaveAsSymbol::accept()
{
m_symbolName = m_ui->leName->text();
m_dlgData.setValue(m_symbolName);
LtsFramelessDialog::accept();
}
void SaveAsSymbol::onInputChanged(const QString &input)
{
if (input.isEmpty())
{
m_ui->lblNameError->setText(tr("Name must not be empty"));
m_ui->lblNameError->setStyleSheet(QStringLiteral("color: rgb(255, 0, 0);"));
}
else if (m_takenNames.contains(input))
{
m_ui->lblNameError->setText(tr("Name is already taken"));
m_ui->lblNameError->setStyleSheet(QStringLiteral("color: rgb(255, 0, 0);"));
}
else
{
m_ui->lblNameError->setStyleSheet(QStringLiteral("color: rgb(0, 255, 0);"));
m_ui->lblNameError->setText(tr("Name is ok"));
}
m_buttonBox->getButton(LtsWidgets::DialogButton::Ok)->setEnabled(!(input.isEmpty() || m_takenNames.contains(input)));
}
void SaveAsSymbol::onFileContentChanged(const FileManagement::FileContent &data, DataModification modType)
{
if (data.fileType != FileManagement::FileType::OperatorDefinedSymbol)
return;
QString name = QString::fromStdString(data.name);
if (modType == DataModification::eRemoved)
m_takenNames.removeAll(name);
else
m_takenNames.append(name);
}
}
@@ -1,42 +0,0 @@
#pragma once
#include <LtsWidgets/lts_frameless_dialog.h>
#include <FileManagement/flm_dtc.h>
class Ui_SaveAsSymbol;
namespace LtsWidgets
{
class LtsDialogButtonBox;
}
namespace AdvancedSymbology
{
class SaveAsSymbol final : public LtsWidgets::LtsFramelessDialog
{
Q_OBJECT
public:
explicit SaveAsSymbol(QVariant &dlgData, const std::shared_ptr<FileManagement::Interface::Dtc> &flmDtc, QWidget *parent = nullptr);
~SaveAsSymbol();
QString symbolName() const;
private Q_SLOTS:
void accept() override final;
void onInputChanged(const QString &input);
void onFileContentChanged(const FileManagement::FileContent &data, DataModification modType);
private:
Ui_SaveAsSymbol *m_ui;
QString m_symbolName;
LtsWidgets::LtsDialogButtonBox *m_buttonBox;
QStringList m_takenNames;
std::shared_ptr<FileManagement::Interface::Dtc> m_flmDtc;
QVariant &m_dlgData;
};
}
@@ -1,38 +0,0 @@
#include "asb_select_text_dialog.h"
#include "ui_asb_select_text_dialog.h"
namespace AdvancedSymbology
{
SelectTextDialog::SelectTextDialog(QVariant &returnData, QWidget *parent)
: LtsWidgets::LtsFramelessDialog(parent)
, ui(new Ui_SelectTextDialog)
, m_returnData(returnData)
{
ui->setupUi(this);
connect(ui->buttonBox->getButton(LtsWidgets::DialogButton::Close), &QPushButton::clicked, this, &SelectTextDialog::reject);
connect(ui->buttonBox->getButton(LtsWidgets::DialogButton::Ok), &QPushButton::clicked, this, &SelectTextDialog::accept);
}
SelectTextDialog::~SelectTextDialog()
{
delete ui;
}
void SelectTextDialog::accept()
{
QVariantMap vmap;
vmap.insert(QStringLiteral("line_one"), ui->lineEdit1->text());
vmap.insert(QStringLiteral("line_two"), ui->lineEdit2->text());
m_returnData.setValue(vmap);
LtsWidgets::LtsFramelessDialog::accept();
}
}
@@ -1,32 +0,0 @@
#pragma once
#include <LtsWidgets/lts_frameless_dialog.h>
#include <QtCore/QVariant>
class Ui_SelectTextDialog;
namespace AdvancedSymbology
{
class SelectTextDialog final : public LtsWidgets::LtsFramelessDialog
{
Q_OBJECT
public:
SelectTextDialog(QVariant& returnData, QWidget* parent);
~SelectTextDialog();
protected:
//NGL::INGLLogger& m_logger; // unused (legacy: commented out)
Ui_SelectTextDialog* ui;
private:
QVariant& m_returnData;
public slots:
void accept() override final;
};
} // namespace AdvancedSymbology
@@ -1,272 +0,0 @@
#pragma once
#include <QtWidgets/QGraphicsScene>
#include <QtGui/QPen>
#include <SymbologyXML/primitive.h>
class QGraphicsItem;
class QGraphicsRectItem;
class QGraphicsSceneMouseEvent;
class QLabel;
class QPolygonF;
namespace AdvancedSymbology
{
class SymbolEditScene final : public QGraphicsScene
{
Q_OBJECT
public:
explicit SymbolEditScene(QObject *parent = nullptr);
void setCoordsLabels(QLabel *xLabel, QLabel *yLabel, QLabel *zoomLabel)
{
m_labelCoordsX = xLabel;
m_labelCoordsY = yLabel;
m_labelZoom = zoomLabel;
}
double zoom() const
{
return m_zoom;
}
double setZoom(double zoom);
double minZoom() const
{
return m_zoomMin;
}
void setMinZoom(double min)
{
if (min < m_zoomMax) m_zoomMin = min;
}
double maxZoom() const
{
return m_zoomMax;
}
void setMaxZoom(double max)
{
if (max > m_zoomMin) m_zoomMax = max;
}
enum DrawMode
{
NONE,
ELLIPSE_START,
ELLIPSE_SET,
ELLIPSE_SET_START,
ELLIPSE_SET_EXTENT,
LINE_START,
LINE_SET,
POLYLINE_START,
POLYLINE_SET,
POLYGON_START,
POLYGON_SET,
RECT_START,
RECT_SET,
ICON_START,
ICON_SET,
TEXT_START,
TEXT_SET,
ELEMENT_DELETE,
ELEMENT_MOVE,
ELEMENT_ROTATE,
ELEMENT_PASTE,
ELEMENT_SCALE,
ELEMENT_SELECT
};
void setDrawMode(DrawMode mode);
DrawMode getDrawMode() const
{
return m_drawMode;
}
bool updatesBlocked() const { return m_blockUpdates; }
void primitivePathItemChanged() { emit primitiveChanged(true); }
void setShowGrid(bool b);
void setShowDrawingArea(bool b);
void setGridWidth(double width);
void reset();
public slots:
void setPen(const QPen &pen)
{
m_pen = pen;
}
void update(const QRectF &rect = QRectF());
void cancelCurrentAction();
signals:
void zoomChanged(double zoom);
void addPrimitive(SymbologyXML::Primitive *p);
void primitiveChanged(bool changed);
void primitiveMoved(QPointF diff);
void transformSelection(int key, Qt::KeyboardModifiers modifiers);
protected:
void mouseMoveEvent(QGraphicsSceneMouseEvent *mouseEvent) override;
void keyPressEvent(QKeyEvent *keyEvent) override;
void keyReleaseEvent(QKeyEvent *keyEvent) override;
void mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent) override;
void mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent) override;
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *mouseEvent) override;
void drawForeground(QPainter *painter, const QRectF &rect) override final;
private:
NGL::INGLLogger &logger;
void newEllipse(const QPointF &start);
void setEllipse(const QPointF &point);
void ellipseSetAngleStart(const QPointF &point);
void ellipseSetAngleExtent(const QPointF &point);
void newLine(const QPointF &start);
void setLine(const QPointF &point);
void newPolygon(const QPointF &start);
void addPointPolygon(const QPointF &next);
void setPolygon(const QPointF &point);
void newRect(const QPointF &start);
void setRect(const QPointF &point);
void sendNewItem(SymbologyXML::Primitive::t_primitive type);
void rotateSelection();
QPointF m_currentItemStartPoint;
QGraphicsItem *m_currentItem, *m_tmpItem;
QGraphicsRectItem *m_boundingRect;
QPolygonF m_tmpPolygon;
double m_ellipsisStart, m_ellipsisExtent;
double m_lastEllipseAngle, m_adjustAngle;
double m_gridWidth;
bool m_useAngles;
bool m_showGrid;
bool m_showDrawingArea;
QPen m_pen;
QPen m_rectPen;
double m_zoom, m_zoomMin, m_zoomMax;
QLabel *m_labelCoordsX, *m_labelCoordsY, *m_labelZoom;
DrawMode m_drawMode;
bool m_shiftPressed;
bool m_altPressed;
bool m_blockUpdates;
QPointF m_mousePos;
QPointF m_lastMousePos;
QPointF m_startPos;
};
}
@@ -1,225 +0,0 @@
#pragma once
#include <LtsSession/lts_session.h>
#include <LtsWidgets/lts_dialog.h>
#include <NGLLogger/INGLLogger.h>
#include <ParticipantManagement/ppm_data_plugin_interface.h>
#include <Plugins/FileManagement/flm_data_plugin_interface.h>
#include <FileManagement/flm_explorer_gui_plugin_interface.h>
#include <SymbologyXML/symbol_types.h>
class QGraphicsScene;
class QComboBox;
namespace Ui
{
class SymbolEditor;
}
namespace FileManagement
{
class ForeignGuiInterface;
}
namespace SymbologyXML
{
class Symbol;
class Primitive;
} // namespace SymbologyXML
namespace AdvancedSymbology
{
class SymbolEditorPrivate;
class SymbolEditor final : public LtsWidgets::LtsDialog
{
Q_OBJECT
public:
explicit SymbolEditor(LtsSession::LtsSession* session, QWidget* parent = nullptr);
~SymbolEditor();
bool init(const std::shared_ptr<FileManagement::Interface::Ftc>& flmFtc,
const std::shared_ptr<FileManagement::Interface::Dtc>& flmDtc,
const std::shared_ptr<FileManagement::ForeignGuiInterface>& flmGui,
const std::shared_ptr<ParticipantManagement::Interface::Dtc>& ppmDtc, bool asApp = false);
void keyPressEvent(QKeyEvent* keyEvent) override final;
void retranslate() override final;
bool apply() override final;
bool writeFile(bool saveAsNew);
enum e_category {
CATEGORY_UNDEFINED = 0,
CATEGORY_HEADQUARTER,
CATEGORY_DIMENSION,
CATEGORY_AFFILIATION,
CATEGORY_BCDAB,
CATEGORY_COMMANDLEVEL,
CATEGORY_MOBILITY,
CATEGORY_BRANCH,
CATEGORY_ICON_TYPE
};
enum t_editMode {
EDIT_NONE,
EDIT_PICK,
EDIT_MOVE,
EDIT_ROTATE,
EDIT_SCALE,
EDIT_COPY,
EDIT_PASTE,
EDIT_DELETE,
EDIT_EDIT
};
public slots:
void movePrimitive(QPointF diff);
bool createNewSymbol(const QString& symbolname);
void setChanged(bool changed);
void updateGraphicViews(bool editview = true, bool preview = true);
void reset();
void slotSaveAs();
void slotSave();
void slotSaveFinished();
void slotImportTemplate();
signals:
void documentChanged(bool changed);
void symbolSaved(bool saveToLib, bool saveToCurrent, bool saveToAll);
void canceled();
void helpRequested();
void invokeHelp(const QString& context);
void saveFinished();
private slots:
void transformSelection(int key, Qt::KeyboardModifiers modifiers);
void onToolButtonSelectClicked();
void onToolButtonRotateClicked();
void onToolButtonScaleClicked();
void onToolButtonDeleteClicked();
void onToolButtonClearClicked();
void onToolButtonUndoClicked();
void onToolButtonCopyClicked();
void onToolButtonPasteClicked();
void onToolButtonEllipseClicked();
void onToolButtonLineClicked();
void onToolButtonPolylineClicked();
void onToolButtonPolygonClicked();
void onToolButtonRectClicked();
void onToolButtonTextClicked();
void onPushButtonFillColorClicked();
void onComboBoxDimenCurrentIndexChanged(int index);
void onComboBoxAffilCurrentIndexChanged(int index);
void onComboBoxBCDABCurrentIndexChanged(int index);
void onComboBoxHeadquarterCurrentIndexChanged(int index);
void onComboBoxCommandLevelCurrentIndexChanged(int index);
void onComboBoxMobCurrentIndexChanged(int index);
void onComboBoxVehicleCurrentIndexChanged(int index);
void onComboBoxIntrinsicMobCurrentIndexChanged(int index);
void onComboBoxIntrinsicMob2CurrentIndexChanged(int index);
void onComboBoxArmingCurrentIndexChanged(int index);
void onListViewMiscItemSelectionChanged();
void onCheckBoxVehicleStateChanged(int state);
void onCheckBoxArmingStateChanged(int state);
void onCheckBoxMainStateChanged(int state);
void onComboBoxSector1CurrentIndexChanged(int index);
void onComboBoxSectorMainCurrentIndexChanged(int index);
void onListViewSectorMainItemSelectionChanged();
void onComboBoxSector2CurrentIndexChanged(int index);
void help_on_ComboBoxIndexChanged(
QComboBox* comboBox, int index, const QMap<int, QString>& contv,
SymbologyXML::SymbolTypes::t_icon_type iconType, SymbologyXML::SymbolTypes::t_sector_position pos,
SymbologyXML::SymbolTypes::t_sector_rectpos rectpos = SymbologyXML::SymbolTypes::SECTOR_RECTPOS_DEFAULT);
void onComboBoxAlign1CurrentIndexChanged(int index);
void onComboBoxAlign2CurrentIndexChanged(int index);
void onComboBoxAlign3CurrentIndexChanged(int index);
void onComboBoxColorCurrentIndexChanged(int index);
void onComboBoxLineStyleCurrentIndexChanged(int index);
void onLineEdit1TextChanged(const QString& text);
void onLineEdit2TextChanged(const QString& text);
void onLineEdit3TextChanged(const QString& text);
void onListViewTruppengattungItemSelectionChanged();
void onCheckBoxBackgroundStateChanged(int state);
void onCheckBoxCopyValuesStateChanged(int state);
void onCheckBoxFillStateChanged(int state);
void onCheckBoxPlannedStateChanged(int state);
void onCheckBoxDrawAreaStateChanged(int state);
void onSpinBoxRasterValueChanged(double d);
void onSpinBoxLineWidthValueChanged(double d);
void onSpinBoxScaleValueChanged(double d);
void onSliderTransparencyValueChanged(int value);
void setZoom(double zoom);
void addItem(SymbologyXML::Primitive* prim);
void selectionChanged();
private:
NGL::INGLLogger& m_logger;
void resetGUI();
void updateGUI();
void updateSymbolAttributesWidgets();
void updateTextProperties();
void resetToolButtonGroupState();
void pushUndo();
void popUndo();
void clearUndo();
void restoreSelection(SymbologyXML::Primitive* prim);
void copyFromSelectedPrimitive();
void enableSelectMove(bool enable);
void setPushButtonFillColorBackground(QColor color);
QIcon getIcon(e_category category, SymbologyXML::SymbolTypes::t_icon_type iconType, int iconId, QSize iconSize);
int getFrameSymbolID(SymbologyXML::SymbolTypes::t_dimen dimen, SymbologyXML::SymbolTypes::t_affil affil);
void fillListWidget(const QMap<int, QString>& container, QWidget* widget, e_category category,
SymbologyXML::SymbolTypes::t_icon_type iconType, bool withIcons = true, bool sort = true);
void widgetInsertItem(QWidget* widget, int index, const QString& text, int key, e_category category,
SymbologyXML::SymbolTypes::t_icon_type iconType, bool withIcons);
void drawSymbol(const SymbologyXML::Symbol* symbol, QGraphicsScene* scene, const QColor& color,
const QColor& fillColor, double z, bool isAttrib = false, bool updateMap = false,
bool drawBoundRect = false);
void drawSymbolPrimitive(SymbologyXML::Primitive* primitive, QGraphicsScene* scene, const QColor& color,
const QColor& fillColor, double z, bool isAttrib = false, bool drawBoundRect = false);
void copyElementsFromSymbol(const SymbologyXML::Symbol& tmpSymbol) const;
Ui::SymbolEditor* m_ui;
SymbolEditorPrivate* m_internal;
LtsSession::LtsSession* m_session;
};
} // namespace AdvancedSymbology
@@ -1,91 +0,0 @@
#include "asb_symbol_editor_gui_plugin.h"
#include "asb_symbol_editor.h"
#include <LtsWidgets/lts_splash.h>
#include <Symbology/symbol_dictionary.h>
#include <LtsSession/lts_session.h>
#include <NGLLogger/NGLLoggerBootstrap.h>
#include <QtCore/QTimer>
namespace AdvancedSymbology
{
InterfaceImpl::InterfaceImpl(LtsSession::LtsSession *session)
: GuiPluginBase::Interface(session, NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("SymbolEditor"))
{}
QVector<LtsWidgets::PluginData> InterfaceImpl::getActions()
{
QVector<LtsWidgets::PluginData> ret;
m_flmDtc->enableFileContent();
m_flmDtc->enableFolder();
m_flmFtc->enableFileContentModify();
LtsWidgets::PluginData plData;
plData.menuGroup = menuGroup();
plData.menuText = tr("Symbol Editor");
plData.identifier = QLatin1String("AsbSymEditDialog");
plData.menuIcon = QIcon(QLatin1String("icon:draw_symbol.svg"));
plData.exercisePart = LtsWidgets::ExercisePart::eSpecial;
if (getFlags().testFlag(LtsAppDescriptor::PluginInfo::Flag::MAIN))
{
plData.layoutArea = LtsWidgets::LayoutArea::eMainTab;
plData.createInstant = LtsWidgets::CreateInstantType::CreateInstantAndDiscardAction;
plData.createWidgetFunc = [this](QWidget * parent)
{
return LtsWidgets::initDialog(new SymbolEditor(m_session, parent),
m_flmFtc, m_flmDtc, m_flmGui, m_ppmDtc, true);
};
}
else
{
plData.layoutArea = LtsWidgets::LayoutArea::eDialogTab;
plData.createWidgetFunc = [this](QWidget * parent)
{
return LtsWidgets::initDialog(new SymbolEditor(m_session, parent),
m_flmFtc, m_flmDtc, m_flmGui, m_ppmDtc, false);
};
}
ret.append(plData);
return ret;
}
bool InterfaceImpl::fetchInterfaces()
{
return m_session->getDtc<FileManagement::DataInterface>(m_flmDtc) &&
m_session->getFtc<FileManagement::DataInterface>(m_flmFtc) &&
m_session->getDtc<ParticipantManagement::DataInterface>(m_ppmDtc) &&
m_session->getForeignGuiInterface(m_flmGui);
}
void InterfaceImpl::clearInterfaces()
{
m_flmDtc = nullptr;
m_flmFtc = nullptr;
m_flmGui = nullptr;
m_ppmDtc = nullptr;
}
std::shared_ptr<GuiPluginBase::Interface> GuiPlugin::createGuiInterface(LtsSession::LtsSession *session)
{
return std::make_shared<InterfaceImpl>(session);
}
}
@@ -1,67 +0,0 @@
#pragma once
#include <PluginInterfaces/gui_plugin_interface.h>
#include <AdvancedSymbology/asb_gui_plugin_interface.h>
#include <Plugins/FileManagement/flm_data_plugin_interface.h>
#include <FileManagement/flm_explorer_gui_plugin_interface.h>
#include <ParticipantManagement/ppm_data_plugin_interface.h>
namespace LtsUtils
{
class RequestHelper;
}
namespace AdvancedSymbology
{
class GuiPlugin final : public QObject, public GuiPluginBase::Plugin
{
Q_PLUGIN_METADATA(IID "gui:3:asb.symedit")
Q_INTERFACES(GuiPluginBase::Plugin)
Q_OBJECT
public:
explicit GuiPlugin() = default;
~GuiPlugin() = default;
QString pluginName() override { return ForeignGuiInterface::pluginName(); }
std::shared_ptr<GuiPluginBase::Interface> createGuiInterface(LtsSession::LtsSession *session) override;
bool availableInPartition(IDL::PartitionType partition) const override
{
return partition == IDL::PartitionType::Exercise ||
partition == IDL::PartitionType::Global ||
partition == IDL::PartitionType::Replay;
}
};
class InterfaceImpl final
: public QObject
, public ForeignGuiInterface
, public GuiPluginBase::Interface
{
Q_OBJECT
public:
explicit InterfaceImpl(LtsSession::LtsSession *session);
QString menuGroup() const override { return tr("Advanced Symbology"); }
bool fetchInterfaces() override;
void clearInterfaces() override;
QVector<LtsWidgets::PluginData> getActions() override;
signals:
void signalInitDone();
private:
LtsWidgets::LtsDialog *onShowSymbolEditorDialog();
private:
std::shared_ptr<FileManagement::Interface::Dtc> m_flmDtc;
std::shared_ptr<FileManagement::Interface::Ftc> m_flmFtc;
std::shared_ptr<FileManagement::ForeignGuiInterface> m_flmGui;
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_ppmDtc;
};
}
@@ -1,35 +0,0 @@
#include "flm_reply_handler.h"
#include <LtsUtils/LtsUtilsGui/LtsUtilsGuiDds/request_helper.h>
namespace AdvancedSymbology
{
FileManagementReplyHandler::FileManagementReplyHandler(LtsUtils::RequestHelper *rh, QObject *parent)
: QObject(parent)
, m_requestHelper(rh)
, m_id(-1)
{
qRegisterMetaType<Core::FunctionReply>("Core::FunctionReply");
}
void FileManagementReplyHandler::requestReply(const Core::FunctionReplyObject &replyObject)
{
m_requestHelper->requestReply(replyObject);
emit signalFileContentModifyReplyReceived();
}
void FileManagementReplyHandler::onGetFileContentDataReply(const FileManagement::GetFileContentDataReply &replyObject)
{
m_content = replyObject.content;
m_id = replyObject.id;
m_requestHelper->requestReply(replyObject);
}
}
@@ -1,52 +0,0 @@
#pragma once
#include <Lts/Services/FileManagement/flm_ftc.h>
#include <FileManagement/flm_ftc_types.h>
#include <QtCore/QObject>
namespace LtsUtils
{
class RequestHelper;
}
namespace AdvancedSymbology
{
class FileManagementReplyHandler final
: public QObject
, public FileManagement::Interface::Ftc::FileContentModifyReplyHandler
, public FileManagement::Interface::Ftc::GetFileContentDataReplyHandler
{
Q_OBJECT
public:
explicit FileManagementReplyHandler(LtsUtils::RequestHelper *rh, QObject *parent);
const std::vector<uint8_t> &getContent() const { return m_content; }
int32_t getId() const { return m_id; }
signals:
void signalFileContentModifyReplyReceived();
protected:
void onFileContentModifyReply(const Core::FunctionReplyObject &replyObject) override final { requestReply(replyObject); }
void onGetFileContentDataReply(const FileManagement::GetFileContentDataReply &replyObject) override final;
private:
void requestReply(const Core::FunctionReplyObject &replyObject);
LtsUtils::RequestHelper *m_requestHelper;
std::vector<uint8_t> m_content;
int32_t m_id;
};
}
@@ -1,70 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DeleteElementsDialog</class>
<widget class="QWidget" name="DeleteElementsDialog">
<property name="windowTitle">
<string>Delete Elements</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Delete elements/attributes from Symbol</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QCheckBox" name="checkBoxPrims">
<property name="text">
<string>Primitives</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxPrimsSectorText">
<property name="text">
<string>PrimsSectorText</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxAttributes">
<property name="text">
<string>Attributes</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="LtsWidgets::LtsDialogButtonBox" name="buttonBox"/>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>LtsWidgets::LtsDialogButtonBox</class>
<extends>QWidget</extends>
<header>LtsWidgets/lts_dialog_button_box.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>
@@ -1,133 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ResizeDialog</class>
<widget class="QWidget" name="ResizeDialog">
<property name="windowTitle">
<string notr="true"/>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QSlider" name="sliderHScale">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>400</number>
</property>
<property name="singleStep">
<number>100</number>
</property>
<property name="value">
<number>100</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="spinBoxHScale">
<property name="readOnly">
<bool>true</bool>
</property>
<property name="buttonSymbols">
<enum>QAbstractSpinBox::NoButtons</enum>
</property>
<property name="maximum">
<double>4.000000000000000</double>
</property>
<property name="value">
<double>1.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QSlider" name="sliderVScale">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>400</number>
</property>
<property name="singleStep">
<number>100</number>
</property>
<property name="value">
<number>100</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="spinBoxVScale">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
<property name="buttonSymbols">
<enum>QAbstractSpinBox::NoButtons</enum>
</property>
<property name="maximum">
<double>4.000000000000000</double>
</property>
<property name="value">
<double>1.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="2" rowspan="2">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QCheckBox" name="checkBoxLock">
<property name="text">
<string>lock</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Horizontal:</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Vertical:</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="3">
<widget class="LtsWidgets::LtsDialogButtonBox" name="buttonBox"/>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>LtsWidgets::LtsDialogButtonBox</class>
<extends>QWidget</extends>
<header>LtsWidgets/lts_dialog_button_box.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
@@ -1,58 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>RotateDialog</class>
<widget class="QWidget" name="RotateDialog">
<property name="windowTitle">
<string notr="true"/>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="1">
<widget class="QDoubleSpinBox" name="spinBoxDegree">
<property name="buttonSymbols">
<enum>QAbstractSpinBox::UpDownArrows</enum>
</property>
<property name="maximum">
<double>360.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QSlider" name="sliderHDegree">
<property name="maximum">
<number>360</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="LtsWidgets::LtsDialogButtonBox" name="buttonBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>LtsWidgets::LtsDialogButtonBox</class>
<extends>QWidget</extends>
<header>LtsWidgets/lts_dialog_button_box.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>sliderHDegree</tabstop>
<tabstop>spinBoxDegree</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>
@@ -1,68 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SaveAsSymbol</class>
<widget class="QWidget" name="SaveAsSymbol">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>506</width>
<height>76</height>
</rect>
</property>
<property name="windowTitle">
<string notr="true"/>
</property>
<property name="toolTip">
<string/>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="lblName">
<property name="toolTip">
<string/>
</property>
<property name="text">
<string>Name:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="leName">
<property name="toolTip">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="lblNameError">
<property name="styleSheet">
<string notr="true">color: rgb(255, 0, 0);</string>
</property>
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
@@ -1,53 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SelectTextDialog</class>
<widget class="QWidget" name="SelectTextDialog">
<property name="windowTitle">
<string notr="true"/>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Zeile 1:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="lineEdit1"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Zeile 2:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="lineEdit2"/>
</item>
</layout>
</item>
<item>
<widget class="LtsWidgets::LtsDialogButtonBox" name="buttonBox"/>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>LtsWidgets::LtsDialogButtonBox</class>
<extends>QWidget</extends>
<header>LtsWidgets/lts_dialog_button_box.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>lineEdit1</tabstop>
<tabstop>lineEdit2</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

@@ -1,53 +0,0 @@
#include <cstdlib>
#include <getopt.h>
#include <string>
#include <nglapplication/nglapplication.h>
#include <QtCore/QString>
#include <QtCore/QDir>
#include "symboleditor.h"
#include "nglsettings.h"
#include <LtsPluginManager/lts_plugin_loader.h>
#include <PluginInterfaces/style_plugin_interface.h>
#include <PluginInterfaces/project_plugin_interface.h>
#include <NGLLogger/NGLLoggerBootstrap.h>
int main(int argc, char *argv[])
{
NGLApplication app(argc, argv);
app.createLogger("SymbolApp");
QCoreApplication::addLibraryPath(QString::fromLocal8Bit(qgetenv("GFS_PATH")) + QLatin1Literal("/lib"));
QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath() + QLatin1Literal("/../lib"));
LtsPluginManager::LtsPluginLoader *pluginLoader = LtsPluginManager::LtsPluginLoader::getInstance();
pluginLoader->loadPlugins(LtsPluginManager::PluginType::STYLE, nullptr, QStringList() << QStringLiteral("rde.light"));
pluginLoader->loadPlugins(LtsPluginManager::PluginType::PROJECT, nullptr, QStringList() << QStringLiteral("legatus"));
QDir::setSearchPaths(QLatin1String("icon"), QStringList(QLatin1String(":/style/icons/")));
QDir::setSearchPaths(QLatin1String("icon"), QStringList(QLatin1String(":/style/")));
STARTUP_LOG(app.baseLogger());
SymbolEditor *edit = new SymbolEditor(QString(), QString(), QString(), false);
if (!edit)
return -1;
edit->show();
int result = app.exec();
delete edit;
SHUTDOWN_LOG(app.baseLogger());
return result;
}
@@ -1,43 +0,0 @@
#
# $Id$
# $HeadURL$
# $Author$
#
# Created by Hannes Baeuerle, SLSE, 2017-06-14
#
SET(AsbSymbolProxyGuiPlugin_SRCS
asb_symbol_proxy_gui_plugin.h
asb_symbol_proxy_gui_plugin.cpp
asb_flm_subscriber.h
asb_flm_subscriber.cpp
flm_symbol_proxy.h
flm_symbol_proxy.cpp
)
NGL_WRAP_UI(AsbSymbolProxyGuiPlugin_SRCS
)
NGL_ADD_LIBRARY(WS AsbSymbolProxyGuiPlugin MODULE ${AsbSymbolProxyGuiPlugin_SRCS})
TARGET_INCLUDE_DIRECTORIES(AsbSymbolProxyGuiPlugin PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/../../../../Viewer/SituationMap
${CMAKE_CURRENT_SOURCE_DIR}/../../../../Viewer/SituationMap/Symbology
)
if(QT6_GUI_AVAILABLE)
NGL_TARGET_LINK_LIBRARIES(AsbSymbolProxyGuiPlugin
AsbSymbolProxyGuiPluginInterface
NGLLogger
Qt6::Svg
Qt6::Xml
SituationMapGuiPluginInterface
LtsSession
LtsSessionData
FlmDataPluginInterface
OpmDataPluginInterface
advancedSymbology
)
endif()
NGL_INSTALL_TARGET(AsbSymbolProxyGuiPlugin)
@@ -1,632 +0,0 @@
#include "asb_flm_subscriber.h"
#include "flm_symbol_proxy.h"
#include <LtsUtils/LtsUtilsCore/dds_vector.h>
#include <NGLLogger/NGLLoggerBootstrap.h>
#include <Plugins/FileManagement/flm_data_plugin_interface.h>
#include <OperatorManagement/opm_data_plugin_interface.h>
#include <QtXml/QDomDocument>
#include <QtGui/QImage>
#include <QtCore/QJsonDocument>
#include <QtCore/QJsonObject>
#include <QtGui/QPainter>
#include <QtCore/QPointer>
#include <QtCore/QSet>
#include <QSvgRenderer>
#include <QtCore/QTimer>
#include <Symbology/sidc_codec.h>
#include <Symbology/symbol_dictionary.h>
#include <utility>
namespace AdvancedSymbology
{
uint qHash(SymbologyType type)
{
return static_cast<uint>(type);
}
struct FileContentStruct
{
enum SymbolType { UnsupportedSymbol, EtsSymbol, XmlSymbol };
enum ReplyState { Undefined, Requested, RequestFailure, ReplyReceived, ReplySuccess, ReplyFailure };
QString name;
SymbolType type{UnsupportedSymbol};
QString operatorName;
int64_t lastModified{0};
QStringList usrTags;
QColor colorTobeReplaced;
struct Monitoring
{
qint64 requestTime{-1};
int retryCnt{0};
ReplyState replyState{Undefined};
int replyContentSize{-1};
};
mutable Monitoring monitoring;
};
qint64 getRequestTime()
{
return time(nullptr);
}
QString toString(FileContentStruct::ReplyState rs)
{
switch (rs)
{
case FileContentStruct::Undefined:
return QStringLiteral("Undefined");
case FileContentStruct::Requested:
return QStringLiteral("Requested");
case FileContentStruct::RequestFailure:
return QStringLiteral("RequestFailure");
case FileContentStruct::ReplyReceived:
return QStringLiteral("ReplyReceived");
case FileContentStruct::ReplySuccess:
return QStringLiteral("ReplySuccess");
case FileContentStruct::ReplyFailure:
return QStringLiteral("ReplyFailure");
}
return QStringLiteral("UnknownReplyState");
}
struct FlmSubscriber::Private
{
QHash<int32_t, FileContentStruct> m_fileContentMap;
QTimer* m_reFetchTimer{nullptr};
FlmSymbolProxy m_symbolProxy;
QSet<SymbologyType> m_symbolDictionaryToUpdate;
std::shared_ptr<FileManagement::Interface::Dtc> m_flmDtc;
std::shared_ptr<FileManagement::Interface::Ftc> m_flmFtc;
std::shared_ptr<OperatorManagement::Interface::Dtc> m_opmDtc;
static long m_counter;
};
long FlmSubscriber::Private::m_counter = 0;
FlmSubscriber::FlmSubscriber(const std::shared_ptr<FileManagement::Interface::Dtc>& flmDtc,
const std::shared_ptr<FileManagement::Interface::Ftc>& flmFtc,
const std::shared_ptr<OperatorManagement::Interface::Dtc>& opmDtc)
: m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("AdvSymbology.FlmSubscriber")), d(new Private())
{
INFO_LOG(m_logger) << Q_FUNC_INFO << " m_counter =" << ++d->m_counter;
d->m_flmDtc = flmDtc;
d->m_flmFtc = flmFtc;
d->m_opmDtc = opmDtc;
d->m_reFetchTimer = new QTimer(this);
d->m_reFetchTimer->setInterval(10000);
connect(d->m_reFetchTimer, &QTimer::timeout, this, &FlmSubscriber::checkForReFetching);
qRegisterMetaType<FileManagement::FileContent>("FileManagement::FileContent");
qRegisterMetaType<DataModification>("DataModification");
}
FlmSubscriber::~FlmSubscriber()
{
INFO_LOG(m_logger) << Q_FUNC_INFO << " m_counter =" << d->m_counter--;
if (d->m_reFetchTimer)
d->m_reFetchTimer->stop();
delete d;
}
bool FlmSubscriber::createFlmSymbolProxy(int type_placeholder)
{
Q_UNUSED(type_placeholder);
if (!d->m_flmDtc || !d->m_flmFtc)
return false;
d->m_flmDtc->enableFileContent();
d->m_flmFtc->enableGetFileContentData();
connect(d->m_flmDtc.get(), &FileManagement::Interface::Dtc::fileContentChanged, this,
&FlmSubscriber::onFileContentChanged, Qt::ConnectionType(Qt::QueuedConnection | Qt::UniqueConnection));
const auto cb = [this](const FileManagement::FileContent& data) -> void { updateFileContentMap(data); };
if (!d->m_flmDtc->fileContents(cb))
ERROR_LOG(m_logger) << Q_FUNC_INFO << " Error performing fileContents";
INFO_LOG(m_logger) << Q_FUNC_INFO << " m_fileContentMap.size()=" << d->m_fileContentMap.size();
for (auto it = d->m_fileContentMap.cbegin(); it != d->m_fileContentMap.cend(); ++it)
{
const int fileContentId = it.key();
FileManagement::GetFileContentDataRequest request(fileContentId);
const FileContentStruct& fcsRef = it.value();
#ifdef LTS_DEBUG
#ifdef SKIP_SOME_TO_TEST_REFETCHING
if (fileContentId >= 98)
request.fileContentId = -1;
#endif
#endif
if (d->m_flmFtc->getFileContentDataRequest(request, this))
{
fcsRef.monitoring.requestTime = getRequestTime();
fcsRef.monitoring.replyState = FileContentStruct::Requested;
}
else
{
fcsRef.monitoring.replyState = FileContentStruct::RequestFailure;
ERROR_LOG(m_logger) << "Error requesting FileContentData, fileContentId=" << fileContentId;
}
}
const int randomOffset = rand() % 10 + 5;
QTimer::singleShot(randomOffset, this, [this]() {
DEBUG_LOG(m_logger) << "start ReFetchingTimer";
d->m_reFetchTimer->start();
});
return true;
}
void FlmSubscriber::onGetFileContentDataReply(const FileManagement::GetFileContentDataReply& reply)
{
const int32_t fileContentId = reply.id;
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START, " << fileContentId;
if (!d->m_fileContentMap.contains(fileContentId))
{
ERROR_LOG(m_logger) << Q_FUNC_INFO << " fileContentId unknown, fileContentId=" << fileContentId;
return;
}
const FileContentStruct& fcData = d->m_fileContentMap[fileContentId];
fcData.monitoring.replyState = FileContentStruct::ReplyReceived;
const QString& name = fcData.name;
const QString& operatorName = fcData.operatorName;
const qint64 lastModified = fcData.lastModified;
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " fileContentId=" << fileContentId << " name=" << name
<< " operatorName=" << operatorName << " lastModified=" << lastModified
<< " #bytes =" << reply.content.size();
fcData.monitoring.replyContentSize = reply.content.size();
switch (fcData.type)
{
case FileContentStruct::SymbolType::EtsSymbol: {
QImage image;
if (!svgToImage(QByteArray::fromRawData(reinterpret_cast<const char*>(&reply.content.at(0)),
reply.content.size()),
image))
{
ERROR_LOG(m_logger) << Q_FUNC_INFO << " svgToImage failed, fileContentId=" << fileContentId;
fcData.monitoring.replyState = FileContentStruct::ReplyFailure;
return;
}
FlmSymbolProxy::SymbolData symbolData(name, image, fcData.colorTobeReplaced);
symbolData.setUsrTags(fcData.usrTags);
d->m_symbolProxy.setSymbol(fileContentId, symbolData);
fcData.monitoring.replyState = FileContentStruct::ReplySuccess;
break;
}
case FileContentStruct::SymbolType::XmlSymbol: {
FlmSymbolProxy::SymbolData symbolData(name, operatorName, lastModified,
LtsUtils::toQByteArray(reply.content));
if (symbolData.isXmlSymbol())
{
symbolData.setUsrTags(fcData.usrTags);
d->m_symbolProxy.setSymbol(fileContentId, symbolData);
fcData.monitoring.replyState = FileContentStruct::ReplySuccess;
}
else
{
ERROR_LOG(m_logger) << Q_FUNC_INFO << " xmlSymbolContent is empty, fileContentId=" << fileContentId;
fcData.monitoring.replyState = FileContentStruct::ReplyFailure;
}
break;
}
case FileContentStruct::SymbolType::UnsupportedSymbol: {
ERROR_LOG(m_logger) << Q_FUNC_INFO << " unsupported symbol found, fileContentId=" << fileContentId;
fcData.monitoring.replyState = FileContentStruct::ReplyFailure;
break;
}
}
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
}
bool FlmSubscriber::svgToImage(const QByteArray& svgByteArray, QImage& imageOut)
{
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
QSvgRenderer svgRenderer;
if (!svgRenderer.load(svgByteArray))
{
ERROR_LOG(m_logger) << Q_FUNC_INFO << " svgRenderer.load failed";
return false;
}
int size = 200;
imageOut = QImage(size, size, QImage::Format_ARGB32);
imageOut.fill(Qt::transparent);
QPainter painter(&imageOut);
svgRenderer.render(&painter);
painter.end();
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
return true;
}
QString FlmSubscriber::operatorName(int operatorId)
{
if (d->m_opmDtc)
return QString::fromStdString(d->m_opmDtc->user(operatorId).name);
return QStringLiteral("unknown user<%1>").arg(operatorId);
}
void FlmSubscriber::checkForReFetching()
{
LOGGER_T logger = NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("AdvSymbology.FlmSubscriber.ReFetch");
DEBUG_LOG(logger) << "********** checkForReFetching START, size=" << d->m_fileContentMap.size();
int i{0};
int unfinished{0};
int reFetchCounter{0};
static int s_reFetchCounter = 0;
const qint64 curTime = time(nullptr);
for (auto it = d->m_fileContentMap.cbegin(); it != d->m_fileContentMap.cend(); ++it)
{
const FileContentStruct& fcs = it.value();
qint64 ageSec = curTime - fcs.monitoring.requestTime;
DEBUG_LOG(logger) << "***** dump i=" << ++i << ", fileContentId=" << it.key()
<< ", retryCnt=" << fcs.monitoring.retryCnt << ", ageSec = " << ageSec
<< ", replyState=" << toString(fcs.monitoring.replyState)
<< ", replyContentSize=" << fcs.monitoring.replyContentSize << ", name='" << fcs.name << "'";
if (fcs.monitoring.replyState != FileContentStruct::ReplySuccess)
{
++unfinished;
if ((ageSec > 30) && (fcs.monitoring.retryCnt < 3))
{
const int32_t fileContentId = it.key();
INFO_LOG(logger) << "***** reFetch *** :"
<< " ageSec = " << ageSec << ", fileContentId=" << fileContentId
<< ", replyState=" << toString(fcs.monitoring.replyState)
<< ", replyContentSize=" << fcs.monitoring.replyContentSize << ", name='" << fcs.name
<< "'";
FileManagement::GetFileContentDataRequest request(fileContentId);
if (!d->m_flmFtc->getFileContentDataRequest(request, this))
ERROR_LOG(logger) << Q_FUNC_INFO
<< "Error reading FileContentData, fileContentId=" << fileContentId;
fcs.monitoring.replyState = FileContentStruct::Requested;
fcs.monitoring.requestTime = getRequestTime();
++fcs.monitoring.retryCnt;
++reFetchCounter;
++s_reFetchCounter;
}
}
}
INFO_LOG(logger) << "***** checkForReFetching END"
<< ", size=" << d->m_fileContentMap.size() << ", unfinished=" << unfinished
<< ", reFetchCounter=" << reFetchCounter << ", s_reFetchCounter=" << s_reFetchCounter;
}
void FlmSubscriber::onFileContentChanged(const FileManagement::FileContent& data, DataModification modType)
{
TRACE_LOG(m_logger) << Q_FUNC_INFO << " data.id=" << data.id
<< " data.fileStatus=" << data.fileStatus << " modType=" << modType
<< " data.name='" << data.name.c_str() << "'";
if (!d->m_flmFtc)
return;
if (data.isDeleted)
return;
if (data.fileType != FileManagement::FileType::OperatorDefinedSymbol)
return;
if (data.fileStatus == FileManagement::FileStatus::Deleted)
{
switch (modType)
{
case DataModification::eAdded:
return;
case DataModification::eModified:
modType = DataModification::eRemoved;
break;
case DataModification::eRemoved:
break;
}
}
const int32_t fileContentId = data.id;
switch (modType)
{
case DataModification::eAdded:
case DataModification::eModified: {
updateFileContentMap(data);
FileManagement::GetFileContentDataRequest request(fileContentId);
if (!d->m_flmFtc->getFileContentDataRequest(request, this))
ERROR_LOG(m_logger) << Q_FUNC_INFO << "Error reading FileContentData, fileContentId=" << fileContentId;
break;
}
case DataModification::eRemoved: {
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " modType=" << modType << " fileContentId=" << fileContentId
<< " fileContentName=" << data.name;
d->m_fileContentMap.remove(fileContentId);
if (!d->m_symbolProxy.removeSymbol(fileContentId))
ERROR_LOG(m_logger) << Q_FUNC_INFO << " removeSymbol failed"
<< " fileContentId=" << fileContentId << " fileContentName='" << data.name << "'"
<< " contains=" << d->m_fileContentMap.contains(fileContentId);
break;
}
}
}
void FlmSubscriber::updateFileContentMap(const FileManagement::FileContent& data)
{
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START"
<< " d->m_fileContentMap.size()=" << d->m_fileContentMap.size()
<< " fileContentId=" << data.id << " data.isDeleted=" << data.isDeleted
<< " data.fileStatus=" << data.fileStatus << " data.name='"
<< QString::fromStdString(data.name) << "'";
if (data.isDeleted)
return;
if (data.fileStatus == FileManagement::FileStatus::Deleted)
return;
if (data.fileType != FileManagement::FileType::OperatorDefinedSymbol)
return;
const int32_t fileContentId = data.id;
FileContentStruct fcData;
fcData.name = QString::fromStdString(data.name);
fcData.type = FileContentStruct::SymbolType::UnsupportedSymbol;
fcData.operatorName = operatorName(data.operatorId);
fcData.lastModified = data.lastModified;
fcData.usrTags << QStringLiteral("file-id=%1").arg(fileContentId);
fcData.usrTags << QStringLiteral("exercise-id=%1").arg(data.exerciseId.has_value() ? data.exerciseId.get() : -1);
fcData.usrTags << fcData.operatorName;
if (data.properties.size() != 0)
{
const QByteArray attributesJson(QByteArray::fromRawData(data.properties.c_str(), data.properties.size()));
QJsonParseError parseError;
QJsonDocument jDoc(QJsonDocument::fromJson(attributesJson, &parseError));
if (parseError.error == QJsonParseError::NoError)
{
const QJsonObject& obj = jDoc.object();
const QLatin1String imageFormatKey("imageFormat");
if (obj.contains(imageFormatKey))
{
const QString& imageFormatValue = obj[imageFormatKey].toString();
if (QLatin1String("xml") == imageFormatValue)
fcData.type = FileContentStruct::SymbolType::XmlSymbol;
if (QLatin1String("ets") == imageFormatValue)
fcData.type = FileContentStruct::SymbolType::EtsSymbol;
}
else
fcData.type = FileContentStruct::SymbolType::EtsSymbol;
if (FileContentStruct::SymbolType::EtsSymbol == fcData.type)
{
const QLatin1String partyColorStr("partyColor");
if (obj.contains(partyColorStr))
{
QJsonObject partyColor = obj[partyColorStr].toObject();
if (partyColor.size() == 3)
{
fcData.colorTobeReplaced.setRgb(partyColor[QLatin1String("r")].toInt(),
partyColor[QLatin1String("g")].toInt(),
partyColor[QLatin1String("b")].toInt());
}
}
}
}
else
{
ERROR_LOG(m_logger) << Q_FUNC_INFO << " QJsonParseError->errorString: '" << parseError.errorString() << "'"
<< ", offset: " << parseError.offset;
}
}
d->m_fileContentMap[fileContentId] = fcData;
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END"
<< " d->m_fileContentMap.size()=" << d->m_fileContentMap.size()
<< " fileContentId=" << data.id << " data.isDeleted=" << data.isDeleted
<< " data.fileStatus=" << data.fileStatus << " data.name='"
<< QString::fromStdString(data.name) << "'";
}
void FlmSubscriber::onLocalSymbolProxyEtsSymbolAdded(qint32 fileContentId, const QString& name, const QImage& image,
const QColor& colorToBeReplaced, const QStringList& usrTags)
{
Q_UNUSED(fileContentId);
for (const SymbologyType symbologyType : std::as_const(d->m_symbolDictionaryToUpdate))
{
AdvancedSymbology::SymbolDictionary& dict = AdvancedSymbology::SymbolDictionary::dictionary(symbologyType);
this->setEtsSymbolToDict(dict, fileContentId, name, image, colorToBeReplaced, usrTags);
}
}
void FlmSubscriber::onLocalSymbolProxyEtsSymbolRemoved(qint32 fileContentId, const QString& name)
{
for (const SymbologyType& symbologyType : std::as_const(d->m_symbolDictionaryToUpdate))
{
AdvancedSymbology::SymbolDictionary& dict = AdvancedSymbology::SymbolDictionary::dictionary(symbologyType);
INFO_LOG(m_logger) << Q_FUNC_INFO << " dict.removeEtsSymbol:"
<< " symbologyType='" << (int)symbologyType << "'"
<< ", name='" << name << "'"
<< ", fileContentId=" << fileContentId;
dict.removeEtsSymbol(fileContentId);
dict.removeEtsSymbol(name);
}
}
void FlmSubscriber::onLocalSymbolProxyXmlSymbolAdded(qint32 fileContentId, const QString& operatorName,
qint64 lastModified, const QString& name,
const QString& xmlContent, const QStringList& usrTags)
{
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START"
<< " fileContentId=" << fileContentId << " name='" << name << "'";
if (!xmlContent.isEmpty())
{
for (const SymbologyType& symbologyType : std::as_const(d->m_symbolDictionaryToUpdate))
{
AdvancedSymbology::SymbolDictionary& dict = AdvancedSymbology::SymbolDictionary::dictionary(symbologyType);
if (!this->setXmlSymbolToDict(dict, fileContentId, operatorName, lastModified, name, xmlContent, usrTags))
ERROR_LOG(m_logger) << Q_FUNC_INFO << " dict.setXmlSymbolToDict failed"
<< ", symbologyType='" << (int)symbologyType << "'"
<< ", name='" << name << "'";
}
}
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END"
<< " fileContentId=" << fileContentId << " name='" << name << "'";
}
void FlmSubscriber::onLocalSymbolProxyXmlSymbolRemoved(qint32 fileContentId)
{
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START" << " fileContentId=" << fileContentId;
for (const SymbologyType& symbologyType : std::as_const(d->m_symbolDictionaryToUpdate))
{
AdvancedSymbology::SymbolDictionary& dict = AdvancedSymbology::SymbolDictionary::dictionary(symbologyType);
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " dict.removeXmlSymbol:"
<< " symbologyType='" << symbologyType << "'"
<< ", fileContentId=" << fileContentId;
const QString& skey = QString::number(fileContentId);
const QString& sidc = SidcCodec::encodeCivilXml(skey);
dict.removeXmlSymbol(sidc);
dict.removeXmlSymbol(fileContentId);
}
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END" << " fileContentId=" << fileContentId;
}
bool FlmSubscriber::connectFlmSymbolProxy(int type_placeholder, SymbologyType symbologyType)
{
Q_UNUSED(type_placeholder);
TRACE_LOG(m_logger) << Q_FUNC_INFO << " m_fileContentMap.size()=" << d->m_fileContentMap.size();
d->m_symbolDictionaryToUpdate.insert(symbologyType);
connect(&d->m_symbolProxy, &FlmSymbolProxy::etsSymbolAdded, this, &FlmSubscriber::onLocalSymbolProxyEtsSymbolAdded,
Qt::QueuedConnection);
connect(&d->m_symbolProxy, &FlmSymbolProxy::etsSymbolRemoved, this,
&FlmSubscriber::onLocalSymbolProxyEtsSymbolRemoved, Qt::QueuedConnection);
connect(&d->m_symbolProxy, &FlmSymbolProxy::xmlSymbolAdded, this, &FlmSubscriber::onLocalSymbolProxyXmlSymbolAdded,
Qt::QueuedConnection);
connect(&d->m_symbolProxy, &FlmSymbolProxy::xmlSymbolRemoved, this,
&FlmSubscriber::onLocalSymbolProxyXmlSymbolRemoved, Qt::QueuedConnection);
if (d->m_symbolProxy.isEmpty())
return true;
AdvancedSymbology::SymbolDictionary& dict = AdvancedSymbology::SymbolDictionary::dictionary(symbologyType);
dict.blockSignals(true);
for (auto mapIt = d->m_symbolProxy.getMap().begin(); mapIt != d->m_symbolProxy.getMap().end(); ++mapIt)
{
const int fileContentId = mapIt.key();
const FlmSymbolProxy::SymbolData& symData = mapIt.value();
if (symData.isXmlSymbol())
setXmlSymbolToDict(dict, fileContentId, symData.operatorName(), symData.lastModified(), symData.name(),
symData.xmlContent(), symData.usrTags());
else
setEtsSymbolToDict(dict, fileContentId, symData.name(), symData.image(), symData.colorToBeReplaced(),
symData.usrTags());
}
dict.blockSignals(false);
return true;
}
bool FlmSubscriber::setEtsSymbolToDict(SymbolDictionary& dict, qint32 fileContentId, const QString& name,
const QImage& image, const QColor& colorToBeReplaced, const QStringList& usrTags)
{
SymbolProperties symProps;
symProps.setKey(name);
symProps.setSidc(SidcCodec::encodeCivilEts(name));
symProps.setName(name);
symProps.setSymbolClass(QLatin1String("3"));
symProps.setGeometryType(GeometryType::Point);
symProps.setTags(QStringList() << name << usrTags);
symProps.setColorToBeReplaced(colorToBeReplaced);
if (!dict.setEtsSymbol(fileContentId, symProps.sidc(), symProps, image))
{
ERROR_LOG(m_logger) << Q_FUNC_INFO << " dict.insertExtraSymbol failed"
<< ", fileContentId=" << fileContentId << ", name='" << name << "'";
return false;
}
else
INFO_LOG(m_logger) << Q_FUNC_INFO << " dict.insertExtraSymbol done"
<< ", fileContentId=" << fileContentId << ", name='" << name << "'";
return true;
}
bool FlmSubscriber::setXmlSymbolToDict(SymbolDictionary& dict, qint32 fileContentId, const QString& operatorName,
qint64 lastModified, const QString& name, const QString& xmlContent,
const QStringList& usrTags)
{
SymbolProperties symProps;
symProps.setTags(QStringList() << name << usrTags);
bool success = dict.setXmlSymbol(fileContentId, name, operatorName, lastModified, xmlContent, symProps);
if (!success)
ERROR_LOG(m_logger) << Q_FUNC_INFO << " setXmlSymbol failed:"
<< ", file-id=" << fileContentId << ", filenameid='" << name << "'";
return success;
}
} // namespace AdvancedSymbology
@@ -1,70 +0,0 @@
#pragma once
#include <AdvancedSymbology/asb_symbol_proxy_gui_plugin_interface.h>
#include <Lts/Services/FileManagement/flm.hpp>
#include <LtsUtils/LtsUtilsCore/data_modification_enum.h>
#include <PluginInterfaces/gui_plugin_interface.h>
#include <Plugins/FileManagement/flm_data_plugin_interface.h>
#include <OperatorManagement/opm_data_plugin_interface.h>
#include <memory>
namespace LtsUtils
{
class RequestHelper;
}
namespace AdvancedSymbology
{
class FlmSubscriber final : public QObject,
public ForeignGuiFlmSymbolsProxyInterface,
public FileManagement::Interface::Ftc::GetFileContentDataReplyHandler
{
Q_OBJECT
public:
explicit FlmSubscriber(const std::shared_ptr<FileManagement::Interface::Dtc>& flmDtc,
const std::shared_ptr<FileManagement::Interface::Ftc>& flmFtc,
const std::shared_ptr<OperatorManagement::Interface::Dtc>& opmDtc);
~FlmSubscriber();
bool createFlmSymbolProxy(int type_placeholder) override;
bool connectFlmSymbolProxy(int type_placeholder, SymbologyType symbologyType) override;
private:
NGL::INGLLogger& m_logger;
bool setEtsSymbolToDict(SymbolDictionary& dict, qint32 fileContentId, const QString& name, const QImage& image,
const QColor& colorToBeReplaced, const QStringList& usrTags);
bool setXmlSymbolToDict(SymbolDictionary& dict, qint32 fileContentId, const QString& operatorName,
qint64 lastModified, const QString& name, const QString& xmlContent,
const QStringList& usrTags);
protected slots:
void onFileContentChanged(const FileManagement::FileContent& data, DataModification modType);
void updateFileContentMap(const FileManagement::FileContent& data);
void onLocalSymbolProxyEtsSymbolAdded(qint32 fileContentId, const QString& name, const QImage& image,
const QColor& colorToBeReplaced, const QStringList& usrTags);
void onLocalSymbolProxyEtsSymbolRemoved(qint32 fileContentId, const QString& name);
void onLocalSymbolProxyXmlSymbolAdded(qint32 fileContentId, const QString& operatorName, qint64 lastModified,
const QString& name, const QString& xmlContent, const QStringList& usrTags);
void onLocalSymbolProxyXmlSymbolRemoved(qint32 fileContentId);
protected:
void onGetFileContentDataReply(const FileManagement::GetFileContentDataReply& reply) override;
bool svgToImage(const QByteArray& svgByteArray, QImage& imageOut);
QString operatorName(int operatorId);
void checkForReFetching();
private:
struct Private;
Private* d = nullptr;
};
} // namespace AdvancedSymbology
@@ -1,142 +0,0 @@
#include "asb_symbol_proxy_gui_plugin.h"
#include "asb_flm_subscriber.h"
#include <LtsSession/lts_session.h>
#include <NGLLogger/NGLLoggerBootstrap.h>
#include <Symbology/symbol_dictionary.h>
#include <Symbology/sidc_codec.h>
#include "flm_symbol_proxy.h"
#include <Plugins/FileManagement/flm_data_plugin_interface.h>
#include <OperatorManagement/opm_data_plugin_interface.h>
namespace AdvancedSymbology
{
std::shared_ptr<GuiPluginBase::Interface> FlmSymbolProxyGuiPlugin::createGuiInterface(LtsSession::LtsSession *session)
{
return std::make_shared<InterfaceImpl>(session);
}
struct InterfaceImpl::Private
{
QSharedPointer<FlmSubscriber> getFlmSubscriber(int type_placeholder)
{
static QWeakPointer<FlmSubscriber> s_flmSubcriber;
m_flmSubscriber = s_flmSubcriber.toStrongRef();
if (!m_flmSubscriber)
{
m_flmSubscriber = QSharedPointer<FlmSubscriber> (new FlmSubscriber(m_flmDtc, m_flmFtc, m_opmDtc));
s_flmSubcriber = m_flmSubscriber.toWeakRef();
m_flmSubscriber->createFlmSymbolProxy(type_placeholder);
}
return m_flmSubscriber;
}
void clearFlmSubscriber()
{
m_flmSubscriber.clear();
}
std::shared_ptr<FileManagement::Interface::Dtc> m_flmDtc;
std::shared_ptr<FileManagement::Interface::Ftc> m_flmFtc;
std::shared_ptr<OperatorManagement::Interface::Dtc> m_opmDtc;
private:
QSharedPointer<FlmSubscriber> m_flmSubscriber;
};
InterfaceImpl::InterfaceImpl(LtsSession::LtsSession *session)
: GuiPluginBase::Interface(session, NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("AdvSymbology.FlmSymbolProxy"))
, d(new Private())
{
qRegisterMetaType<FileManagement::FileContent>("FileManagement::FileContent");
qRegisterMetaType<DataModification>("DataModification");
}
InterfaceImpl::~InterfaceImpl()
{
delete d;
}
bool InterfaceImpl::fetchInterfaces()
{
if (!m_session->getDtc<FileManagement::DataInterface>(d->m_flmDtc))
{
DEBUG_LOG(m_logger) << "getDtc for FileManagement::DataInterface failed.";
return false;
}
if (!m_session->getFtc<FileManagement::DataInterface>(d->m_flmFtc))
{
DEBUG_LOG(m_logger) << "getFtc for FileManagement::DataInterface failed.";
return false;
}
if (!m_session->getDtc<OperatorManagement::DataInterface>(d->m_opmDtc))
{
DEBUG_LOG(m_logger) << "getDtc for OperatorManagement::DataInterface failed.";
return false;
}
return true;
}
void InterfaceImpl::clearInterfaces()
{
d->m_flmDtc = nullptr;
d->m_flmFtc = nullptr;
d->m_opmDtc = nullptr;
d->clearFlmSubscriber();
}
bool InterfaceImpl::createFlmSymbolProxy(int type_placeholder)
{
Q_UNUSED(type_placeholder);
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
if (!d->m_flmDtc || !d->m_flmFtc || !d->m_opmDtc)
return false;
QSharedPointer<FlmSubscriber> flmSubscriber = d->getFlmSubscriber(type_placeholder);
if (!flmSubscriber)
{
ERROR_LOG(m_logger) << LOGFUNCTION << " no FlmSubscriber";
return false;
}
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
return true;
}
bool InterfaceImpl::connectFlmSymbolProxy(int type_placeholder, SymbologyType symbologyType)
{
Q_UNUSED(type_placeholder);
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
QSharedPointer<FlmSubscriber> flmSubscriber = d->getFlmSubscriber(type_placeholder);
if (!flmSubscriber)
{
ERROR_LOG(m_logger) << LOGFUNCTION << " no FlmSubscriber";
return false;
}
flmSubscriber->connectFlmSymbolProxy(type_placeholder, symbologyType);
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
return true;
}
}
@@ -1,68 +0,0 @@
#pragma once
#include <PluginInterfaces/gui_plugin_interface.h>
#include <AdvancedSymbology/asb_symbol_proxy_gui_plugin_interface.h>
#include <memory>
namespace LtsUtils
{
class RequestHelper;
}
namespace AdvancedSymbology
{
class FlmSymbolProxyGuiPlugin final : public QObject, public GuiPluginBase::Plugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "gui:3:asb.flmsymbolproxy")
Q_INTERFACES(GuiPluginBase::Plugin)
public:
explicit FlmSymbolProxyGuiPlugin() = default;
~FlmSymbolProxyGuiPlugin() = default;
QString pluginName() override { return ForeignGuiFlmSymbolsProxyInterface::pluginName(); }
std::shared_ptr<GuiPluginBase::Interface> createGuiInterface(LtsSession::LtsSession *session) override;
bool availableInPartition(IDL::PartitionType partition) const override
{
Q_UNUSED(partition);
return true;
}
};
class InterfaceImpl final
: public QObject
, public ForeignGuiFlmSymbolsProxyInterface
, public GuiPluginBase::Interface
{
Q_OBJECT
public:
explicit InterfaceImpl(LtsSession::LtsSession *session);
~InterfaceImpl();
bool fetchInterfaces() override;
void clearInterfaces() override;
private:
bool createFlmSymbolProxy(int type_placeholder) override;
bool connectFlmSymbolProxy(int type_placeholder, SymbologyType symbologyType) override;
protected slots:
private:
struct Private;
Private *d = nullptr;
};
}
@@ -1,40 +0,0 @@
#include "flm_symbol_proxy.h"
namespace AdvancedSymbology
{
FlmSymbolProxy::FlmSymbolProxy(QObject *parent)
: QObject(parent)
{
}
bool FlmSymbolProxy::setSymbol(int32_t fileContentId, const SymbolData &symbolData)
{
m_imageMap[fileContentId] = symbolData;
if (symbolData.isXmlSymbol())
emit xmlSymbolAdded(fileContentId, symbolData.operatorName(), symbolData.lastModified(), symbolData.name(), symbolData.xmlContent(), symbolData.usrTags());
else
emit etsSymbolAdded(fileContentId, symbolData.name(), symbolData.image(), symbolData.colorToBeReplaced(), symbolData.usrTags());
return true;
}
bool FlmSymbolProxy::removeSymbol(qint32 fileContentId)
{
SymbolData symbolDat = m_imageMap[fileContentId];
bool ret = m_imageMap.remove(fileContentId) > 0;
if (ret)
{
if (symbolDat.isXmlSymbol())
emit xmlSymbolRemoved(fileContentId);
else
emit etsSymbolRemoved(fileContentId, symbolDat.name());
}
return ret;
}
}
@@ -1,111 +0,0 @@
#pragma once
#include <QtCore/QHash>
#include <QtCore/QString>
#include <QtGui/QImage>
#include <QtCore/QObject>
namespace AdvancedSymbology
{
class FlmSymbolProxy : public QObject
{
Q_OBJECT
public:
class SymbolData
{
public:
SymbolData() = default;
SymbolData(const QString &name, const QImage &image, const QColor &colorToBeReplaced = QColor())
: m_name(name), m_image(image), m_colorToBeReplaced(colorToBeReplaced), m_xmlContent()
{}
SymbolData(const QString &name, const QString &operatorName, qint64 lastModified, const QByteArray &xmlContent)
: m_name(name), m_operatorName(operatorName), m_lastModified(lastModified), m_image(), m_colorToBeReplaced(), m_xmlContent(QString::fromUtf8(xmlContent))
{}
QString name() const { return m_name; }
void setName(const QString &name) { m_name = name; }
QString operatorName() const { return m_operatorName; }
void setOperatorName(const QString &operatorName) { m_operatorName = operatorName; }
qint64 lastModified() const { return m_lastModified; }
void setLastModified(qint64 lastModified) { m_lastModified = lastModified; }
QImage image() const { return m_image; }
void setImage(const QImage &image) { m_image = image; if (!image.isNull()) m_xmlContent.clear(); }
QColor colorToBeReplaced() const { return m_colorToBeReplaced; }
void setColorToBeReplaced(const QColor &colorToBeReplaced) { m_colorToBeReplaced = colorToBeReplaced; }
QString xmlContent() const { return m_xmlContent; }
void setXmlContent(const QString &xmlContent) { m_xmlContent = xmlContent; }
bool isXmlSymbol() const { return (!m_xmlContent.isEmpty()); }
QStringList usrTags() const { return m_usrTags; }
void setUsrTags(const QStringList &usrTags) { m_usrTags = usrTags; }
void addUsrTag(const QString &tag) { m_usrTags << tag; }
void addUsrTag(const char *tag) { m_usrTags << QLatin1String(tag); }
void clearUsrTags() { m_usrTags.clear(); }
protected:
QString m_name;
QString m_operatorName;
qint64 m_lastModified = 0;
QImage m_image;
QColor m_colorToBeReplaced;
QString m_xmlContent;
QStringList m_usrTags;
};
explicit FlmSymbolProxy(QObject *parent = nullptr);
FlmSymbolProxy(const FlmSymbolProxy &other) = delete;
FlmSymbolProxy &operator=(const FlmSymbolProxy &other) = delete;
bool isEmpty() const { return m_imageMap.isEmpty(); }
bool containsSymbol(qint32 fileContentId) const { return m_imageMap.contains(fileContentId); }
const QHash<qint32, SymbolData> &getMap() const { return m_imageMap; }
bool setSymbol(int32_t fileContentId, const SymbolData &symbolData);
bool removeSymbol(qint32 fileContentId);
Q_SIGNALS:
void etsSymbolAdded(qint32 fileContentId, const QString &name, const QImage &image, const QColor &colorToBeReplaced, const QStringList &usrTags);
void etsSymbolRemoved(qint32 fileContentId, const QString &name);
void xmlSymbolAdded(qint32 fileContentId, const QString & operatorName, qint64 lastModified, const QString &name, const QString &xmlContent, const QStringList &usrTags);
void xmlSymbolRemoved(qint32 fileContentId);
private:
QHash<qint32, SymbolData> m_imageMap;
};
}
@@ -1,36 +0,0 @@
#
# $Id$
# $HeadURL$
# $Author$
# Created by Christian Ehrlicher, SLSE, 2017-11-01
#
# Make ${Qt6_Gui} optional
if(QT6_GUI_AVAILABLE AND TARGET Qt6::Gui)
set(Qt6_Gui ${Qt6_Gui})
else()
set(Qt6_Gui "")
endif()
SET(tmsr_SRCS
table_model_symbol_renderer_base.cpp
table_model_symbol_renderer_base.h
table_model_symbol_renderer.h
)
NGL_ADD_LIBRARY2(WS AsbHelper STATIC ${tmsr_SRCS})
NGL_TARGET_INCLUDE_DIRECTORIES(AsbHelper
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/../
${CMAKE_SOURCE_DIR}/Lts/Viewer/SituationMap/
)
if(QT6_GUI_AVAILABLE)
NGL_TARGET_LINK_LIBRARIES(AsbHelper
PUBLIC
Qt6::Core
PRIVATE
${Qt6_Gui}
AsbDataPluginInterface
NGLLogger
)
endif()
@@ -1,23 +0,0 @@
#pragma once
#include "table_model_symbol_renderer_base.h"
namespace AdvancedSymbology
{
template <typename SUPER>
class TableModelSymbolRenderer : public TableModelSymbolRendererBase
{
protected:
using TableModelSymbolRendererBase::TableModelSymbolRendererBase;
virtual NGL::INGLLogger &logger() const final { return super()->m_logger; }
virtual QAbstractItemModel *model() final { return super(); }
virtual QModelIndex indexForId(int id, int column) final { return super()->findIndexForId(id, column); }
SUPER *super() { return static_cast<SUPER *>(this); }
const SUPER *super() const { return static_cast<const SUPER *>(this); }
};
}
@@ -1,142 +0,0 @@
#include "table_model_symbol_renderer_base.h"
#include <AdvancedSymbology/asb_data_plugin_interface.h>
#include <NGLLogger/INGLLogger.h>
#include <QtCore/QAbstractItemModel>
#include <QtCore/QPointer>
namespace AdvancedSymbology
{
TableModelSymbolRendererBase::TableModelSymbolRendererBase(int iconColumn)
: m_partyRole(AdvancedSymbology::Role::Unknown)
, m_iconColumn(iconColumn)
, m_super(nullptr)
{}
void TableModelSymbolRendererBase::init(const std::shared_ptr<AdvancedSymbology::ForeignDataInterface> &asb,
QObject *super)
{
m_asb = asb;
m_super = super;
}
void TableModelSymbolRendererBase::setDefaultRoleAndColor(const Role &role, const QColor &partyColor)
{
m_partyRole = role;
m_partyColor = partyColor;
}
QVariant TableModelSymbolRendererBase::decorationData(const QModelIndex &idx, int id) const
{
return decorationIcon(idx, id);
}
QIcon TableModelSymbolRendererBase::decorationIcon(const QModelIndex &idx, int id) const
{
if (idx.column() != m_iconColumn)
return QIcon();
auto it = m_symbols.find(id);
if (it != m_symbols.end())
return it.value();
return QIcon();
}
bool TableModelSymbolRendererBase::tryRenderSymbol(const QString &symbol, int id)
{
return tryRenderSymbol(symbol, id, m_partyColor, m_partyRole);
}
bool TableModelSymbolRendererBase::tryRenderSymbol(const QString &symbol, int id, const QColor &color, Role role)
{
if (!m_asb || symbol.isEmpty())
return false;
AdvancedSymbology::SymbolDataToRender symDataToRender(symbol);
symDataToRender.role = role;
if (color.isValid())
{
symDataToRender.fillColor = color;
symDataToRender.fillColorReplace = true;
}
else
{
symDataToRender.fillColor = AdvancedSymbology::SymbolDataToRender::unknownColor();
symDataToRender.fillColorReplace = true;
}
QSharedPointer<AdvancedSymbology::SymbolResult> sr = m_asb->findImage(symDataToRender);
AdvancedSymbology::SymbolResult *ptrSr = sr.data();
if (!ptrSr)
{
WARNING_LOG(logger()) << "Can not render symbol for sidc '" << symbol << "'";
return false;
}
auto it = m_symbolResultMapping.find(ptrSr);
if (it == m_symbolResultMapping.end())
{
SymbolResultData srd;
srd.result = sr;
srd.ids.push_back(id);
m_symbolResultMapping.insert(ptrSr, srd);
if (ptrSr->isResultReady())
{
symbolRendered(ptrSr);
}
else
{
Q_ASSERT(m_super);
QPointer<AdvancedSymbology::SymbolResult> qPointer(ptrSr);
QObject::connect(ptrSr,
&AdvancedSymbology::SymbolResult::resultReadyInternal,
m_super ? m_super : ptrSr,
[this, qPointer]() { symbolRendered(qPointer); }, Qt::QueuedConnection);
}
}
else
{
SymbolResultData &srd = it.value();
srd.ids.push_back(id);
}
return true;
}
void TableModelSymbolRendererBase::removeRenderedSymbol(int id)
{
m_symbols.remove(id);
}
void TableModelSymbolRendererBase::symbolRendered(AdvancedSymbology::SymbolResult *sr)
{
if (!sr || !sr->isResultReady())
return;
auto it = m_symbolResultMapping.constFind(sr);
if (it == m_symbolResultMapping.constEnd())
return;
const SymbolResultData &srd = it.value();
const QIcon ico(QPixmap::fromImage(srd.result->symbolImage().image()));
for (int id : srd.ids)
{
DEBUG_LOG(logger()) << "Symbol for id " << id << " ready";
m_symbols[id] = ico;
const QModelIndex idx = indexForId(id, m_iconColumn);
if (idx.isValid())
emit model()->dataChanged(idx, idx, {Qt::DecorationRole});
}
m_symbolResultMapping.erase(it);
}
}
@@ -1,71 +0,0 @@
#pragma once
#include <memory>
#include <QtGui/QColor>
#include <QtCore/QHash>
#include <QtGui/QIcon>
#include <QtCore/QSharedPointer>
class QAbstractItemModel;
class QModelIndex;
class QVariant;
namespace NGL
{
class INGLLogger;
}
namespace AdvancedSymbology
{
class SymbolResult;
class ForeignDataInterface;
enum class Role;
class TableModelSymbolRendererBase
{
protected:
explicit TableModelSymbolRendererBase(int iconColumn);
virtual ~TableModelSymbolRendererBase() = default;
void init(const std::shared_ptr<AdvancedSymbology::ForeignDataInterface> &asb,
QObject *super);
void setDefaultRoleAndColor(const Role &role, const QColor &partyColor);
QColor defaultColor() const { return m_partyColor; }
Role defaultRole() const { return m_partyRole; }
QVariant decorationData(const QModelIndex &idx, int id) const;
QIcon decorationIcon(const QModelIndex &idx, int id) const;
bool tryRenderSymbol(const QString &symbol, int id);
bool tryRenderSymbol(const QString &symbol, int id, const QColor &color, Role role);
void removeRenderedSymbol(int id);
private:
void symbolRendered(AdvancedSymbology::SymbolResult *sr);
virtual NGL::INGLLogger &logger() const = 0;
virtual QAbstractItemModel *model() = 0;
virtual QModelIndex indexForId(int id, int column) = 0;
private:
std::shared_ptr<AdvancedSymbology::ForeignDataInterface> m_asb;
struct SymbolResultData
{
QSharedPointer<AdvancedSymbology::SymbolResult> result;
QVector<int> ids;
};
QHash<AdvancedSymbology::SymbolResult *, SymbolResultData> m_symbolResultMapping;
Role m_partyRole;
QColor m_partyColor;
const int m_iconColumn;
QHash<int, QIcon> m_symbols;
QObject *m_super;
};
}
@@ -1,57 +0,0 @@
#pragma once
#include <QtGui/QColor>
#include <Symbology/symbol_dictionary.h>
#include <PluginInterfaces/data_plugin_interface.h>
namespace ParticipantManagement
{
class Participant;
}
namespace AdvancedSymbology
{
class ForeignDataInterface;
class DataInterface : public DataPluginBase::Interface
{
public:
using DataPluginBase::Interface::Interface;
virtual std::shared_ptr<ForeignDataInterface> getForeignDataInterface() = 0;
};
class ForeignDataInterface
{
public:
ForeignDataInterface() = default;
virtual ~ForeignDataInterface() = default;
virtual AdvancedSymbology::SymbolDictionary &getSymbolDictionary(AdvancedSymbology::SymbologyType type) const = 0;
virtual QSharedPointer<SymbolResult> findImage(const SymbolDictionary &dict, const SymbolDataToRender &symDataToRender) const = 0;
virtual QSharedPointer<SymbolResult> findImage(const SymbolDataToRender &symDataToRender) const = 0;
virtual QSharedPointer<SymbolResult> findImage(const ParticipantManagement::Participant &participant, int sizeL = 100, const QColor& desiredColor = QColor()) const = 0;
virtual QSharedPointer<SymbolResult> findPreview(const SymbolDictionary &dict, const QString &sidc) const = 0;
virtual QSharedPointer<SymbolResult> findPreview(const QString &sidc) const = 0;
virtual QSharedPointer<SymbolResult> findBaseSymbol(const SymbolDictionary &dict, const QString &sidc) const = 0;
virtual QSharedPointer<SymbolResult> findBaseSymbol(const QString &sidc) const = 0;
virtual AdvancedSymbology::SymbologyType defaultSymbologyType() const = 0;
};
}
@@ -1,19 +0,0 @@
#pragma once
#include <QtCore/QString>
namespace AdvancedSymbology
{
class ForeignGuiInterface
{
public:
ForeignGuiInterface() = default;
virtual ~ForeignGuiInterface() = default;
static QString pluginName() { return QStringLiteral("AdvancedSymbology"); }
};
}
@@ -1,37 +0,0 @@
#pragma once
#include <Symbology/symbol_dictionary_types.h>
#include <QtCore/QString>
namespace AdvancedSymbology
{
enum class SymbologyType;
class ForeignGuiFlmSymbolsProxyInterface
{
public:
ForeignGuiFlmSymbolsProxyInterface() = default;
virtual ~ForeignGuiFlmSymbolsProxyInterface() = default;
static QString pluginName() { return QStringLiteral("AdvancedSymbology.SymbolProxy"); }
virtual bool createFlmSymbolProxy(int type_placeholder) = 0;
virtual bool connectFlmSymbolProxy(int type_placeholder, SymbologyType symbologyType) = 0;
};
}
@@ -1,202 +0,0 @@
#!/usr/bin/python3
import os
import re
import sys
import shutil
if len(sys.argv) != 2 and len(sys.argv) != 4 :
print("Usage %s directory-path file-path-types-dump [path to insert_ppm_values_types.sql]" % sys.argv[0])
sys.exit
dirPath = os.path.abspath(sys.argv[1])
if not os.path.isdir(dirPath) :
print("directory \"%s\" doesn't exists. Abort ..." % dirPath)
sys.exit
fdSql = open("symbols_insert.sql", "wt")
maxId = -1
nameDict = {}
idDict = {}
symbolCount = 0
print ("\nParsing XML symbol definitions:")
for fileN in os.listdir(dirPath) :
symbolId = -1
if fileN.endswith(".xml") :
fd = open(dirPath + "/"+ fileN,"rt")
xmlContent = fd.read()
fd.close()
idBegin = xmlContent.find("id=\"")
idEnd = xmlContent.find("\"",idBegin+4)
if idBegin > 0 and idEnd > 0 :
idBegin = idBegin + 4
symbolId = int(xmlContent[idBegin:idEnd],0)
if symbolId >= 0 :
if symbolId > maxId :
maxId = symbolId
nameBegin = xmlContent.find("<name>")
nameEnd = xmlContent.find("</name>")
name = ""
if nameBegin > 0 and nameEnd > 0 :
nameBegin = nameBegin + 6
name = xmlContent[nameBegin:nameEnd]
else :
name = "noname"
nameCount = nameDict.get(name,0) + 1
nameDict[name] = nameCount
if nameCount > 1 :
name = name +"(" + str(nameCount)+")"
symbolCount = symbolCount+1
print(" [%3d] : Insert symbol %s with id=%d to sql database" % (symbolCount,name,symbolId) )
fdSql.write("INSERT INTO flm.flm_file_content (id, name, folder_id, file_category_id, file_type_id, file_status_id, operator_id, properties )")
fdSql.write(" values (" + str(symbolId) + ",'" + name + "', 30, 1, 8, 0, 99, '{\"imageFormat\": \"xml\"}');\n")
symbolPath = "/shd/CTC/TOOLS/TDS/TDS-source/Lts/Tests/DatabaseInitialisation/GuezSymbols/" + fileN
fdSql.write("UPDATE flm.flm_file_content SET content = ( SELECT bytea_import('" + symbolPath + "')) WHERE id = " + str(symbolId) + "; \n")
maxId = maxId + 1
fdSql.write("ALTER SEQUENCE flm.flm_file_content_id_seq RESTART WITH " + str(maxId) + ";")
fdSql.close()
print("\n"+str(symbolCount)+" symbols added to sql script")
if len(sys.argv) == 4 :
typeDump = os.path.abspath(sys.argv[2])
if not os.path.exists(typeDump) :
print("types dump file \"%s\" doesn't exists. Abort ..." % typeDump)
sys.exit
print("\nParsing db type dump \"%s\" ..." % typeDump)
fdTypen = open(typeDump,"rt")
while True:
line = fdTypen.readline()
if (line == "") :
break
typeDataList = line.split("|")
if len(typeDataList) > 4 :
name = typeDataList[2]
symbolId = int(typeDataList[3])
if symbolId > 0 :
nameId = re.sub(r"\s+", "", name, flags=re.UNICODE)
idDict[nameId] = symbolId
print(nameId + " ---> " + str(idDict[nameId]))
fdTypen.close()
print("\nModify insert_ppm_values_types.sql ...")
ppm_script_template = os.path.abspath(sys.argv[3]) + "/insert_ppm_values_types.sql"
ppm_script = os.path.abspath(sys.argv[3]) + "/insert_ppm_values_types_with_symbols.sql"
fdRead = open( ppm_script_template,"rt")
fdWrite = open( ppm_script,"wt")
ppmValueCnt = 0
changeLine = False
while True:
line = fdRead.readline()
if (line == "") :
break
if line.startswith("INSERT INTO ppm.ppm_type (") :
fdWrite.write(line)
changeLine = True
continue
if line.startswith(" VALUES (") and changeLine == True :
nameBegin = line.find("'") + 1
nameEnd = line.find("'",nameBegin)
sidc = ""
if nameBegin > 0 and nameEnd > 0 :
name = line[nameBegin:nameEnd]
name = re.sub(r"\s+", "", name, flags=re.UNICODE)
keyName = name
for key in idDict :
if key != "" :
if name.startswith(key):
keyName = key
break
if key.startswith("BPz3B") and name.startswith("BPz3B"):
keyName = key
break
if idDict.get(keyName,0) > 0 :
symbolBegin = line.find("'",nameEnd+1)+1
symbolEnd = line.find("'",symbolBegin)
if symbolBegin == symbolEnd :
sidc = "NONE|CVLX|" + str(idDict.get(keyName,0))
tmpLine = line[:symbolBegin]+sidc+line[symbolEnd:]
line = tmpLine
ppmValueCnt += 1
else :
sidc = line[symbolBegin:symbolEnd]
if sidc == "" :
print("\"" + name + "\" not found in db type dump." )
print(name + " : " + sidc)
fdWrite.write(line)
changeLine = False
fdWrite.close()
fdRead.close()
print("\n%d symbols added to ppm types\n" % ppmValueCnt)
File diff suppressed because it is too large. Load diff
@@ -1,152 +0,0 @@
0|-1|Kein Typ|212|-1|-1|-1|0|0|0|0|-1|||
1|265|ABCAufklTrp|1|1|8|0|0|0|0|0|-1|||
2|266|ABCAufklZg|2|1|5|0|0|0|0|0|-1|||
3|267|LKW 5t mil gl TA|303|3|43|70|0|0|6500|50|-1|||
4|268|Anh MiV|4|3|46|48|0|0|7550|50|-1|||
222||SR Kontr NL|186|6|106|83|0|0|9700|100|-1|||
10|274|BPz 3 BüFFEL|11|4|72|30|1|0|5800|50|-1|||
11|275|BrLPz BIBER|12|4|71|31|1|0|5850|50|-1|||
13|277|BtlGefStd|861|1|2|0|0|0|0|0|-1|||
221||SR Kontr Mine NL|186|6|106|84|0|0|9600|50|-1|||
220||Richtmine NL|268|5|82|82|0|0|9000|50|-1|||
19|283|FschJgGrp|29|1|7|0|0|0|0|0|-1|||
20|284|FschJgKp|31|1|3|0|0|0|0|0|-1|||
21|285|FschJgKpFüGrp|33|1|4|0|0|0|0|0|-1|||
22|286|FschJgZg|35|1|5|0|0|0|0|0|-1|||
23|287|FschJgZgTrp|37|1|6|0|0|0|0|0|-1|||
33|297|GebJgGrp|52|1|7|0|0|0|0|0|-1|||
34|298|GebJgKp|56|1|3|0|0|0|0|0|-1|||
35|299|GebJgKpFüGrp|58|1|4|0|0|0|0|0|-1|||
36|300|GebJgZg|65|1|5|0|0|0|0|0|-1|||
37|301|GebJgZgTrp|67|1|6|0|0|0|0|0|-1|||
44|308|Krad gl|90|5|87|5|0|0|500|2500|-1|||
46|310|LKW 5t tmil gl 4x4 Iveco|303|3|43|71|0|0|6650|100|-1|||
47|311|LKW 10t gl/glw|93|3|44|47|0|0|6950|100|-1|||
48|312|LKW 5t FKue DB|98|3|43|72|0|0|7050|100|-1|||
50|314|LKW 2t gl|96|3|42|42|0|0|6250|200|-1|||
51|315|LKW 5t tmil gl 4x4 DB|98|3|43|44|0|0|6550|100|-1|||
52|316|LKW 5t mil gl/glw|98|3|43|45|0|0|6750|100|-1|||
53|317|LKW 7t mil gl/glw|99|3|44|46|0|0|6850|100|-1|||
54|318|LKW gl le kurz|92|3|41|38|0|0|6050|100|-1|||
56|320|LKW gl le LL|92|3|41|38|0|0|6050|100|-1|||
67|331|MunTrp|121|1|8|0|0|0|0|0|-1|||
68|332|PiErkGrp|163|1|7|0|0|0|0|0|-1|||
69|333|PiPz DACHS|125|4|70|34|1|0|5700|50|-1| | |
71|335|PzAufklKp|128|1|3|0|0|0|0|0|-1|||
75|339|PzAufklZg|132|1|5|0|0|0|0|0|-1|||
79|343|PzGrenGrp|140|1|7|0|0|0|0|0|-1|||
80|344|PzGrenKp|143|1|3|0|0|0|0|0|-1|||
81|345|PzGrenKpFüGrp|145|1|4|0|0|0|0|0|-1|||
82|346|PzGrenTrp|147|1|8|0|0|0|0|0|-1|||
83|347|PzGrenZg|149|1|5|0|0|0|0|0|-1|||
84|348|PzGrenZgTrp|152|1|6|0|0|0|0|0|-1|||
88|352|PzKp|156|1|3|0|0|0|0|0|-1|||
89|353|PzKpFüGrp|158|1|4|0|0|0|0|0|-1|||
94|358|PzPiGrp|163|1|7|0|0|0|0|0|-1|||
95|359|PzPiKp|165|1|3|0|0|0|0|0|-1|||
96|360|PzPiZg|166|1|5|0|0|0|0|0|-1|||
97|361|PzPiZgTrp|167|1|6|0|0|0|0|0|-1|||
98|362|PzZg|168|1|5|0|0|0|0|0|-1|||
100|830|SR (Leiter)|188|6|101|18|0|0|3000|150|-1|||
101|833|SR Fz (Leiter)|429|7|121|100|2|0|7700|150|-1|||
106|576|Soldat/G|180|5|82|5|0|0|500|2500|-1|||
112|376|SR Spezial|188|6|106|18|0|0|3000|150|-1|||
114|378|SR Truppe|188|6|105|18|0|0|3000|150|-1|||
116|380|TVPL|202|1|1|0|0|0|0|0|-1|||
118|382|VB Trp Art|204|1|8|0|0|0|0|0|-1|||
120|384|VersGrp|206|1|7|0|0|0|0|0|-1|||
121|385|Video Dok|208|6|108|19|0|0|3150|50|-1|||
122|386|VVD|209|1|1|0|0|0|0|0|-1|||
123|387|Wtg Trp|210|1|8|0|0|0|0|0|-1|||
128|392|TrpFhr|816|5|81|5|0|0|500|2500|-1|||
129|393|Soldat/MG|107|5|84|5|0|0|500|2500|-1|||
130|394|Soldat/PzF|137|5|85|5|0|0|500|2500|-1|||
131|396|Soldat/MILAN|111|5|86|5|0|0|500|2500|-1|||
140|824|LKW 5t FKue Iveco|98|3|43|73|0|0|7150|100|-1|||
141|835|SR Fz|227|7|124|100|2|0|7700|150|-1|||
142|836|Inst Fz|232|7|126|100|2|0|7700|150|-1|||
143|837|Video Fz|239|7|127|99|1|0|7850|50|-1|||
144|838|Mobiles Auditorium|288|7|128|98|0|0|7900|50|-1|||
145|839|SR Fz (Kp)|289|7|122|100|2|0|7700|150|-1|||
146|840|SR Fz (Zg)|290|7|123|100|2|0|7700|150|-1|||
147|841|SR (Kp)|188|6|102|18|0|0|3000|150|-1|||
148|842|SR (Zg)|188|6|103|18|0|0|3000|150|-1|||
150|843|LKW 14t 8x8 MULTI|294|3|45|74|0|0|7250|100|-1|||
151|845|FzKran le tmil|295|3|47|76|0|0|7450|25|-1|||
152|846|FzKran (MAN/Magierus/KHD)|296|3|47|77|0|0|7475|25|-1|||
154|865|Rgmt|214|1|1|0|0|0|0|0|-1|||
155|866|Btl|215|1|2|0|0|0|0|0|-1|||
156|867|Kp|216|1|3|0|0|0|0|0|-1|||
157|868|KpFüGrp|217|1|4|0|0|0|0|0|-1|||
158|869|Zg|123|1|5|0|0|0|0|0|-1|||
159|872|ZgTrp|226|1|6|0|0|0|0|0|-1|||
160|870|Grp|218|1|7|0|0|0|0|0|-1|||
161|871|Trp|219|1|8|0|0|0|0|0|-1|||
162|873|BtlFüGrp|222|1|2|0|0|0|0|0|-1|||
163|423|FschJgBtl|27|1|2|0|0|0|0|0|-1|||
165|445|GebJgBtl|49|1|2|0|0|0|0|0|-1|||
166|446|GebJgBtlFüGrp|50|1|2|0|0|0|0|0|-1|||
170|523|PzAufklBtl|231|1|2|0|0|0|0|0|-1|||
171|531|PzBtl|135|1|2|0|0|0|0|0|-1|||
173|534|PzGrenBtl|138|1|2|0|0|0|0|0|-1|||
174|585|StabsKp (FschJgBtl)|189|1|3|0|0|0|0|0|-1|||
175|586|StabsKp (GebJgBtl)|190|1|3|0|0|0|0|0|-1|||
177|588|StabsKp (PzBtl)|192|1|3|0|0|0|0|0|-1|||
178|589|StabsKp (PzGrenBtl)|193|1|3|0|0|0|0|0|-1|||
179|2134|SRGrp|220|10|7|0|0|0|0|0|-1|||
181|2136|VideoGrp|208|10|-1|0|0|0|0|0|-1|||
182|2137|VideoTrp|208|10|-1|0|0|0|0|0|-1|||
183|3886|PAH 1A1|124|8|141|90|1|0|7650|50|-1|||
186|3926|KPz LEO 2A6|230|2|21|61|2|0|4100|300|-1| | |
187|3931|FlaRakWaTrgt OZELOT|300|2|28|26|2|0|4900|50|-1|||
188|3932|SpähWg FENNEK|301|2|25|66|2|0|7600|50|-1| | |
189|3935|PzAbwRiMi|310|2|29|0|0|0|0|0|-1|||
190|3936|LKW 7t MULTI|99|3|44|75|0|0|7350|100|-1|||
191|3937|EAG|308|3|48|80|0|0|7500|25|-1|||
192|3938|EAM/AS6M|308|3|48|81|0|0|7525|25|-1|||
193|468|Jabo|72|8|142|89|0|0|8050|50|-1|||
194|4399|TEP|456|1|1|0|0|0|0|0|-1|||
195|4735|Aufklärer|425|8|142|89|0|0|8050|50|-1|||
196|4736|Anflugpunkt|551|8|143|0|0|0|0|0|-1|||
197|4886|TetraDEFla|916|8|142|89|0|0|8050|50|-1| | |
201|4845|MOUT-Ebene|240|1|7|0|0|0|0|0|0|||
224||MUNGO|831|4|64|79|1|0|5550|50|-1| | |
57|321|LKW gl le San|95|3|41|40|1|0|6150|100|-1| | |
58|322|LLPz Wiesel|105|2|23|25|1|0|4750|50|-1| | |
185|3934|ABC-Warngeber|298|5|88|91|0|0|8000|50|-1| | |
136|820|Pz Haubitze M109|229|4|67|69|1|0|5250|50|-1| | |
113|377|SR Stab|188|6|104|18|0|0|3000|150|-1| | |
149|831|Wirkungsdarsteller|293|6|107|18|0|0|3000|150|-1| | |
43|3885|KPz LEO 1A5|230|2|21|55|2|1|3200|300|-1| | |
132|814|KPz LEO 2A4|230|2|21|57|2|1|3500|300|-1| | |
133|815|KPz LEO 2A5|230|2|21|59|2|1|3800|300|-1| | |
8|272|BeobPz Art M113|9|4|66|52|2|0|5300|50|-1| | |
49|313|LKW 2t gl KrKw|95|3|42|43|1|0|6450|50|-1| | |
55|319|LKW gl le kurz/FüFu|92|3|41|38|1|0|6050|100|-1| | |
59|323|LLPz WIESEL TOW|106|2|23|28|1|0|4700|50|-1| | |
60|324|MiRPz KEILER|112|4|69|32|1|0|5600|50|-1| | |
64|328|MiW SKORPION|115|4|68|33|1|0|5650|50|-1| | |
108|372|SpähPz LUCHS|182|2|24|24|2|0|5000|200|-1| | |
109|373|SpürPz FUCHS|183|4|65|36|1|0|6000|50|-1| | |
110|580|SPz MARDER 1A3|184|2|22|21|2|2|4400|300|-1| | |
111|375|SPz MARDER VBMrs|185|2|22|21|2|2|4400|300|-1| | |
115|379|TPz FUCHS (Jäger)|197|4|64|35|1|0|5900|100|-1| | |
134|817|LLPz WIESEL LeFaSys|286|2|23|68|1|0|4950|50|-1| | |
135|819|Pz Haubitze 2000|229|4|67|65|1|0|5200|50|-1| | |
137|821|BeobPz Art LEO 1A5|284|4|67|51|2|0|5350|50|-1| | |
138|822|BPz LEO 1 Standard|11|4|72|64|1|0|5750|50|-1| | |
139|834|WD Fz (DMF)|228|7|125|20|1|0|7950|50|-1| | |
153|844|Soldat/Fu|201|5|83|5|1|0|500|2500|-1| | |
214||Moerser M113|923|4|62|67|1|0|5550|50|-1| | |
215||FüFu M113|929|4|61|53|1|0|5400|100|-1| | |
223||SR Wolf NL|227|7|124|85|2|0|9500|100|-1| | |
227||KrKw M113|95|4|63|50|1|0|5500|50|-1| | |
232||TPz FUCHS (1A8)|197|4|64|37|1|0|0|0|-1| | |
233||LKW NLK 0.5t|0|3|41|6|0|0|0|0|-1| | |
230||KPz LEO 2A5 (F)|230|2|21|60|2|1|3800|300|-1| | |
125|389|KpChef|813|5|81|5|1|0|500|2500|-1| | |
126|390|ZgFhr|814|5|81|5|1|0|500|2500|-1| | |
127|391|GrpFhr|815|5|81|5|1|0|500|2500|-1| | |
124|388|BtlKdr|811|5|81|5|1|0|500|2500|-1| | |
231||KPz LEO 2A7|230|2|21|63|2|0|0|0|-1| | |
234||GTF 15t|294|4|67|87|1|0|0|0|-1| | |
@@ -1,56 +0,0 @@
#
# $Id$
# $HeadURL$
# $Author$
#
#ADD_SUBDIRECTORY(Data)
#ADD_SUBDIRECTORY(Gui)
#
# Gui Plugin Interface
#
ADD_INTERFACE_LIBRARY(AlmGuiPluginInterface
${CMAKE_CURRENT_SOURCE_DIR}/alm_gui_plugin_interface.h
${CMAKE_CURRENT_SOURCE_DIR}/..
GuiPluginInterface
)
#
# Gui Plugin Interface
#
ADD_INTERFACE_LIBRARY(AlmInfoGuiPluginInterface
${CMAKE_CURRENT_SOURCE_DIR}/alm_info_gui_plugin_interface.h
${CMAKE_CURRENT_SOURCE_DIR}/..
GuiPluginInterface
)
#
# Data Plugin Interface
#
ADD_INTERFACE_LIBRARY(AlmDataPluginInterface
${CMAKE_CURRENT_SOURCE_DIR}/alm_data_plugin_interface.h
${CMAKE_CURRENT_SOURCE_DIR}/..
DataPluginInterface
svcAlmCommon
)
#
# $Id$
# $HeadURL$
# $Author$
# Created by Mike Wille, SLSE, 2017-01-11
#
ADD_SUBDIRECTORY(Data)
ADD_SUBDIRECTORY(Gui)
#
# Gui Plugin Interface
#
#NGL_ADD_LIBRARY2(WS AlmGuiPluginInterface SHARED alm_gui_plugin_interface.h)
#NGL_TARGET_LINK_LIBRARIES(AlmGuiPluginInterface
# Qt6::Core
# GuiPluginInterface
#)
#NGL_INSTALL_TARGET(AlarmGuiPluginInterface)
@@ -1,18 +0,0 @@
#
# $Id$
# $HeadURL$
# $Author$
# Created by Mike Wille, SLSE; 2016-09-06
#
#
# Data Plugin
#
NGL_ADD_LIBRARY2(WS AlmDataPlugin MODULE alm_data_plugin.cpp alm_data_plugin.h)
NGL_TARGET_LINK_LIBRARIES(AlmDataPlugin
Qt6::Core
AlmDataPluginInterface
svcAlmClient
NGLLogger
LtsSessionDataDds
)
@@ -1,28 +0,0 @@
#include "alm_data_plugin.h"
#include <DDS/DDSConnector/dds_connector.h>
#include <LtsSession/lts_session_data_dds.h>
namespace AlarmManagement
{
std::shared_ptr<DataPluginBase::Interface> DataPlugin::createDataInterface(LtsSession::LtsSessionDataDds *session)
{
std::shared_ptr<AlarmManagement::Interface::Dtc> dtc;
std::shared_ptr<AlarmManagement::Interface::Ftc> ftc;
if (!session->createTopicClient(dtc, ftc))
return std::shared_ptr<DataPluginBase::Interface>();
return std::make_shared<DataInterfaceImpl>(dtc,ftc);
}
DataInterfaceImpl::DataInterfaceImpl(const std::shared_ptr<AlarmManagement::Interface::Dtc> &dtc,
const std::shared_ptr<AlarmManagement::Interface::Ftc> &ftc)
: DataInterface()
, m_dtc(dtc)
, m_ftc(ftc)
{}
}
@@ -1,49 +0,0 @@
#pragma once
#include <PluginInterfaces/data_plugin_interface.h>
#include <AlarmManagement/alm_data_plugin_interface.h>
#include <AlarmManagement/alm_dtc.h>
#include <AlarmManagement/alm_ftc.h>
namespace AlarmManagement
{
class DataPlugin final : public DataPluginBase::Plugin
{
Q_PLUGIN_METADATA(IID "data:3:alm")
Q_OBJECT
public:
DataPlugin() = default;
~DataPlugin() = default;
QString pluginName() const override { return QStringLiteral("AlarmManagement"); }
std::shared_ptr<DataPluginBase::Interface> createDataInterface(LtsSession::LtsSessionDataDds *session) override;
bool availableInPartition(IDL::PartitionType partition) const override
{
return partition == IDL::PartitionType::Exercise
|| partition == IDL::PartitionType::Replay;
}
};
class DataInterfaceImpl final : public DataInterface
{
public:
explicit DataInterfaceImpl(const std::shared_ptr<AlarmManagement::Interface::Dtc> &dtc,
const std::shared_ptr<AlarmManagement::Interface::Ftc> &ftc);
std::shared_ptr<AlarmManagement::Interface::Dtc> getDtc() override { return m_dtc; }
std::shared_ptr<AlarmManagement::Interface::Ftc> getFtc() override { return m_ftc; }
private:
std::shared_ptr<AlarmManagement::Interface::Dtc> m_dtc;
std::shared_ptr<AlarmManagement::Interface::Ftc> m_ftc;
};
}
@@ -1,10 +0,0 @@
#
# $Id$
# $HeadURL$
# $Author$
#
ADD_SUBDIRECTORY(Common)
ADD_SUBDIRECTORY(ConfigAlarm)
ADD_SUBDIRECTORY(ConfigParticipantAlarm)
ADD_SUBDIRECTORY(EmergencyCalls)
@@ -1,52 +0,0 @@
#
# $Id$
# $HeadURL$
# $Author$
# Created by Mike Wille, SLSE, 2016-09-06
#
#
# Data Plugin
#
# Make ${Qt6_Widgets} optional
if(QT6_GUI_AVAILABLE AND TARGET Qt6::Widgets)
set(Qt6_Widgets ${Qt6_Widgets})
else()
set(Qt6_Widgets "")
endif()
IF(BUILD_RTI)
SET(alarm_common_gui_SRCS
alm_history_alarm_model.cpp
alm_history_alarm_model.h
alm_config_alarm_model.cpp
alm_config_alarm_model.h
)
NGL_ADD_LIBRARY2(WS AlmCommon SHARED ${alarm_common_gui_SRCS} )
if(QT6_GUI_AVAILABLE)
NGL_TARGET_LINK_LIBRARIES(AlmCommon
PRIVATE
${Qt6_Widgets}
LtsSession
LtsSessionData
LtsCoordTrans
NGLLogger
PUBLIC
Qt6::Core
nglwidgets
svcPpmCommon
svcAlmCommon
svcAesCommon
advancedSymbology
advancedSymbologyGui
ngltools
svcGnaCommon
)
endif()
NGL_TARGET_INCLUDE_DIRECTORIES(AlmCommon
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/../../Proxies/GuezNasat/
)
ENDIF(BUILD_RTI)
@@ -1,157 +0,0 @@
#include "alm_config_alarm_model.h"
#include <AlarmManagement/alm_translation.h>
#include <GuezNasat/logger.h>
#include <LtsSession/lts_session_data.h>
#include <LtsUtilsCore/data_modification_enum.h>
#include <ProjectDataManagement/pdm_to_string.h>
#include <algorithm>
namespace AlarmManagement
{
namespace
{
NGL::INGLLogger& getLogger()
{
static auto& logger = GuezNasat::getLogger("AlarmManagement.ConfigAlarmModel");
return logger;
}
} // namespace
ConfigAlarmModel::ConfigAlarmModel(QObject* parent)
: LtsWidgets::LtsAbstractTableModel<AlarmManagement::AlarmConfig>(
{tr("Id"), tr("Equip. No."), tr("Designator"), tr("Tact. Identifier"), tr("Vulnerability State"),
tr("Event Type"), tr("Message Window"), tr("Set Marker")},
parent),
m_dtc(nullptr), m_ppmDtc(nullptr), m_alarmHistoryModel(nullptr), m_global(false)
{
}
bool ConfigAlarmModel::initModel(const std::shared_ptr<AlarmManagement::Interface::Dtc>& dtc,
const std::shared_ptr<ParticipantManagement::Interface::Dtc>& ppmDtc,
AlarmHistoryModel* alarmHistoryModel, bool global)
{
m_dtc = dtc;
m_ppmDtc = ppmDtc;
m_alarmHistoryModel = alarmHistoryModel;
m_global = global;
// STUB: alarmConfigs() und enableAlarmConfig() nicht verfügbar
// const QMap<qint32, AlarmManagement::AlarmConfig> alarmConfigs = m_dtc->alarmConfigs();
INFO_LOG(getLogger()) << "initModel - STUB mode (alarmConfigs not available)";
// STUB: alarmConfigChanged Signal nicht verfügbar
// connect(m_dtc.get(), &Interface::Dtc::alarmConfigChanged, this, &ConfigAlarmModel::onAlarmConfigChanged);
// STUB: enableAlarmConfig() nicht verfügbar
// m_dtc->enableAlarmConfig();
// STUB: alarmConfigs(callback) nicht verfügbar
// auto cb = [this](const AlarmManagement::AlarmConfig& d) { onAlarmConfigChanged(d, DataModification::eAdded); };
// m_dtc->alarmConfigs(cb);
return true;
}
QVariant ConfigAlarmModel::data(const QModelIndex& index, int role) const
{
DEBUG_LOG(getLogger()) << "AlarmManagementModel::data";
if (role != Qt::DisplayRole || !indexIsValid(index))
return QVariant();
const AlarmManagement::AlarmConfig& alarmConfig = m_vecData.at(index.row());
if (alarmConfig.global != m_global)
return QVariant();
switch (index.column())
{
case Id:
return alarmConfig.id;
case EquipmentNumber: {
const int equipmentNumber = m_alarmHistoryModel->participantId2EquipNo(alarmConfig.participantId);
if (equipmentNumber == 0)
return tr("All");
return equipmentNumber;
}
case Designator:
return m_alarmHistoryModel->getDesignator(alarmConfig.participantId);
case TactIdentifier:
return m_alarmHistoryModel->getTactIdentifier(alarmConfig.participantId);
case VulnerabilityState: {
QString vulnerabilityState = tr("All Types");
if (alarmConfig.vulnerabilityState >= 0)
{
ParticipantManagement::TypeClass typeClass =
m_ppmDtc->type(m_ppmDtc->participant(alarmConfig.participantId).typeId).typeClass;
const ProjectDataManagement::VulnerabilityClass vc =
typeClass == ParticipantManagement::TypeClass::Human
? ProjectDataManagement::VulnerabilityClass::VulnerabilityClass_SoldierInjuries
: ProjectDataManagement::VulnerabilityClass::VulnerabilityClass_VehicleDamages;
ProjectDataManagement::VulnerabilityState vs =
static_cast<ProjectDataManagement::VulnerabilityState>(alarmConfig.vulnerabilityState);
vulnerabilityState = ProjectDataManagement::toString(vs, vc);
}
return vulnerabilityState;
}
case EventType:
return ProjectDataManagement::toString(static_cast<ProjectDataManagement::PdmEventType>(alarmConfig.eventTypeId));
case MessageWindow:
return alarmConfig.messageWindow ? tr("Yes") : tr("No");
case SetMarker:
return alarmConfig.setMarker ? tr("Yes") : tr("No");
}
return QVariant();
}
void ConfigAlarmModel::onAlarmConfigChanged(const AlarmManagement::AlarmConfig& data, const DataModification modType)
{
const int id = data.id;
if (data.global != m_global)
return;
int row = findRowForId(id);
const int eventTypeId = static_cast<int>(data.eventTypeId);
const bool messageWindow = data.messageWindow;
const bool setMarker = data.setMarker;
DEBUG_LOG(getLogger()) << "onAlarmConfigChanged: " << eventTypeId << " messageWindow=" << messageWindow << "setMarker"
<< setMarker;
switch (modType)
{
case DataModification::eRemoved: {
DEBUG_LOG(getLogger()) << "AlarmConfig was removed: " << id;
AlarmManagement::AlarmConfig data1 = data;
data1.messageWindow = false;
data1.setMarker = false;
setRowData(row, data1);
removeRow(row);
return;
}
case DataModification::eModified: {
DEBUG_LOG(getLogger()) << "DataModification::eModified: ";
if (row < 0)
{
return;
}
if (m_alarmHistoryModel->participantId2EquipNo(data.participantId) > 0)
setRowData(row, data);
break;
}
case DataModification::eAdded: {
DEBUG_LOG(getLogger()) << "DataModification::eAdded";
insertRow(data);
}
break;
}
}
} // namespace AlarmManagement
@@ -1,49 +0,0 @@
#pragma once
#include "alm_history_alarm_model.h"
#include "almcommon_export.h"
#include <AlarmManagement/alm_dtc.h>
#include <GuezNasat/logger.h>
#include <LtsSession/lts_session.h>
#include <LtsWidgets/lts_abstract_table_model.h>
#include <LtsUtils/LtsUtilsCore/data_modification_enum.h>
namespace AlarmManagement
{
class ALMCOMMON_EXPORT ConfigAlarmModel final : public LtsWidgets::LtsAbstractTableModel<AlarmManagement::AlarmConfig>
{
Q_OBJECT
public:
enum Columns {
Id,
EquipmentNumber,
Designator,
TactIdentifier,
VulnerabilityState,
EventType,
MessageWindow,
SetMarker
};
explicit ConfigAlarmModel(QObject* parent = nullptr);
bool initModel(const std::shared_ptr<AlarmManagement::Interface::Dtc>& dtc,
const std::shared_ptr<ParticipantManagement::Interface::Dtc>& ppmDtc,
AlarmHistoryModel* alarmHistoryModel, bool global);
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
private slots:
void onAlarmConfigChanged(const AlarmManagement::AlarmConfig& data, const DataModification modType);
private:
std::shared_ptr<AlarmManagement::Interface::Dtc> m_dtc;
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_ppmDtc;
AlarmHistoryModel* m_alarmHistoryModel;
bool m_global;
};
} // namespace AlarmManagement
@@ -1,270 +0,0 @@
#include "alm_history_alarm_model.h"
#include <AlarmManagement/alm_translation.h>
#include <LtsCoordTrans/lts_coord_trans.h>
#include <LtsSession/lts_session_data.h>
#include <LtsUtils/LtsUtilsCore/data_modification_enum.h>
#include <ParticipantManagement/ppm_translation.h>
#include <ProjectDataManagement/pdm_translation.h>
#include <QtCore/QJsonDocument>
#include <QtCore/QJsonObject>
#include <QJsonParseError>
#include <ngltools/ngltools_dtg.h>
namespace AlarmManagement
{
AlarmHistoryModel::AlarmHistoryModel(QObject* parent)
: LtsWidgets::LtsAbstractTableModel<NotificationEx>(
{
tr("Id"),
tr("Date"),
tr("Incident"),
tr("Equip. No."),
tr("Hierarchie"),
tr("Participant Id"),
tr("Position"),
tr("Aes Id"),
tr("Aes Name"),
},
parent),
m_dtc(nullptr), m_ppmDtc(nullptr), m_aesDtc(nullptr)
{
}
bool AlarmHistoryModel::initModel(const std::shared_ptr<AlarmManagement::Interface::Dtc>& dtc,
const std::shared_ptr<ParticipantManagement::Interface::Dtc>& ppmDtc,
const std::shared_ptr<AreaEffectSimulation::Interface::Dtc>& aesDtc)
{
m_dtc = dtc;
m_ppmDtc = ppmDtc;
m_aesDtc = aesDtc;
connect(m_dtc.get(), &Interface::Dtc::notificationChanged, this, &AlarmHistoryModel::onNotificationChanged);
connect(m_ppmDtc.get(), &ParticipantManagement::Interface::Dtc::participantChanged, this,
&AlarmHistoryModel::onParticipantChanged);
// Register callbacks instead of enableParticipant()
const auto cbParticipants = [this](const ParticipantManagement::Participant& participant) {
onParticipantChanged(participant, DataModification::eAdded);
};
m_ppmDtc->participants(cbParticipants);
const auto cbNotifications = [this](const AlarmManagement::Notification& notification) {
onNotificationChanged(notification, DataModification::eAdded);
};
m_dtc->notifications(cbNotifications);
connect(m_aesDtc.get(), &AreaEffectSimulation::Interface::Dtc::boobyTrapChanged, this,
&AlarmHistoryModel::onBoobyTrapChanged);
connect(m_aesDtc.get(), &AreaEffectSimulation::Interface::Dtc::offRouteMineChanged, this,
&AlarmHistoryModel::onOffRouteMineChanged);
auto cbAesItem = [this](const AreaEffectSimulation::AesItem& item) {
onAesItemChanged(item, DataModification::eAdded);
};
m_aesDtc->bCContaminations(cbAesItem);
m_aesDtc->boobyTraps(cbAesItem);
m_aesDtc->offRouteMines(cbAesItem);
return true;
}
QVariant AlarmHistoryModel::data(const QModelIndex& index, int role) const
{
if (!indexIsValid(index))
return QVariant();
if ((role != Qt::DisplayRole) && (role != Qt::UserRole) && (role != Qt::BackgroundRole))
return QVariant();
const NotificationEx& notificationEx = m_vecData.at(index.row());
if (role == Qt::BackgroundRole)
{
if (notificationEx.eventType == ProjectDataManagement::PdmEventType::EventType_EmergencyCall)
return QColor(Qt::red);
return QVariant();
}
switch (index.column())
{
case Id:
return notificationEx.id;
case Date:
return QDateTime::fromMSecsSinceEpoch(notificationEx.time);
case EquipmentNumber:
if (notificationEx.equipmentNumber)
return notificationEx.equipmentNumber;
break;
case Incident:
return ProjectDataManagement::toString(static_cast<ProjectDataManagement::PdmEventType>(notificationEx.eventTypeId));
case Hierarchie:
return m_ppmDtc->hierarchyFromParticipant(notificationEx.participantId);
case ParticipantId:
return notificationEx.participantId;
case Position:
if (role == Qt::DisplayRole)
return LtsCoordTrans::mgrsFromGeographic(notificationEx.position.lon,
notificationEx.position.lat);
else if (role == Qt::UserRole)
return QPointF(notificationEx.position.lon, notificationEx.position.lat);
break;
case AesId:
return notificationEx.aesId;
case AesName:
return m_aesNameMap.value(notificationEx.aesId, tr("-"));
}
return QVariant();
}
bool AlarmHistoryModel::isFiltered(const NotificationEx& data, DataModification modType) const
{
Q_UNUSED(modType);
if (data.operatorId == 0)
return false;
return data.operatorId != LtsSessionData::LtsSessionData::getInstance()->getOperatorId();
}
void AlarmHistoryModel::onNotificationChanged(const AlarmManagement::Notification& data, const DataModification modType)
{
if (modType == DataModification::eRemoved)
return;
NotificationEx notification(data);
const QByteArray properties = QByteArray::fromRawData(data.properties.c_str(), data.properties.size());
const QJsonDocument propertieJsonDoc = QJsonDocument::fromJson(properties);
const QJsonObject propertieJsonObj = propertieJsonDoc.object();
notification.equipmentNumber = data.equipmentNumber;
if (data.participantId.has_value())
notification.participantId = data.participantId.value();
notification.eventTypeId = static_cast<ProjectDataManagement::PdmEventType>(data.eventType);
if (data.aesId.has_value())
notification.aesId = data.aesId.value();
const int global = propertieJsonObj[QStringLiteral("Global")].toInt();
const int friendlyFire = propertieJsonObj[QStringLiteral("FriendlyFire")].toInt();
DEBUG_LOG(getLogger("AlarmHistoryModel")) << Q_FUNC_INFO << " notification id=" << data.id
<< ", Global: " << global << ", FriendlyFire: " << friendlyFire;
onDataChanged(notification, modType);
}
void AlarmHistoryModel::onParticipantChanged(const ParticipantManagement::Participant& participant,
const DataModification modType)
{
if (modType == DataModification::eRemoved)
return;
QString designator = QString::fromStdString(participant.designator);
m_idDesignatorMap.insert(participant.id, designator);
const int equipNo = participant.equipmentNumber.has_value() ? participant.equipmentNumber.value() : 0;
m_partId2EquipNoMap.insert(participant.id, equipNo);
QString tacticalIdentifier = QString::fromStdString(participant.tacticalIdentifier);
m_idTactIdentifierMap.insert(participant.id, tacticalIdentifier);
DEBUG_LOG(getLogger("AlarmHistoryModel")) << Q_FUNC_INFO << " id=" << participant.id << " designator=" << designator
<< " tacticalIdentifier=" << tacticalIdentifier;
}
int AlarmHistoryModel::participantId2EquipNo(const int participantId) const
{
int ret = m_partId2EquipNoMap.value(participantId, 0);
INFO_LOG(getLogger("AlarmHistoryModel")) << "participantId2EquipNo participantId=" << participantId << " EquipmentNumber=" << ret;
return ret;
}
QString AlarmHistoryModel::getDesignator(const int participantId) const
{
QString designator = m_idDesignatorMap.value(participantId);
DEBUG_LOG(getLogger("AlarmHistoryModel")) << "m_idDesignatorMap.value(participantId)=" << designator;
return designator;
}
QString AlarmHistoryModel::getTactIdentifier(const int participantId) const
{
QString tactIdentifier = m_idTactIdentifierMap.value(participantId);
DEBUG_LOG(getLogger("AlarmHistoryModel")) << "m_idTactIdentifierMap.value(participantId)=" << tactIdentifier;
return tactIdentifier;
}
void AlarmHistoryModel::onBCContaminationChanged(const AreaEffectSimulation::BCContamination& data,
const DataModification modType)
{
if (modType == DataModification::eRemoved)
return;
int id = data.id;
QString name = QString::fromStdString(data.name);
m_aesNameMap[id] = name;
DEBUG_LOG(getLogger("AlarmHistoryModel")) << "onBCContaminationChanged: id=" << id << " Name=" << name;
}
void AlarmHistoryModel::onBoobyTrapChanged(const AreaEffectSimulation::BoobyTrap& data, const DataModification modType)
{
if (modType == DataModification::eRemoved)
return;
int id = data.id;
QString name = QString::fromStdString(data.name);
m_aesNameMap[id] = name;
DEBUG_LOG(getLogger("AlarmHistoryModel")) << "BoobyTrap: id=" << id << " Name=" << name;
}
void AlarmHistoryModel::onOffRouteMineChanged(const AreaEffectSimulation::OffRouteMine& data,
const DataModification modType)
{
if (modType == DataModification::eRemoved)
return;
int id = data.id;
QString name = QString::fromStdString(data.name);
m_aesNameMap[id] = name;
DEBUG_LOG(getLogger("AlarmHistoryModel")) << "OffRouteMine: id=" << id << " Name=" << name;
}
void AlarmHistoryModel::onAesItemChanged(const AreaEffectSimulation::AesItem& item, const DataModification modType)
{
if (modType == DataModification::eRemoved)
return;
QString name = QString::fromStdString(item.name);
int id = item.id;
m_aesNameMap[id] = name;
DEBUG_LOG(getLogger("AlarmHistoryModel")) << "AreaEffectSimulation::AesItem onAesItemChanged: id=" << id
<< " Name=" << name;
}
void AlarmHistoryProxyModel::setSourceModel(QAbstractItemModel* sourceModel)
{
m_sourceModel = qobject_cast<AlarmHistoryModel*>(sourceModel);
LtsWidgets::LtsColumnFilterProxyModel::setSourceModel(sourceModel);
}
bool AlarmHistoryProxyModel::lessThan(const QModelIndex& source_left, const QModelIndex& source_right) const
{
if (!m_sourceModel || source_left.column() != source_right.column() || !source_left.isValid() ||
!source_right.isValid())
return LtsWidgets::LtsColumnFilterProxyModel::lessThan(source_left, source_right);
const auto& dataLeft = m_sourceModel->m_vecData.at(source_left.row());
const auto dataRight = m_sourceModel->m_vecData.at(source_right.row());
switch (source_left.column())
{
case AlarmHistoryModel::Date:
return dataLeft.time < dataRight.time;
case AlarmHistoryModel::Id:
case AlarmHistoryModel::Incident:
case AlarmHistoryModel::EquipmentNumber:
case AlarmHistoryModel::Hierarchie:
case AlarmHistoryModel::ParticipantId:
case AlarmHistoryModel::Position:
case AlarmHistoryModel::AesId:
case AlarmHistoryModel::AesName:
break;
}
return LtsWidgets::LtsColumnFilterProxyModel::lessThan(source_left, source_right);
}
} // namespace AlarmManagement
@@ -1,86 +0,0 @@
#pragma once
#include "almcommon_export.h"
#include <AlarmManagement/alm_dtc.h>
#include <AlarmManagement/logger.h>
#include <AreaEffectSimulation/aes_dtc.h>
#include <LtsUtils/LtsUtilsCore/data_modification_enum.h>
#include <LtsWidgets/lts_abstract_table_model.h>
#include <LtsWidgets/lts_column_filter_proxy_model.h>
#include <ParticipantManagement/ppm.hpp>
#include <ParticipantManagement/ppm_dtc.h>
#include <ProjectDataManagement/pdm_enums.hpp>
namespace AlarmManagement
{
struct NotificationEx : public AlarmManagement::Notification
{
int equipmentNumber = 0;
int participantId = 0;
int aesId = 0;
ProjectDataManagement::PdmEventType eventTypeId = ProjectDataManagement::PdmEventType::EventType_Unknown;
NotificationEx() = default;
explicit NotificationEx(const AlarmManagement::Notification& n) : AlarmManagement::Notification(n) {}
};
class ALMCOMMON_EXPORT AlarmHistoryModel final : public LtsWidgets::LtsAbstractTableModel<NotificationEx>
{
Q_OBJECT
public:
enum Columns { Id, Date, Incident, EquipmentNumber, Hierarchie, ParticipantId, Position, AesId, AesName };
explicit AlarmHistoryModel(QObject* parent = nullptr);
bool initModel(const std::shared_ptr<AlarmManagement::Interface::Dtc>& dtc,
const std::shared_ptr<ParticipantManagement::Interface::Dtc>& ppmDtc,
const std::shared_ptr<AreaEffectSimulation::Interface::Dtc>& aesDtc);
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
int participantId2EquipNo(const int participantId) const;
QString getDesignator(const int participantId) const;
QString getTactIdentifier(const int participantId) const;
protected:
bool isFiltered(const NotificationEx& data, DataModification modType) const override;
public slots:
void onNotificationChanged(const AlarmManagement::Notification& data, const DataModification modType);
void onParticipantChanged(const ParticipantManagement::Participant& participant, const DataModification modType);
void onAesItemChanged(const AreaEffectSimulation::AesItem& item, const DataModification modType);
void onBCContaminationChanged(const AreaEffectSimulation::BCContamination& data, const DataModification modType);
void onBoobyTrapChanged(const AreaEffectSimulation::BoobyTrap& data, const DataModification modType);
void onOffRouteMineChanged(const AreaEffectSimulation::OffRouteMine& data, const DataModification modType);
private:
std::shared_ptr<AlarmManagement::Interface::Dtc> m_dtc;
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_ppmDtc;
std::shared_ptr<AreaEffectSimulation::Interface::Dtc> m_aesDtc;
QMap<int, int> m_partId2EquipNoMap;
QHash<int, QString> m_idDesignatorMap;
QHash<int, QString> m_idTactIdentifierMap;
QHash<int, QString> m_aesNameMap;
friend class AlarmHistoryProxyModel;
};
class ALMCOMMON_EXPORT AlarmHistoryProxyModel final : public LtsWidgets::LtsColumnFilterProxyModel
{
Q_OBJECT
public:
using LtsWidgets::LtsColumnFilterProxyModel::LtsColumnFilterProxyModel;
void setSourceModel(QAbstractItemModel* sourceModel) override;
protected:
bool lessThan(const QModelIndex& source_left, const QModelIndex& source_right) const override;
private:
AlarmHistoryModel* m_sourceModel = nullptr;
};
} // namespace AlarmManagement
@@ -1,55 +0,0 @@
#
# $Id$
# $HeadURL$
# $Author$
# Created by Patric Karwat, SLSE, 2016-10-05
#
# Make ${Qt6_Widgets} optional
if(QT6_GUI_AVAILABLE AND TARGET Qt6::Widgets)
set(Qt6_Widgets ${Qt6_Widgets})
else()
set(Qt6_Widgets "")
endif()
SET(alm_config_alarm_gui_SRCS
alm_config_alarm_gui_plugin.cpp
alm_config_alarm_gui_plugin.h
alm_dialog.cpp
alm_dialog.h
alm_history.cpp
alm_history.h
)
NGL_WRAP_UI(alm_config_alarm_gui_SRCS
alm_dialog.ui
alm_history.ui
)
NGL_ADD_LIBRARY(WS AlmConfigAlarmGuiPlugin MODULE ${alm_config_alarm_gui_SRCS})
if(QT6_GUI_AVAILABLE)
NGL_TARGET_LINK_LIBRARIES(AlmConfigAlarmGuiPlugin
LtsPrinting
AlmCommon
LtsSession
LtsSessionData
LtsUtilsSettings
AlmGuiPluginInterface
AlmDataPluginInterface
$<IF:$<TARGET_EXISTS:svcPdmCommon>,svcPdmCommon,> # pdm_enums.h in alm_dialog.cpp
svcPpmCommon
GuiPluginInterface
${Qt6_Widgets}
LtsCoordTrans
LtsWidgets
LtsDataView
SituationMapGuiPluginInterface
NGLLogger
LtsUtilsGuiDds
LtsAppManager # get sessions to look on which one to open alarm history
)
endif()
NGL_INSTALL_TARGET(AlmConfigAlarmGuiPlugin)
@@ -1,161 +0,0 @@
#include "alm_config_alarm_gui_plugin.h"
#include "alm_dialog.h"
#include "alm_history.h"
#include <AlarmManagement/alm_operator_rights.h>
#include <AreaEffectSimulation/aes_data_plugin_interface.h>
#include <ParticipantManagement/ppm_data_plugin_interface.h>
#include <LtsSession/lts_session.h>
#include <LtsSession/lts_session_data.h>
#include <QtCore/QJsonDocument>
#include <QtCore/QJsonObject>
#include <LtsCoordTrans/lts_coord_trans.h>
#include <ngltools/ngltools_dtg.h>
#include <LtsAppManager/lts_app_manager.h>
namespace AlarmManagement
{
std::shared_ptr<GuiPluginBase::Interface> GuiPlugin::createGuiInterface(LtsSession::LtsSession *session)
{
return std::make_shared<InterfaceImpl>(session);
}
InterfaceImpl::InterfaceImpl(LtsSession::LtsSession *session)
: GuiPluginBase::Interface(session, getLogger("InterfaceImpl"))
, m_dtc(nullptr)
, m_ftc(nullptr)
, m_ppmDtc(nullptr)
, m_aesDtc(nullptr)
, m_alarmHistoryModel(nullptr)
, m_alarmHistoryDialogIdentifier(QStringLiteral("almAlarmHistory"))
, m_alarmHistoryDialogLayoutArea(LtsWidgets::LayoutArea::eInfoTab)
{
}
bool InterfaceImpl::fetchInterfaces()
{
if (!m_session->getDtc<AlarmManagement::DataInterface>(m_dtc))
return false;
if (!m_session->getFtc<AlarmManagement::DataInterface>(m_ftc))
return false;
if (!m_session->getDtc<ParticipantManagement::DataInterface>(m_ppmDtc))
return false;
if (!m_session->getDtc<AreaEffectSimulation::DataInterface>(m_aesDtc))
return false;
return true;
}
void InterfaceImpl::clearInterfaces()
{
m_ppmDtc = nullptr;
m_aesDtc = nullptr;
m_ftc = nullptr;
m_dtc = nullptr;
}
void InterfaceImpl::showEmergencyMessage(const AlarmManagement::Notification &data)
{
if (data.eventType != ProjectDataManagement::PdmEventType::EventType_EmergencyCall)
return;
const int issi = data.equipmentNumber;
const QString &positionStr = LtsCoordTrans::mgrsFromGeographic(data.position.lon, data.position.lat);
new LtsWidgets::LtsMessageDialogNew(m_session->baseLayout(),
tr("ISSI: %1 --- Position: %2\n").arg(issi).arg(positionStr),
tr("!!!!!! Emergency Call --- %1 !!!!!").arg(DTG::toStringMSec(data.time)));
}
void InterfaceImpl::showAlarm(const AlarmManagement::Notification &data)
{
showEmergencyMessage(data);
if (data.operatorId == LtsSessionData::LtsSessionData::getInstance()->getOperatorId() ||
data.operatorId == 0)
{
bool bWidgetExists = m_session->widgetExists(menuGroup(), m_alarmHistoryDialogIdentifier, m_alarmHistoryDialogLayoutArea);
if (!bWidgetExists)
m_session->addWidget(onShowHistoryAlarmDialog(), menuGroup(), m_alarmHistoryDialogIdentifier, m_alarmHistoryDialogLayoutArea);
}
}
void InterfaceImpl::onNotificationChanged(const AlarmManagement::Notification &data, const DataModification &mod)
{
if (mod != DataModification::eAdded)
return;
INFO_LOG(m_logger) << "ALARM! data.operatorId(): " << data.operatorId
<< "currentOperatorId: " << LtsSessionData::LtsSessionData::getInstance()->getOperatorId();
if (m_session->widgetExists(menuGroup(), m_alarmHistoryDialogIdentifier, m_alarmHistoryDialogLayoutArea))
{
showEmergencyMessage(data);
return;
}
if (LtsAppManager::LtsAppManager::getInstance()->otherSessionsResponsibility(
m_session, {LtsAppDescriptor::App::Situation}, {IDL::PartitionType::Exercise},
menuGroup(), m_alarmHistoryDialogIdentifier, m_alarmHistoryDialogLayoutArea))
return;
showAlarm(data);
}
QVector<LtsWidgets::PluginData> InterfaceImpl::getActions()
{
QVector<LtsWidgets::PluginData> ret;
LtsWidgets::PluginData plData;
plData.menuGroup = menuGroup();
if (!m_alarmHistoryModel)
{
m_alarmHistoryModel = new AlarmManagement::AlarmHistoryModel(this);
m_alarmHistoryModel->initModel(m_dtc, m_ppmDtc, m_aesDtc);
}
plData.menuText = tr("Configure Global Alarms");
plData.menuIcon = QIcon(QLatin1String("icon:config_global_alarms.svg"));
plData.identifier = QLatin1String("almAlarmConfig");
plData.operatorRight = OperatorRights::ConfigGlobalDialog;
plData.exercisePart = LtsWidgets::ExercisePart::eExecution;
plData.createWidgetFunc = [this](QWidget * parent)
{
return LtsWidgets::initDialog(new AlarmDialog(parent),
m_ftc, m_dtc, m_ppmDtc, m_alarmHistoryModel);
};
ret.append(plData);
plData.menuText = tr("Alarm History");
plData.menuIcon = QIcon(QLatin1String("icon:global_alarms_history.svg"));
plData.identifier = QLatin1String("almAlarmHistory");
plData.operatorRight = OperatorRights::ConfigGlobalDialog;
plData.layoutArea = m_alarmHistoryDialogLayoutArea;
plData.exercisePart = LtsWidgets::ExercisePart::eExecution;
plData.createWidgetFunc = [this](QWidget *)
{
return onShowHistoryAlarmDialog();
};
ret.append(plData);
connect(m_dtc.get(), &AlarmManagement::Interface::Dtc::notificationChanged,
this, &InterfaceImpl::onNotificationChanged);
return ret;
}
LtsWidgets::LtsDialog *InterfaceImpl::onShowHistoryAlarmDialog()
{
return LtsWidgets::initDialog(new AlarmView(m_session),
m_dtc, m_alarmHistoryModel);
}
}
@@ -1,72 +0,0 @@
#pragma once
#include <AlarmManagement/logger.h>
#include <PluginInterfaces/gui_plugin_interface.h>
#include <AlarmManagement/alm_gui_plugin_interface.h>
#include <AlarmManagement/alm_data_plugin_interface.h>
#include <AlarmManagement/Gui/Common/alm_config_alarm_model.h>
#include <AlarmManagement/Gui/Common/alm_history_alarm_model.h>
#include <AreaEffectSimulation/aes_dtc.h>
#include <ParticipantManagement/ppm.hpp>
#include <ParticipantManagement/ppm_dtc.h>
namespace AlarmManagement
{
class GuiPlugin final : public QObject, public GuiPluginBase::Plugin
{
Q_PLUGIN_METADATA(IID "gui:3:alm.configalarm")
Q_INTERFACES(GuiPluginBase::Plugin)
Q_OBJECT
public:
explicit GuiPlugin() = default;
~GuiPlugin() = default;
QString pluginName() override { return QLatin1String("AlarmManagement.GuiPlugin.ConfigAlarm"); }
std::shared_ptr<GuiPluginBase::Interface> createGuiInterface(LtsSession::LtsSession *session) override;
bool availableInPartition(IDL::PartitionType partition) const override
{
return partition == IDL::PartitionType::Exercise;
}
};
class InterfaceImpl final
: public QObject
, public GuiPluginBase::Interface
, public ForeignGuiInterface
{
Q_OBJECT
public:
explicit InterfaceImpl(LtsSession::LtsSession *session);
bool fetchInterfaces() override;
void clearInterfaces() override;
QVector<LtsWidgets::PluginData> getActions() override;
QString menuGroup() const override { return tr("Alarm Management"); }
private:
LtsWidgets::LtsDialog *onShowHistoryAlarmDialog();
void showEmergencyMessage(const AlarmManagement::Notification &data);
void showAlarm(const AlarmManagement::Notification &data);
private:
std::shared_ptr<AlarmManagement::Interface::Dtc> m_dtc;
std::shared_ptr<AlarmManagement::Interface::Ftc> m_ftc;
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_ppmDtc;
std::shared_ptr<AreaEffectSimulation::Interface::Dtc> m_aesDtc;
AlarmHistoryModel *m_alarmHistoryModel;
QString m_alarmHistoryDialogIdentifier;
LtsWidgets::LayoutArea m_alarmHistoryDialogLayoutArea;
private slots:
void onNotificationChanged(const AlarmManagement::Notification &data, const DataModification &mod);
};
}
@@ -1,288 +0,0 @@
#include "alm_dialog.h"
#include <NGLLogger/NGLLoggerBootstrap.h>
#include "alm_history.h"
#include "ui_alm_dialog.h"
#include <LtsSession/lts_session_data.h>
#include <LtsUtilsSettings/settings.h>
#include <LtsWidgets/lts_dialog.h>
#include <AlarmManagement/Gui/Common/alm_config_alarm_model.h>
#include <AlarmManagement/Gui/Common/alm_history_alarm_model.h>
#include <ProjectDataManagement/pdm_enums.hpp>
#include <utility>
namespace AlarmManagement
{
AlarmDialog::AlarmDialog(QWidget* parent)
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::OkApplyCancel), m_configAlarmModel(nullptr),
m_dtc(nullptr), m_ftc(nullptr), m_ui(new Ui::AlarmDialog), m_requestHelper(new LtsUtils::RequestHelper(this)),
m_operatorId(-1), m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger())
{
AlarmCheckBox alarmCheckBox;
LtsUtils::ProjectSettings* ps = LtsUtils::ProjectSettings::getInstance();
const bool enableNuclearContaminations =
ps->value(QLatin1String("aes"), QLatin1String("enableNuclearContaminations")).toBool();
const bool enableDangerAreas = ps->value(QLatin1String("aes"), QLatin1String("enableDangerAreas")).toBool();
const bool enableMineAreas = ps->value(QLatin1String("aes"), QLatin1String("enableMineAreas")).toBool();
m_ui->setupUi(this);
if (!enableNuclearContaminations)
{
m_ui->lblNAgentEntry->hide();
m_ui->cbxNMarker->hide();
m_ui->cbxNMessage->hide();
}
if (!enableDangerAreas)
{
m_ui->lblDangerAreaEntry->hide();
m_ui->cbxDanerAreaMarker->hide();
m_ui->cbxDangerAreaMessage->hide();
}
if (!enableMineAreas)
{
m_ui->lblMineAreaEntry->hide();
m_ui->cbxMineAreaEntryMarker->hide();
m_ui->cbxMineAreaEntryMessage->hide();
m_ui->lblMineAreaHit->hide();
m_ui->cbxMineAreaHitMarker->hide();
m_ui->cbxMineAreaHitMessage->hide();
}
alarmCheckBox.name = QLatin1String("NuclearAgentEntry");
alarmCheckBox.checkboxMarker = m_ui->cbxNMarker;
alarmCheckBox.checkboxWindow = m_ui->cbxNMessage;
alarmCheckBox.eventTypeId = ProjectDataManagement::PdmEventType::EventType_EnterNuclear;
m_checkBoxes.append(alarmCheckBox);
alarmCheckBox.name = QLatin1String("DangerAreasEntry");
alarmCheckBox.checkboxMarker = m_ui->cbxDanerAreaMarker;
alarmCheckBox.checkboxWindow = m_ui->cbxDangerAreaMessage;
alarmCheckBox.eventTypeId = ProjectDataManagement::PdmEventType::EventType_EnterDangerArea;
m_checkBoxes.append(alarmCheckBox);
alarmCheckBox.name = QLatin1String("MineAreaEntry");
alarmCheckBox.checkboxMarker = m_ui->cbxMineAreaEntryMarker;
alarmCheckBox.checkboxWindow = m_ui->cbxMineAreaEntryMessage;
alarmCheckBox.eventTypeId = ProjectDataManagement::PdmEventType::EventType_EnterMineArea;
m_checkBoxes.append(alarmCheckBox);
alarmCheckBox.name = QLatin1String("MineAreaHit");
alarmCheckBox.checkboxMarker = m_ui->cbxMineAreaHitMarker;
alarmCheckBox.checkboxWindow = m_ui->cbxMineAreaHitMessage;
alarmCheckBox.eventTypeId = ProjectDataManagement::PdmEventType::EventType_HitMine;
m_checkBoxes.append(alarmCheckBox);
alarmCheckBox.name = QLatin1String("DirectFire");
alarmCheckBox.checkboxMarker = m_ui->cbxDirectFireMarker;
alarmCheckBox.checkboxWindow = m_ui->cbxDirectFireMessage;
alarmCheckBox.eventTypeId = ProjectDataManagement::PdmEventType::EventType_Hit;
m_checkBoxes.append(alarmCheckBox);
alarmCheckBox.name = QLatin1String("IndirectFire");
alarmCheckBox.checkboxMarker = m_ui->cbxIndirectFireMarker;
alarmCheckBox.checkboxWindow = m_ui->cbxIndirectFireMessage;
alarmCheckBox.eventTypeId = ProjectDataManagement::PdmEventType::EventType_HitEffectSimulation;
m_checkBoxes.append(alarmCheckBox);
alarmCheckBox.name = QLatin1String("CrossLocalBorderlines");
alarmCheckBox.checkboxMarker = m_ui->cbxLocalBorderMarker;
alarmCheckBox.checkboxWindow = m_ui->cbxLocalBorderMessage;
alarmCheckBox.eventTypeId = ProjectDataManagement::PdmEventType::EventType_CrossLocalBorderline;
m_checkBoxes.append(alarmCheckBox);
alarmCheckBox.name = QLatin1String("CrossGlobalBorderlines");
alarmCheckBox.checkboxMarker = m_ui->cbxGlobalBorderMarker;
alarmCheckBox.checkboxWindow = m_ui->cbxGlobalBorderMessage;
alarmCheckBox.eventTypeId = ProjectDataManagement::PdmEventType::EventType_CrossGlobalBorderline;
m_checkBoxes.append(alarmCheckBox);
alarmCheckBox.name = QLatin1String("AirSupport");
alarmCheckBox.checkboxMarker = m_ui->cbxAirSupportMarker;
alarmCheckBox.checkboxWindow = m_ui->cbxAirSupportMessage;
alarmCheckBox.eventTypeId = ProjectDataManagement::PdmEventType::EventType_AirSupport;
m_checkBoxes.append(alarmCheckBox);
setOnlineHelpFilename(QLatin1String("Situation-Configure_Global_Alarms"));
}
AlarmDialog::~AlarmDialog()
{
delete m_ui;
}
bool AlarmDialog::init(const std::shared_ptr<AlarmManagement::Interface::Ftc>& ftc,
const std::shared_ptr<AlarmManagement::Interface::Dtc>& dtc,
const std::shared_ptr<ParticipantManagement::Interface::Dtc>& ppmDtc,
AlarmHistoryModel* alarmHistoryModel)
{
if (!ftc)
return false;
if (!dtc)
return false;
if (!ppmDtc)
return false;
m_operatorId = LtsSessionData::LtsSessionData::getInstance()->getOperatorId();
m_ftc = ftc;
m_dtc = dtc;
connect(m_dtc.get(), &AlarmManagement::Interface::Dtc::alarmConfigChanged, this,
&AlarmDialog::onAlarmConfigChanged);
m_dtc->enableAlarmConfig();
auto cbConfig = [this](const AlarmManagement::AlarmConfig& c) {
onAlarmConfigChanged(c, DataModification::eAdded);
};
m_dtc->alarmConfigs(cbConfig);
delete m_configAlarmModel;
m_configAlarmModel = new AlarmManagement::ConfigAlarmModel(this);
bool global = true;
m_configAlarmModel->initModel(m_dtc, ppmDtc, alarmHistoryModel, global);
INFO_LOG(m_logger) << "AlarmDialog::init";
return true;
}
void AlarmDialog::retranslate()
{
translate(m_ui, tr("Configure Global Alarms"));
}
void AlarmDialog::onAlarmConfigChanged(const AlarmManagement::AlarmConfig& data, DataModification modType)
{
bool setMarker = data.setMarker;
bool messageWindow = data.messageWindow;
if (modType == DataModification::eRemoved)
return;
DEBUG_LOG(m_logger) << "************** onAlarmConfigChanged "
<< " id=" << data.id << " operatorId=" << data.operatorId
<< " m_operatorId=" << m_operatorId << " participantId=" << data.participantId
<< " eventTypeId=" << data.eventTypeId << " messageWindow=" << messageWindow
<< " setMarker=" << setMarker;
if (data.global == false)
return;
if (data.operatorId == m_operatorId)
{
DEBUG_LOG(m_logger) << "************** onAlarmConfig zuweisen ";
switch (data.eventTypeId)
{
case ProjectDataManagement::PdmEventType::EventType_EnterNuclear: {
DEBUG_LOG(m_logger) << "EnterNuclear zuweisen ";
m_ui->cbxNMarker->setChecked(setMarker);
m_ui->cbxNMessage->setChecked(messageWindow);
break;
}
case ProjectDataManagement::PdmEventType::EventType_EnterDangerArea: {
DEBUG_LOG(m_logger) << "EnterDangerArea zuweisen ";
m_ui->cbxDanerAreaMarker->setChecked(setMarker);
m_ui->cbxDangerAreaMessage->setChecked(messageWindow);
break;
}
case ProjectDataManagement::PdmEventType::EventType_EnterMineArea: {
DEBUG_LOG(m_logger) << "EnterMineArea zuweisen ";
m_ui->cbxMineAreaEntryMarker->setChecked(setMarker);
m_ui->cbxMineAreaEntryMessage->setChecked(messageWindow);
break;
}
case ProjectDataManagement::PdmEventType::EventType_HitMine: {
DEBUG_LOG(m_logger) << "HitMine zuweisen ";
m_ui->cbxMineAreaHitMarker->setChecked(setMarker);
m_ui->cbxMineAreaHitMessage->setChecked(messageWindow);
break;
}
case ProjectDataManagement::PdmEventType::EventType_Hit: {
DEBUG_LOG(m_logger) << "Hit zuweisen ";
m_ui->cbxDirectFireMarker->setChecked(setMarker);
m_ui->cbxDirectFireMessage->setChecked(messageWindow);
break;
}
case ProjectDataManagement::PdmEventType::EventType_HitEffectSimulation: {
DEBUG_LOG(m_logger) << "HitEffectSimulation zuweisen ";
m_ui->cbxIndirectFireMarker->setChecked(setMarker);
m_ui->cbxIndirectFireMessage->setChecked(messageWindow);
break;
}
case ProjectDataManagement::PdmEventType::EventType_CrossLocalBorderline: {
DEBUG_LOG(m_logger) << "CrossLocalBorderline zuweisen ";
m_ui->cbxLocalBorderMarker->setChecked(setMarker);
m_ui->cbxLocalBorderMessage->setChecked(messageWindow);
break;
}
case ProjectDataManagement::PdmEventType::EventType_CrossGlobalBorderline: {
DEBUG_LOG(m_logger) << "CrossGlobalBorderline zuweisen ";
m_ui->cbxGlobalBorderMarker->setChecked(setMarker);
m_ui->cbxGlobalBorderMessage->setChecked(messageWindow);
break;
}
case ProjectDataManagement::PdmEventType::EventType_AirSupport: {
DEBUG_LOG(m_logger) << "AirSupport zuweisen ";
m_ui->cbxAirSupportMarker->setChecked(setMarker);
m_ui->cbxAirSupportMessage->setChecked(messageWindow);
break;
}
default:
ERROR_LOG(m_logger) << "Not possible to set with Operator App!!!";
break;
}
}
}
std::vector<AlarmManagement::AlarmAction> AlarmDialog::getCheckedValues() const
{
AlarmManagement::AlarmAction alarmActionDds;
std::vector<AlarmManagement::AlarmAction> ret;
ret.clear();
ret.reserve(m_checkBoxes.size());
for (const AlarmCheckBox& item : std::as_const(m_checkBoxes))
{
alarmActionDds.eventTypeId = item.eventTypeId;
if (item.checkboxMarker->isChecked())
{
alarmActionDds.setMarker = true;
DEBUG_LOG(m_logger) << item.name << " setMarker = true";
}
else
{
alarmActionDds.setMarker = false;
DEBUG_LOG(m_logger) << item.name << " setMarker = false";
}
if (item.checkboxWindow->isChecked())
{
alarmActionDds.messageWindow = true;
DEBUG_LOG(m_logger) << item.name << " messageWindow = true";
}
else
{
alarmActionDds.messageWindow = false;
DEBUG_LOG(m_logger) << item.name << " messageWindow = false";
}
if (alarmActionDds.setMarker || alarmActionDds.messageWindow)
ret.push_back(alarmActionDds);
}
return ret;
}
bool AlarmDialog::apply()
{
std::vector<int32_t> participantIds;
participantIds.push_back(0);
bool globalEvent = true;
bool remove = false;
const ConfigureAlarmsRequest req(getCheckedValues(), m_operatorId, participantIds, globalEvent, remove);
return m_requestHelper->startSingleRequest([req, this]() { return m_ftc->configureAlarmsRequest(req, this); });
}
} // namespace AlarmManagement
@@ -1,80 +0,0 @@
#pragma once
#include <LtsWidgets/lts_dialog.h>
#include <AlarmManagement/alm_ftc.h>
#include <AlarmManagement/alm_dtc.h>
#include <ParticipantManagement/ppm.hpp>
#include <ParticipantManagement/ppm_dtc.h>
#include <LtsUtils/LtsUtilsGui/LtsUtilsGuiDds/request_helper.h>
#include <AlarmManagement/logger.h>
class QCheckBox;
namespace Ui
{
class AlarmDialog;
}
namespace AlarmManagement
{
class ConfigAlarmModel;
class AlarmHistoryModel;
class AlarmDialog final : public LtsWidgets::LtsDialog
, protected AlarmManagement::Interface::Ftc::ConfigureAlarmsReplyHandler
{
Q_OBJECT
public:
struct AlarmAction
{
int eventTypeId = 0;
bool setMarker = false;
bool messageWindow = false;
};
struct AlarmCheckBox
{
QCheckBox *checkboxMarker = nullptr;
QCheckBox *checkboxWindow = nullptr;
QString name;
ProjectDataManagement::PdmEventType eventTypeId = ProjectDataManagement::PdmEventType::EventType_Unknown;
};
explicit AlarmDialog(QWidget *parent = nullptr);
~AlarmDialog();
bool init(const std::shared_ptr<AlarmManagement::Interface::Ftc> &ftc,
const std::shared_ptr<AlarmManagement::Interface::Dtc> &dtc,
const std::shared_ptr<ParticipantManagement::Interface::Dtc> &ppmDtc,
AlarmHistoryModel *alarmHistoryModel);
void retranslate() override;
bool apply() override;
protected:
void onConfigureAlarmsReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
private slots:
void onAlarmConfigChanged(const AlarmManagement::AlarmConfig &data, DataModification modType);
private:
std::vector<AlarmManagement::AlarmAction> getCheckedValues() const;
ConfigAlarmModel *m_configAlarmModel;
std::shared_ptr<AlarmManagement::Interface::Dtc> m_dtc;
std::shared_ptr<AlarmManagement::Interface::Ftc> m_ftc;
Ui::AlarmDialog *m_ui;
QVector<AlarmCheckBox> m_checkBoxes;
LtsUtils::RequestHelper *m_requestHelper;
int m_operatorId;
LOGGER_T m_logger;
};
}
@@ -1,335 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AlarmDialog</class>
<widget class="QWidget" name="AlarmDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>413</width>
<height>285</height>
</rect>
</property>
<property name="windowTitle">
<string notr="true">MainWindow</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="2" column="2">
<widget class="QCheckBox" name="cbxDanerAreaMarker">
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
<item row="9" column="5">
<widget class="QCheckBox" name="cbxGlobalBorderMessage">
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
<item row="5" column="2">
<widget class="QCheckBox" name="cbxDirectFireMarker">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="1" column="5">
<widget class="QCheckBox" name="cbxNMessage">
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Indirect Fire</string>
</property>
</widget>
</item>
<item row="1" column="3">
<spacer name="horizontalSpacer_8">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>18</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="4" colspan="3">
<widget class="QLabel" name="label_3">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Message Window</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="1">
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>19</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1" colspan="3">
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Set Marker</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="8" column="2">
<widget class="QCheckBox" name="cbxLocalBorderMarker">
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Direct Fire</string>
</property>
</widget>
</item>
<item row="2" column="5">
<widget class="QCheckBox" name="cbxDangerAreaMessage">
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QCheckBox" name="cbxMineAreaEntryMarker">
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="lblDangerAreaEntry">
<property name="text">
<string>Danger Areas Entry</string>
</property>
</widget>
</item>
<item row="3" column="5">
<widget class="QCheckBox" name="cbxMineAreaEntryMessage">
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
<item row="8" column="5">
<widget class="QCheckBox" name="cbxLocalBorderMessage">
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
<item row="4" column="5">
<widget class="QCheckBox" name="cbxMineAreaHitMessage">
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="lblMineAreaEntry">
<property name="text">
<string>Mine Area Entry</string>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="lblCrossLocalBorderline">
<property name="text">
<string>Cross Local Borderlines</string>
</property>
</widget>
</item>
<item row="6" column="2">
<widget class="QCheckBox" name="cbxIndirectFireMarker">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="1" column="4">
<spacer name="horizontalSpacer_14">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>39</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="6" column="5">
<widget class="QCheckBox" name="cbxIndirectFireMessage">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="11" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="7">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="2">
<widget class="QCheckBox" name="cbxNMarker">
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
<item row="5" column="5">
<widget class="QCheckBox" name="cbxDirectFireMessage">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QCheckBox" name="cbxMineAreaHitMarker">
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
<item row="9" column="2">
<widget class="QCheckBox" name="cbxGlobalBorderMarker">
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lblNAgentEntry">
<property name="text">
<string>Nuclear Agent Entry</string>
</property>
</widget>
</item>
<item row="1" column="6">
<spacer name="horizontalSpacer_20">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>38</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="9" column="0">
<widget class="QLabel" name="lblCrossGlobalBorderline">
<property name="text">
<string>Cross Global Borderlines</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="lblMineAreaHit">
<property name="text">
<string>Mine Area Hit</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="lblAirSupport">
<property name="text">
<string>Air Support</string>
</property>
</widget>
</item>
<item row="7" column="2">
<widget class="QCheckBox" name="cbxAirSupportMarker">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="7" column="5">
<widget class="QCheckBox" name="cbxAirSupportMessage">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
<tabstops>
<tabstop>cbxNMarker</tabstop>
<tabstop>cbxNMessage</tabstop>
<tabstop>cbxDanerAreaMarker</tabstop>
<tabstop>cbxDangerAreaMessage</tabstop>
<tabstop>cbxMineAreaEntryMarker</tabstop>
<tabstop>cbxMineAreaEntryMessage</tabstop>
<tabstop>cbxMineAreaHitMarker</tabstop>
<tabstop>cbxMineAreaHitMessage</tabstop>
<tabstop>cbxLocalBorderMarker</tabstop>
<tabstop>cbxLocalBorderMessage</tabstop>
<tabstop>cbxGlobalBorderMarker</tabstop>
<tabstop>cbxGlobalBorderMessage</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>
@@ -1,144 +0,0 @@
#include "alm_history.h"
#include <NGLLogger/NGLLoggerBootstrap.h>
#include "ui_alm_history.h"
#include <LtsPrinting/printing.h>
#include <PluginInterfaces/gui_plugin_interface.h>
#include <AlarmManagement/Gui/Common/alm_history_alarm_model.h>
#include <QtWidgets/QTreeView>
namespace AlarmManagement
{
AlarmView::AlarmView(LtsSession::LtsSession* session, QWidget* parent)
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::CloseOnly), m_alarmHistoryModel(nullptr),
m_dtc(nullptr), m_sitMapGuiIfc(nullptr), m_session(session), m_ui(new Ui::AlarmView),
m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger())
{
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " --- AlarmView Konstruktor() ";
m_ui->setupUi(this);
m_ui->widget->setSelectionMode(QAbstractItemView::MultiSelection);
connect(m_ui->widget, &LtsDataView::LtsDataView::signalSelectionChanged, this, &AlarmView::onSelectionChanged);
connect(m_ui->widget, &LtsDataView::LtsDataView::signalDoubleClicked, this, &AlarmView::onShowAlarm);
m_buttonBox->connectButton(LtsWidgets::DialogButton::Print, this, &AlarmView::onPrint);
m_buttonBox->connectButton(LtsWidgets::DialogButton::Remove, this, &AlarmView::onRemoveAlarm);
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Remove, false);
m_buttonBox->connectButton(LtsWidgets::DialogButton::Edit, this, &AlarmView::onCenterAlarm);
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Edit, false);
setOnlineHelpFilename(QStringLiteral("Situation-Alarm_History"));
}
AlarmView::~AlarmView()
{
INFO_LOG(m_logger) << "--- AlarmView Destruktor() ";
m_sitMapGuiIfc = nullptr;
delete m_ui;
}
void AlarmView::retranslate()
{
translate(m_ui, tr("Alarm History"));
m_buttonBox->getButton(LtsWidgets::DialogButton::Edit)->setText(tr("Center Map"));
}
bool AlarmView::init(const std::shared_ptr<AlarmManagement::Interface::Dtc>& dtc, AlarmHistoryModel* alarmHistoryModel)
{
INFO_LOG(m_logger) << "--- init() ";
if (!dtc)
return false;
m_dtc = dtc;
m_alarmHistoryModel = alarmHistoryModel;
DEBUG_LOG(m_logger) << "--- AlarmView::init ";
m_proxyModel = new AlarmHistoryProxyModel(this);
m_proxyModel->setSourceModel(m_alarmHistoryModel);
m_ui->widget->setModel(m_proxyModel);
#ifndef LTS_DEBUG
m_ui->widget->hideColumn(AlarmHistoryModel::Id);
m_ui->widget->hideColumn(AlarmHistoryModel::ParticipantId);
m_ui->widget->hideColumn(AlarmHistoryModel::AesId);
#endif
m_buttonBox->getButton(LtsWidgets::DialogButton::Edit)->setIcon(QIcon(QStringLiteral("icon:center_to_object.svg")));
m_session->getForeignGuiInterface<SituationMap::ForeignGuiInterface>(m_sitMapGuiIfc);
return true;
}
void AlarmView::onSelectionChanged()
{
QModelIndexList selectedRows = m_ui->widget->selectedRows();
const int cntSelectedRows = selectedRows.size();
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Edit, cntSelectedRows == 1);
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Remove, cntSelectedRows > 0);
}
void AlarmView::onShowAlarm()
{
INFO_LOG(m_logger) << "--- onShowMAlarm() ";
}
void AlarmView::onRemoveAlarm()
{
DEBUG_LOG(m_logger) << "onRemoveAlarm selectedRows.size" << m_ui->widget->selectedRows().size();
const QModelIndexList idxList = m_ui->widget->selectedRows();
QVector<int> rowsToRemove;
rowsToRemove.reserve(idxList.size());
for (const auto& idx : idxList)
rowsToRemove.push_back(idx.row());
std::sort(rowsToRemove.begin(), rowsToRemove.end(), std::greater<int>());
for (int i = 0; i < rowsToRemove.length(); i++)
m_alarmHistoryModel->removeRow(rowsToRemove.at(i));
}
void AlarmView::onCenterAlarm()
{
DEBUG_LOG(m_logger) << "onCenterAlarm";
if (!m_sitMapGuiIfc)
return;
const QModelIndexList indexList = m_ui->widget->selectedRows();
if (indexList.isEmpty())
return;
const QModelIndex& index = indexList.first();
const QModelIndex indexPosi = m_alarmHistoryModel->index(index.row(), AlarmHistoryModel::Position, index.parent());
const QPointF& position = indexPosi.data(Qt::UserRole).toPointF();
if (!position.isNull())
{
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " position=" << position.x() << " - " << position.y();
m_sitMapGuiIfc->setCenterPoint(position);
}
else
{
const QModelIndex& indexParticipantId =
m_alarmHistoryModel->index(index.row(), AlarmHistoryModel::ParticipantId, index.parent());
const int participantId = indexParticipantId.data().toInt();
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " participantId=" << participantId;
m_sitMapGuiIfc->centerMapToParticipant(participantId);
}
}
void AlarmView::onPrint()
{
LtsPrinting::printView(m_session, this, m_ui->widget->treeView());
}
void AlarmView::tableColumnOrganiserSetting()
{
m_ui->widget->setColumnsOrganiserEnabled(identifier(), true);
}
} // namespace AlarmManagement
@@ -1,50 +0,0 @@
#pragma once
#include <AlarmManagement/alm_dtc.h>
#include <AlarmManagement/logger.h>
#include <LtsSession/lts_session.h>
#include <LtsWidgets/lts_dialog.h>
#include <SituationMapPlugin/situation_map_gui_plugin_interface.h>
namespace Ui
{
class AlarmView;
}
namespace AlarmManagement
{
class AlarmHistoryModel;
class AlarmHistoryProxyModel;
class AlarmView final : public LtsWidgets::LtsDialog
{
Q_OBJECT
public:
explicit AlarmView(LtsSession::LtsSession* session, QWidget* parent = nullptr);
~AlarmView();
bool init(const std::shared_ptr<AlarmManagement::Interface::Dtc>& dtc, AlarmHistoryModel* alarmHistoryModel);
private:
NGL::INGLLogger& m_logger;
void retranslate() override;
void onSelectionChanged();
void onShowAlarm();
void onRemoveAlarm();
void onCenterAlarm();
void onPrint();
void tableColumnOrganiserSetting() override;
private:
AlarmHistoryModel* m_alarmHistoryModel;
AlarmHistoryProxyModel* m_proxyModel;
std::shared_ptr<AlarmManagement::Interface::Dtc> m_dtc;
std::shared_ptr<SituationMap::ForeignGuiInterface> m_sitMapGuiIfc;
LtsSession::LtsSession* m_session;
Ui::AlarmView* m_ui;
};
} // namespace AlarmManagement
@@ -1,45 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AlarmView</class>
<widget class="QWidget" name="AlarmView">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>455</width>
<height>341</height>
</rect>
</property>
<property name="windowTitle">
<string notr="true">AlarmView</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="LtsDataView::LtsDataView" name="widget">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>250</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>LtsDataView::LtsDataView</class>
<extends>QWidget</extends>
<header>LtsDataView/lts_data_view.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
@@ -1,55 +0,0 @@
#
# $Id$
# $HeadURL$
# $Author$
# Created by Hannes Baeuerle, SLSE, 2017-02-24
#
# Make ${Qt6_Widgets} optional
if(QT6_GUI_AVAILABLE AND TARGET Qt6::Widgets)
set(Qt6_Widgets ${Qt6_Widgets})
else()
set(Qt6_Widgets "")
endif()
SET(alm_online_reports_gui_SRCS
alm_participant_model.h
alm_participant_model.cpp
alm_participant_gui_plugin.h
alm_participant_gui_plugin.cpp
alm_config_participant_dialog.h
alm_config_participant_dialog.cpp
alm_participant_dialog.h
alm_participant_dialog.cpp
alm_participant_show_config.cpp
alm_participant_show_config.h
)
NGL_WRAP_UI (alm_online_reports_gui_SRCS
alm_config_participant_dialog.ui
alm_participant_dialog.ui
alm_participant_show_config.ui
)
NGL_ADD_LIBRARY(WS AlmOnlineReportsGuiPlugin MODULE ${alm_online_reports_gui_SRCS})
if(QT6_GUI_AVAILABLE)
NGL_TARGET_LINK_LIBRARIES(AlmOnlineReportsGuiPlugin
LtsPrinting
LtsSession
LtsSessionData
AlmGuiPluginInterface
AlmDataPluginInterface
$<IF:$<TARGET_EXISTS:svcPdmCommon>,svcPdmCommon,> # pdm_translation.h in alm_dialog.cpp
svcAesCommon
GuiPluginInterface
${Qt6_Widgets}
PpmCommon
AlmCommon
LtsUtilsGuiDds
LtsUtilsSettings
)
endif()
NGL_INSTALL_TARGET(AlmOnlineReportsGuiPlugin)
@@ -1,306 +0,0 @@
#include "alm_config_participant_dialog.h"
#include "ui_alm_config_participant_dialog.h"
#include <LtsSession/lts_session_data.h>
#include <LtsUtilsSettings/settings.h>
#include <ParticipantManagement/Gui/Common/participant_vulnerability_types.h>
namespace ParticipantAlarms
{
ConfigParticipantsDialog::ConfigParticipantsDialog(QWidget* parent)
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::OkApplyCancel),
m_ui(new Ui::ConfigParticipantsDialog), m_requestHelper(new LtsUtils::RequestHelper(this)),
m_typeClass(ParticipantManagement::TypeClass::Human),
m_logger(AlarmManagement::getLogger("ConfigParticipantsDialog"))
{
LtsUtils::ProjectSettings* ps = LtsUtils::ProjectSettings::getInstance();
const bool enableNuclearContaminations =
ps->value(QStringLiteral("aes"), QStringLiteral("enableNuclearContaminations")).toBool();
const bool enableMineAreas = ps->value(QStringLiteral("aes"), QStringLiteral("enableMineAreas")).toBool();
m_ui->setupUi(this);
if (!enableNuclearContaminations)
{
m_ui->cbxNbcAgent->hide();
}
if (!enableMineAreas)
{
m_ui->cbxMines->hide();
m_ui->cbxIndirectFire->hide();
}
#ifdef ETS_MODE
m_ui->cbxFriendlyFire->hide();
m_ui->cbStatusFriendly->hide();
#endif
setNoTopicLock();
}
ConfigParticipantsDialog::~ConfigParticipantsDialog()
{
delete m_ui;
}
void ConfigParticipantsDialog::retranslate()
{
if (!m_participantData.equipmentNumber.has_value())
{
QString hierarchy = m_ppmDtc->hierarchyFromParticipant(m_participantData.id);
translate(m_ui, m_participantData, hierarchy, tr("Participant Alarm"));
}
else
translate(m_ui, m_participantData, QString::number(m_participantData.equipmentNumber.get()),
tr("Participant Alarm"));
m_uiRequirements->clear();
m_uiRequirements->addRequirement(
{m_ui->lbReaction, [this]() { return m_ui->cbxSetMarker->isChecked() || m_ui->cbxMessageWindow->isChecked(); },
tr("Select at least one reaction")});
}
bool ConfigParticipantsDialog::init(const std::shared_ptr<ParticipantManagement::Interface::Dtc>& ppmDtc,
const std::shared_ptr<AlarmManagement::Interface::Dtc>& almDtc,
const std::shared_ptr<AlarmManagement::Interface::Ftc>& almFtc,
const ParticipantManagement::ParticipantData& participantData,
const std::vector<int>& participantVector, const std::vector<int>& equipmentVector)
{
if (!ppmDtc || !almDtc || !almFtc)
return false;
m_ppmDtc = ppmDtc;
m_almFtc = almFtc;
m_almDtc = almDtc;
m_participantVector = participantVector;
m_participantData = participantData;
m_operatorId = LtsSessionData::LtsSessionData::getInstance()->getOperatorId();
m_ui->lbHierarchy->setText(m_ppmDtc->hierarchyFromParticipant(m_participantData.id));
QString equipmentNumbersStr;
if (participantData.equipmentNumber.has_value())
{
equipmentNumbersStr.append(QString::number(participantData.equipmentNumber.get()));
equipmentNumbersStr.append(QStringLiteral(": "));
}
for (const int equipNo : equipmentVector)
equipmentNumbersStr += QString::number(equipNo) + QStringLiteral(", ");
equipmentNumbersStr.chop(2);
m_ui->equipmentNoContent->setText(equipmentNumbersStr);
DEBUG_LOG(m_logger) << "current participantId = " << participantData.id;
m_typeClass = ppmDtc->type(participantData.typeId).typeClass;
DEBUG_LOG(m_logger) << "m_typeClass=" << m_typeClass << " TypeId=" << participantData.typeId;
fillCbx();
m_almDtc->alarmConfigs([this](const AlarmManagement::AlarmConfig& alarm) { setAlaramData(alarm); });
return true;
}
void ConfigParticipantsDialog::setAlaramData(const AlarmManagement::AlarmConfig& alarm)
{
DEBUG_LOG(m_logger) << "setAlaramData:" << alarm;
if (alarm.operatorId != m_operatorId || alarm.participantId != m_participantData.id || alarm.global)
return;
switch (alarm.eventTypeId)
{
case ProjectDataManagement::PdmEventType::EventType_Hit: {
DEBUG_LOG(m_logger) << "Hit zuweisen ";
m_ui->cbxDirectFire->setChecked(true);
m_ui->cbxSetMarker->setChecked(alarm.setMarker);
m_ui->cbxMessageWindow->setChecked(alarm.messageWindow);
if (alarm.vulnerabilityState >= 0)
{
ProjectDataManagement::VulnerabilityState vulState =
static_cast<ProjectDataManagement::VulnerabilityState>(alarm.vulnerabilityState);
int index = m_ui->cbStatusDirect->findData(QVariant(static_cast<int>(vulState)));
m_ui->cbStatusDirect->setCurrentIndex(index);
}
break;
}
case ProjectDataManagement::PdmEventType::EventType_HitEffectSimulation: {
DEBUG_LOG(m_logger) << "HitIndirect zuweisen ";
m_ui->cbxIndirectFire->setChecked(true);
m_ui->cbxSetMarker->setChecked(alarm.setMarker);
m_ui->cbxMessageWindow->setChecked(alarm.messageWindow);
break;
}
case ProjectDataManagement::PdmEventType::EventType_AirSupport: {
DEBUG_LOG(m_logger) << "AirSupport zuweisen ";
m_ui->cbxAirSupport->setChecked(true);
m_ui->cbxSetMarker->setChecked(alarm.setMarker);
m_ui->cbxMessageWindow->setChecked(alarm.messageWindow);
break;
}
case ProjectDataManagement::PdmEventType::EventType_HitMine: {
DEBUG_LOG(m_logger) << "HitMine zuweisen ";
m_ui->cbxMines->setChecked(true);
m_ui->cbxSetMarker->setChecked(alarm.setMarker);
m_ui->cbxMessageWindow->setChecked(alarm.messageWindow);
break;
}
case ProjectDataManagement::PdmEventType::EventType_HitB:
case ProjectDataManagement::PdmEventType::EventType_HitN:
case ProjectDataManagement::PdmEventType::EventType_HitC: {
DEBUG_LOG(m_logger) << "Hit N/B/C zuweisen ";
m_ui->cbxNbcAgent->setChecked(true);
m_ui->cbxSetMarker->setChecked(alarm.setMarker);
m_ui->cbxMessageWindow->setChecked(alarm.messageWindow);
break;
}
case ProjectDataManagement::PdmEventType::EventType_FriendlyFire: {
DEBUG_LOG(m_logger) << "FriendlyFire zuweisen ";
m_ui->cbxFriendlyFire->setChecked(true);
m_ui->cbxSetMarker->setChecked(alarm.setMarker);
m_ui->cbxMessageWindow->setChecked(alarm.messageWindow);
if (alarm.vulnerabilityState >= 0)
{
ProjectDataManagement::VulnerabilityState vulState =
static_cast<ProjectDataManagement::VulnerabilityState>(alarm.vulnerabilityState);
int index = m_ui->cbStatusDirect->findData(QVariant(static_cast<int>(vulState)));
m_ui->cbStatusFriendly->setCurrentIndex(index);
}
break;
}
case ProjectDataManagement::PdmEventType::EventType_Manipulation: {
DEBUG_LOG(m_logger) << "Manipulation zuweisen ";
m_ui->cbxManipulation->setChecked(true);
m_ui->cbxSetMarker->setChecked(alarm.setMarker);
m_ui->cbxMessageWindow->setChecked(alarm.messageWindow);
break;
}
case ProjectDataManagement::PdmEventType::EventType_CrossGlobalBorderline: {
DEBUG_LOG(m_logger) << "CrossGlobalBorderline zuweisen ";
m_ui->cbxGlobalBorderLine->setChecked(true);
m_ui->cbxSetMarker->setChecked(alarm.setMarker);
m_ui->cbxMessageWindow->setChecked(alarm.messageWindow);
break;
}
case ProjectDataManagement::PdmEventType::EventType_CrossLocalBorderline: {
DEBUG_LOG(m_logger) << "CrossLocalBorderline zuweisen ";
m_ui->cbxLocalBorderLine->setChecked(true);
m_ui->cbxSetMarker->setChecked(alarm.setMarker);
m_ui->cbxMessageWindow->setChecked(alarm.messageWindow);
break;
}
default: {
ERROR_LOG(m_logger) << "Not possible to set with Operator App!!!";
}
}
}
std::vector<AlarmManagement::AlarmAction> ConfigParticipantsDialog::getCheckedValues() const
{
AlarmManagement::AlarmAction alarmActionDds;
DEBUG_LOG(m_logger) << "getCheckedValues";
std::vector<AlarmManagement::AlarmAction> alarmsDds;
alarmActionDds.setMarker = m_ui->cbxSetMarker->isChecked();
alarmActionDds.messageWindow = m_ui->cbxMessageWindow->isChecked();
alarmActionDds.vulnerabilityState = -1;
if (alarmActionDds.setMarker || alarmActionDds.messageWindow)
{
if (m_ui->cbxDirectFire->isChecked())
{
alarmActionDds.eventTypeId = ProjectDataManagement::PdmEventType::EventType_Hit;
int statusDirect = -1;
if (m_ui->cbStatusDirect->currentIndex() > 0)
statusDirect = m_ui->cbStatusDirect->currentData().toInt();
alarmActionDds.vulnerabilityState = statusDirect;
alarmsDds.push_back(alarmActionDds);
}
if (m_ui->cbxFriendlyFire->isChecked())
{
alarmActionDds.eventTypeId = ProjectDataManagement::PdmEventType::EventType_FriendlyFire;
int statusFriendly = -1;
if (m_ui->cbStatusFriendly->currentIndex() > 0)
statusFriendly = m_ui->cbStatusFriendly->currentData().toInt();
alarmActionDds.vulnerabilityState = statusFriendly;
alarmsDds.push_back(alarmActionDds);
}
alarmActionDds.vulnerabilityState = -1;
if (m_ui->cbxIndirectFire->isChecked())
{
alarmActionDds.eventTypeId = ProjectDataManagement::PdmEventType::EventType_HitEffectSimulation;
alarmsDds.push_back(alarmActionDds);
}
if (m_ui->cbxAirSupport->isChecked())
{
alarmActionDds.eventTypeId = ProjectDataManagement::PdmEventType::EventType_AirSupport;
alarmsDds.push_back(alarmActionDds);
}
if (m_ui->cbxMines->isChecked())
{
alarmActionDds.eventTypeId = ProjectDataManagement::PdmEventType::EventType_HitMine;
alarmsDds.push_back(alarmActionDds);
}
if (m_ui->cbxNbcAgent->isChecked())
{
alarmActionDds.eventTypeId = ProjectDataManagement::PdmEventType::EventType_HitN;
alarmsDds.push_back(alarmActionDds);
alarmActionDds.eventTypeId = ProjectDataManagement::PdmEventType::EventType_HitB;
alarmsDds.push_back(alarmActionDds);
alarmActionDds.eventTypeId = ProjectDataManagement::PdmEventType::EventType_HitC;
alarmsDds.push_back(alarmActionDds);
}
if (m_ui->cbxManipulation->isChecked())
{
alarmActionDds.eventTypeId = ProjectDataManagement::PdmEventType::EventType_Manipulation;
alarmsDds.push_back(alarmActionDds);
}
if (m_ui->cbxGlobalBorderLine->isChecked())
{
alarmActionDds.eventTypeId = ProjectDataManagement::PdmEventType::EventType_CrossGlobalBorderline;
alarmsDds.push_back(alarmActionDds);
}
if (m_ui->cbxLocalBorderLine->isChecked())
{
alarmActionDds.eventTypeId = ProjectDataManagement::PdmEventType::EventType_CrossLocalBorderline;
alarmsDds.push_back(alarmActionDds);
}
}
return alarmsDds;
}
bool ConfigParticipantsDialog::apply()
{
DEBUG_LOG(m_logger) << "apply";
AlarmManagement::ConfigureAlarmsRequest req;
req.participantIds = m_participantVector;
req.alarms = getCheckedValues();
req.operatorId = m_operatorId;
req.global = false;
req.remove = false;
return m_requestHelper->startSingleRequest([req, this]() { return m_almFtc->configureAlarmsRequest(req, this); });
}
void ConfigParticipantsDialog::fillCbx()
{
m_ui->cbStatusDirect->clear();
m_ui->cbStatusFriendly->clear();
m_ui->cbStatusDirect->addItem(tr("All Types"), -1);
m_ui->cbStatusFriendly->addItem(tr("All Types"), -1);
ParticipantManagement::insertVulnerabilityStates(m_ui->cbStatusDirect, m_typeClass);
ParticipantManagement::insertVulnerabilityStates(m_ui->cbStatusFriendly, m_typeClass);
m_ui->cbStatusDirect->removeItem(
m_ui->cbStatusDirect->findData(static_cast<int>(ProjectDataManagement::VulnerabilityState::VulnerabilityState_TemporarySeverance)));
m_ui->cbStatusFriendly->removeItem(
m_ui->cbStatusDirect->findData(static_cast<int>(ProjectDataManagement::VulnerabilityState::VulnerabilityState_TemporarySeverance)));
}
} // namespace ParticipantAlarms
@@ -1,61 +0,0 @@
#pragma once
#include <AlarmManagement/logger.h>
#include <LtsUtils/LtsUtilsGui/LtsUtilsGuiDds/request_helper.h>
#include <LtsWidgets/lts_dialog.h>
#include <ParticipantManagement/ppm_dtc.h>
#include <AlarmManagement/alm_dtc.h>
#include <AlarmManagement/alm_ftc.h>
#include <memory>
namespace Ui
{
class ConfigParticipantsDialog;
}
namespace ParticipantAlarms
{
class ConfigParticipantsDialog : public LtsWidgets::LtsDialog,
protected AlarmManagement::Interface::Ftc::ConfigureAlarmsReplyHandler
{
Q_OBJECT
public:
explicit ConfigParticipantsDialog(QWidget* parent = nullptr);
~ConfigParticipantsDialog();
bool init(const std::shared_ptr<ParticipantManagement::Interface::Dtc>& ppmDtc,
const std::shared_ptr<AlarmManagement::Interface::Dtc>& almDtc,
const std::shared_ptr<AlarmManagement::Interface::Ftc>& almFtc,
const ParticipantManagement::ParticipantData& participantData, const std::vector<int>& participantVector,
const std::vector<int>& equipmentVector);
protected:
NGL::INGLLogger& m_logger;
void onConfigureAlarmsReply(const Core::FunctionReplyObject& replyObject) override final
{
m_requestHelper->requestReply(replyObject);
}
private:
void retranslate() override;
bool apply() override;
std::vector<AlarmManagement::AlarmAction> getCheckedValues() const;
void fillCbx();
void setAlaramData(const AlarmManagement::AlarmConfig& alarm);
private:
Ui::ConfigParticipantsDialog* m_ui;
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_ppmDtc;
std::shared_ptr<AlarmManagement::Interface::Dtc> m_almDtc;
std::shared_ptr<AlarmManagement::Interface::Ftc> m_almFtc;
int m_operatorId;
LtsUtils::RequestHelper* m_requestHelper;
std::vector<int> m_participantVector;
ParticipantManagement::TypeClass m_typeClass;
ParticipantManagement::ParticipantData m_participantData;
};
} // namespace ParticipantAlarms
@@ -1,267 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ConfigParticipantsDialog</class>
<widget class="QWidget" name="ConfigParticipantsDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>323</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string notr="true">Messaging View</string>
</property>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0">
<widget class="QLabel" name="designatorName">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Hierarchy:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="lbHierarchy">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="equipmentNoName">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Equip. No.:</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QLabel" name="equipmentNoContent">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
<item row="1" column="0" colspan="4">
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0" rowspan="2">
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Hit</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="0">
<widget class="QCheckBox" name="cbxIndirectFire">
<property name="text">
<string>Indirect Fire</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="cbxNbcAgent">
<property name="text">
<string>N/B/C Agents</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="cbxDirectFire">
<property name="text">
<string>Direct Fire</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="LtsWidgets::LtsComboBox" name="cbStatusDirect">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="cbxMines">
<property name="text">
<string>Mines</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QCheckBox" name="cbxFriendlyFire">
<property name="text">
<string>Friendly Fire</string>
</property>
</widget>
</item>
<item row="7" column="0">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item row="5" column="1">
<widget class="LtsWidgets::LtsComboBox" name="cbStatusFriendly">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QCheckBox" name="cbxManipulation">
<property name="text">
<string>Manipulation</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="cbxAirSupport">
<property name="text">
<string>Air Support</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="1">
<widget class="QGroupBox" name="groupBox_11">
<property name="title">
<string>Cross</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QCheckBox" name="cbxGlobalBorderLine">
<property name="text">
<string>Global Borderline</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="cbxLocalBorderLine">
<property name="text">
<string>Local Borderline</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="1">
<widget class="QGroupBox" name="groupBox_13">
<property name="title">
<string/>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="1" column="0">
<widget class="QCheckBox" name="cbxSetMarker">
<property name="text">
<string>Set Marker</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="cbxMessageWindow">
<property name="text">
<string>Message Window</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="0" alignment="Qt::AlignHCenter">
<widget class="QLabel" name="lbReaction">
<property name="text">
<string>Reaction</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item row="2" column="0" colspan="4">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>LtsWidgets::LtsComboBox</class>
<extends>QComboBox</extends>
<header>LtsWidgets/lts_combo_box.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>cbxDirectFire</tabstop>
<tabstop>cbStatusDirect</tabstop>
<tabstop>cbxIndirectFire</tabstop>
<tabstop>cbxNbcAgent</tabstop>
<tabstop>cbxMines</tabstop>
<tabstop>cbxFriendlyFire</tabstop>
<tabstop>cbStatusFriendly</tabstop>
<tabstop>cbxManipulation</tabstop>
<tabstop>cbxGlobalBorderLine</tabstop>
<tabstop>cbxLocalBorderLine</tabstop>
<tabstop>cbxSetMarker</tabstop>
<tabstop>cbxMessageWindow</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>
@@ -1,205 +0,0 @@
#include "alm_participant_dialog.h"
#include "alm_config_participant_dialog.h"
#include "alm_participant_model.h"
#include "ui_alm_participant_dialog.h"
#include <AdvancedSymbology/asb_data_plugin_interface.h>
#include <LtsPrinting/printing.h>
#include <ParticipantManagement/Gui/Common/participant_edit_model.h>
#include <ParticipantManagement/ppm_gui_combobox_plugin_interface.h>
#include <QtWidgets/QTreeView>
namespace ParticipantAlarms
{
int ParticipantsDialog::s_preselectedParty = -1;
ParticipantsDialog::ParticipantsDialog(const QString& menuGroup, QWidget* parent)
: LtsWidgets::LtsDialog(parent), m_session(nullptr), m_almDtc(nullptr), m_almFtc(nullptr), m_ppmDtc(nullptr),
m_participantModel(nullptr), m_requestHelper(new LtsUtils::RequestHelper(this)), m_menuGroup(menuGroup),
m_ui(new Ui::ParticipantsDialog), m_logger(AlarmManagement::getLogger("ParticipantsDialog"))
{
m_ui->setupUi(this);
m_buttonBox->connectButton(LtsWidgets::DialogButton::Edit, this, &ParticipantsDialog::onAddButtonClicked);
m_buttonBox->connectButton(LtsWidgets::DialogButton::Print, this, &ParticipantsDialog::onPrint);
m_ui->cbAllParticipants->setVisible(false);
setOnlineHelpFilename(QStringLiteral("Situation-Assign_Participant_Alarms"));
}
ParticipantsDialog::~ParticipantsDialog()
{
delete m_ui;
}
void ParticipantsDialog::retranslate()
{
translate(m_ui, tr("Assign Participant Alarms"));
}
bool ParticipantsDialog::init(LtsSession::LtsSession* session,
const std::shared_ptr<ParticipantManagement::Interface::Dtc>& ppmDtc,
const std::shared_ptr<AlarmManagement::Interface::Dtc>& almDtc,
const std::shared_ptr<AlarmManagement::Interface::Ftc>& almFtc,
const std::shared_ptr<ParticipantManagement::ForeignGuiComboboxInterface>& ppmGuiCbxIfc)
{
m_ppmDtc = ppmDtc;
m_almDtc = almDtc;
m_almFtc = almFtc;
m_session = session;
if (m_ppmDtc == nullptr || !ppmDtc->enableDynamicParticipantData() || !ppmDtc->enableParticipant())
return false;
if (m_almFtc == nullptr || !almFtc->enableConfigureAlarms())
return false;
std::shared_ptr<AdvancedSymbology::ForeignDataInterface> asbIfc;
m_session->getForeignDataInterface<AdvancedSymbology::DataInterface>(asbIfc);
m_participantModel = new ParticipantAlarms::ParticipantAlarmModel(this, m_ppmDtc, asbIfc);
m_participantProxyModel = new ParticipantManagement::ParticipantTreeFilterProxyModel(this);
m_participantProxyModel->setSourceModel(m_participantModel);
m_participantProxyModel->setRecursiveFilteringEnabled(true);
m_ui->dvParticipants->setModel(m_participantProxyModel);
connect(m_ui->cbParty,
static_cast<void (LtsWidgets::LtsComboBox::*)(int)>(&LtsWidgets::LtsComboBox::currentIndexChanged), this,
&ParticipantsDialog::onCbPartyChanged);
connect(m_ui->cbAllParticipants, &QCheckBox::clicked, m_ui->dvParticipants, &LtsDataView::LtsDataView::setDisabled);
connect(m_ui->dvParticipants, &LtsDataView::LtsDataView::selectionChanged, this,
&ParticipantsDialog::onSelectionChanged);
connect(m_ui->dvParticipants, &LtsDataView::LtsDataView::signalDoubleClicked, this,
&ParticipantsDialog::onDoubleClicked);
connect(m_ui->cbAllParticipants, &QCheckBox::clicked, this, [this](bool checked) {
if (checked)
m_ui->dvParticipants->treeView()->selectAll();
else
m_ui->dvParticipants->treeView()->clearSelection();
});
ppmGuiCbxIfc->fillPartyComboBox(m_ui->cbParty);
const int idx = m_ui->cbParty->findData(s_preselectedParty);
if (idx >= 0)
m_ui->cbParty->setCurrentIndex(idx);
onCbPartyChanged();
return true;
}
void ParticipantsDialog::onSelectionChanged()
{
bool configureAlarms = false;
DEBUG_LOG(m_logger) << "onSelectionChanged";
const QModelIndexList currentlySelectedParticipants = m_ui->dvParticipants->selectedRows();
for (const QModelIndex& index : currentlySelectedParticipants)
{
const ParticipantManagement::ParticipantData data(m_participantModel->getParticipantData(index));
if ((data.equipmentNumber.has_value() && data.equipmentNumber.get() > 0) ||
m_ppmDtc->type(data.typeId).typeClass == ParticipantManagement::TypeClass::Unit)
configureAlarms = true;
DEBUG_LOG(m_logger) << "setChildrenSelected row =" << index.row() << " column=" << index.column();
}
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Edit, configureAlarms);
}
void ParticipantsDialog::onCbPartyChanged()
{
const int curPartyId = m_ui->cbParty->currentData().toInt();
s_preselectedParty = curPartyId;
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Edit, false);
m_participantModel->onReinitModel(curPartyId);
m_ui->dvParticipants->expandAll();
if (m_ui->cbAllParticipants->isChecked())
m_ui->dvParticipants->treeView()->selectAll();
m_ui->dvParticipants->resizeHeadersByContent();
}
void ParticipantsDialog::onAddButtonClicked()
{
DEBUG_LOG(m_logger) << "onAddButtonClicked";
m_participantVector.clear();
m_equipmentVector.clear();
if (!m_ui->cbAllParticipants->isChecked())
{
const QModelIndexList currentlySelectedParticipants = m_ui->dvParticipants->selectedRows();
for (const QModelIndex& index : currentlySelectedParticipants)
{
DEBUG_LOG(m_logger) << "setChildrenSelected: " << index.row() << " column=" << index.column();
setChildrenSelected(index);
}
}
QModelIndex participantIndex = m_ui->dvParticipants->currentIndex();
ParticipantManagement::ParticipantData data = m_participantModel->getParticipantData(participantIndex);
DEBUG_LOG(m_logger) << "current participantId = " << data.id;
m_participantVector.push_back(data.id);
const auto partData = m_participantModel->getParticipantData(participantIndex);
addDialog(LtsWidgets::initDialog(new ConfigParticipantsDialog(this), m_ppmDtc, m_almDtc, m_almFtc, partData,
m_participantVector, m_equipmentVector),
m_menuGroup, QStringLiteral("ConfigAlarms%1").arg(partData.id));
}
void ParticipantsDialog::onPrint()
{
LtsPrinting::printView(m_session, this, m_ui->dvParticipants->treeView());
}
void ParticipantsDialog::setChildrenSelected(const QModelIndex& parent)
{
if (!(parent.isValid() && m_participantModel->hasChildren(parent)))
return;
const int rc = m_participantModel->rowCount(parent);
for (int currentRow = 0; currentRow < rc; ++currentRow)
{
QModelIndex childIndex = m_participantModel->index(currentRow, 0, parent);
if (m_participantModel->hasChildren(childIndex))
setChildrenSelected(childIndex);
DEBUG_LOG(m_logger) << "Setting row " << childIndex.row() << " selected";
ParticipantManagement::ParticipantData data = m_participantModel->getParticipantData(childIndex);
DEBUG_LOG(m_logger) << "append participantId = " << data.id;
m_participantVector.push_back(data.id);
if (data.equipmentNumber.has_value())
{
DEBUG_LOG(m_logger) << "append equipmentNumber = " << data.equipmentNumber.get();
m_equipmentVector.push_back(data.equipmentNumber.get());
}
m_ui->dvParticipants->selectionModel()->select(m_participantProxyModel->mapFromSource(childIndex),
QItemSelectionModel::Select | QItemSelectionModel::Rows);
}
}
void ParticipantsDialog::tableColumnOrganiserSetting()
{
m_ui->dvParticipants->setColumnsOrganiserEnabled(identifier(), true);
}
void ParticipantsDialog::onConfigureAlarmsReply(const Core::FunctionReplyObject& replyObject)
{
DEBUG_LOG(m_logger) << "onConfigureAlarmsReply" << replyObject.str();
m_requestHelper->requestReply(replyObject);
}
void ParticipantsDialog::onDoubleClicked()
{
if (!m_buttonBox->isButtonEnabled(LtsWidgets::DialogButton::Edit))
return;
DEBUG_LOG(m_logger) << "onDoubleClicked";
onAddButtonClicked();
}
} // namespace ParticipantAlarms
@@ -1,75 +0,0 @@
#pragma once
#include "alm_participant_model.h"
#include <LtsSession/lts_session.h>
#include <LtsUtils/LtsUtilsGui/LtsUtilsGuiDds/request_helper.h>
#include <LtsWidgets/lts_dialog.h>
#include <ParticipantManagement/ppm_dtc.h>
#include <AlarmManagement/alm.hpp>
#include <AlarmManagement/alm_dtc.h>
#include <AlarmManagement/alm_ftc.h>
#include <memory>
namespace Ui
{
class ParticipantsDialog;
}
namespace ParticipantManagement
{
class ParticipantTreeFilterProxyModel;
class ForeignGuiComboboxInterface;
} // namespace ParticipantManagement
namespace ParticipantAlarms
{
class TypeModel;
class ParticipantsDialog : public LtsWidgets::LtsDialog,
protected AlarmManagement::Interface::Ftc::ConfigureAlarmsReplyHandler
{
Q_OBJECT
public:
explicit ParticipantsDialog(const QString& menuGroup, QWidget* parent = nullptr);
~ParticipantsDialog();
bool init(LtsSession::LtsSession* session, const std::shared_ptr<ParticipantManagement::Interface::Dtc>& ppmDtc,
const std::shared_ptr<AlarmManagement::Interface::Dtc>& almDtc,
const std::shared_ptr<AlarmManagement::Interface::Ftc>& almFtc,
const std::shared_ptr<ParticipantManagement::ForeignGuiComboboxInterface>& ppmGuiCbxIfc);
protected:
NGL::INGLLogger& m_logger;
void onConfigureAlarmsReply(const Core::FunctionReplyObject& replyObject) override final;
private slots:
void onAddButtonClicked();
void onPrint();
void onCbPartyChanged();
void onDoubleClicked();
void onSelectionChanged();
private:
void retranslate() override;
void setChildrenSelected(const QModelIndex& parent);
void tableColumnOrganiserSetting() override;
private:
LtsSession::LtsSession* m_session;
std::shared_ptr<AlarmManagement::Interface::Dtc> m_almDtc;
std::shared_ptr<AlarmManagement::Interface::Ftc> m_almFtc;
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_ppmDtc;
ParticipantAlarmModel* m_participantModel;
ParticipantManagement::ParticipantTreeFilterProxyModel* m_participantProxyModel;
LtsUtils::RequestHelper* m_requestHelper;
std::vector<int> m_participantVector;
std::vector<int> m_equipmentVector;
QString m_menuGroup;
static int s_preselectedParty;
Ui::ParticipantsDialog* m_ui;
};
} // namespace ParticipantAlarms
@@ -1,90 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ParticipantsDialog</class>
<widget class="QWidget" name="ParticipantsDialog">
<property name="windowTitle">
<string notr="true">Messaging View</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="1">
<widget class="LtsWidgets::LtsComboBox" name="cbParty">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QCheckBox" name="cbAllParticipants">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>all</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="lblParty">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Party:</string>
</property>
</widget>
</item>
<item row="0" column="3">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0" colspan="4">
<widget class="LtsDataView::LtsDataView" name="dvParticipants">
<property name="showColumnCount" stdset="0">
<bool>false</bool>
</property>
<property name="toolButtonsVisible">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>LtsWidgets::LtsComboBox</class>
<extends>QComboBox</extends>
<header>LtsWidgets/lts_combo_box.h</header>
</customwidget>
<customwidget>
<class>LtsDataView::LtsDataView</class>
<extends>QWidget</extends>
<header>LtsDataView/lts_data_view.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>cbParty</tabstop>
<tabstop>cbAllParticipants</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>
@@ -1,90 +0,0 @@
#include "alm_participant_gui_plugin.h"
#include "alm_participant_dialog.h"
#include "alm_participant_show_config.h"
#include <AlarmManagement/alm_data_plugin_interface.h>
#include <AreaEffectSimulation/aes_data_plugin_interface.h>
#include <ParticipantManagement/ppm_data_plugin_interface.h>
#include <ParticipantManagement/ppm_gui_combobox_plugin_interface.h>
#include <AlarmManagement/alm_operator_rights.h>
#include <AlarmManagement/logger.h>
#include <LtsSession/lts_session.h>
namespace ParticipantAlarms
{
std::shared_ptr<GuiPluginBase::Interface> GuiPlugin::createGuiInterface(LtsSession::LtsSession *session)
{
return std::make_shared<InterfaceImpl>(session);
}
InterfaceImpl::InterfaceImpl(LtsSession::LtsSession *session)
: GuiPluginBase::Interface(session, AlarmManagement::getLogger("OnlineReports"))
{
}
bool InterfaceImpl::fetchInterfaces()
{
return m_session->getDtc<ParticipantManagement::DataInterface>(m_ppmDtc) &&
m_session->getDtc<AreaEffectSimulation::DataInterface>(m_aesDtc) &&
m_session->getDtc<AlarmManagement::DataInterface>(m_almDtc) &&
m_session->getFtc<AlarmManagement::DataInterface>(m_almFtc) &&
m_session->getForeignGuiInterface<ParticipantManagement::ForeignGuiComboboxInterface>(m_ppmGuiCbxIfc);
}
void InterfaceImpl::clearInterfaces()
{
m_ppmDtc = nullptr;
m_aesDtc = nullptr;
m_almDtc = nullptr;
m_almFtc = nullptr;
m_ppmGuiCbxIfc = nullptr;
}
QString InterfaceImpl::menuGroup() const
{
return tr("Alarm Management");
}
QVector<LtsWidgets::PluginData> InterfaceImpl::getActions()
{
QVector<LtsWidgets::PluginData> ret;
LtsWidgets::PluginData plData;
plData.menuGroup = menuGroup();
plData.menuText = tr("Assign Participant Alarms");
plData.identifier = QLatin1String("almDialog");
plData.operatorRight = OperatorRights::ConfigParticipantDialog;
plData.exercisePart = LtsWidgets::ExercisePart::eExecution;
plData.layoutArea = LtsWidgets::LayoutArea::eDialogTab;
plData.menuIcon = QIcon(QLatin1String("icon:config_player_alarms.svg"));
plData.createWidgetFunc = [this](QWidget *)
{
return LtsWidgets::initDialog(new ParticipantsDialog(menuGroup()),
m_session, m_ppmDtc, m_almDtc, m_almFtc, m_ppmGuiCbxIfc);
};
ret.append(plData);
plData.menuText = tr("Show Config Participant Alarms");
plData.identifier = QLatin1String("almShowConfigAlarm");
plData.operatorRight = OperatorRights::ConfigParticipantDialog;
plData.exercisePart = LtsWidgets::ExercisePart::eExecution;
plData.layoutArea = LtsWidgets::LayoutArea::eDialogTab;
plData.menuIcon = QIcon(QLatin1String("icon:show_player_alarms.svg"));
plData.createWidgetFunc = [this](QWidget * parent)
{
return LtsWidgets::initDialog(new ParticipantShowConfigView(m_session, parent),
m_almDtc, m_almFtc, m_ppmDtc, m_aesDtc);
};
ret.append(plData);
return ret;
}
}
@@ -1,60 +0,0 @@
#pragma once
#include <PluginInterfaces/gui_plugin_interface.h>
#include <AlarmManagement/alm_gui_plugin_interface.h>
#include <AreaEffectSimulation/aes_dtc.h>
#include <ParticipantManagement/ppm.hpp>
#include <ParticipantManagement/ppm_dtc.h>
#include <AlarmManagement/alm_ftc.h>
#include <AlarmManagement/alm_dtc.h>
namespace ParticipantManagement
{
class ForeignGuiComboboxInterface;
}
namespace ParticipantAlarms
{
class GuiPlugin final : public QObject, public GuiPluginBase::Plugin
{
Q_PLUGIN_METADATA(IID "gui:3:alm.configparticipantalarm")
Q_INTERFACES(GuiPluginBase::Plugin)
Q_OBJECT
public:
explicit GuiPlugin() = default;
~GuiPlugin() = default;
QString pluginName() override { return QLatin1String("AlarmManagement.GuiPlugin.ConfigParticipantAlarm"); }
std::shared_ptr<GuiPluginBase::Interface> createGuiInterface(LtsSession::LtsSession *session) override;
bool availableInPartition(IDL::PartitionType partition) const override
{
return (partition == IDL::PartitionType::Exercise);
}
};
class InterfaceImpl final : public QObject, public GuiPluginBase::Interface
{
Q_OBJECT
public:
explicit InterfaceImpl(LtsSession::LtsSession *session);
bool fetchInterfaces() override;
void clearInterfaces() override;
QString menuGroup() const override;
QVector<LtsWidgets::PluginData> getActions() override;
private:
std::shared_ptr<AlarmManagement::Interface::Ftc> m_almFtc;
std::shared_ptr<AlarmManagement::Interface::Dtc> m_almDtc;
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_ppmDtc;
std::shared_ptr<AreaEffectSimulation::Interface::Dtc> m_aesDtc;
std::shared_ptr<ParticipantManagement::ForeignGuiComboboxInterface> m_ppmGuiCbxIfc;
};
}
@@ -1,68 +0,0 @@
#include "alm_participant_model.h"
#include <AlarmManagement/logger.h>
#include <ParticipantManagement/ppm_data_plugin_interface.h>
namespace ParticipantAlarms
{
ParticipantAlarmModel::ParticipantAlarmModel(QObject* parent,
const std::shared_ptr<ParticipantManagement::Interface::Dtc>& ppmDtc,
const std::shared_ptr<AdvancedSymbology::ForeignDataInterface>& asbIfc)
: ParticipantManagement::ParticipantEditModel(parent, ppmDtc, asbIfc),
m_logger(AlarmManagement::getLogger("ParticipantAlarmModel"))
{
m_titles += tr("Alarm Assignable");
DEBUG_LOG(m_logger) << "ParticipantAlarmModel::ParticipantAlarmModel";
}
QVariant ParticipantAlarmModel::data(const QModelIndex& index, int role) const
{
if (role == Qt::DisplayRole && index.column() == columnCount() - 1)
{
bool bIsSimulated = false;
if (!isSelectableByAlarm(index, &bIsSimulated))
return QVariant();
return !bIsSimulated ? tr("Yes") : tr("No");
}
return ParticipantManagement::ParticipantEditModel::data(index, role);
}
void ParticipantAlarmModel::onParticipantChanged(const ParticipantManagement::Participant& data,
DataModification modType)
{
Q_UNUSED(modType);
if (data.partyId != partyId())
return;
INFO_LOG(m_logger) << "onParticipantChanged isSimulated=" << data.isSimulated;
onReinitModel(partyId());
emit newData();
}
bool ParticipantAlarmModel::isSelectableByAlarm(const QModelIndex& index, bool* bIsSimulated) const
{
bool isSimulatable = false;
const ParticipantManagement::ParticipantData data(getParticipantData(index));
if ((data.equipmentNumber.has_value() && data.equipmentNumber.get() > 0) ||
m_dtc->type(data.typeId).typeClass == ParticipantManagement::TypeClass::Unit)
isSimulatable = true;
DEBUG_LOG(m_logger) << "ParticipantId: " << data.id << " isSimulated:" << data.isSimulated
<< " equipmentNo:" << data.equipmentNumber << " typeId=" << data.typeId
<< " modId=" << data.modId << " typeClass=" << m_dtc->type(data.typeId).typeClass
<< " isSimulatable=" << isSimulatable;
if (bIsSimulated)
*bIsSimulated = data.isSimulated;
return isSimulatable;
}
} // namespace ParticipantAlarms
@@ -1,26 +0,0 @@
#pragma once
#include <ParticipantManagement/Gui/Common/participant_edit_model.h>
namespace ParticipantAlarms
{
class ParticipantAlarmModel final : public ParticipantManagement::ParticipantEditModel
{
Q_OBJECT
public:
ParticipantAlarmModel(QObject* parent, const std::shared_ptr<ParticipantManagement::Interface::Dtc>& ppmDtc,
const std::shared_ptr<AdvancedSymbology::ForeignDataInterface>& asbIfc);
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
signals:
void newData();
private:
NGL::INGLLogger& m_logger;
void onParticipantChanged(const ParticipantManagement::Participant& data, DataModification modType);
bool isSelectableByAlarm(const QModelIndex& index, bool* bIsSimulated = nullptr) const;
};
} // namespace ParticipantAlarms
@@ -1,133 +0,0 @@
#include "alm_participant_show_config.h"
#include "ui_alm_participant_show_config.h"
#include <LtsPrinting/printing.h>
#include <LtsSession/lts_session_data.h>
#include <QtWidgets/QTreeView>
namespace ParticipantAlarms
{
ParticipantShowConfigView::ParticipantShowConfigView(LtsSession::LtsSession* session, QWidget* parent)
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::CloseOnly), m_configAlarmModel(nullptr),
m_alarmHistoryModel(nullptr), m_dtc(nullptr), m_almFtc(nullptr), m_session(session),
m_ui(new Ui::ParticipantShowConfigView), m_requestHelper(new LtsUtils::RequestHelper(this)),
m_logger(AlarmManagement::getLogger("ParticipantShowConfigView"))
{
DEBUG_LOG(m_logger) << "--- ParticipantShowConfigView Konstruktor() ";
m_ui->setupUi(this);
m_ui->widget->setSelectionMode(QAbstractItemView::SingleSelection);
connect(m_ui->widget, &LtsDataView::LtsDataView::signalSelectionChanged, this,
&ParticipantShowConfigView::onSelectionChanged);
connect(m_ui->widget, &LtsDataView::LtsDataView::signalDoubleClicked, this,
&ParticipantShowConfigView::onShowAlarm);
m_buttonBox->connectButton(LtsWidgets::DialogButton::Remove, this, &ParticipantShowConfigView::onRemoveAlarm);
m_buttonBox->connectButton(LtsWidgets::DialogButton::Print, this, &ParticipantShowConfigView::onPrint);
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Remove, false);
setOnlineHelpFilename(QStringLiteral("Situation-Show_Config_Participant_Alarms"));
}
ParticipantShowConfigView::~ParticipantShowConfigView()
{
INFO_LOG(m_logger) << "--- ParticipantShowConfigView Destruktor() ";
delete m_ui;
}
void ParticipantShowConfigView::retranslate()
{
translate(m_ui, tr("Show Config Participant Alarms"));
}
bool ParticipantShowConfigView::init(const std::shared_ptr<AlarmManagement::Interface::Dtc>& dtc,
const std::shared_ptr<AlarmManagement::Interface::Ftc>& ftc,
const std::shared_ptr<ParticipantManagement::Interface::Dtc>& ppmDtc,
const std::shared_ptr<AreaEffectSimulation::Interface::Dtc>& aesDtc)
{
INFO_LOG(m_logger) << "--- init() ";
if (!dtc || !ftc)
return false;
m_dtc = dtc;
m_almFtc = ftc;
m_alarmHistoryModel = new AlarmManagement::AlarmHistoryModel(this);
m_alarmHistoryModel->initModel(dtc, ppmDtc, aesDtc);
DEBUG_LOG(m_logger) << "--- ParticipantShowConfigView::init ";
m_configAlarmModel = new AlarmManagement::ConfigAlarmModel(this);
m_configAlarmModel->initModel(m_dtc, ppmDtc, m_alarmHistoryModel, false);
m_ui->widget->setModel(m_configAlarmModel);
return true;
}
void ParticipantShowConfigView::onSelectionChanged()
{
QModelIndexList selectedRows = m_ui->widget->selectedRows();
const int cntSelectedRows = selectedRows.size();
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Edit, cntSelectedRows == 1);
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Remove, cntSelectedRows == 1);
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Show, cntSelectedRows == 1);
}
void ParticipantShowConfigView::onConfigureAlarmsReply(const Core::FunctionReplyObject& replyObject)
{
DEBUG_LOG(m_logger) << "onConfigureAlarmsReply" << replyObject.str();
m_requestHelper->requestReply(replyObject);
}
void ParticipantShowConfigView::tableColumnOrganiserSetting()
{
m_ui->widget->setColumnsOrganiserEnabled(identifier(), true);
}
void ParticipantShowConfigView::onShowAlarm()
{
INFO_LOG(m_logger) << "--- onShowAlarm() ";
}
void ParticipantShowConfigView::onRemoveAlarm()
{
DEBUG_LOG(m_logger) << "onRemoveAlarm"
<< " id = " << m_configAlarmModel->getRowData(m_ui->widget->currentIndex().row()).id
<< " eventTypeId = "
<< m_configAlarmModel->getRowData(m_ui->widget->currentIndex().row()).eventTypeId
<< " operatorId = "
<< m_configAlarmModel->getRowData(m_ui->widget->currentIndex().row()).operatorId
<< " participantId = "
<< m_configAlarmModel->getRowData(m_ui->widget->currentIndex().row()).participantId;
const QModelIndex curIdx = m_ui->widget->currentIndex();
if (!curIdx.isValid())
return;
const AlarmManagement::AlarmConfig& rowdata = m_configAlarmModel->getRowData(curIdx.row());
int operatorId = rowdata.operatorId;
std::vector<int32_t> ddsParticipantIds;
ddsParticipantIds.push_back(rowdata.participantId);
bool globalEvent = true;
bool remove = true;
std::vector<AlarmManagement::AlarmAction> alarmsDds;
alarmsDds.resize(1);
alarmsDds[0].setMarker = false;
alarmsDds[0].messageWindow = false;
alarmsDds[0].eventTypeId = rowdata.eventTypeId;
AlarmManagement::ConfigureAlarmsRequest request(alarmsDds, operatorId, ddsParticipantIds, globalEvent, remove);
m_requestHelper->startSingleRequest([request, this]() {
return m_almFtc->configureAlarmsRequest(request, this);
});
}
void ParticipantShowConfigView::onPrint()
{
LtsPrinting::printView(m_session, this, m_ui->widget->treeView());
}
} // namespace ParticipantAlarms
@@ -1,63 +0,0 @@
#pragma once
#include <LtsSession/lts_session.h>
#include <LtsUtils/LtsUtilsGui/LtsUtilsGuiDds/request_helper.h>
#include <LtsWidgets/lts_dialog.h>
#include <ParticipantManagement/ppm_dtc.h>
#include <AlarmManagement/Gui/Common/alm_config_alarm_model.h>
#include <AlarmManagement/alm_dtc.h>
#include <AlarmManagement/alm_ftc.h>
namespace Ui
{
class ParticipantShowConfigView;
}
namespace ParticipantAlarms
{
class ParticipantShowConfigView : public LtsWidgets::LtsDialog,
protected AlarmManagement::Interface::Ftc::ConfigureAlarmsReplyHandler
{
Q_OBJECT
public:
explicit ParticipantShowConfigView(LtsSession::LtsSession* session, QWidget* parent = nullptr);
~ParticipantShowConfigView();
bool init(const std::shared_ptr<AlarmManagement::Interface::Dtc>& dtc,
const std::shared_ptr<AlarmManagement::Interface::Ftc>& ftc,
const std::shared_ptr<ParticipantManagement::Interface::Dtc>& ppmDtc,
const std::shared_ptr<AreaEffectSimulation::Interface::Dtc>& aesDtc);
private Q_SLOTS:
void retranslate() override;
void onSelectionChanged();
void onShowAlarm();
void onRemoveAlarm();
void onPrint();
protected:
void onConfigureAlarmsReply(const Core::FunctionReplyObject& replyObject) override final;
private:
void tableColumnOrganiserSetting() override;
private:
AlarmManagement::ConfigAlarmModel* m_configAlarmModel;
AlarmManagement::AlarmHistoryModel* m_alarmHistoryModel;
std::shared_ptr<AlarmManagement::Interface::Dtc> m_dtc;
std::shared_ptr<AlarmManagement::Interface::Ftc> m_almFtc;
LtsSession::LtsSession* m_session;
Ui::ParticipantShowConfigView* m_ui;
LtsUtils::RequestHelper* m_requestHelper;
AlarmManagement::LOGGER_T m_logger;
};
} // namespace ParticipantAlarms
@@ -1,45 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ParticipantShowConfigView</class>
<widget class="QWidget" name="ParticipantShowConfigView">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>455</width>
<height>341</height>
</rect>
</property>
<property name="windowTitle">
<string notr="true">ShowConfigView</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="LtsDataView::LtsDataView" name="widget">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>250</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>LtsDataView::LtsDataView</class>
<extends>QWidget</extends>
<header>LtsDataView/lts_data_view.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
@@ -1,61 +0,0 @@
#
# $Id$
# $HeadURL$
# $Author$
# Created by Patric Karwat, SLSE, 2016-10-05
#
# Make ${Qt6_Widgets} optional
if(QT6_GUI_AVAILABLE AND TARGET Qt6::Widgets)
set(Qt6_Widgets ${Qt6_Widgets})
else()
set(Qt6_Widgets "")
endif()
SET(alm_emergency_call_gui_SRCS
alm_emergency_call_gui_plugin.cpp
alm_emergency_call_gui_plugin.h
alm_emergency_call_dialog.cpp
alm_emergency_call_dialog.h
alm_emergency_call_model.cpp
alm_emergency_call_model.h
alm_emergency_call_info_dialog.cpp
alm_emergency_call_info_dialog.h
)
NGL_WRAP_UI(alm_emergency_call_gui_SRCS
alm_emergency_call_dialog.ui
alm_emergency_call_info_dialog.ui
)
NGL_ADD_LIBRARY(WS AlmEmergencyCallGuiPlugin MODULE ${alm_emergency_call_gui_SRCS})
if(QT6_GUI_AVAILABLE)
NGL_TARGET_LINK_LIBRARIES(AlmEmergencyCallGuiPlugin
LtsPrinting
AlmCommon
svcTabCommon
LtsSession
LtsSessionData
LtsUtilsSettings
#AlmGuiPluginInterface
AlmInfoGuiPluginInterface
AlmDataPluginInterface
OpmDataPluginInterface
ExmDataPluginInterface
#svcPdmCommon # pdm_enums.h in alm_dialog.cpp
#svcPpmCommon
GuiPluginInterface
${Qt6_Widgets}
LtsCoordTrans
LtsWidgets
LtsDataView
SituationMapGuiPluginInterface
NGLLogger
LtsUtilsGuiDds
LtsAppManager # get sessions to look on which one to open alarm history
)
endif()
NGL_INSTALL_TARGET(AlmEmergencyCallGuiPlugin)
@@ -1,234 +0,0 @@
#include "alm_emergency_call_dialog.h"
#include <NGLLogger/NGLLoggerBootstrap.h>
#include "AlarmManagement/Gui/EmergencyCalls/alm_emergency_call_model.h"
#include "ui_alm_emergency_call_dialog.h"
#include <ExerciseManagement/exm_data_plugin_interface.h>
#include <LtsSession/lts_session_data.h>
#include <LtsWidgets/lts_abstract_table_model.h>
#include <QtCore/QDateTime>
#include <QtWidgets/QLabel>
#include <QtWidgets/QLineEdit>
#include <AlarmManagement/alm_operator_rights.h>
namespace AlarmManagement
{
EmergencyCallDialog::EmergencyCallDialog(QWidget* parent)
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::CloseOnly), m_dtc(nullptr), m_ftc(nullptr),
m_session(nullptr), m_ui(new Ui::EmergencyCallDialog), m_requestHelper(new LtsUtils::RequestHelper(this)),
m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger())
{
m_ui->setupUi(this);
}
void EmergencyCallDialog::retranslate()
{
translate(m_ui, tr("Emergency Call "));
}
bool EmergencyCallDialog::init(const std::shared_ptr<AlarmManagement::Interface::Ftc>& ftc,
const std::shared_ptr<AlarmManagement::Interface::Dtc>& dtc,
const std::shared_ptr<SituationMap::ForeignGuiInterface>& sitMapGuiIfc,
const std::shared_ptr<OperatorManagement::Interface::Dtc>& opmDtc,
LtsSession::LtsSession* session)
{
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START ";
if (!ftc || !dtc || !session)
{
ERROR_LOG(m_logger) << " init Emergency call dialog failed !!";
return false;
}
m_ftc = ftc;
m_dtc = dtc;
m_opmDtc = opmDtc;
m_session = session;
m_dtc->enableAlmEmergencyCall();
m_ftc->enableEmergencyCallAcknowledge();
m_sitMapGuiIfc = sitMapGuiIfc;
delete m_model;
m_model = new AlarmManagement::EmergencyCallModel(this);
m_model->initModel(m_dtc, opmDtc);
m_proxyModel = new EmergencyCallProxyModel(this);
m_proxyModel->setSourceModel(m_model);
m_ui->emergencyCallView->setModel(m_proxyModel);
m_proxyModel->hideByExerciseStopped(m_session->exerciseState() != LtsWidgets::ExcState::eStarted &&
m_session->exerciseState() != LtsWidgets::ExcState::ePaused);
m_ui->emergencyCallView->setSortingEnabled(true);
m_ui->emergencyCallView->resizeSection(EmergencyCallModel::Columns::SAMPLE_TIME, 300);
m_ui->emergencyCallView->resizeSection(EmergencyCallModel::Columns::POSITION, 300);
m_ui->emergencyCallView->resizeSection(EmergencyCallModel::Columns::DELETED_TIMESTAMP, 300);
m_buttonBox->getButton(LtsWidgets::DialogButton::Edit)->setText(tr("Acknowledge"));
m_buttonBox->getButton(LtsWidgets::DialogButton::Show)->setText(tr("Center"));
m_buttonBox->getButton(LtsWidgets::DialogButton::Show)->setIcon(QIcon(QStringLiteral("icon:center_to_object.svg")));
m_buttonBox->connectButton(LtsWidgets::DialogButton::Edit, this, &EmergencyCallDialog::onEditBtCliked);
const bool& hasOperatorRightEmergencyCall =
LtsSessionData::LtsSessionData::getInstance()->hasOperatorRight(OperatorRights::EmergencyCall);
m_buttonBox->getButton(LtsWidgets::DialogButton::Edit)->setVisible(hasOperatorRightEmergencyCall);
m_buttonBox->connectButton(LtsWidgets::DialogButton::Show, this, &EmergencyCallDialog::onFindEmergencyOnMap);
QCheckBox* cbExpired = new QCheckBox(tr("Show expired"), m_ui->emergencyCallView);
cbExpired->setProperty("const", true);
m_ui->emergencyCallView->setCustomWidget(cbExpired);
connect(cbExpired, &QCheckBox::toggled, this, &EmergencyCallDialog::onSetShowExpired);
connect(m_ui->emergencyCallView, &LtsDataView::LtsDataView::signalSelectionChanged, this,
&EmergencyCallDialog::enaDisa);
connect(m_ui->emergencyCallView, &LtsDataView::LtsDataView::doubleClicked, this,
&EmergencyCallDialog::onEmergencyIndexDoubleClicked);
enaDisa();
#ifndef LTS_DEBUG
m_ui->emergencyCallView->hideColumn(EmergencyCallModel::ID);
m_ui->emergencyCallView->hideColumn(EmergencyCallModel::SAMPLE_TIME);
m_ui->emergencyCallView->hideColumn(EmergencyCallModel::NAME);
m_ui->emergencyCallView->hideColumn(EmergencyCallModel::EXPIRED);
#endif
INFO_LOG(m_logger) << "EmergencyCallDialog::init done";
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
return true;
}
void EmergencyCallDialog::enaDisa()
{
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Edit, false);
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Show, false);
const AlmEmergencyCall& sos = getSelectedSOS();
if (sos.id <= 0)
return;
if (!sos.expired)
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Edit, true);
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Show, true);
}
AlmEmergencyCall EmergencyCallDialog::getSelectedSOS()
{
QModelIndexList indexList = m_ui->emergencyCallView->selectedRows();
if (indexList.isEmpty())
return {};
return m_model->getRowData(indexList.front().row());
}
void EmergencyCallDialog::setAcknowledgeUi()
{
LtsWidgets::LtsFramelessDialog* popup = new LtsWidgets::LtsFramelessDialog(this, LtsWidgets::Behaviour::Popup);
LtsWidgets::LtsDialogButtonBox* btnBox = new LtsWidgets::LtsDialogButtonBox(popup);
btnBox->getButton(LtsWidgets::DialogButton::Ok)->setEnabled(false);
QVBoxLayout* lay = new QVBoxLayout(popup);
QLineEdit* le = new QLineEdit(popup);
QLabel* lblTxt = new QLabel(tr("Acknowledged by:"), popup);
connect(btnBox->getButton(LtsWidgets::DialogButton::Close), &QPushButton::clicked, popup,
&LtsWidgets::LtsFramelessDialog::accept);
connect(le, &QLineEdit::textChanged, this, [btnBox](const QString& text) {
const int textMinSize = 5;
btnBox->getButton(LtsWidgets::DialogButton::Ok)->setEnabled(text.trimmed().size() >= textMinSize);
});
connect(btnBox->getButton(LtsWidgets::DialogButton::Ok), &QPushButton::clicked, this, [this, le, popup]() {
sendAcknowledgeEmergency(le->text());
popup->accept();
});
lay->addWidget(lblTxt);
lay->addWidget(le);
lay->addWidget(btnBox);
popup->setLayout(lay);
popup->setMinimumWidth(350);
popup->show();
le->setFocus();
}
void EmergencyCallDialog::onEditBtCliked()
{
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
const AlmEmergencyCall& sos = getSelectedSOS();
if (sos.id <= 0)
return;
setAcknowledgeUi();
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
}
void EmergencyCallDialog::onSetShowExpired(bool show)
{
if (m_proxyModel)
m_proxyModel->setShowExpired(show);
if (!m_updateSOSGuard)
m_updateSOSGuard = QSharedPointer<UpdateSOSGuard>(new UpdateSOSGuard(m_sitMapGuiIfc));
m_updateSOSGuard->showExpiredSOS(show);
}
void EmergencyCallDialog::onFindEmergencyOnMap()
{
if (!m_sitMapGuiIfc)
return;
const AlmEmergencyCall& sos = getSelectedSOS();
if (sos.id <= 0)
return;
m_sitMapGuiIfc->setCenterPoint(QPointF(sos.position.lon, sos.position.lat));
}
void EmergencyCallDialog::onEmergencyIndexDoubleClicked(const QModelIndex& index)
{
Q_UNUSED(index)
emit openInfoDlg(getSelectedSOS().id);
}
void EmergencyCallDialog::sendAcknowledgeEmergency(const QString& comment)
{
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
const AlmEmergencyCall& sos = getSelectedSOS();
if (sos.id <= 0 || sos.expired)
return;
EmergencyCallAcknowledgeRequest request;
request.id = sos.id;
request.issi = sos.issi;
request.name = sos.name;
request.timestamp = QDateTime::currentMSecsSinceEpoch();
request.incomingTime = sos.incomingTime;
request.expired = true;
request.operatorId = LtsSessionData::LtsSessionData::getInstance()->getOperatorId();
request.comment = comment.toStdString();
m_requestHelper->startSingleRequest(
[this, request]() { return m_ftc->emergencyCallAcknowledgeRequest(request, this); });
enaDisa();
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
}
void EmergencyCallDialog::tableColumnOrganiserSetting()
{
m_ui->emergencyCallView->setColumnsOrganiserEnabled(identifier(), true);
}
EmergencyCallDialog::~EmergencyCallDialog()
{
delete m_ui;
}
} // namespace AlarmManagement
Loaded 100 of 14140 files, more files were not shown because too many files have changed in this diff. Show more