Initial commit

This commit is contained in:
torsten committed 2026-08-13 18:33:10 +02:00
commit b7d90b9afe
16245 files changed
+3396666

No files matched your search

@@ -0,0 +1,36 @@
#
# $Id$
# $HeadURL$
# $Author$
#
# Created by Dassow Philipp, SLEA, 2017-08-22
#
SET (gim_info_gui_SRCS
gim_info_gui_plugin.h
gim_info_gui_plugin.cpp
gim_info_dialog.h
gim_info_dialog.cpp
)
QT5_WRAP_UI(gim_info_gui_SRCS
gim_info_dialog.ui
)
NGL_ADD_LIBRARY(WS GimInfoGuiPlugin MODULE ${gim_info_gui_SRCS})
NGL_TARGET_LINK_LIBRARIES(GimInfoGuiPlugin
PRIVATE
svcGimCommon
PUBLIC
LtsSession
LtsCoordTrans
LtsUtilsGuiDds
GimGuiInfoPluginInterface
GimDataPluginInterface
AsbDataPluginInterface
PpmDataPluginInterface
SituationMapGuiPluginInterface
Qt5::Widgets
)
NGL_INSTALL_TARGET(GimInfoGuiPlugin)
@@ -0,0 +1,271 @@
/**
* @RDE_HEADER@
* GUI Plugin for IED- Info
* $Id$
* $HeadURL$
* $Author$
* Created by Philipp Dassow, SLEA, 2017-08-23
*/
#include "gim_info_dialog.h"
#include "ui_gim_info_dialog.h"
#include <QTableWidgetItem>
#include <LtsCoordTrans/lts_coord_trans.h>
#include <GuezIedManagement/gim_translation.h>
#include <ParticipantManagement/ppm_translation.h>
#include <Symbology/symbol_data_to_render_role.h>
#include <Symbology/sidc_builder_base.h>
namespace GuezIedManagement {
InfoDialog::InfoDialog(int iedEntityId, QWidget *parent)
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::CloseOnly)
, m_iedEntityId(iedEntityId)
, m_session(nullptr)
, m_dtc(nullptr)
, m_ppmDtc(nullptr)
, m_asbIfc(nullptr)
, m_symbolWatcher(nullptr)
, m_ui(new Ui::InfoDialog)
, m_logger(getLogger("IedInfoDialog"))
{
m_ui->setupUi(this);
setUnchangeable();
m_symbolWatcher = new AdvancedSymbology::SymbolResultWatcherLabel(m_ui->lblIcon);
connect(m_ui->pbFindOnMap, &QToolButton::clicked, this, &InfoDialog::onFindOnMap);
}
InfoDialog::~InfoDialog()
{
delete m_symbolWatcher;
delete m_ui;
}
bool InfoDialog::init(LtsSession::LtsSession *session,
const std::shared_ptr<Interface::Dtc> &dtc,
const std::shared_ptr<ParticipantManagement::Interface::Dtc> &ppmDtc,
const std::shared_ptr<SituationMap::ForeignGuiInterface> &situationIfc,
const std::shared_ptr<AdvancedSymbology::ForeignDataInterface> &asbIfc)
{
m_session = session;
m_dtc = dtc;
m_ppmDtc = ppmDtc;
m_situationIfc = situationIfc;
m_asbIfc = asbIfc;
if (!m_dtc->enableIed())
return false;
if (!m_ppmDtc->enableParty())
return false;
connect(m_dtc.get(), &Interface::Dtc::iedChanged, this, &InfoDialog::onIedChanged);
connect(m_dtc.get(), &Interface::Dtc::iedPositionChanged, this, &InfoDialog::onIedPositionChanged);
showIedInfos();
return true;
}
void InfoDialog::retranslate()
{
translate(m_ui, QString::number(m_dtc->ied(m_iedEntityId).equipmentNumber()), false, tr("IED"));
}
void InfoDialog::showIedInfos()
{
Ied ied = m_dtc->ied(m_iedEntityId);
m_ui->lblEquipmentNumber->setText(QString::number(ied.equipmentNumber()));
m_ui->lblParty->setText(ParticipantManagement::trPartyName(m_ppmDtc->party(ied.partyId()).name()));
m_ui->lblDesignator->setText(QString::fromStdString(ied.name()));
setPosition(m_dtc->iedPosition(m_iedEntityId));
m_ui->lblExplosiveForce->setText(QString::number(ied.explosiveForce()));
m_ui->lblTriggerRemote->setEnabled(ied.remoteTrigger());
m_ui->lblTriggerButton->setEnabled(ied.switchTrigger());
m_ui->lblTriggerLightbarrier->setEnabled(ied.lightBarrierTrigger());
m_ui->lblTriggerWire->setEnabled(ied.tautWireTrigger());
if (ied.pyrotechnics())
m_ui->lblPyrotechnics->setText(tr("Active"));
else
m_ui->lblPyrotechnics->setText(tr("Inactive"));
m_ui->lblState->setText(GuezIedManagement::toString(ied.tacticalState()));
m_ui->tbwBit->setRowCount(0);
if (ied.electronicsError().underlying() != IedError_def::NoError)
{
QTableWidgetItem *device = new QTableWidgetItem(tr("Electronics"));
QTableWidgetItem *error = new QTableWidgetItem(GuezIedManagement::toString(ied.electronicsError()));
addTbwBitEntry(device, error);
}
if (ied.pyrotechnics1Error().underlying() != IedError_def::NoError)
{
QTableWidgetItem *device = new QTableWidgetItem(tr("Pyrotechnics 1"));
QTableWidgetItem *error = new QTableWidgetItem(GuezIedManagement::toString(ied.pyrotechnics1Error()));
addTbwBitEntry(device, error);
}
if (ied.pyrotechnics2Error().underlying() != IedError_def::NoError)
{
QTableWidgetItem *device = new QTableWidgetItem(tr("Pyrotechnics 2"));
QTableWidgetItem *error = new QTableWidgetItem(GuezIedManagement::toString(ied.pyrotechnics2Error()));
addTbwBitEntry(device, error);
}
if (ied.pyrotechnics3Error().underlying() != IedError_def::NoError)
{
QTableWidgetItem *device = new QTableWidgetItem(tr("Pyrotechnics 3"));
QTableWidgetItem *error = new QTableWidgetItem(GuezIedManagement::toString(ied.pyrotechnics3Error()));
addTbwBitEntry(device, error);
}
if ((ied.electronicsError().underlying() == IedError_def::NoError) &&
(ied.pyrotechnics1Error().underlying() == IedError_def::NoError) &&
(ied.pyrotechnics2Error().underlying() == IedError_def::NoError) &&
(ied.pyrotechnics3Error().underlying() == IedError_def::NoError))
{
QTableWidgetItem *device = new QTableWidgetItem(tr("no Errors"));
addTbwBitEntry(device, nullptr);
}
const QColor &color = QColor::fromRgb(QRgb(m_ppmDtc->party(ied.partyId()).color()));
const AdvancedSymbology::Role &role = AdvancedSymbology::roleToRole<>(m_ppmDtc->party(ied.partyId()).role());
updateIcon(color, role, ied.tacticalState(), QString::fromStdString(ied.symbol()));
}
void InfoDialog::setPosition(const IedPosition &pos)
{
if (std::isnan(pos.position().lon()) || std::isnan(pos.position().lat()))
m_ui->lblPosition->setText(tr("Invalid Position"));
else
m_ui->lblPosition->setText(LtsCoordTrans::mgrsFromGeographic(pos.position().lon(), pos.position().lat()));
}
AdvancedSymbology::Injury guezIedStateToInjury(const GuezIedManagement::IedTacticalState &iedState)
{
switch (iedState.underlying())
{
case GuezIedManagement::IedTacticalState::Active:
return AdvancedSymbology::Injury::NoInjury; // ""
break;
default:
return AdvancedSymbology::Injury::TotalKill; // "/\"
}
}
void updateIedPyro(const GuezIedManagement::IedTacticalState &iedStateIn,
AdvancedSymbology::Injury &injuryInOut,
QString &symbolInOut)
{
// Note:
// Special: triggered Ied<Small|Big> has seperate SIDC:
// "M25D|CMPL|10014000001103000000"); // SIDC for IED (OHNE ZickZack)
// "M25D|CMPL|10014000001103010000"); // SIDC for IED (MIT ZickZack)
// ^
// | -> Therefore suppress Injury
// handled at guez_ied_to_map.cpp and gim_info_dialog.cpp
if (injuryInOut != AdvancedSymbology::Injury::TotalKill)
return;
switch (iedStateIn.underlying())
{
case GuezIedManagement::IedTacticalState::Unknown:
case GuezIedManagement::IedTacticalState::NotActive:
case GuezIedManagement::IedTacticalState::Active:
// empty
break;
case GuezIedManagement::IedTacticalState::TriggeredBySwitch:
case GuezIedManagement::IedTacticalState::TriggeredByRemote:
case GuezIedManagement::IedTacticalState::TriggeredByLightBarrier:
case GuezIedManagement::IedTacticalState::TriggeredByTautWire:
case GuezIedManagement::IedTacticalState::TriggeredByControlDevice:
{
// Sonderfall: type == Ied:
// sidc MIT ZickZack ersetzt 'sidc OHNE ZickZack && TotalKill'
const QString &bsc = AdvancedSymbology::SidcBuilderBase::concreteSidcToBaseSymbolCode(symbolInOut);
// QStringLiteral("AP6D|CMPL|10014000001103000000"); // SIDC for IED (OHNE ZickZack)
if ((bsc.compare(QStringLiteral("AP6D|BASE|40110300")) == 0 ||
bsc.compare(QStringLiteral("M25D|BASE|40110300")) == 0)
)
{
symbolInOut = QStringLiteral("AP6D|CMPL|10014000001103010000"); // SIDC for IED (MIT ZickZack)
injuryInOut = AdvancedSymbology::Injury::NoInjury;
}
}
break;
case GuezIedManagement::IedTacticalState::Defused:
// empty
return;
} //switch
}
void InfoDialog::updateIcon(const QColor &color, AdvancedSymbology::Role role,
const IedTacticalState &state, const QString &sidc)
{
AdvancedSymbology::SymbolDataToRender symDataToRender(sidc);
//symDataToRender.injury = stateToInjury(state);
symDataToRender.role = role;
symDataToRender.injuryColor = Qt::black;
symDataToRender.fillColor = color;
symDataToRender.fillColorReplace = true;
symDataToRender.injury = guezIedStateToInjury(state);
// copy of Lts/Plugins/SituationMapPlugin/Gui/SituationMap/AdapterDds/guez_ied_to_map.cpp :
updateIedPyro(state, symDataToRender.injury, symDataToRender.sidc);
// : copy of Lts/Plugins/SituationMapPlugin/Gui/SituationMap/AdapterDds/guez_ied_to_map.cpp
m_symbolWatcher->setSymbolResult(m_asbIfc->findImage(symDataToRender));
}
void InfoDialog::onFindOnMap()
{
m_situationIfc->centerMapToGuezIedObject(m_iedEntityId);
}
void InfoDialog::onIedChanged(const Ied &data, DataModification modType)
{
Q_UNUSED(modType);
if (data.id() != m_iedEntityId)
return;
showIedInfos();
}
void InfoDialog::onIedPositionChanged(const IedPosition &data, DataModification modType)
{
if (data.id() != m_iedEntityId || modType == DataModification::eRemoved)
return;
setPosition(data);
}
void InfoDialog::addTbwBitEntry(QTableWidgetItem *device, QTableWidgetItem *error)
{
m_ui->tbwBit->setSortingEnabled(false);
int newRow = m_ui->tbwBit->rowCount();
if (device || error)
m_ui->tbwBit->insertRow(newRow);
if (device)
m_ui->tbwBit->setItem(newRow, 0, device);
if (error)
m_ui->tbwBit->setItem(newRow, 1, error);
m_ui->tbwBit->setSortingEnabled(true);
}
}
@@ -0,0 +1,79 @@
/**
* @RDE_HEADER@
* GUI Plugin for IED- Info
* $Id$
* $HeadURL$
* $Author$
* Created by Philipp Dassow, SLEA, 2017-08-23
*/
#pragma once
// Lts
#include <LtsWidgets/lts_dialog.h>
#include <LtsSession/lts_session.h>
// Logger
#include <GuezIedManagement/logger.h>
// Plugins
#include <Plugins/AdvancedSymbology/asb_data_plugin_interface.h>
#include <Plugins/GuezIedManagement/gim_data_plugin_interface.h>
#include <Plugins/SituationMapPlugin/situation_map_gui_plugin_interface.h>
#include <Plugins/ParticipantManagement/ppm_data_plugin_interface.h>
namespace Ui {
class InfoDialog;
}
class QTableWidgetItem;
namespace GuezIedManagement
{
// --------------------------------------------------------
// BuildingInfoDialog
// --------------------------------------------------------
class InfoDialog : public LtsWidgets::LtsDialog
{
Q_OBJECT
public:
explicit InfoDialog(int iedEntityId, QWidget *parent = nullptr);
~InfoDialog();
bool init(LtsSession::LtsSession *session,
const std::shared_ptr<GuezIedManagement::Interface::Dtc> &dtc,
const std::shared_ptr<ParticipantManagement::Interface::Dtc> &ppmDtc,
const std::shared_ptr<SituationMap::ForeignGuiInterface> &situationIfc,
const std::shared_ptr<AdvancedSymbology::ForeignDataInterface> &asbIfc);
private:
void retranslate() override;
void showIedInfos();
void setPosition(const IedPosition &pos);
void updateIcon(const QColor &color, AdvancedSymbology::Role role,
const IedTacticalState &state, const QString &sidc);
private Q_SLOTS:
void onFindOnMap();
void onIedChanged(const Ied &data, DataModification modType);
void onIedPositionChanged(const IedPosition &data, DataModification modType);
private:
void addTbwBitEntry(QTableWidgetItem* device, QTableWidgetItem* error);
int m_iedEntityId;
LtsSession::LtsSession *m_session;
std::shared_ptr<GuezIedManagement::Interface::Dtc> m_dtc;
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_ppmDtc;
std::shared_ptr<SituationMap::ForeignGuiInterface> m_situationIfc;
std::shared_ptr<AdvancedSymbology::ForeignDataInterface> m_asbIfc;
AdvancedSymbology::SymbolResultWatcherLabel *m_symbolWatcher;
Ui::InfoDialog* m_ui;
LOGGER_T m_logger;
};
} // namespace Buildings
@@ -0,0 +1,526 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>InfoDialog</class>
<widget class="QWidget" name="InfoDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>363</width>
<height>510</height>
</rect>
</property>
<property name="windowTitle">
<string notr="true"/>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout_2">
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<spacer name="horizontalSpacer">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<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>
<widget class="QLabel" name="lblIcon">
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="1" column="0">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="lbEquimentNumber">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Equipment Number:</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="lblEquipmentNumber">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">&lt;Equipment Number&gt;</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QLabel" name="lbParty">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Party:</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="lblParty">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">&lt;Party&gt;</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QLabel" name="lbDesignator">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Designator:</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QLabel" name="lblDesignator">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">&lt;Designator&gt;</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QLabel" name="lbPosition">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Position:</string>
</property>
</widget>
</item>
<item row="3" column="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="lblPosition">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">&lt;Position&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="pbFindOnMap">
<property name="maximumSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
<property name="text">
<string notr="true"/>
</property>
<property name="icon">
<iconset resource="../../../Styles/Light/resources/rme_light_style.qrc">
<normaloff>:/style/center_to_object.svg</normaloff>:/style/center_to_object.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>1</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="4" column="0" colspan="2">
<widget class="QLabel" name="lbExplosiveForce">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Explosive Force:</string>
</property>
</widget>
</item>
<item row="4" column="2">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="lblExplosiveForce">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">&lt;Explosive Force&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbExplosiveForceUnit">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>kg TNT</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>1</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="5" column="0" colspan="2">
<widget class="QLabel" name="lbTrigger">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Trigger:</string>
</property>
</widget>
</item>
<item row="5" column="2">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="lblTriggerRemote">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>R</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lblTriggerButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>B</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lblTriggerLightbarrier">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>L</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lblTriggerWire">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>W</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>13</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="6" column="0" colspan="2">
<widget class="QLabel" name="lbPyrotechnics">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Pyrotechnics:</string>
</property>
</widget>
</item>
<item row="6" column="2">
<widget class="QLabel" name="lblPyrotechnics">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">&lt;Pyrotechnics&gt;</string>
</property>
</widget>
</item>
<item row="7" column="0" colspan="2">
<widget class="QLabel" name="lbState">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>State:</string>
</property>
</widget>
</item>
<item row="7" column="2">
<widget class="QLabel" name="lblState">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">&lt;State&gt;</string>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="lbBit">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>BIT:</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item row="8" column="1" colspan="2">
<widget class="QTableWidget" name="tbwBit">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>120</height>
</size>
</property>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
</property>
<attribute name="horizontalHeaderDefaultSectionSize">
<number>120</number>
</attribute>
<attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool>
</attribute>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
<attribute name="verticalHeaderDefaultSectionSize">
<number>31</number>
</attribute>
<attribute name="verticalHeaderStretchLastSection">
<bool>false</bool>
</attribute>
<column>
<property name="text">
<string>Device</string>
</property>
</column>
<column>
<property name="text">
<string>State</string>
</property>
</column>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>75</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources>
<include location="../../../Styles/Light/resources/rme_light_style.qrc"/>
</resources>
<connections/>
</ui>
@@ -0,0 +1,109 @@
/**
* @RDE_HEADER@
* Pairing of IED-objects
* $Id$
* $HeadURL$
* $Author$
* Created by Philipp Dassow, SLEA, 2017-07-28
*/
#include "gim_info_gui_plugin.h"
#include "gim_info_dialog.h"
#include <LtsSession/lts_session.h>
#include <GuezIedManagement/gim_operator_rights.h>
#include <GuezIedManagement/logger.h>
#include <Plugins/AdvancedSymbology/asb_data_plugin_interface.h>
#include <Plugins/GuezIedManagement/gim_data_plugin_interface.h>
#include <Plugins/ParticipantManagement/ppm_data_plugin_interface.h>
#include <Plugins/SituationMapPlugin/situation_map_gui_plugin_interface.h>
namespace GuezIedManagement
{
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("GuiInterface"))
, m_dtc(nullptr)
, m_ppmDtc(nullptr)
, m_situationIfc(nullptr)
, m_asbIfc(nullptr)
{}
QVector<LtsWidgets::PluginData> InterfaceImpl::getActions()
{
QVector<LtsWidgets::PluginData> ret;
/*LtsWidgets::PluginData plData;
plData.menuGroup = menuGroup();
plData.menuText = tr("Info");
plData.identifier = QLatin1String("gimInfo");
plData.menuIcon = QIcon(QLatin1String("icon:set_marker_situation.svg"));
plData.layoutArea = LtsWidgets::LayoutArea::eInfoTab;
plData.createWidgetFunc = [this](QWidget *parent)
{
return onShowInfoWindow(parent, 1);
};
plData.operatorRight = OperatorRights::PairingEdit;
plData.exercisePart = LtsWidgets::ExercisePart::ePlanning;
ret.append(plData);*/
return ret;
}
bool InterfaceImpl::fetchInterfaces()
{
if (!m_session->getDtc<GuezIedManagement::DataInterface>(m_dtc))
return false;
if (!m_session->getDtc<ParticipantManagement::DataInterface>(m_ppmDtc))
return false;
if (!m_session->getForeignGuiInterface<SituationMap::ForeignGuiInterface>(m_situationIfc))
return false;
if (!m_session->getForeignDataInterface<AdvancedSymbology::DataInterface>(m_asbIfc))
return false;
return true;
}
void InterfaceImpl::clearInterfaces()
{
m_asbIfc = nullptr;
m_situationIfc = nullptr;
m_ppmDtc = nullptr;
m_dtc = nullptr;
}
void InterfaceImpl::showInfoWindow(const QVector<int> &iedEntityIds)
{
for (auto id : iedEntityIds)
this->showInfoWindow(id);
}
void InterfaceImpl::showInfoWindow(int iedEntityId)
{
DEBUG_LOG(m_logger) << LOGFUNCTION << " iedEntityId: " << iedEntityId;
InfoDialog *dialog = new InfoDialog(iedEntityId);
if (!dialog->init(m_session, m_dtc, m_ppmDtc, m_situationIfc, m_asbIfc))
{
delete dialog;
return;
}
m_session->addWidget(dialog, menuGroup(), QString::number(iedEntityId), LtsWidgets::LayoutArea::eInfoTab);
}
LtsWidgets::LtsDialog *InterfaceImpl::onShowInfoWindow(QWidget *parent, int iedEntityId)
{
DEBUG_LOG(m_logger) << "onShowInfoWindow() "
<< " iedEntityId: " << iedEntityId;
InfoDialog *dialog = new InfoDialog(iedEntityId, parent);
dialog->init(m_session, m_dtc, m_ppmDtc, m_situationIfc, m_asbIfc);
return dialog;
}
} // namespace GuezIedManagement
@@ -0,0 +1,85 @@
/**
* @RDE_HEADER@
* Pairing of IED-objects
* $Id$
* $HeadURL$
* $Author$
* Created by Philipp Dassow, SLEA, 2017-07-28
*/
#pragma once
#include <PluginInterfaces/gui_plugin_interface.h>
#include <Common/ProjectConfig/project_defines.h>
#include <Plugins/GuezIedManagement/gim_info_gui_plugin_interface.h>
namespace ParticipantManagement
{
namespace Interface {
class Dtc;
}
}
namespace SituationMap{
class ForeignGuiInterface;
}
namespace AdvancedSymbology {
class ForeignDataInterface;
}
namespace GuezIedManagement
{
namespace Interface {
class Dtc;
}
class GuiPlugin final : public QObject, public GuiPluginBase::Plugin
{
Q_PLUGIN_METADATA(IID "gui:3:gim.info")
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::Replay;
}
};
class InterfaceImpl final : public QObject, public GuezIedManagement::ForeignGuiInterface, public GuiPluginBase::Interface
{
Q_OBJECT
public:
explicit InterfaceImpl(LtsSession::LtsSession *session);
QString pluginName() { return ForeignGuiInterface::pluginName(); }
QVector<LtsWidgets::PluginData> getActions() override;
QString menuGroup() const override { return tr("IED Management"); }
bool fetchInterfaces() override;
void clearInterfaces() override;
// ForeignDataInterface
void showInfoWindow(const QVector<int> &iedEntityIds) override;
void showInfoWindow(int iedEntityId) override;
private:
LtsWidgets::LtsDialog *onShowInfoWindow(QWidget *parent, int iedEntityId);
std::shared_ptr<GuezIedManagement::Interface::Dtc> m_dtc;
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_ppmDtc;
std::shared_ptr<SituationMap::ForeignGuiInterface> m_situationIfc;
std::shared_ptr<AdvancedSymbology::ForeignDataInterface> m_asbIfc;
};
} // namespace GuezIedManagement