98 lines
2.9 KiB
C++
Executable File
98 lines
2.9 KiB
C++
Executable File
/**
|
|
* Dialog to show affected participants and builsings by an impact
|
|
* @RDE_HEADER@
|
|
* $Id: ppm_msdl_edit.h 52239 2020-10-05 11:33:12Z thoden $
|
|
* $HeadURL: svn://192.168.133.21/TDS/branches/product/features/3dws_devel/Lts/Plugins/ParticipantManagement/Gui/MSDL/ppm_msdl_edit.h $
|
|
* $Author: thoden $
|
|
* Created by Hannes Fritsche, ESZS, 2024-08-05
|
|
*/
|
|
|
|
#include "cds_simulation_dialog.h"
|
|
#include "ui_cds_simulation_dialog.h"
|
|
|
|
#include <InfrastructureManagement/ism_dtc.h>
|
|
#include <ParticipantManagement/ppm_dtc.h>
|
|
|
|
#include "cds_building_model.h"
|
|
#include "cds_participant_model.h"
|
|
|
|
namespace CollateralDamageSimulation
|
|
{
|
|
|
|
SimulationDialog::SimulationDialog(QWidget *parent)
|
|
: LtsDialog(parent, LtsWidgets::ButtonCombination::CloseOnly)
|
|
, m_ui(new Ui::SimulationDialog)
|
|
{
|
|
m_ui->setupUi(this);
|
|
|
|
setOnlineHelpFilename(QStringLiteral("Situation_Kollateralschadensimulator"));
|
|
}
|
|
|
|
void SimulationDialog::init(const QVector<int> &buildingsInRange, const QVector<int> &participantsWithoutProtection, const QVector<int> &participantsWithProtection, const std::shared_ptr<InfrastructureManagement::Interface::Dtc> &ismDtc, const std::shared_ptr<ParticipantManagement::Interface::Dtc> &ppmDtc)
|
|
{
|
|
// dds stuff
|
|
if (!ismDtc->isMainStructureElementEnabled())
|
|
{
|
|
ismDtc->enableMainStructureElement();
|
|
ismDtc->waitForHistoricalDataMainStructureElement(3000);
|
|
}
|
|
|
|
if (!ppmDtc->isParticipantEnabled())
|
|
{
|
|
ppmDtc->enableParticipant();
|
|
ppmDtc->waitForHistoricalDataParticipant(3000);
|
|
}
|
|
|
|
if (!ppmDtc->isPartyEnabled())
|
|
{
|
|
ppmDtc->enableParty();
|
|
ppmDtc->waitForHistoricalDataParty(3000);
|
|
}
|
|
|
|
// participants without protection
|
|
if (m_participantsWithoutProtectionModel != nullptr)
|
|
{
|
|
delete m_participantsWithoutProtectionModel;
|
|
m_participantsWithoutProtectionModel = nullptr;
|
|
}
|
|
|
|
m_participantsWithoutProtectionModel = new ParticipantModel(this);
|
|
|
|
m_participantsWithoutProtectionModel->initModel(ppmDtc, participantsWithoutProtection);
|
|
|
|
m_ui->ldvParticipantsWithoutProtection->setModel(m_participantsWithoutProtectionModel);
|
|
|
|
// participants with protection
|
|
if (m_participantsWithProtectionModel != nullptr)
|
|
{
|
|
delete m_participantsWithProtectionModel;
|
|
m_participantsWithProtectionModel = nullptr;
|
|
}
|
|
|
|
m_participantsWithProtectionModel = new ParticipantModel(this);
|
|
|
|
m_participantsWithProtectionModel->initModel(ppmDtc, participantsWithProtection);
|
|
|
|
m_ui->ldvParticipantsWithProtection->setModel(m_participantsWithProtectionModel);
|
|
|
|
// buildings
|
|
if (m_buildingModel != nullptr)
|
|
{
|
|
delete m_buildingModel;
|
|
m_buildingModel = nullptr;
|
|
}
|
|
|
|
m_buildingModel = new BuildingModel(this);
|
|
|
|
m_buildingModel->initModel(ismDtc, buildingsInRange);
|
|
|
|
m_ui->ldvBuildings->setModel(m_buildingModel);
|
|
}
|
|
|
|
void SimulationDialog::retranslate()
|
|
{
|
|
translate(m_ui, tr("Simulation"));
|
|
}
|
|
|
|
} //namespace ParticipantManagement
|