Files
qt5-legatus-legacy/Lts/Plugins/AreaEffectSimulation/Gui/AesInfo/aes_info_dialog.cpp
T
2026-08-13 18:33:10 +02:00

1389 lines
57 KiB
C++
Executable File

/**
*@RDE_HEADER@
* GUI Plugin for AreaEffectSimulation - Info
* $Id$
* $HeadURL$
* $Author$
* Created by hjl, SLSE, 2017-03-23
*/
#include "aes_info_dialog.h"
#include "ui_aes_info_dialog.h"
#include <AreaEffectSimulation/aes_translation.h>
#include <AreaEffectSimulation/aes_operator_rights.h>
#include <AreaEffectSimulation/Utils/polygons.h>
#include <ProjectDataManagement/pdm_translation.h>
#include <Plugins/AreaEffectSimulation/Gui/Base/aes_base_model.h>
#include <Plugins/AreaEffectSimulation/Gui/Base/aes_base_edit.h>
#include <ProjectDataManagement/pdm.hpp>
#include <ngltools/ngltools_dtg.h>
#include <LtsCoordTrans/lts_coord_trans.h>
#include <LtsSession/lts_session_data.h>
#include <LtsUtilsSettings/settings.h>
#include <PluginInterfaces/gui_plugin_interface.h>
#include <Plugins/SituationMapPlugin/situation_map_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>
namespace AreaEffectSimulation
{
AesInfoDialog::AesInfoDialog(int aesEntityId, AesType aesType, QWidget *parent)
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::CloseOnly)
, m_aesEntityId(aesEntityId)
, m_aesType(aesType)
, m_bcChargeTypeId(-1)
, m_singleExpChargeTypeId(-1)
, m_areaExpChargeTypeId(-1)
, m_session(nullptr)
, m_dtc(nullptr)
, m_ftc(nullptr)
, m_pdmDtc(nullptr)
, m_ui(new Ui::AesInfoDialog)
, m_requestHelper(new LtsUtils::RequestHelper(this))
, m_logger(getLogger("AESInfoDialog"))
{
DEBUG_LOG(m_logger) << "ctor AesInfoDialog() ";
m_ui->setupUi(this);
m_ui->lblAesId->setText(QString::number(aesEntityId));
connect(m_ui->pbFindOnMap, &QToolButton::clicked, this, &AesInfoDialog::onFindOnMap);
connect(m_ui->pbDetails, &QToolButton::clicked, this, &AesInfoDialog::onShowDetails);
LtsUtils::ProjectSettings *ps = LtsUtils::ProjectSettings::getInstance();
const bool enableGuezDusMines = ps->value(QStringLiteral("aes"),
QStringLiteral("enableGuezDusMines")).toBool();
m_ui->pbResetDusMines->setVisible(enableGuezDusMines);
connect(m_ui->pbResetDusMines, &QToolButton::clicked, this, &AesInfoDialog::onResetDusMines);
} // end of ctor()
//-----------------------------------------------------------------------------
AesInfoDialog::~AesInfoDialog()
{
delete m_ui;
} // end of dtor()
//-----------------------------------------------------------------------------
void AesInfoDialog::retranslate()
{
translate(m_ui, tr("%1 \"%2\"").arg(AreaEffectSimulation::toString(m_aesType)).arg(m_aesEntityName, 1, QLatin1Char('?')));
m_ui->pbResetDusMines->setToolTip(m_mineIsReactivatable ? tr("Reset DUS Mines matched to this Minearea") : tr("Hide DUS Mines matched to this Minearea"));
}
bool AesInfoDialog::cbFunc(const AreaEffectSimulation::AesItemView &aesItemView)
{
if (aesItemView.aesItemId() != m_aesEntityId)
return false;
DEBUG_LOG(m_logger) << "AesItemView found for aesEntityId: " << m_aesEntityId
<< " AesItemView.aesTypeId(): " << aesItemView.aesTypeId();
if (aesItemView.aesTypeId() != m_aesType)
{
// WARNING...
return false;
}
switch (aesItemView.aesTypeId().underlying())
{
case AreaEffectSimulation::AesType::AtNContamination:
{
handleNContamination(aesItemView);
connect(m_dtc.get(), &AreaEffectSimulation::Interface::Dtc::nContaminationChanged, this, &AesInfoDialog::onNContaminationChanged);
DEBUG_LOG(m_logger) << "connect AreaEffectSimulation::Interface::Dtc::NContaminationChanged for aesEntityId: " << m_aesEntityId;
setOnlineHelpFilename(QStringLiteral("Info_Dialog-N-Contamination"));
break;
}
case AreaEffectSimulation::AesType::AtBCContamination:
{
handleBCContamination(aesItemView);
connect(m_dtc.get(), &AreaEffectSimulation::Interface::Dtc::bCContaminationChanged, this, &AesInfoDialog::onBCContaminationChanged);
DEBUG_LOG(m_logger) << "connect AreaEffectSimulation::Interface::Dtc::bCContaminationChanged for aesEntityId: " << m_aesEntityId;
setOnlineHelpFilename(QStringLiteral("Info_Dialog-C-Contamination"));
break;
}
case AreaEffectSimulation::AesType::AtBoobyTrap:
case AreaEffectSimulation::AesType::AtBoobyTrapSecondary:
{
handleBoobyTrap(aesItemView);
connect(m_dtc.get(), &AreaEffectSimulation::Interface::Dtc::boobyTrapChanged, this, &AesInfoDialog::onBoobyTrapChanged);
DEBUG_LOG(m_logger) << "connect AreaEffectSimulation::Interface::Dtc::boobyTrapChanged for aesEntityId: " << m_aesEntityId;
setOnlineHelpFilename(QStringLiteral("Info_Dialog-BoobyTrap"));
break;
}
case AreaEffectSimulation::AesType_def::AtOffRouteMine:
case AreaEffectSimulation::AesType_def::AtOffRouteMineSecondary:
{
handleOffRouteMine(aesItemView);
connect(m_dtc.get(), &AreaEffectSimulation::Interface::Dtc::offRouteMineChanged, this, &AesInfoDialog::onOffRouteMineChanged);
DEBUG_LOG(m_logger) << "connect AreaEffectSimulation::Interface::Dtc::offRouteMineChanged for aesEntityId: " << m_aesEntityId;
setOnlineHelpFilename(QStringLiteral("Info_Dialog-OffRouteMine"));
break;
}
case AreaEffectSimulation::AesType::AtExplosionArea:
{
handleExplosionArea(aesItemView);
connect(m_dtc.get(), &AreaEffectSimulation::Interface::Dtc::explosionAreaChanged, this, &AesInfoDialog::onExplosionAreaChanged);
DEBUG_LOG(m_logger) << "connect AreaEffectSimulation::Interface::Dtc::explosionAreaChanged for aesEntityId: " << m_aesEntityId;
setOnlineHelpFilename(QStringLiteral("Info_Dialog-Area_Artillery"));
break;
}
case AreaEffectSimulation::AesType::AtExplosionSingle:
{
handleExplosionSingle(aesItemView);
connect(m_dtc.get(), &AreaEffectSimulation::Interface::Dtc::explosionSingleChanged, this, &AesInfoDialog::onExplosionSingleChanged);
DEBUG_LOG(m_logger) << "connect AreaEffectSimulation::Interface::Dtc::explosionSingleChanged for aesEntityId: " << m_aesEntityId;
setOnlineHelpFilename(QStringLiteral("Info_Dialog-Single_Artillery"));
break;
}
case AreaEffectSimulation::AesType::AtMineArea:
{
handleMineArea(aesItemView);
connect(m_dtc.get(), &AreaEffectSimulation::Interface::Dtc::mineAreaChanged, this, &AesInfoDialog::onMineAreaChanged);
DEBUG_LOG(m_logger) << "connect AreaEffectSimulation::Interface::Dtc::mineAreaChanged for aesEntityId: " << m_aesEntityId;
setOnlineHelpFilename(QStringLiteral("Info_Dialog-Mine_Area"));
break;
}
case AreaEffectSimulation::AesType::AtMineCorridor:
{
handleMineCorridor(aesItemView);
connect(m_dtc.get(), &AreaEffectSimulation::Interface::Dtc::mineCorridorChanged, this, &AesInfoDialog::onMineCorridorChanged);
DEBUG_LOG(m_logger) << "connect AreaEffectSimulation::Interface::Dtc::mineCorridorChanged for aesEntityId: " << m_aesEntityId;
setOnlineHelpFilename(QStringLiteral("Info_Dialog-Mine_Corridor"));
break;
}
case AreaEffectSimulation::AesType::AtGasPipe:
{
handleGasPipe(aesItemView);
connect(m_dtc.get(), &AreaEffectSimulation::Interface::Dtc::gasPipeChanged, this, &AesInfoDialog::onGasPipeChanged);
DEBUG_LOG(m_logger) << "connect AreaEffectSimulation::Interface::Dtc::gasPipeChanged for aesEntityId: " << m_aesEntityId;
setOnlineHelpFilename(QStringLiteral("Info_Dialog-Gas_Pipeline"));
break;
}
case AreaEffectSimulation::AesType::AtDangerArea:
{
handleDangerArea(aesItemView);
connect(m_dtc.get(), &AreaEffectSimulation::Interface::Dtc::dangerAreaChanged, this, &AesInfoDialog::onDangerAreaChanged);
DEBUG_LOG(m_logger) << "connect AreaEffectSimulation::Interface::Dtc::dangerAreaChanged for aesEntityId: " << m_aesEntityId;
setOnlineHelpFilename(QStringLiteral("Info_Dialog-Danger_Area"));
break;
}
case AreaEffectSimulation::AesType::AtBorderline:
{
handleBorderline(aesItemView);
connect(m_dtc.get(), &AreaEffectSimulation::Interface::Dtc::borderlineChanged, this, &AesInfoDialog::onBorderlineChanged);
DEBUG_LOG(m_logger) << "connect AreaEffectSimulation::Interface::Dtc::borderlineChanged for aesEntityId: " << m_aesEntityId;
setOnlineHelpFilename(QStringLiteral("Info_Dialog-Borderline"));
// Hide Charge-Information(s)
m_ui->lbChargeType->hide();
m_ui->lblChargeTypeId->hide();
m_ui->lbChargeTypeId->hide();
m_ui->lblChargeType->hide();
m_ui->lbAesStart->hide();
m_ui->lblAesStart->hide();
m_ui->lbAesDuration->hide();
m_ui->lblAesDuration->hide();
m_ui->lbStatus->hide();
m_ui->lblStatus->hide();
break;
}
case AreaEffectSimulation::AesType::AtFunctionalArea:
{
handleFunctionalArea(aesItemView);
connect(m_dtc.get(), &AreaEffectSimulation::Interface::Dtc::functionalAreaChanged, this, &AesInfoDialog::onFunctionalAreaChanged);
DEBUG_LOG(m_logger) << "connect AreaEffectSimulation::Interface::Dtc::functionalAreaChanged for aesEntityId: " << m_aesEntityId;
setOnlineHelpFilename(QStringLiteral("Info_Dialog-Functional_Area"));
break;
}
case AreaEffectSimulation::AesType::AtAirSupportImpact:
{
handleAirSupportImpact(aesItemView);
connect(m_dtc.get(), &AreaEffectSimulation::Interface::Dtc::airSupportImpactChanged, this, &AesInfoDialog::onAirSupportImpactChanged);
DEBUG_LOG(m_logger) << "connect AreaEffectSimulation::Interface::Dtc::airSupportImpactChanged for aesEntityId: " << m_aesEntityId;
setOnlineHelpFilename(QStringLiteral("Info_Dialog-Aerial_Ordnance")); //TODO: rename help file to Air_Support_Impact
break;
}
case AreaEffectSimulation::AesType::AtExplosionCluster:
{
handleExplosionCluster(aesItemView);
connect(m_dtc.get(), &AreaEffectSimulation::Interface::Dtc::explosionClusterChanged, this, &AesInfoDialog::onExplosionClusterChanged);
DEBUG_LOG(m_logger) << "connect AreaEffectSimulation::Interface::Dtc::ExplosionCluster for aesEntityId: "<<m_aesEntityId;
setOnlineHelpFilename(QStringLiteral("Info_Dialog-Explosion_Cluster")); //TODO set online page
break;
}
case AreaEffectSimulation::AesType::AtEffectCluster:
{
handleEffectCluster(aesItemView);
connect(m_dtc.get(), &AreaEffectSimulation::Interface::Dtc::effectClusterChanged, this, &AesInfoDialog::onEffectClusterChanged);
DEBUG_LOG(m_logger) << "connect AreaEffectSimulation::Interface::Dtc::EffectCluster for aesEntityId: " << m_aesEntityId;
setOnlineHelpFilename(QStringLiteral("Info_Dialog-Explosion_Cluster")); //TODO set online page
break;
}
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:
// empty
break;
case AreaEffectSimulation::AesType::AtUnknown:
WARNING_LOG(m_logger) << "Unknown AesType found for aesEntityId " << m_aesEntityId << ": " << aesItemView.aesTypeId();
Q_ASSERT(false);
break;
} // switch
return true;
} // end of cbFunc()
//-----------------------------------------------------------------------------
bool AesInfoDialog::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)
{
m_session = session;
m_dtc = dtc;
m_ftc = ftc;
m_pdmDtc = pdmDtc;
if (!m_pdmDtc->isChargeTypeEnabled())
m_pdmDtc->enableChargeType();
//hide first:
m_ui->lblPosition->hide();
m_ui->pbResetDusMines->hide();
// FlightTime only needed for AtAirSupport
m_ui->lbFlightTime->hide();
m_ui->lblFlightTime->hide();
// Debug Infos
#ifndef LTS_DEBUG
m_ui->lbAesId->hide();
m_ui->lblAesId->hide();
m_ui->lbAesItemId->hide();
m_ui->lblAesItemId->hide();
m_ui->lbAesTypeId->hide();
m_ui->lblAesTypeId->hide();
m_ui->lbChargeTypeId->hide();
m_ui->lblChargeTypeId->hide();
#endif
m_ui->lbAesId->setText(tr("AES Id:")); // must only be translated here! -,
// because the variable is also used to display the DUS mine id.
if (m_aesType == AreaEffectSimulation::AesType_def::AtMineAreaSingleMines)
{
// single dus (guez) mines with no assoicated minefield
handleMineAraeSingleMine();
connect(m_dtc.get(), &AreaEffectSimulation::Interface::Dtc::dusMineStateChanged, this, &AesInfoDialog::onDusMineStateChanged);
}
else if (m_aesType == AreaEffectSimulation::AesType_def::AtDusSingleMine)
{
// single dus mine
handleSingleDusMine();
connect(m_dtc.get(), &AreaEffectSimulation::Interface::Dtc::dusSingleMineChanged, this, &AesInfoDialog::onDusSingleMineChanged);
}
else
{
std::function<bool(const AreaEffectSimulation::AesItemView &data)> cb = [this](const AreaEffectSimulation::AesItemView & aesItemView)
{
return cbFunc(aesItemView);
};
m_dtc->aesItemViews(cb);
}
return true;
} // end of init()
//-----------------------------------------------------------------------------
void AesInfoDialog::handleNContamination(const AesItemView &aesItemView)
{
DEBUG_LOG(m_logger) << LOGFUNCTION << "(AesItemView)"
<< " aesItemView.aesItemId(): " << aesItemView.aesItemId();
handleNContamination(m_dtc->nContamination(m_aesEntityId));
} // end of handleNContamination()
//-----------------------------------------------------------------------------
void AesInfoDialog::handleNContamination(const AreaEffectSimulation::NContamination &data)
{
DEBUG_LOG(m_logger) << LOGFUNCTION << "(AreaEffectSimulation::NContamination)"
<< " data.id(): " << data.id();
handleAesItem(data, AesType::AtNContamination);
// Position
m_ui->lblPosition->show();
QString mgrs = LtsCoordTrans::mgrsFromGeographic(data.impactPosition().lon(), data.impactPosition().lat());
m_ui->lblPosition->setText(tr("Position: %1").arg(mgrs));
} // end of handleNContamination()
//-----------------------------------------------------------------------------
void AesInfoDialog::handleBCContamination(const AesItemView &aesItemView)
{
DEBUG_LOG(m_logger) << LOGFUNCTION << "(AesItemView)"
<< " aesItemView.aesItemId(): " << aesItemView.aesItemId();
handleBCContamination(m_dtc->bCContamination(m_aesEntityId));
} // end of handleBCContaminati// end of onDangerAreaChanged()on()
//-----------------------------------------------------------------------------
void AesInfoDialog::handleBCContamination(const AreaEffectSimulation::BCContamination &data)
{
DEBUG_LOG(m_logger) << LOGFUNCTION << "(AreaEffectSimulation::BCContamination)"
<< " data.id(): " << data.id();
handleAesItem(data, AesType::AtBCContamination);
m_bcChargeTypeId = data.chargeStruct().chargeTypeId();
// Position
m_ui->lblPosition->show();
QString mgrs = LtsCoordTrans::mgrsFromGeographic(data.impactPosition().lon(), data.impactPosition().lat());
m_ui->lblPosition->setText(tr("Position: %1").arg(mgrs));
} // end of handleBCContamination()
//-----------------------------------------------------------------------------
void AesInfoDialog::handleBoobyTrap(const AesItemView &aesItemView)
{
DEBUG_LOG(m_logger) << LOGFUNCTION << "(AesItemView)"
<< " aesItemView.aesItemId(): " << aesItemView.aesItemId();
handleBoobyTrap(m_dtc->boobyTrap(m_aesEntityId));
} // end of handleBoobyTrap
//-----------------------------------------------------------------------------
void AesInfoDialog::handleBoobyTrap(const AreaEffectSimulation::BoobyTrap &data)
{
DEBUG_LOG(m_logger) << LOGFUNCTION << "(AreaEffectSimulation::BoobyTrap)"
<< " data.id(): " << data.id();
handleAesItem(data, AesType_def::AtBoobyTrap);
m_bcChargeTypeId = data.chargeStruct().chargeTypeId();
m_ui->lblChargeType->setText(m_pdmDtc->trChargeTypeShortName(m_bcChargeTypeId, true));
m_ui->lblChargeType->setToolTip(m_pdmDtc->trChargeTypeName(m_bcChargeTypeId, true));
m_ui->lblChargeType->show();
m_ui->lblChargeTypeId->setText(QString::number(m_bcChargeTypeId));
// Position
m_ui->lblPosition->show();
QString mgrs = LtsCoordTrans::mgrsFromGeographic(data.impactPosition().lon(), data.impactPosition().lat());
m_ui->lblPosition->setText(tr("Position: %1").arg(mgrs));
} // end of handleBoobyTrap()
//-----------------------------------------------------------------------------
void AesInfoDialog::handleOffRouteMine(const AesItemView &aesItemView)
{
DEBUG_LOG(m_logger) << LOGFUNCTION << "(AesItemView)"
<< " aesItemView.aesItemId(): " << aesItemView.aesItemId();
handleOffRouteMine(m_dtc->offRouteMine(m_aesEntityId));
} // end of handleOffRouteMine
//-----------------------------------------------------------------------------
void AesInfoDialog::handleOffRouteMine(const AreaEffectSimulation::OffRouteMine &data)
{
DEBUG_LOG(m_logger) << LOGFUNCTION << "(AreaEffectSimulation::OffRouteMine)"
<< " data.id(): " << data.id();
handleAesItem(data, AesType_def::AtOffRouteMine);
m_bcChargeTypeId = data.chargeStruct().chargeTypeId();
m_ui->lblChargeType->setText(m_pdmDtc->trChargeTypeShortName(m_bcChargeTypeId, true));
m_ui->lblChargeType->setToolTip(m_pdmDtc->trChargeTypeName(m_bcChargeTypeId, true));
m_ui->lblChargeType->show();
m_ui->lblChargeTypeId->setText(QString::number(m_bcChargeTypeId));
// Position
m_ui->lblPosition->show();
QString mgrs = LtsCoordTrans::mgrsFromGeographic(data.area().cornerBottomLeft().lon(), data.area().cornerBottomLeft().lat());
m_ui->lblPosition->setText(tr("Position: %1").arg(mgrs));
} // end of handleBoobyTrap()
//-----------------------------------------------------------------------------
void AesInfoDialog::handleExplosionArea(const AesItemView &aesItemView)
{
DEBUG_LOG(m_logger) << LOGFUNCTION << "(AesItemView)"
<< " aesItemView.aesItemId(): " << aesItemView.aesItemId();
handleExplosionArea(m_dtc->explosionArea(m_aesEntityId));
} // end of handleExplosionArea()
//-----------------------------------------------------------------------------
void AesInfoDialog::handleExplosionArea(const AreaEffectSimulation::ExplosionArea &data)
{
DEBUG_LOG(m_logger) << LOGFUNCTION << "(AreaEffectSimulation::ExplosionArea)"
<< " data.id(): " << data.id();
handleAesItem(data, AesType::AtExplosionArea);
m_areaExpChargeTypeId = data.chargeStruct().chargeTypeId();
const Area &area = data.area();
if (!qFuzzyCompare(area.cornerBottomLeft().lon(), 0) ||
!qFuzzyCompare(area.cornerBottomLeft().lat(), 0))
{
m_ui->lblPosition->show();
QPointF bottomLeft(area.cornerBottomLeft().lon(), area.cornerBottomLeft().lat());
const QPointF &center = Polygons::bottomLeft2CenterPoint(bottomLeft, area.width(), area.height(), area.rotation());
QString mgrs = LtsCoordTrans::mgrsFromGeographic(center.x(), center.y());
m_ui->lblPosition->setText(tr("Position: %1").arg(mgrs));
}
} // end of handleExplosionArea()
//-----------------------------------------------------------------------------
void AesInfoDialog::handleExplosionSingle(const AesItemView &aesItemView)
{
DEBUG_LOG(m_logger) << LOGFUNCTION << "(AesItemView)"
<< " aesItemView.aesItemId(): " << aesItemView.aesItemId();
handleExplosionSingle(m_dtc->explosionSingle(m_aesEntityId));
} // end of handleExplosionSingle()
//-----------------------------------------------------------------------------
void AesInfoDialog::handleExplosionSingle(const AreaEffectSimulation::ExplosionSingle &data)
{
DEBUG_LOG(m_logger) << LOGFUNCTION << "(AreaEffectSimulation::ExplosionSingle)"
<< " data.id(): " << data.id();
handleAesItem(data, AesType::AtExplosionSingle);
m_singleExpChargeTypeId = data.chargeStruct().chargeTypeId();
// Position
m_ui->lblPosition->show();
QString mgrs = LtsCoordTrans::mgrsFromGeographic(data.impactPosition().lon(), data.impactPosition().lat());
m_ui->lblPosition->setText(tr("Position: %1").arg(mgrs));
} // end of handleExplosionSingle()
//-----------------------------------------------------------------------------
void AesInfoDialog::handleMineArea(const AesItemView &aesItemView)
{
DEBUG_LOG(m_logger) << LOGFUNCTION << "(AesItemView)"
<< " aesItemView.aesItemId(): " << aesItemView.aesItemId();
handleMineArea(m_dtc->mineArea(m_aesEntityId));
} // end of handleMineArea()
//-----------------------------------------------------------------------------
void AesInfoDialog::handleMineArea(const AreaEffectSimulation::MineArea &data)
{
DEBUG_LOG(m_logger) << LOGFUNCTION << "(AreaEffectSimulation::MineArea)"
<< " data.id(): " << data.id();
handleAesItem(data, AesType::AtMineArea);
// Position
m_ui->lblPosition->show();
QString mgrs = LtsCoordTrans::mgrsFromGeographic(data.boundingRectCorner().lon(), data.boundingRectCorner().lat());
m_ui->lblPosition->setText(tr("Position: %1").arg(mgrs));
// Reset DUS Mines
bool bResetVisbile = (data.isDus() || data.isConcrete()) &&
// data.isReactivatable() && // although they're not reactivatable, they should go away from the map
LtsSessionData::LtsSessionData::getInstance()->hasOperatorRight(OperatorRights::MineAreasResetDusMines) &&
((m_session->app() == LtsAppDescriptor::App::Situation || m_session->app() == LtsAppDescriptor::App::SituationTablet) &&
(!m_session->isReplayPartition()));
m_ui->pbResetDusMines->setVisible(bResetVisbile);
m_mineIsReactivatable = data.isReactivatable();
m_ui->pbResetDusMines->setToolTip(data.isDus() ? tr("Reset DUS Mines matched to this Minearea") : tr("Reset Concrete Mines matched to this Minearea"));
} // end of handleMineArea()
//-----------------------------------------------------------------------------
void AesInfoDialog::handleMineCorridor(const AesItemView &aesItemView)
{
DEBUG_LOG(m_logger) << LOGFUNCTION << "(AesItemView)"
<< " aesItemView.aesItemId(): " << aesItemView.aesItemId();
handleMineCorridor(m_dtc->mineCorridor(m_aesEntityId));
} // end of handleMineCorridor()
//-----------------------------------------------------------------------------
void AesInfoDialog::handleMineCorridor(const AreaEffectSimulation::MineCorridor &data)
{
DEBUG_LOG(m_logger) << LOGFUNCTION << "(AreaEffectSimulation::MineArea)"
<< " data.id(): " << data.id();
handleAesItem(data, AesType::AtMineCorridor);
// Mine Corridors have no charge type
m_ui->lblChargeType->hide();
m_ui->lbChargeType->hide();
// and no suitable duration
m_ui->lbAesDuration->hide();
m_ui->lblAesDuration->hide();
} // end of handleMineCorridor()
//-----------------------------------------------------------------------------
void AesInfoDialog::handleGasPipe(const AesItemView &aesItemView)
{
DEBUG_LOG(m_logger) << LOGFUNCTION << "(AesItemView)"
<< " handleGasPipe: aesItemView.aesItemId(): " << aesItemView.aesItemId();
handleGasPipe(m_dtc->gasPipe(m_aesEntityId));
} // end of handleGasPipe()
//-----------------------------------------------------------------------------
void AesInfoDialog::handleGasPipe(const AreaEffectSimulation::GasPipe &data)
{
DEBUG_LOG(m_logger) << LOGFUNCTION << "(AreaEffectSimulation::GasPipe)"
<< " data.id(): " << data.id();
handleAesItem(data, AesType::AtGasPipe);
// Gas Pipes have no charge type
m_ui->lblChargeType->hide();
m_ui->lbChargeType->hide();
// and no suitable duration
m_ui->lbAesDuration->hide();
m_ui->lblAesDuration->hide();
} // end of handleGasPipe()
//-----------------------------------------------------------------------------
void AesInfoDialog::handleDangerArea(const AesItemView &aesItemView)
{
DEBUG_LOG(m_logger) << LOGFUNCTION << "(AesItemView)"
<< " aesItemView.aesItemId(): " << aesItemView.aesItemId();
handleDangerArea(m_dtc->dangerArea(m_aesEntityId));
} // end of handleDangerArea()
//-----------------------------------------------------------------------------
void AesInfoDialog::handleDangerArea(const AreaEffectSimulation::DangerArea &data)
{
DEBUG_LOG(m_logger) << LOGFUNCTION << "(AreaEffectSimulation::DangerArea)"
<< " data.id(): " << data.id();
handleAesItem(data, AesType::AtDangerArea);
// Position
const auto &qv = data.segments();
if (qv.size() > 0)
{
m_ui->lblPosition->show();
const Core::GeoPosition2D &pos = qv.at(0);
QString mgrs = LtsCoordTrans::mgrsFromGeographic(pos.lon(), pos.lat());
m_ui->lblPosition->setText(tr("Position: %1").arg(mgrs));
}
// hide charge type
m_ui->lbChargeType->hide();
m_ui->lblChargeType->hide();
} // end of handleDangerArea()
//-----------------------------------------------------------------------------
void AesInfoDialog::handleBorderline(const AesItemView &aesItemView)
{
DEBUG_LOG(m_logger) << LOGFUNCTION << "(AesItemView)"
<< " aesItemView.aesItemId(): " << aesItemView.aesItemId();
handleBorderline(m_dtc->borderline(m_aesEntityId));
} // end of handleBorderline()
//-----------------------------------------------------------------------------
void AesInfoDialog::handleBorderline(const AreaEffectSimulation::Borderline &data)
{
DEBUG_LOG(m_logger) << LOGFUNCTION << "(AreaEffectSimulation::Borderline)"
<< " data.id(): " << data.id();
handleAesItem(data, AesType::AtBorderline);
// Position
const auto &qv = data.segments();
if (qv.size() > 0)
{
m_ui->lblPosition->show();
const Core::GeoPosition2D &pos = qv.at(0);
QString mgrs = LtsCoordTrans::mgrsFromGeographic(pos.lon(), pos.lat());
m_ui->lblPosition->setText(tr("Position: %1").arg(mgrs));
}
}
// end of handleBorderline()
//-----------------------------------------------------------------------------
void AesInfoDialog::handleFunctionalArea(const AesItemView &aesItemView)
{
DEBUG_LOG(m_logger) << LOGFUNCTION << "(AesItemView)"
<< " aesItemView.aesItemId(): " << aesItemView.aesItemId();
handleFunctionalArea(m_dtc->functionalArea(m_aesEntityId));
}
// end of handleFunctionalArea()
//-----------------------------------------------------------------------------
void AesInfoDialog::handleFunctionalArea(const FunctionalArea &data)
{
DEBUG_LOG(m_logger) << LOGFUNCTION << "(AreaEffectSimulation::FunctionalArea)"
<< " data.id(): " << data.id();
handleAesItem(data, AesType::AtFunctionalArea);
// Charge Type
QStringList chargeTypesNames;
QStringList chargeTypesShortNames;
if (data.medicMode() != AesOperatingMode_def::OmNotUsed)
{
chargeTypesNames << m_pdmDtc->trChargeTypeName(411, true);
chargeTypesShortNames << m_pdmDtc->trChargeTypeShortName(411, true);
}
if (data.maintMode() != AesOperatingMode_def::OmNotUsed)
{
chargeTypesNames << m_pdmDtc->trChargeTypeName(412, true);
chargeTypesShortNames << m_pdmDtc->trChargeTypeShortName(412, true);
}
if (data.deconMode() != AesOperatingMode_def::OmNotUsed)
{
chargeTypesNames << m_pdmDtc->trChargeTypeName(413, true);
chargeTypesShortNames << m_pdmDtc->trChargeTypeShortName(413, true);
}
m_ui->lblChargeType->setText(chargeTypesNames.join(QLatin1String(", ")));
m_ui->lblChargeType->setToolTip(chargeTypesShortNames.join(QLatin1String(", ")));
// Position
m_ui->lblPosition->show();
const QPointF bottomLeft(data.area().cornerBottomLeft().lon(), data.area().cornerBottomLeft().lat());
const QPointF centerpoint = Polygons::bottomLeft2CenterPoint(bottomLeft, data.area().width(), data.area().height(), 0.0);
const QString mgrs = LtsCoordTrans::mgrsFromGeographic(centerpoint.x(), centerpoint.y());
m_ui->lblPosition->setText(tr("Position: %1").arg(mgrs));
}
// end of handleFunctionalArea()
//-----------------------------------------------------------------------------
void AesInfoDialog::handleAirSupportImpact(const AesItemView &aesItemView)
{
DEBUG_LOG(m_logger) << LOGFUNCTION << "(AesItemView)"
<< " aesItemView.aesItemId(): " << aesItemView.aesItemId();
handleAirSupportImpact(m_dtc->airSupportImpact(m_aesEntityId));
}
// end of handleAirSupportImpact()
//-----------------------------------------------------------------------------
void AesInfoDialog::handleAirSupportImpact(const AirSupportImpact &data)
{
DEBUG_LOG(m_logger) << LOGFUNCTION << "(AreaEffectSimulation::FunctionalArea)"
<< " data.id(): " << data.id();
handleAesItem(data, AesType::AtAirSupportImpact);
// Position
m_ui->lblPosition->show();
QString mgrs = LtsCoordTrans::mgrsFromGeographic(data.impactPosition().lon(), data.impactPosition().lat());
m_ui->lblPosition->setText(tr("Position: %1").arg(mgrs));
m_ui->lbFlightTime->show();
m_ui->lblFlightTime->show();
m_ui->lblFlightTime->setText(LtsWidgets::readableDuration(data.flightTime()));
}
// end of handleAirSupportImpact()
//-----------------------------------------------------------------------------
void AesInfoDialog::handleMineAraeSingleMine()
{
AesItemView itemView;
if (!m_dtc->aesItemViewFromEntityId(0, m_aesType, itemView))
return;
const DusMineState dms = m_dtc->dusMineState(0);
for (size_t i = 0; i < dms.mines().size(); ++i)
{
const DusMine &mine = dms.mines().at(i);
if (mine.eqId() == m_aesEntityId)
{
if (itemView.form().size() <= i)
return;
handleMineAraeSingleMine(itemView.form().at(i), mine);
return;
}
}
}
// end of handleMineAraeSingleMine()
//-----------------------------------------------------------------------------
void AesInfoDialog::handleMineAraeSingleMine(const Core::GeoPosition2D &position, const DusMine &mine)
{
m_ui->lbAesId->show(); // misused to display DUS mineId
m_ui->lblAesId->show();
m_ui->lbAesItemId->hide();
m_ui->lblAesItemId->hide();
m_ui->lbAesName->hide();
m_ui->lblAesName->hide();
m_ui->lbAesStart->hide();
m_ui->lblAesStart->hide();
m_ui->lbAesDuration->hide();
m_ui->lblAesDuration->hide();
m_ui->pbDetails->hide();
m_aesEntityName = QString::number(mine.eqId());
// Type
m_ui->lblAesTypeId->setText(QString::number(m_aesType.underlying()));
m_ui->lblAesType->setText(toString(m_aesType));
// Charge Type
const int ctId = mine.chargeTypeId();
if (ctId != 0)
{
m_ui->lblChargeType->setText(m_pdmDtc->trChargeTypeShortName(ctId, true));
m_ui->lblChargeType->setToolTip(m_pdmDtc->trChargeTypeName(ctId, true));
m_ui->lblChargeType->show();
m_ui->lblChargeTypeId->setText(QString::number(ctId));
}
// Mine Id
// NOTE: igniterType/IgniterFunciton = 0 as long as DusMine does not contain values
const bool isDus = static_cast<MineClass::type>(m_pdmDtc->mineClass(ctId, 0, 0)) == MineClass::DUS;
if (isDus)
m_ui->lbAesId->setText(tr("DUS Mine Id:")); // It doesn't overwrite the ui entry when translate is set there!
else
m_ui->lbAesId->setText(tr("Mine Id:"));
m_ui->lblAesId->setText(QString::number(mine.eqId()));
// State
bool bResetVisible = false;
// Reactivate for dus mines only (not concrete mines)
// NOTE: igniterType/IgniterFunciton = 0 as long as DusMine does not contain values
if (mine.triggered() && isDus)
{
m_ui->lblStatus->setText(tr("Inactive"));
if (LtsSessionData::LtsSessionData::getInstance()->hasOperatorRight(OperatorRights::MineAreasResetDusMines)
// && m_pdmDtc->isReactivatable(ctId)
)
bResetVisible = true;
}
else
{
m_ui->lblStatus->setText(tr("Active"));
}
m_ui->pbResetDusMines->setVisible(bResetVisible &&
((m_session->app() == LtsAppDescriptor::App::Situation ||
m_session->app() == LtsAppDescriptor::App::SituationTablet) &&
(!m_session->isReplayPartition())));
// NOTE: igniterType/IgniterFunciton = 0 as long as DusMine does not contain values
m_mineIsReactivatable = m_pdmDtc->isReactivatable(ctId,0,0);
m_ui->pbResetDusMines->setToolTip(isDus ? tr("Reset DUS Mines matched to this Minearea") : tr("Reset Concrete Mines matched to this Minearea"));
// Position
const QString mgrs = LtsCoordTrans::mgrsFromGeographic(position.lon(), position.lat());
m_ui->lblPosition->setText(tr("Position: %1").arg(mgrs));
m_ui->lblPosition->show();
setOnlineHelpFilename(QStringLiteral("Info_Dialog-Mine_Area_Single_Mine"));
}
// end of handleMineAraeSingleMine()
//-----------------------------------------------------------------------------
void AesInfoDialog::handleSingleDusMine()
{
DusSingleMine dsm = m_dtc->dusSingleMine(m_aesEntityId);
m_ui->lbAesId->show(); // misused to display DUS mineId
m_ui->lblAesId->show();
m_ui->lbAesItemId->hide();
m_ui->lblAesItemId->hide();
m_ui->lbAesName->hide();
m_ui->lblAesName->hide();
m_ui->lbAesStart->hide();
m_ui->lblAesStart->hide();
m_ui->lbAesDuration->hide();
m_ui->lblAesDuration->hide();
m_ui->pbDetails->hide();
m_aesEntityName = QString::number(dsm.id()); // used for id in Tab
// Type
m_ui->lblAesTypeId->setText(QString::number(m_aesType.underlying()));
m_ui->lblAesType->setText(toString(m_aesType));
// Charge Type
const int ctId = dsm.chargeStruct().chargeTypeId();
m_ui->lblChargeType->setText(m_pdmDtc->trChargeTypeShortName(ctId));
m_ui->lblChargeType->setToolTip(m_pdmDtc->trChargeTypeName(ctId));
m_ui->lblChargeType->show();
m_ui->lblChargeTypeId->setText(QString::number(ctId));
// Mine Id
m_ui->lbAesId->setText(tr("DUS Mine Id:")); // It doesn't overwrite the ui entry when translate is set there!
m_ui->lblAesId->setText(QString::number(dsm.id()));
// State
switch (dsm.effectStateId().underlying())
{
case AesEffectState_def::EsExpired:
m_ui->lblStatus->setText(tr("Inactive"));
break;
case AesEffectState_def::EsRemoved:
m_ui->lblStatus->setText(tr("Removed"));
break;
case AesEffectState_def::EsCreated:
m_ui->lblStatus->setText(tr("Created"));
break;
case AesEffectState_def::EsPrepared:
m_ui->lblStatus->setText(tr("Prepared"));
break;
case AesEffectState_def::EsActivated:
m_ui->lblStatus->setText(tr("Active"));
break;
case AesEffectState_def::EsPaused:
m_ui->lblStatus->setText(tr("Paused"));
break;
case AesEffectState_def::EsError:
m_ui->lblStatus->setText(tr("Error"));
break;
case AesEffectState_def::EsReceived:
m_ui->lblStatus->setText(tr("Received"));
break;
default:
m_ui->lblStatus->setText(tr("Unknown"));
break;
}
// Position
const QString mgrs = LtsCoordTrans::mgrsFromGeographic(dsm.position().lon(), dsm.position().lat());
m_ui->lblPosition->setText(tr("Position: %1").arg(mgrs));
m_ui->lblPosition->show();
setOnlineHelpFilename(QStringLiteral("Info_Dialog-DUS_Single_Mine"));
}
void AesInfoDialog::handleExplosionCluster(const AesItemView &aesItemView)
{
DEBUG_LOG(m_logger) << LOGFUNCTION << "(AesItemView)"
<< " aesItemView.aesItemId(): " << aesItemView.aesItemId();
handleExplosionCluster(m_dtc->explosionCluster(m_aesEntityId));
}
void AesInfoDialog::handleExplosionCluster(const ExplosionCluster &data)
{
DEBUG_LOG(m_logger) << LOGFUNCTION << "(AreaEffectSimulation::ExplosionCluster)"
<< " data.id(): " << data.id();
handleAesItem(data, AesType::AtExplosionCluster);
const int m_explosionClusterChargeTypeId = data.chargeStruct().chargeTypeId();
m_ui->lblChargeType->setText(m_pdmDtc->trChargeTypeShortName(m_explosionClusterChargeTypeId, true));
m_ui->lblChargeType->setToolTip(m_pdmDtc->trChargeTypeName(m_explosionClusterChargeTypeId, true));
m_ui->lblChargeType->show();
m_ui->lblChargeTypeId->setText(QString::number(m_explosionClusterChargeTypeId));
}
void AesInfoDialog::handleEffectCluster(const AesItemView &aesItemView)
{
DEBUG_LOG(m_logger) << LOGFUNCTION << "(AesItemView)"
<< " aesItemView.aesItemId(): " << aesItemView.aesItemId();
handleEffectCluster(m_dtc->effectCluster(m_aesEntityId));
}
void AesInfoDialog::handleEffectCluster(const EffectCluster &data)
{
DEBUG_LOG(m_logger) << LOGFUNCTION << "(AreaEffectSimulation::EffectCluster)"
<< " data.id(): " << data.id();
handleAesItem(data, AesType::AtEffectCluster);
}
// end of handleSingleDusMine()
//-----------------------------------------------------------------------------
void AesInfoDialog::handleAesItem(const AesItem &aesData, AesType aesTypeId)
{
m_aesEntityName = QString::fromStdString(aesData.name());
m_aesEffectSource = aesData.effectSourceId();
// ItemId
m_ui->lblAesItemId->setText(QString::number(aesData.id()));
// Type
m_ui->lblAesTypeId->setText(QString::number(aesTypeId.underlying()));
const ProjectDataManagement::GearClass gearClass = m_pdmDtc->gearClassFromChargeTypeId(aesData.chargeStruct().chargeTypeId());
switch (gearClass.underlying())
{
case ProjectDataManagement::GearClass_def::Biological:
case ProjectDataManagement::GearClass_def::Chemical:
m_ui->lblAesType->setText(ProjectDataManagement::toString(gearClass));
break;
default:
m_ui->lblAesType->setText(toString(aesTypeId));
}
// Name
m_ui->lblAesName->setText(m_aesEntityName);
// Start
if (aesData.effectStart().is_set())
m_ui->lblAesStart->setText(DTG::toStringMSec(aesData.effectStart().get()));
else
m_ui->lblAesStart->setText(tr("None"));
// Duration
if (aesData.effectDuration() == 0)
{
m_ui->lbAesDuration->hide();
m_ui->lblAesDuration->hide();
}
if (aesTypeId == AesType::AtEffectCluster && aesData.effectDuration() == DEFAULT_EFFECT_DURATION)
m_ui->lblAesDuration->setText(QStringLiteral("---"));
else
m_ui->lblAesDuration->setText(LtsWidgets::readableDuration(aesData.effectDuration()));
// Effect State
AreaEffectSimulation::AesEffectState st = aesData.effectStateId();
m_ui->lblStatus->setText(toString(st));
// Charge Type Id
m_ui->lblChargeTypeId->setText(QString::number(aesData.chargeStruct().chargeTypeId()));
// Charge Type
m_ui->lblChargeType->setText(m_pdmDtc->trChargeTypeShortName(aesData.chargeStruct().chargeTypeId()));
m_ui->lblChargeType->setToolTip(m_pdmDtc->trChargeTypeName(aesData.chargeStruct().chargeTypeId()));
} // end of handleAesItem()
//-----------------------------------------------------------------------------
void AesInfoDialog::onFindOnMap()
{
DEBUG_LOG(m_logger) << "onFindOnMap()";
std::shared_ptr<SituationMap::ForeignGuiInterface> ifc;
if (m_session->getForeignGuiInterface<SituationMap::ForeignGuiInterface>(ifc))
ifc->centerMapToAesObject(m_aesEntityId);
else
WARNING_LOG(m_logger) << LOGFUNCTION << "getForeignGuiInterface<SituationMap::ForeignGuiInterface> failed!";
} // end of onFindOnMap()
//-----------------------------------------------------------------------------
void AesInfoDialog::onShowDetails()
{
DEBUG_LOG(m_logger) << LOGFUNCTION;
switch (m_aesType.underlying())
{
case AreaEffectSimulation::AesType::AtNContamination:
{
std::shared_ptr<AesNContamination::ForeignGuiInterface> ifc;
if (m_session->getForeignGuiInterface<AesNContamination::ForeignGuiInterface>(ifc))
{
AreaEffectSimulation::BaseEdit* dialog = ifc->showEditWindow(m_aesEntityId, this);
if (dialog)
addDialog(dialog, dialog->menuGroup(), dialog->dialogIdentifier(), LtsWidgets::LayoutArea::eDialogTab);
}
else
WARNING_LOG(m_logger) << LOGFUNCTION << " getForeignGuiInterface<AesNContamination::ForeignGuiInterface> failed!";
break;
}
case AreaEffectSimulation::AesType::AtBCContamination:
{
std::shared_ptr<AesBCContamination::ForeignGuiInterface> ifc;
if (m_session->getForeignGuiInterface<AesBCContamination::ForeignGuiInterface>(ifc))
{
const auto gearClass = m_pdmDtc->gearClassFromChargeTypeId(m_bcChargeTypeId);
if (gearClass == ProjectDataManagement::GearClass_def::Biological)
{
AreaEffectSimulation::BaseEdit* dialog = ifc->showEditWindow(m_aesEntityId, false, this);
if (dialog)
addDialog(dialog, dialog->menuGroup(), dialog->dialogIdentifier(), LtsWidgets::LayoutArea::eDialogTab);
break;
}
if (gearClass == ProjectDataManagement::GearClass_def::Chemical)
{
AreaEffectSimulation::BaseEdit* dialog = ifc->showEditWindow(m_aesEntityId, true, this);
if (dialog)
addDialog(dialog, dialog->menuGroup(), dialog->dialogIdentifier(), LtsWidgets::LayoutArea::eDialogTab);
break;
}
}
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))
{
AreaEffectSimulation::BaseEdit* dialog = ifc->showBoobyTrapEditWindow(m_aesEntityId, this);
if (dialog)
addDialog(dialog, dialog->menuGroup(), dialog->dialogIdentifier(), LtsWidgets::LayoutArea::eDialogTab);
break;
}
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))
{
AreaEffectSimulation::BaseEdit* dialog = ifc->showOffRouteMineEditWindow(m_aesEntityId, this);
if (dialog)
addDialog(dialog, dialog->menuGroup(), dialog->dialogIdentifier(), LtsWidgets::LayoutArea::eDialogTab);
break;
}
else
WARNING_LOG(m_logger) << LOGFUNCTION << " getForeignGuiInterface<AesMineSingleVirtual::ForeignGuiInterface> failed!";
break;
}
case AreaEffectSimulation::AesType::AtExplosionSingle:
{
std::shared_ptr<AesExplosion::ForeignGuiInterface> ifc;
if (m_session->getForeignGuiInterface<AesExplosion::ForeignGuiInterface>(ifc))
{
const auto gcs = { ProjectDataManagement::GearClass::Artillery, ProjectDataManagement::GearClass::Mortar, ProjectDataManagement::GearClass::AirSupport };
const auto gearClass = m_pdmDtc->gearClassFromChargeTypeId(m_singleExpChargeTypeId);
for (auto gc : gcs)
{
if (gearClass == gc)
{
AreaEffectSimulation::BaseEdit* dialog = ifc->showEditWindow(m_aesEntityId, true, false, gc, this);
if (dialog)
addDialog(dialog, dialog->menuGroup(), dialog->dialogIdentifier(), LtsWidgets::LayoutArea::eDialogTab);
break;
}
}
break;
}
else
WARNING_LOG(m_logger) << LOGFUNCTION << " getForeignGuiInterface<AesExplosion::ForeignGuiInterface> failed!";
break;
}
case AreaEffectSimulation::AesType::AtExplosionArea:
{
std::shared_ptr<AesExplosion::ForeignGuiInterface> ifc;
if (m_session->getForeignGuiInterface<AesExplosion::ForeignGuiInterface>(ifc))
{
const auto gcs = { ProjectDataManagement::GearClass::Artillery, ProjectDataManagement::GearClass::Mortar };
const auto gearClass = m_pdmDtc->gearClassFromChargeTypeId(m_areaExpChargeTypeId);
for (auto gc : gcs)
{
if (gearClass == gc)
{
AreaEffectSimulation::BaseEdit* dialog = ifc->showEditWindow(m_aesEntityId, false, false, gc, this);
if (dialog)
addDialog(dialog, dialog->menuGroup(), dialog->dialogIdentifier(), LtsWidgets::LayoutArea::eDialogTab);
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))
{
AreaEffectSimulation::BaseEdit* dialog = ifc->showEditWindow(m_aesEntityId, m_aesEffectSource, this); // ExplosionCluster / aes_explosions_edit.{h,cpp}
if (dialog)
addDialog(dialog, dialog->menuGroup(), dialog->dialogIdentifier(), LtsWidgets::LayoutArea::eDialogTab);
break;
}
else
WARNING_LOG(m_logger) << LOGFUNCTION << " getForeignGuiInterface<AesExplosion::ForeignGuiInterface> failed!";
break;
}
case AreaEffectSimulation::AesType::AtMineArea:
{
std::shared_ptr<AesMineArea::ForeignGuiInterface> ifc;
if (m_session->getForeignGuiInterface<AesMineArea::ForeignGuiInterface>(ifc))
{
AreaEffectSimulation::BaseEdit* dialog = ifc->showEditWindow(m_aesEntityId, this);
if (dialog)
addDialog(dialog, dialog->menuGroup(), dialog->dialogIdentifier(), LtsWidgets::LayoutArea::eDialogTab);
}
else
WARNING_LOG(m_logger) << LOGFUNCTION << " getForeignGuiInterface<AesMineArea::ForeignGuiInterface> failed!";
break;
}
case AreaEffectSimulation::AesType::AtMineCorridor:
{
std::shared_ptr<AesMineCorridor::ForeignGuiInterface> ifc;
if (m_session->getForeignGuiInterface<AesMineCorridor::ForeignGuiInterface>(ifc))
{
AreaEffectSimulation::BaseEdit* dialog = ifc->showEditWindow(m_aesEntityId, this);
if (dialog)
addDialog(dialog, dialog->menuGroup(), dialog->dialogIdentifier(), LtsWidgets::LayoutArea::eDialogTab);
}
else
WARNING_LOG(m_logger) << LOGFUNCTION << " getForeignGuiInterface<AesMineCorridor::ForeignGuiInterface> failed!";
break;
}
case AreaEffectSimulation::AesType::AtGasPipe:
{
std::shared_ptr<AesGasPipe::ForeignGuiInterface> ifc;
if (m_session->getForeignGuiInterface<AesGasPipe::ForeignGuiInterface>(ifc))
{
AreaEffectSimulation::BaseEdit* dialog = ifc->showEditWindow(m_aesEntityId, this);
if (dialog)
addDialog(dialog, dialog->menuGroup(), dialog->dialogIdentifier(), LtsWidgets::LayoutArea::eDialogTab);
}
else
WARNING_LOG(m_logger) << LOGFUNCTION << " getForeignGuiInterface<AesGasPipe::ForeignGuiInterface> failed!";
break;
}
case AreaEffectSimulation::AesType::AtDangerArea:
{
std::shared_ptr<AesDangerArea::ForeignGuiInterface> ifc;
if (m_session->getForeignGuiInterface<AesDangerArea::ForeignGuiInterface>(ifc))
{
AreaEffectSimulation::BaseEdit* dialog = ifc->showEditWindow(m_aesEntityId, this);
if (dialog)
addDialog(dialog, dialog->menuGroup(), dialog->dialogIdentifier(), LtsWidgets::LayoutArea::eDialogTab);
}
else
WARNING_LOG(m_logger) << LOGFUNCTION << " getForeignGuiInterface<AesDangerArea::ForeignGuiInterface> failed!";
break;
}
case AreaEffectSimulation::AesType::AtBorderline:
{
std::shared_ptr<AesBorderline::ForeignGuiInterface> ifc;
if (m_session->getForeignGuiInterface<AesBorderline::ForeignGuiInterface>(ifc))
{
AreaEffectSimulation::BaseEdit* dialog = ifc->showEditWindow(m_aesEntityId, this);
if (dialog)
addDialog(dialog, dialog->menuGroup(), dialog->dialogIdentifier(), LtsWidgets::LayoutArea::eDialogTab);
}
else
WARNING_LOG(m_logger) << LOGFUNCTION << " getForeignGuiInterface<AesBorderline::ForeignGuiInterface> failed!";
break;
}
case AreaEffectSimulation::AesType::AtFunctionalArea:
{
std::shared_ptr<AesFunctionalArea::ForeignGuiInterface> ifc;
if (m_session->getForeignGuiInterface<AesFunctionalArea::ForeignGuiInterface>(ifc))
{
AreaEffectSimulation::BaseEdit* dialog = ifc->showEditWindow(m_aesEntityId, this);
if (dialog)
addDialog(dialog, dialog->menuGroup(), dialog->dialogIdentifier(), LtsWidgets::LayoutArea::eDialogTab);
}
else
WARNING_LOG(m_logger) << LOGFUNCTION << " getForeignGuiInterface<AesFunctionalArea::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:
// empty
break;
case AreaEffectSimulation::AesType::AtUnknown:
Q_ASSERT(false);
WARNING_LOG(m_logger) << "Unknown AesType found for aesEntityId: " << m_aesEntityId;
break;
default:
break;
} // switch
} // end of onShowDetails()
//-----------------------------------------------------------------------------
bool AesInfoDialog::onResetDusMines()
{
if (m_aesType == AreaEffectSimulation::AesType_def::AtMineAreaSingleMines)
{
DEBUG_LOG(m_logger) << "onResetDusMines() AtMineAreaSingleMines mineId: " << m_aesEntityId;
MineResetRequest req(0, {m_aesEntityId});
return m_requestHelper->startSingleRequest([req, this]()
{
return m_ftc->mineResetRequest(req, this);
});
}
else
{
MineResetRequest req(m_aesEntityId, {});
return m_requestHelper->startSingleRequest([req, this]()
{
return m_ftc->mineResetRequest(req, this);
});
}
} // end of onResetDusMines()
//-----------------------------------------------------------------------------
void AesInfoDialog::onNContaminationChanged(const AreaEffectSimulation::NContamination &data, DataModification modType)
{
DEBUG_LOG(m_logger) << LOGFUNCTION << " id: " << data.id();
if (data.id() == m_aesEntityId && modType != DataModification::eRemoved)
handleNContamination(data);
} // end of onNContaminationChanged()
//-----------------------------------------------------------------------------
void AesInfoDialog::onBCContaminationChanged(const AreaEffectSimulation::BCContamination &data, DataModification modType)
{
DEBUG_LOG(m_logger) << LOGFUNCTION << " id: " << data.id();
if (data.id() == m_aesEntityId && modType != DataModification::eRemoved)
handleBCContamination(data);
} // end of bCContaminationChanged()
//-----------------------------------------------------------------------------
void AesInfoDialog::onBoobyTrapChanged(const AreaEffectSimulation::BoobyTrap &data, DataModification modType)
{
DEBUG_LOG(m_logger) << LOGFUNCTION << " id: " << data.id();
if (data.id() == m_aesEntityId && modType != DataModification::eRemoved)
handleBoobyTrap(data);
} // end of onBoobyTrapChanged()
//-----------------------------------------------------------------------------
void AesInfoDialog::onOffRouteMineChanged(const AreaEffectSimulation::OffRouteMine &data, DataModification modType)
{
DEBUG_LOG(m_logger) << LOGFUNCTION << " id: " << data.id();
if (data.id() == m_aesEntityId && modType != DataModification::eRemoved)
handleOffRouteMine(data);
} // end of onBoobyTrapChanged()
//-----------------------------------------------------------------------------
void AesInfoDialog::onExplosionAreaChanged(const AreaEffectSimulation::ExplosionArea &data, DataModification modType)
{
DEBUG_LOG(m_logger) << LOGFUNCTION << " id: " << data.id();
if (data.id() == m_aesEntityId && modType != DataModification::eRemoved)
handleExplosionArea(data);
} // end of onExplosionAreaChanged()
//-----------------------------------------------------------------------------
void AesInfoDialog::onExplosionSingleChanged(const AreaEffectSimulation::ExplosionSingle &data, DataModification modType)
{
DEBUG_LOG(m_logger) << LOGFUNCTION << " id: " << data.id();
if (data.id() == m_aesEntityId && modType != DataModification::eRemoved)
handleExplosionSingle(data);
} // end of onExplosionSingleChanged()
//-----------------------------------------------------------------------------
void AesInfoDialog::onMineAreaChanged(const AreaEffectSimulation::MineArea &data, DataModification modType)
{
DEBUG_LOG(m_logger) << LOGFUNCTION << " id: " << data.id();
if (data.id() == m_aesEntityId && modType != DataModification::eRemoved)
handleMineArea(data);
} // end of onMineAreaChanged()
//-----------------------------------------------------------------------------
void AesInfoDialog::onMineCorridorChanged(const MineCorridor &data, DataModification modType)
{
DEBUG_LOG(m_logger) << LOGFUNCTION << " id: " << data.id();
if (data.id() == m_aesEntityId && modType != DataModification::eRemoved)
handleMineCorridor(data);
} // end of onMineCorridorChanged()
//-----------------------------------------------------------------------------
void AesInfoDialog::onGasPipeChanged(const GasPipe &data, DataModification modType)
{
DEBUG_LOG(m_logger) << LOGFUNCTION << " id: " << data.id();
if (data.id() == m_aesEntityId && modType != DataModification::eRemoved)
handleGasPipe(data);
} // end of onGasPipeChanged()
//-----------------------------------------------------------------------------
void AesInfoDialog::onDangerAreaChanged(const AreaEffectSimulation::DangerArea &data, DataModification modType)
{
DEBUG_LOG(m_logger) << LOGFUNCTION << " id: " << data.id();
if (data.id() == m_aesEntityId && modType != DataModification::eRemoved)
handleDangerArea(data);
} // end of onDangerAreaChanged()
//-----------------------------------------------------------------------------
void AesInfoDialog::onBorderlineChanged(const AreaEffectSimulation::Borderline &data, DataModification modType)
{
DEBUG_LOG(m_logger) << LOGFUNCTION << " id: " << data.id();
if (data.id() == m_aesEntityId && modType != DataModification::eRemoved)
handleBorderline(data);
}// end of onBorderlineChanged()
//-----------------------------------------------------------------------------
void AesInfoDialog::onFunctionalAreaChanged(const FunctionalArea &data, DataModification modType)
{
DEBUG_LOG(m_logger) << LOGFUNCTION << " id: " << data.id();
if (data.id() == m_aesEntityId && modType != DataModification::eRemoved)
handleFunctionalArea(data);
}// end of onFunctionalAreaChanged()
//-----------------------------------------------------------------------------
void AesInfoDialog::onAirSupportImpactChanged(const AirSupportImpact &data, DataModification modType)
{
DEBUG_LOG(m_logger) << LOGFUNCTION << " id: " << data.id();
if (data.id() == m_aesEntityId && modType != DataModification::eRemoved)
handleAirSupportImpact(data);
}// end of onAirSupportImpactChanged()
//-----------------------------------------------------------------------------
void AesInfoDialog::onDusMineStateChanged(const DusMineState &data, DataModification modType)
{
DEBUG_LOG(m_logger) << LOGFUNCTION << " id: " << data.id();
if (modType == DataModification::eRemoved)
return;
if (data.id() != 0) // we're only interested in minearea 0 (= dus mines without minefield)
return;
AesItemView itemView;
if (!m_dtc->aesItemViewFromEntityId(0, m_aesType, itemView))
return;
for (size_t i = 0; i < data.mines().size(); ++i)
{
const DusMine &mine = data.mines().at(i);
if (mine.eqId() == m_aesEntityId)
{
if (itemView.form().size() <= i)
return;
handleMineAraeSingleMine(itemView.form().at(i), mine);
return;
}
}
}// end of onDusMineStateChanged()
//-----------------------------------------------------------------------------
void AesInfoDialog::onDusSingleMineChanged(const DusSingleMine &data, DataModification modType)
{
DEBUG_LOG(m_logger) << LOGFUNCTION << " id: " << data.id();
if (data.id() == m_aesEntityId && modType != DataModification::eRemoved)
handleSingleDusMine();
}// end of onDusSingleMineChanged()
//-----------------------------------------------------------------------------
void AesInfoDialog::onExplosionClusterChanged(const ExplosionCluster &data, DataModification modType)
{
DEBUG_LOG(m_logger) << LOGFUNCTION << " id: " << data.id();
if (data.id() == m_aesEntityId && modType != DataModification::eRemoved)
handleExplosionCluster(data);
}// end of onExplosionClusterChanged()
void AesInfoDialog::onEffectClusterChanged(const EffectCluster &data, DataModification modType)
{
DEBUG_LOG(m_logger) << LOGFUNCTION << " id: " << data.id();
if (data.id() == m_aesEntityId && modType != DataModification::eRemoved)
handleEffectCluster(data);
}
//-----------------------------------------------------------------------------
} // namespace AreaEffectSimulation