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,48 @@
#
# $Id$
# $HeadURL$
# $Author$
# Created by hjl, SLSE, 2017-03-22
#
SET(aes_info_gui_SRCS
aes_info_gui_plugin.h
aes_info_gui_plugin.cpp
aes_info_dialog.h
aes_info_dialog.cpp
aes_danger_area_aes_item_info.cpp
aes_danger_area_aes_item_info.h
aes_charge_effect_item_info.cpp
aes_charge_effect_item_info.h
)
NGL_WRAP_UI(aes_info_gui_SRCS
aes_info_dialog.ui
aes_danger_area_aes_item_info.ui
aes_charge_effect_item_info.ui
)
NGL_ADD_LIBRARY(WS AesInfoGuiPlugin MODULE ${aes_info_gui_SRCS})
NGL_TARGET_LINK_LIBRARIES(AesInfoGuiPlugin
AesInfoGuiPluginInterface
NGLLogger
PdmDataPluginInterface
AesChargeEffectGuiPluginInterface
svcAesCommon
AesBaseGui
AesBCContaminationGuiPluginInterface
AesNContaminationGuiPluginInterface
AesExplosionGuiPluginInterface
AesMineAreaGuiPluginInterface
AesDangerAreaGuiPluginInterface
SituationMapGuiPluginInterface
Qt5::Widgets
LtsWidgets
LtsSession
LtsSessionData
LtsUtilsGuiDds
LtsUtilsSettings
LtsCoordTrans
ngltools
)
NGL_INSTALL_TARGET(AesInfoGuiPlugin)
@@ -0,0 +1,348 @@
#include <LtsCoordTrans/lts_coord_trans.h>
#include <Plugins/SituationMapPlugin/situation_map_gui_plugin_interface.h>
#include <ngltools/ngltools_dtg.h>
#include <AreaEffectSimulation/aes_data_plugin_interface.h>
#include <PluginInterfaces/gui_plugin_interface.h>
#include <ChargeEffect/aes_charge_effect_edit.h>
#include <ChargeEffect/aes_charge_effect_gui_plugin_interface.h>
#include <Plugins/AreaEffectSimulation/Gui/BCContamination/aes_bccontamination_gui_plugin_interface.h>
#include <Plugins/AreaEffectSimulation/Gui/NContamination/aes_ncontamination_gui_plugin_interface.h>
#include <Plugins/AreaEffectSimulation/Gui/Explosion/aes_explosion_gui_plugin_interface.h>
#include <Plugins/AreaEffectSimulation/Gui/MineArea/aes_mine_area_gui_plugin_interface.h>
#include <Plugins/AreaEffectSimulation/Gui/MineCorridor/aes_mine_corridor_gui_plugin_interface.h>
#include <Plugins/AreaEffectSimulation/Gui/GasPipe/aes_gas_pipe_gui_plugin_interface.h>
#include <Plugins/AreaEffectSimulation/Gui/DangerArea/aes_danger_area_gui_plugin_interface.h>
#include <Plugins/AreaEffectSimulation/Gui/Borderline/aes_borderline_gui_plugin_interface.h>
#include <Plugins/AreaEffectSimulation/Gui/FunctionalArea/aes_functional_area_gui_plugin_interface.h>
#include <Plugins/AreaEffectSimulation/Gui/MineSingleVirtual/aes_mine_single_virtual_gui_plugin_interface.h>
#include "aes_translation.h"
#include "aes_charge_effect_item_info.h"
#include "ui_aes_charge_effect_item_info.h"
namespace AreaEffectSimulation
{
AesChargeEffectItemInfo::AesChargeEffectItemInfo(int chargeEffectId, QWidget *parent)
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::CloseOnly)
, m_logger(getLogger("AesChargeEffectItemInfo"))
, m_session(nullptr)
, m_ChargeEffectId(chargeEffectId)
, m_ui(new Ui::AesChargeEffectItemInfo)
{
m_ui->setupUi(this);
m_ui->lblChargeEffectId->setText(QString::number(m_ChargeEffectId));
connect(m_ui->pbFindOnMap, &QToolButton::clicked, this, &AesChargeEffectItemInfo::onFindOnMap);
connect(m_ui->pbDetails, &QToolButton::clicked, this, &AesChargeEffectItemInfo::onShowDetails);
}
AesChargeEffectItemInfo::~AesChargeEffectItemInfo()
{
delete m_ui;
}
bool AesChargeEffectItemInfo::init(LtsSession::LtsSession *session)
{
m_session = session;
if (!session->getDtc<ProjectDataManagement::DataInterface>(m_pdmDtc))
{
ERROR_LOG(m_logger) << " failed to get pdmDtc";
return false;
}
if (!session->getDtc<AreaEffectSimulation::DataInterface>(m_aesDtc))
{
ERROR_LOG(m_logger) << " failed to get aesDtc";
return false;
}
if (!m_aesDtc->isAesItemViewEnabled())
m_aesDtc->enableAesItemView();
if (!m_pdmDtc->isChargeTypeEnabled())
m_pdmDtc->enableChargeType();
const ChargeEffect data = m_aesDtc->chargeEffect(m_ChargeEffectId);
//hide first:
m_ui->lblPosition->hide();
// Debug Infos
#ifndef LTS_DEBUG
m_ui->lbxChargeEffectId->hide();
m_ui->lblChargeEffectId->hide();
m_ui->lbxChargeTypeId->hide();
m_ui->lblChargeTypeId->hide();
m_ui->lbxOriginatorId->hide();
m_ui->lblOriginatorId->hide();
m_ui->lbxOriginatorType->hide();
m_ui->lblOriginatorType->hide();
#endif
m_ui->lblOriginatorId->setText(QString::number(data.originatorId()));
m_ui->lblOriginatorType->setText(QString::number(data.originatorTypeId().underlying()));
setOnlineHelpFilename(QStringLiteral("Info_Dialog-Charge_Effect"));
connect(m_aesDtc.get(), &AreaEffectSimulation::Interface::Dtc::chargeEffectChanged,
this, &AesChargeEffectItemInfo::onChargeEffectChanged);
handleChargeEffect(data);
return true;
}
void AesChargeEffectItemInfo::retranslate()
{
const ChargeEffect item = m_aesDtc->chargeEffect(m_ChargeEffectId);
translate(m_ui, tr("ChargeEffect: \"%1\"").arg(QString::fromStdString(item.name()), 1, QLatin1Char('?')));
}
void AesChargeEffectItemInfo::onFindOnMap() const
{
DEBUG_LOG(m_logger) << "onFindOnMap() aesId: "<<m_ChargeEffectId;
std::shared_ptr<SituationMap::ForeignGuiInterface> ifc;
if (m_session->getForeignGuiInterface<SituationMap::ForeignGuiInterface>(ifc))
ifc->centerMapToChargeEffectObject(m_ChargeEffectId);
else
WARNING_LOG(m_logger) << LOGFUNCTION << "getForeignGuiInterface<SituationMap::ForeignGuiInterface> failed!";
}
template <typename InterfaceType>
bool AesChargeEffectItemInfo::tryShowStandardEditDialog(const AesItemView& aiv)
{
std::shared_ptr<InterfaceType> ifc;
if (m_session->getForeignGuiInterface<InterfaceType>(ifc))
{
AreaEffectSimulation::BaseEdit* dialog = ifc->showEditWindow(aiv.aesItemId(), this);
if (dialog)
{
addDialog(dialog, dialog->menuGroup(), dialog->dialogIdentifier(), LtsWidgets::LayoutArea::eDialogTab);
}
return true;
}
WARNING_LOG(m_logger) << LOGFUNCTION << " getForeignGuiInterface failed for specific AES interface!";
return false;
}
void AesChargeEffectItemInfo::onShowDetails()
{
DEBUG_LOG(m_logger) << LOGFUNCTION;
const ChargeEffect item = m_aesDtc->chargeEffect(m_ChargeEffectId);
if (item.originatorTypeId() == ProjectDataManagement::StateChangeOriginator::AreaEffectSimulation)
{
AesItemView aiv;
m_aesDtc->aesItemViewFromEntityId(item.originatorId(), AreaEffectSimulation::AesType::AtUnknown, aiv);
DEBUG_LOG(m_logger) << "aiv.id():" << aiv.id() << ", aesType: " << aiv.aesTypeId();
// Lambda für die Standard-Dialogregistrierung (spart Schreibarbeit bei Sonderfällen)
auto registerDialog = [this](AreaEffectSimulation::BaseEdit* dialog) {
if (dialog) {
addDialog(dialog, dialog->menuGroup(), dialog->dialogIdentifier(), LtsWidgets::LayoutArea::eDialogTab);
}
};
switch(aiv.aesTypeId().underlying())
{
case AreaEffectSimulation::AesType::AtNContamination:
{
tryShowStandardEditDialog<AesNContamination::ForeignGuiInterface>(aiv);
break;
}
case AreaEffectSimulation::AesType::AtMineArea:
{
tryShowStandardEditDialog<AesMineArea::ForeignGuiInterface>(aiv);
break;
}
case AreaEffectSimulation::AesType::AtMineCorridor:
{
tryShowStandardEditDialog<AesMineCorridor::ForeignGuiInterface>(aiv);
break;
}
case AreaEffectSimulation::AesType::AtGasPipe:
{
tryShowStandardEditDialog<AesGasPipe::ForeignGuiInterface>(aiv);
break;
}
case AreaEffectSimulation::AesType::AtDangerArea:
{
tryShowStandardEditDialog<AesDangerArea::ForeignGuiInterface>(aiv);
break;
}
case AreaEffectSimulation::AesType::AtBorderline:
{
tryShowStandardEditDialog<AesBorderline::ForeignGuiInterface>(aiv);
break;
}
case AreaEffectSimulation::AesType::AtFunctionalArea:
{
tryShowStandardEditDialog<AesFunctionalArea::ForeignGuiInterface>(aiv);
break;
}
case AreaEffectSimulation::AesType::AtBCContamination:
{
std::shared_ptr<AesBCContamination::ForeignGuiInterface> ifc;
if (m_session->getForeignGuiInterface<AesBCContamination::ForeignGuiInterface>(ifc))
{
const auto gearClass = m_pdmDtc->gearClassFromChargeTypeId(aiv.chargeStruct().chargeTypeId());
if (gearClass == ProjectDataManagement::GearClass_def::Biological)
registerDialog(ifc->showEditWindow(aiv.aesItemId(), false, this));
else if (gearClass == ProjectDataManagement::GearClass_def::Chemical)
registerDialog(ifc->showEditWindow(aiv.aesItemId(), true, this));
}
else
WARNING_LOG(m_logger) << LOGFUNCTION << " getForeignGuiInterface<AesBCContamination::ForeignGuiInterface> failed!";
break;
}
case AreaEffectSimulation::AesType::AtBoobyTrap:
case AreaEffectSimulation::AesType::AtBoobyTrapSecondary:
{
std::shared_ptr<AesMineSingleVirtual::ForeignGuiInterface> ifc;
if (m_session->getForeignGuiInterface<AesMineSingleVirtual::ForeignGuiInterface>(ifc))
registerDialog(ifc->showBoobyTrapEditWindow(aiv.aesItemId(), this));
else
WARNING_LOG(m_logger) << LOGFUNCTION << " getForeignGuiInterface<AesMineSingleVirtual::ForeignGuiInterface> failed!";
break;
}
case AreaEffectSimulation::AesType::AtOffRouteMine:
case AreaEffectSimulation::AesType::AtOffRouteMineSecondary:
{
std::shared_ptr<AesMineSingleVirtual::ForeignGuiInterface> ifc;
if (m_session->getForeignGuiInterface<AesMineSingleVirtual::ForeignGuiInterface>(ifc))
registerDialog(ifc->showOffRouteMineEditWindow(aiv.aesItemId(), this));
else
WARNING_LOG(m_logger) << LOGFUNCTION << " getForeignGuiInterface<AesMineSingleVirtual::ForeignGuiInterface> failed!";
break;
}
case AreaEffectSimulation::AesType::AtExplosionSingle:
case AreaEffectSimulation::AesType::AtExplosionArea:
{
std::shared_ptr<AesExplosion::ForeignGuiInterface> ifc;
if (m_session->getForeignGuiInterface<AesExplosion::ForeignGuiInterface>(ifc))
{
const bool isExplosionSingle = (aiv.aesTypeId().underlying() == AreaEffectSimulation::AesType::AtExplosionSingle);
const auto gearClass = m_pdmDtc->gearClassFromChargeTypeId(aiv.chargeStruct().chargeTypeId());
for (auto gc : { ProjectDataManagement::GearClass::Artillery, ProjectDataManagement::GearClass::Mortar, ProjectDataManagement::GearClass::AirSupport })
{
if (gc == ProjectDataManagement::GearClass::AirSupport && !isExplosionSingle) continue; // ExplosionArea -> No AirSupport
if (gearClass == gc)
{
registerDialog(ifc->showEditWindow(aiv.aesItemId(), isExplosionSingle, false, gc, this));
break;
}
}
}
else
WARNING_LOG(m_logger) << LOGFUNCTION << " getForeignGuiInterface<AesExplosion::ForeignGuiInterface> failed!";
break;
}
case AreaEffectSimulation::AesType::AtExplosionCluster:
case AreaEffectSimulation::AesType::AtEffectCluster:
{
std::shared_ptr<AesExplosion::ForeignGuiInterface> ifc;
if (m_session->getForeignGuiInterface<AesExplosion::ForeignGuiInterface>(ifc))
{
// EffectSource is not set in aiv, get aesItem
AesItem ai;
m_aesDtc->aesItemFromId(aiv.aesItemId(), ai);
registerDialog(ifc->showEditWindow(aiv.aesItemId(), ai.effectSourceId(), this));
}
else
WARNING_LOG(m_logger) << LOGFUNCTION << " getForeignGuiInterface<AesExplosion::ForeignGuiInterface> failed!";
break;
}
case AreaEffectSimulation::AesType::AtAirSupportImpact:
case AreaEffectSimulation::AesType::AtDusSingleMine:
case AreaEffectSimulation::AesType::AtExplosionAreaSingleExplosions:
case AreaEffectSimulation::AesType::AtMineAreaSingleMines:
case AreaEffectSimulation::AesType::AtReconArea:
case AreaEffectSimulation::AesType::AtTechnicalArea:
case AreaEffectSimulation::AesType::AtExplosionSingleCentral:
case AreaEffectSimulation::AesType::AtExplosionSingleCentralTrajectory:
case AreaEffectSimulation::AesType::AtExplosionClusterSingleExplosions:
case AreaEffectSimulation::AesType::AtExplosionClusterSingleTrajectory:
case AreaEffectSimulation::AesType::AtExplosionClusterGunToTargetLine:
case AreaEffectSimulation::AesType::AtEffectClusterGunToTargetLine:
case AreaEffectSimulation::AesType::AtEffectClusterSingleExplosions:
case AreaEffectSimulation::AesType::AtEffectClusterSingleTrajectory:
// empty
m_ui->pbDetails->hide();
break;
case AreaEffectSimulation::AesType::AtUnknown:
Q_ASSERT(false);
WARNING_LOG(m_logger) << "Unknown AesType found for aesEntityId: " << aiv.aesTypeId();
break;
default:
DEBUG_LOG(m_logger) << "Couldn't find AesItem to ChargeEffect (any more). Hiding the button";
m_ui->pbDetails->hide();
break;
} // switch
}
else
{
std::shared_ptr<AesChargeEffect::ForeignGuiInterface> ifc;
if (m_session->getForeignGuiInterface<AesChargeEffect::ForeignGuiInterface>(ifc))
{
AreaEffectSimulation::BaseEdit* dialog = ifc->showEditWindow(m_ChargeEffectId, this);
if (dialog)
addDialog(dialog, dialog->menuGroup(), dialog->dialogIdentifier(), LtsWidgets::LayoutArea::eDialogTab);
}
else
WARNING_LOG(m_logger) << LOGFUNCTION << " getForeignGuiInterface ChargeEffect failed!";
}
}
void AesChargeEffectItemInfo::onChargeEffectChanged(const ChargeEffect &data, DataModification modType)
{
DEBUG_LOG(m_logger) << " [onChargeEffectChanged] id: " << data.id();
if (data.id() == m_ChargeEffectId && modType != DataModification::eRemoved)
handleChargeEffect(data);
}
void AesChargeEffectItemInfo::handleChargeEffect(const ChargeEffect &data)
{
// Name
m_ui->lblChargeEffectName->setText(QString::fromStdString(data.name()));
// Start
m_ui->lblEffectStart->setText(DTG::toStringMSec(data.effectStart()));
// Duration
m_ui->lblEffectDuration->setVisible(data.effectDuration() > 0);
m_ui->lbxEffectDuration->setVisible(data.effectDuration() > 0);
m_ui->lblEffectDuration->setText(LtsWidgets::readableDuration(data.effectDuration()));
// Effect State
AreaEffectSimulation::AesEffectState st = data.state();
m_ui->lblStatus->setText(AreaEffectSimulation::toString(st));
// Charge Type Id
m_ui->lblChargeTypeId->setText(QString::number(data.chargeTypeId()));
// Charge Type
m_ui->lblChargeType->setText(m_pdmDtc->trChargeTypeShortName(data.chargeTypeId()));
m_ui->lblChargeType->setToolTip(m_pdmDtc->trChargeTypeName(data.chargeTypeId()));
// Position
m_ui->lblPosition->show();
QString mgrs = LtsCoordTrans::mgrsFromGeographic(data.position().lon(), data.position().lat());
m_ui->lblPosition->setText(tr("Position: %1").arg(mgrs));
}
}
@@ -0,0 +1,63 @@
/**
* @RDE_HEADER@
* Info dialog for the items covered by a charge effect
* $Id$
* $HeadURL$
* $Author$
* Created by kemayou_s, ESZS, 2017-03-27
*/
#pragma once
#include <AreaEffectSimulation/logger.h>
#include <LtsWidgets/lts_dialog.h>
#include <LtsSession/lts_session.h>
#include <AreaEffectSimulation/aes.hpp>
#include <Plugins/ProjectDataManagement/pdm_data_plugin_interface.h>
#include <QWidget>
namespace Ui {
class AesChargeEffectItemInfo;
}
namespace AreaEffectSimulation
{
namespace Interface
{
class Ftc;
class Dtc;
}
class AesChargeEffectItemInfo : public LtsWidgets::LtsDialog
{
Q_OBJECT
public:
explicit AesChargeEffectItemInfo(int aesId, QWidget *parent = nullptr);
~AesChargeEffectItemInfo();
bool init(LtsSession::LtsSession *session);
private:
void retranslate() override;
template <typename InterfaceType>
bool tryShowStandardEditDialog(const AesItemView& aiv);
private Q_SLOTS:
void onFindOnMap() const;
void onShowDetails();
void onChargeEffectChanged(const AreaEffectSimulation::ChargeEffect &data, DataModification modType);
void handleChargeEffect(const AreaEffectSimulation::ChargeEffect &data);
private:
std::shared_ptr<ProjectDataManagement::Interface::Dtc> m_pdmDtc;
std::shared_ptr<AreaEffectSimulation::Interface::Dtc> m_aesDtc;
LOGGER_T m_logger;
LtsSession::LtsSession *m_session;
int m_ChargeEffectId{-1};
Ui::AesChargeEffectItemInfo *m_ui;
};
} // namespace AreaEffectSimulation
@@ -0,0 +1,343 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AesChargeEffectItemInfo</class>
<widget class="QWidget" name="AesChargeEffectItemInfo">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>275</width>
<height>479</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer_2">
<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_3">
<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">
<widget class="LtsWidgets::LtsElidedLabel" name="lbxChargeEffectId">
<property name="text">
<string>Charge Effect Id:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="lblChargeEffectId">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">&lt;EFFECTID&gt;</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="LtsWidgets::LtsElidedLabel" name="lbxEffectName">
<property name="text">
<string>Charge Effect Name:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="lblChargeEffectName">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">&lt;EFFECTNAME&gt;</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="LtsWidgets::LtsElidedLabel" name="lbxOriginatorId">
<property name="text">
<string>Originator Id:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLabel" name="lblOriginatorId">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">&lt;ORIGINATORID&gt;</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="LtsWidgets::LtsElidedLabel" name="lbxOriginatorType">
<property name="text">
<string>Originator Type:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLabel" name="lblOriginatorType">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">&lt;ORIGINATORTYPE&gt;</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="LtsWidgets::LtsElidedLabel" name="lbxEffectStart">
<property name="text">
<string>Effect Start:</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLabel" name="lblEffectStart">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">&lt;EFFECTSTART&gt;</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="LtsWidgets::LtsElidedLabel" name="lbxEffectDuration">
<property name="text">
<string>Effect Duration:</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QLabel" name="lblEffectDuration">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">&lt;EFFECTDURATION&gt;</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="LtsWidgets::LtsElidedLabel" name="lbxStatus">
<property name="text">
<string>Status:</string>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QLabel" name="lblStatus">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">&lt;STATUS&gt;</string>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="LtsWidgets::LtsElidedLabel" name="lbxChargeTypeId">
<property name="text">
<string>Charge Type Id:</string>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QLabel" name="lblChargeTypeId">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">&lt;CHARGETYPEID&gt;</string>
</property>
</widget>
</item>
<item row="9" column="0">
<widget class="LtsWidgets::LtsElidedLabel" name="lbxChargeType">
<property name="text">
<string>Charge Type:</string>
</property>
</widget>
</item>
<item row="9" column="1">
<widget class="QLabel" name="lblChargeType">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">&lt;CHARGETYPE&gt;</string>
</property>
</widget>
</item>
<item row="10" column="0">
<widget class="QLabel" name="lblPosition">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">&lt;POSITION&gt;</string>
</property>
</widget>
</item>
<item row="11" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QToolButton" name="pbFindOnMap">
<property name="maximumSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
<property name="toolTip">
<string>Find on map</string>
</property>
<property name="text">
<string notr="true"/>
</property>
<property name="icon">
<iconset>
<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>
<widget class="QToolButton" name="pbDetails">
<property name="maximumSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
<property name="toolTip">
<string>Show details</string>
</property>
<property name="text">
<string notr="true"/>
</property>
<property name="icon">
<iconset>
<normaloff>:/style/pi_tact_status_history.svg</normaloff>:/style/pi_tact_status_history.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
<property name="autoRepeatInterval">
<number>100</number>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>17</width>
<height>17</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="12" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>LtsWidgets::LtsElidedLabel</class>
<extends>QLabel</extends>
<header>LtsWidgets/lts_elided_label.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
@@ -0,0 +1,166 @@
/**
* @RDE_HEADER@
* Info dialog for the items covered by a danger area
* $Id$
* $HeadURL$
* $Author$
* Created by diers, SLSE, 2017-03-27
*/
#include "aes_danger_area_aes_item_info.h"
#include "ui_aes_danger_area_aes_item_info.h"
#include <Plugins/AreaEffectSimulation/aes_data_plugin_interface.h>
#include <BCContamination/aes_bccontamination_gui_plugin_interface.h>
#include <Plugins/ProjectDataManagement/pdm_data_plugin_interface.h>
#include <LtsCoordTrans/lts_coord_trans.h>
#include <PluginInterfaces/gui_plugin_interface.h>
#include <QDateTime>
#include <memory>
namespace AreaEffectSimulation
{
DangerAreaAesItemInfo::DangerAreaAesItemInfo(QWidget *parent)
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::CloseOnly)
, m_dtc(nullptr)
, m_logger(getLogger("DangerArea.AesItemInfo"))
, m_session(nullptr)
, m_ui(new Ui::DangerAreaAesItemInfo)
, m_aesItemId(-1)
{
m_ui->setupUi(this);
}
DangerAreaAesItemInfo::~DangerAreaAesItemInfo()
{
for (const auto &item : qAsConst(m_aesItems))
delete item.item;
delete m_ui;
}
void DangerAreaAesItemInfo::retranslate()
{
std::unique_ptr<AesItem> item(new BCContamination(m_dtc->bCContamination(m_aesItemId)));
if (item->id() > 0)
{
translate(m_ui, m_dtc->bCContamination(m_aesItemId), tr("B/C-Contamination"));
return;
}
item.reset(new NContamination(m_dtc->nContamination(m_aesItemId)));
if (item->id() > 0)
{
translate(m_ui, m_dtc->nContamination(m_aesItemId), tr("N-Contamination"));
return;
}
item.reset(new ExplosionArea(m_dtc->explosionArea(m_aesItemId)));
if (item->id() > 0)
{
translate(m_ui, m_dtc->explosionArea(m_aesItemId), tr("Explosion Area"));
return;
}
item.reset(new ExplosionSingle(m_dtc->explosionSingle(m_aesItemId)));
if (item->id() > 0)
{
translate(m_ui, m_dtc->explosionSingle(m_aesItemId), tr("Single Explosion"));
return;
}
item.reset(new MineArea(m_dtc->mineArea(m_aesItemId)));
if (item->id() > 0)
{
translate(m_ui, m_dtc->mineArea(m_aesItemId), tr("Mine Area"));
return;
}
translate(m_ui, tr("Unknown Aes Type"));
}
bool DangerAreaAesItemInfo::init(const QSet<int> &dangerAreaIds, const QSet<int> &aesItemIds, LtsSession::LtsSession *session)
{
if (!init(session))
return false;
for (int dangerAreaId : dangerAreaIds)
m_dangerAreas.insert(dangerAreaId, m_dtc->dangerArea(dangerAreaId));
for (int aesItemId : aesItemIds)
insertAesItem(aesItemId);
m_aesItemId = aesItemIds.empty() ? -1 : *aesItemIds.begin();
setText();
return true;
}
bool DangerAreaAesItemInfo::init(LtsSession::LtsSession *session)
{
if (m_session && session)
{
ERROR_LOG(m_logger) << "double init()!";
return false;
}
if (!m_session && !session)
{
ERROR_LOG(m_logger) << "No Session available!";
return false;
}
if (!m_session)
m_session = session;
if(!m_dtc.get())
if (!m_session->getDtc<AreaEffectSimulation::DataInterface>(m_dtc))
return false;
setText();
return true;
}
void DangerAreaAesItemInfo::insertAesItem(int aesItemId)
{
AesItem *item;
item = new BCContamination(m_dtc->bCContamination(aesItemId));
if (item->id() > 0)
{
m_aesItems.insert(aesItemId, AesStruct(AesType::AtBCContamination, item));
return;
}
delete item;
WARNING_LOG(m_logger) << "AesItem with id " << aesItemId << " is not of any known type!";
}
void DangerAreaAesItemInfo::setText()
{
for (const DangerArea &dangerArea : qAsConst(m_dangerAreas))
aesItemInfo(&dangerArea);
for(const AesStruct &aesStruct : qAsConst(m_aesItems))
{
if(aesStruct.item->effectStateId() == AreaEffectSimulation::AesEffectState::EsActivated)
aesItemInfo(aesStruct.item);
}
}
void DangerAreaAesItemInfo::aesItemInfo(const AesItem *item)
{
// Todo: Use This, not the HTML!
std::shared_ptr<AesBCContamination::ForeignGuiInterface> guiInterface;
if (!m_session->getForeignGuiInterface<AesBCContamination::ForeignGuiInterface>(guiInterface) || !guiInterface)
return;
LtsWidgets::LtsDialog *info = guiInterface->showInfoWindow(item);
m_ui->mainLayout->addWidget(info);
// End Use This
}
} // namespace AreaEffectSimulation
@@ -0,0 +1,64 @@
/**
* @RDE_HEADER@
* Info dialog for the items covered by a danger area
* $Id$
* $HeadURL$
* $Author$
* Created by diers, SLSE, 2017-03-27
*/
#pragma once
#include <AreaEffectSimulation/logger.h>
#include <LtsWidgets/lts_dialog.h>
#include <LtsSession/lts_session.h>
#include <AreaEffectSimulation/aes.hpp>
namespace Ui {
class DangerAreaAesItemInfo;
}
namespace AreaEffectSimulation
{
namespace Interface
{
class Ftc;
class Dtc;
}
class DangerAreaAesItemInfo : public LtsWidgets::LtsDialog
{
Q_OBJECT
public:
explicit DangerAreaAesItemInfo(QWidget *parent = nullptr);
~DangerAreaAesItemInfo();
bool init(const QSet<int> &dangerAreaIds, const QSet<int> &aesItemIds, LtsSession::LtsSession *session = nullptr);
private:
void retranslate() override;
void setText();
void aesItemInfo(const AesItem *item);
bool init(LtsSession::LtsSession *session);
void insertAesItem(int aesItemId);
struct AesStruct
{
AesType type = AesType::AtUnknown;
AesItem *item = nullptr;
AesStruct(AesType _type, AesItem *_item) : type(_type), item(_item) {}
};
std::shared_ptr<Interface::Dtc> m_dtc;
LOGGER_T m_logger;
LtsSession::LtsSession *m_session;
QMap<int, DangerArea> m_dangerAreas;
QMap<int, AesStruct> m_aesItems;
Ui::DangerAreaAesItemInfo *m_ui;
int m_aesItemId;
};
} // namespace AreaEffectSimulation
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DangerAreaAesItemInfo</class>
<widget class="QWidget" name="DangerAreaAesItemInfo">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string notr="true">Aes Danger Area Info</string>
</property>
<property name="toolTip">
<string notr="true"/>
</property>
<layout class="QVBoxLayout" name="mainLayout"/>
</widget>
<resources/>
<connections/>
</ui>
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,136 @@
/**
*@RDE_HEADER@
* GUI Plugin for AreaEffectSimulation - Info
* $Id$
* $HeadURL$
* $Author$
* Created by hjl, SLSE, 2017-03-23
*/
#pragma once
//Lts
#include <LtsWidgets/lts_dialog.h>
#include <LtsSession/lts_session.h>
#include <LtsUtilsGuiDds/request_helper.h>
//AreaEffectSimulation
#include <AreaEffectSimulation/logger.h>
//DDS
#include <Plugins/AreaEffectSimulation/aes_data_plugin_interface.h>
#include <Plugins/ProjectDataManagement/pdm_data_plugin_interface.h>
namespace Ui {
class AesInfoDialog;
}
namespace AreaEffectSimulation
{
// --------------------------------------------------------
// AESInfoDialog
// --------------------------------------------------------
class AesInfoDialog : public LtsWidgets::LtsDialog
, protected AreaEffectSimulation::Interface::Ftc::MineResetReplyHandler
{
Q_OBJECT
public:
explicit AesInfoDialog(int aesEntityId, AreaEffectSimulation::AesType aesType, QWidget *parent = nullptr);
~AesInfoDialog();
bool init(LtsSession::LtsSession *session,
const std::shared_ptr<Interface::Dtc> &dtc,
const std::shared_ptr<Interface::Ftc> &ftc,
const std::shared_ptr<ProjectDataManagement::Interface::Dtc> &pdmDtc);
void onMineResetReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
private:
void retranslate() override;
void handleNContamination(const AesItemView &aesItemView);
void handleNContamination(const AreaEffectSimulation::NContamination &data);
void handleBCContamination(const AesItemView &aesItemView);
void handleBCContamination(const AreaEffectSimulation::BCContamination &data);
void handleExplosionArea(const AesItemView &aesItemView);
void handleExplosionArea(const AreaEffectSimulation::ExplosionArea &data);
void handleExplosionSingle(const AesItemView &aesItemView);
void handleExplosionSingle(const AreaEffectSimulation::ExplosionSingle &data);
void handleMineArea(const AesItemView &aesItemView);
void handleMineArea(const AreaEffectSimulation::MineArea &data);
void handleMineCorridor(const AesItemView &aesItemView);
void handleMineCorridor(const AreaEffectSimulation::MineCorridor &data);
void handleBoobyTrap(const AesItemView &aesItemView);
void handleBoobyTrap(const AreaEffectSimulation::BoobyTrap &data);
void handleOffRouteMine(const AesItemView &aesItemView);
void handleOffRouteMine(const AreaEffectSimulation::OffRouteMine &data);
void handleGasPipe(const AesItemView &aesItemView);
void handleGasPipe(const AreaEffectSimulation::GasPipe &data);
void handleDangerArea(const AesItemView &aesItemView);
void handleDangerArea(const AreaEffectSimulation::DangerArea &data);
void handleBorderline(const AesItemView &aesItemView);
void handleBorderline(const AreaEffectSimulation::Borderline &data);
void handleFunctionalArea(const AesItemView &aesItemView);
void handleFunctionalArea(const AreaEffectSimulation::FunctionalArea &data);
void handleAirSupportImpact(const AesItemView &aesItemView);
void handleAirSupportImpact(const AreaEffectSimulation::AirSupportImpact &data);
void handleMineAraeSingleMine();
void handleMineAraeSingleMine(const Core::GeoPosition2D &position, const DusMine &mine);
void handleSingleDusMine();
void handleExplosionCluster(const AesItemView &aesItemView);
void handleExplosionCluster(const AreaEffectSimulation::ExplosionCluster &data);
void handleEffectCluster(const AesItemView &aesItemView);
void handleEffectCluster(const AreaEffectSimulation::EffectCluster &data);
bool cbFunc(const AesItemView &aesItemView);
void handleAesItem(const AesItem &aesData, AesType aesTypeId);
private Q_SLOTS:
void onFindOnMap();
void onShowDetails();
bool onResetDusMines();
void onNContaminationChanged(const AreaEffectSimulation::NContamination &data, DataModification modType);
void onBCContaminationChanged(const AreaEffectSimulation::BCContamination &data, DataModification modType);
void onBoobyTrapChanged(const AreaEffectSimulation::BoobyTrap &data, DataModification modType);
void onOffRouteMineChanged(const AreaEffectSimulation::OffRouteMine &data, DataModification modType);
void onExplosionAreaChanged(const AreaEffectSimulation::ExplosionArea &data, DataModification modType);
void onExplosionSingleChanged(const AreaEffectSimulation::ExplosionSingle &data, DataModification modType);
void onMineAreaChanged(const AreaEffectSimulation::MineArea &data, DataModification modType);
void onMineCorridorChanged(const AreaEffectSimulation::MineCorridor &data, DataModification modType);
void onGasPipeChanged(const GasPipe &data, DataModification modType);
void onDangerAreaChanged(const AreaEffectSimulation::DangerArea &data, DataModification modType);
void onBorderlineChanged(const AreaEffectSimulation::Borderline &data, DataModification modType);
void onFunctionalAreaChanged(const AreaEffectSimulation::FunctionalArea &data, DataModification modType);
void onAirSupportImpactChanged(const AirSupportImpact &data, DataModification modType);
void onDusMineStateChanged(const DusMineState &data, DataModification modType);
void onDusSingleMineChanged(const DusSingleMine &data, DataModification modType);
void onExplosionClusterChanged(const ExplosionCluster &data, DataModification modType);
void onEffectClusterChanged(const EffectCluster &data, DataModification modType);
private:
int m_aesEntityId;
QString m_aesEntityName;
AreaEffectSimulation::AesType m_aesType;
ProjectDataManagement::EffectSource m_aesEffectSource;
int m_bcChargeTypeId;
int m_singleExpChargeTypeId;
int m_areaExpChargeTypeId;
bool m_mineIsReactivatable;
LtsSession::LtsSession *m_session;
std::shared_ptr<Interface::Dtc> m_dtc;
std::shared_ptr<Interface::Ftc> m_ftc;
std::shared_ptr<ProjectDataManagement::Interface::Dtc> m_pdmDtc;
Ui::AesInfoDialog* m_ui;
LtsUtils::RequestHelper *m_requestHelper;
LOGGER_T m_logger;
};
} // namespace AreaEffectSimulation
@@ -0,0 +1,408 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AesInfoDialog</class>
<widget class="QWidget" name="AesInfoDialog">
<property name="windowTitle">
<string notr="true">Aes Info</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="6" column="0">
<widget class="LtsWidgets::LtsElidedLabel" name="lbAesStart">
<property name="text">
<string>AES Start:</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="LtsWidgets::LtsElidedLabel" name="lbAesType">
<property name="text">
<string>AES Type:</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="LtsWidgets::LtsElidedLabel" name="lbAesName">
<property name="text">
<string>AES Name:</string>
</property>
</widget>
</item>
<item row="10" column="1">
<widget class="QLabel" name="lblChargeTypeId">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">&lt;CHARGETYPEID&gt;</string>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QLabel" name="lblAesDuration">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">&lt;AESDURATION&gt;</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="LtsWidgets::LtsElidedLabel" name="lbAesTypeId">
<property name="text">
<string>AES Type Id:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="lblAesItemId">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">&lt;AESITEMID&gt;</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QLabel" name="lblAesStart">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">&lt;AESSTART&gt;</string>
</property>
</widget>
</item>
<item row="12" column="0" colspan="2">
<widget class="QLabel" name="lblPosition">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">&lt;POSITION&gt;</string>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="LtsWidgets::LtsElidedLabel" name="lbFlightTime">
<property name="text">
<string>Flight Time:</string>
</property>
</widget>
</item>
<item row="9" column="0">
<widget class="LtsWidgets::LtsElidedLabel" name="lbStatus">
<property name="text">
<string>Status:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLabel" name="lblAesTypeId">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">&lt;AESTYPEID&gt;</string>
</property>
</widget>
</item>
<item row="9" column="1">
<widget class="QLabel" name="lblStatus">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">&lt;STATUS&gt;</string>
</property>
</widget>
</item>
<item row="10" column="0">
<widget class="LtsWidgets::LtsElidedLabel" name="lbChargeTypeId">
<property name="text">
<string>Charge Type Id:</string>
</property>
</widget>
</item>
<item row="13" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QToolButton" name="pbFindOnMap">
<property name="maximumSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
<property name="toolTip">
<string>Find on map</string>
</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>
<widget class="QToolButton" name="pbDetails">
<property name="maximumSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
<property name="toolTip">
<string>Show details</string>
</property>
<property name="text">
<string notr="true"/>
</property>
<property name="icon">
<iconset resource="../../../Styles/Light/resources/rme_light_style.qrc">
<normaloff>:/style/pi_tact_status_history.svg</normaloff>:/style/pi_tact_status_history.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
<property name="autoRepeatInterval">
<number>100</number>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="pbResetDusMines">
<property name="maximumSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
<property name="toolTip">
<string>Reset DUS Mines matched to this Minearea</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../../Styles/Light/resources/rme_light_style.qrc">
<normaloff>:/style/mine_barriers.svg</normaloff>:/style/mine_barriers.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="14" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item row="4" column="1">
<widget class="QLabel" name="lblAesType">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">&lt;AESTYPE&gt;</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="LtsWidgets::LtsElidedLabel" name="lbAesDuration">
<property name="text">
<string>AES Duration:</string>
</property>
</widget>
</item>
<item row="11" column="1">
<widget class="QLabel" name="lblChargeType">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">&lt;CHARGETYPE&gt;</string>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QLabel" name="lblFlightTime">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">&lt;FLIGHTTIME&gt;</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer_2">
<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_3">
<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="2" column="0">
<widget class="LtsWidgets::LtsElidedLabel" name="lbAesItemId">
<property name="text">
<string>AES Item Id:</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLabel" name="lblAesName">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">&lt;AESNAME&gt;</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="LtsWidgets::LtsElidedLabel" name="lbAesId">
<property name="text">
<string notr="true">AES Id:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="lblAesId">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">&lt;AESID&gt;</string>
</property>
</widget>
</item>
<item row="11" column="0">
<widget class="LtsWidgets::LtsElidedLabel" name="lbChargeType">
<property name="text">
<string>Charge Type:</string>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>LtsWidgets::LtsElidedLabel</class>
<extends>QLabel</extends>
<header>LtsWidgets/lts_elided_label.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>pbResetDusMines</tabstop>
<tabstop>pbFindOnMap</tabstop>
<tabstop>pbDetails</tabstop>
</tabstops>
<resources>
<include location="../../../Styles/Light/resources/rme_light_style.qrc"/>
</resources>
<connections/>
</ui>
@@ -0,0 +1,109 @@
/**
*@RDE_HEADER@
* Gui Plugin for AreaEffectSimulation - Info
* $Id$
* $HeadURL$
* $Author$
* Created by hjl, SLSE, 2017-03-22
*/
#include "aes_info_gui_plugin.h"
#include "aes_info_dialog.h"
#include "aes_danger_area_aes_item_info.h"
#include "aes_charge_effect_item_info.h"
#include <LtsSession/lts_session.h>
#include <AreaEffectSimulation/logger.h>
namespace AreaEffectSimulation
{
std::shared_ptr<GuiPluginBase::Interface> GuiPlugin::createGuiInterface(LtsSession::LtsSession *session)
{
return std::make_shared<InterfaceImpl>(session);
} // end of createGuiInterface()
//-----------------------------------------------------------------------------
InterfaceImpl::InterfaceImpl(LtsSession::LtsSession *session)
: GuiPluginBase::Interface(session, getLogger("AESInfo"))
, m_dtc(nullptr)
, m_pdmDtc(nullptr)
{} // end of ctor()
//-----------------------------------------------------------------------------
bool InterfaceImpl::fetchInterfaces()
{
if (!m_session->getDtc<AreaEffectSimulation::DataInterface>(m_dtc))
return false;
if (!m_session->getFtc<AreaEffectSimulation::DataInterface>(m_ftc))
return false;
if (!m_session->getDtc<ProjectDataManagement::DataInterface>(m_pdmDtc))
return false;
return true;
} // end of fetchInterfaces()
//-----------------------------------------------------------------------------
void InterfaceImpl::clearInterfaces()
{
m_pdmDtc = nullptr;
m_dtc = nullptr;
m_ftc = nullptr;
} // end of clearInterfaces()
//-----------------------------------------------------------------------------
QString InterfaceImpl::menuGroup() const
{
return QStringLiteral("AES Info");
} // end of menuGroup()
//-----------------------------------------------------------------------------
QVector<LtsWidgets::PluginData> InterfaceImpl::getActions()
{
return {};
} // end of getActions()
//-----------------------------------------------------------------------------
void InterfaceImpl::showInfoWindow(const QVector<int> &aesEntityIds, AreaEffectSimulation::AesType aesType)
{
for (auto id : aesEntityIds)
this->showInfoWindow(id, aesType);
}
void InterfaceImpl::showInfoWindow(int aesEntityId, AesType aesType)
{
DEBUG_LOG(m_logger) << "ShowInfoWindow() "
<< " aesEntityId: " << aesEntityId;
AesInfoDialog *dialog = new AesInfoDialog(aesEntityId, aesType);
if (!dialog->init(m_session, m_dtc, m_ftc, m_pdmDtc))
{
delete dialog;
return;
}
m_session->addWidget(dialog, menuGroup(), QStringLiteral("AesInfo%1").arg(aesEntityId), LtsWidgets::LayoutArea::eInfoTab);
} // end of showInfoWindow()
//-----------------------------------------------------------------------------
LtsWidgets::LtsDialog* InterfaceImpl::showDangerAreaAesItemInfo(const QSet<int> &dangerAreaIds, const QSet<int> &aesItemIds)
{
return LtsWidgets::initDialog(new DangerAreaAesItemInfo,
dangerAreaIds, aesItemIds, m_session);
}// end of showDangerAreaAesItemInfo()
void InterfaceImpl::showChargeEffectInfoWindow(int chargeEffectId)
{
AesChargeEffectItemInfo *dialog = new AesChargeEffectItemInfo(chargeEffectId);
if (!dialog->init(m_session))
{
delete dialog;
return;
}
m_session->addWidget(dialog, menuGroup(), QStringLiteral("AesInfo%1").arg(chargeEffectId), LtsWidgets::LayoutArea::eInfoTab);
} // end of showChargeEffectInfoWindow
//-----------------------------------------------------------------------------
} // namespace AreaEffectSimulation
@@ -0,0 +1,70 @@
/**
*@RDE_HEADER@
* Gui Plugin for AreaEffectSimulation - Info
* $Id$
* $HeadURL$
* $Author$
* Created by hjl, SLSE, 2017-03-22
*/
#pragma once
#include <AreaEffectSimulation/logger.h>
#include <PluginInterfaces/gui_plugin_interface.h>
#include <Plugins/AreaEffectSimulation/aes_info_gui_plugin_interface.h>
#include <Plugins/AreaEffectSimulation/aes_data_plugin_interface.h>
#include <Plugins/ProjectDataManagement/pdm_data_plugin_interface.h>
namespace AreaEffectSimulation
{
class GuiPlugin final : public QObject, public GuiPluginBase::Plugin
{
Q_PLUGIN_METADATA(IID "gui:3:aes.info")
Q_INTERFACES(GuiPluginBase::Plugin)
Q_OBJECT
public:
GuiPlugin() = default;
~GuiPlugin() = default;
QString pluginName() override { return QLatin1String("AreaEffectSimulationInfoGui"); }
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 ForeignInfoGuiInterface, public GuiPluginBase::Interface
{
Q_OBJECT
public:
explicit InterfaceImpl(LtsSession::LtsSession *session);
QVector<LtsWidgets::PluginData> getActions() override;
bool fetchInterfaces() override;
void clearInterfaces() override;
QString menuGroup() const override;
bool availableInPartition(IDL::PartitionType partition) const override { return partition == IDL::PartitionType::Exercise; }
// ForeignDataInterface
void showInfoWindow(const QVector<int> &aesEntityIds, AreaEffectSimulation::AesType aesType) override;
void showInfoWindow(int aesEntityId, AreaEffectSimulation::AesType aesType) override;
LtsWidgets::LtsDialog* showDangerAreaAesItemInfo(const QSet<int> &dangerAreaIds, const QSet<int> &aesItemIds) override;
virtual void showChargeEffectInfoWindow(int chargeEffectId) override;
private:
std::shared_ptr<AreaEffectSimulation::Interface::Dtc> m_dtc;
std::shared_ptr<AreaEffectSimulation::Interface::Ftc> m_ftc;
std::shared_ptr<ProjectDataManagement::Interface::Dtc> m_pdmDtc;
};
} // namespace AreaEffectSimulation