Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
@@ -0,0 +1,51 @@
|
||||
#
|
||||
# $Id$
|
||||
# $HeadURL$
|
||||
# $Author$
|
||||
# Created by Patric Karwat, SLSE, 2016-07-03
|
||||
#
|
||||
|
||||
ADD_INTERFACE_LIBRARY(
|
||||
AesNContaminationGuiPluginInterface
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/aes_ncontamination_gui_plugin_interface.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/..
|
||||
)
|
||||
|
||||
SET(aes_ncontamination_gui_SRCS
|
||||
aes_ncontamination_gui_plugin.cpp
|
||||
aes_ncontamination_gui_plugin.h
|
||||
aes_ncontamination_edit.cpp
|
||||
aes_ncontamination_edit.h
|
||||
aes_ncontamination_list.cpp
|
||||
aes_ncontamination_list.h
|
||||
aes_ncontaminations_model.cpp
|
||||
aes_ncontaminations_model.h
|
||||
CustomView/aes_ncontamination.h
|
||||
CustomView/aes_ncontamination.cpp
|
||||
)
|
||||
|
||||
NGL_WRAP_UI(aes_ncontamination_gui_SRCS
|
||||
aes_ncontamination_edit.ui
|
||||
CustomView/aes_ncontamination.ui
|
||||
)
|
||||
|
||||
NGL_ADD_LIBRARY(WS AesNContaminationGuiPlugin MODULE ${aes_ncontamination_gui_SRCS})
|
||||
NGL_TARGET_LINK_LIBRARIES(AesNContaminationGuiPlugin
|
||||
AesBaseGui
|
||||
ngltools # dtg
|
||||
NGLLogger
|
||||
LtsSessionData
|
||||
AesDataPluginInterface
|
||||
AesNContaminationGuiPluginInterface
|
||||
PpmGuiComboboxPluginInterface
|
||||
SituationMapGuiPluginInterface
|
||||
Qt5::Widgets
|
||||
LtsWidgets
|
||||
LtsDataView
|
||||
LtsUtilsGuiDds
|
||||
LtsUtilsSettings
|
||||
)
|
||||
|
||||
NGL_INSTALL_TARGET(AesNContaminationGuiPlugin)
|
||||
|
||||
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* CustomView for AES NContamination
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Mike Wille, SLSE, 2016-04-08
|
||||
*/
|
||||
|
||||
#include "aes_ncontamination.h"
|
||||
#include "ui_aes_ncontamination.h"
|
||||
|
||||
#include "aes_ncontaminations_model.h"
|
||||
#include <Services/AreaEffectSimulation/Utils/polygons.h>
|
||||
|
||||
namespace AreaEffectSimulation
|
||||
{
|
||||
CustomViewNContamination::CustomViewNContamination(QWidget *parent)
|
||||
: AbstractDisplayWidget(parent)
|
||||
, m_ui(new Ui::CustomViewNContamination)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
}
|
||||
|
||||
CustomViewNContamination::~CustomViewNContamination()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
bool CustomViewNContamination::init(const QModelIndex &idx)
|
||||
{
|
||||
if (!idx.isValid())
|
||||
return false;
|
||||
|
||||
m_ui->lblIdentifier->setText(rowData(idx, AreaEffectSimulation::NContaminationsModel::BcName).toString());
|
||||
m_ui->lblEffectState->setText(rowData(idx, AreaEffectSimulation::NContaminationsModel::BcEffectState).toString());
|
||||
m_ui->lblEffectStart->setText(rowData(idx, AreaEffectSimulation::NContaminationsModel::BcEffectStart).toString());
|
||||
m_ui->lblChargeType->setText(rowData(idx, AreaEffectSimulation::NContaminationsModel::BcChargeType).toString());
|
||||
m_ui->lblIcon->clear();
|
||||
m_ui->lblIcon->setAutoFillBackground(true);
|
||||
|
||||
const AesItemSortFilterProxyModel *sfpm = qobject_cast<const AesItemSortFilterProxyModel*>(idx.model());
|
||||
if (!sfpm)
|
||||
return false;
|
||||
const NContaminationsModel *aesModel = qobject_cast<const NContaminationsModel*>(sfpm->sourceModel());
|
||||
if (!aesModel)
|
||||
return false;
|
||||
const auto srcIdx = sfpm->mapToSource(idx);
|
||||
NContamination nContamin = aesModel->getRowData(srcIdx.row());
|
||||
calculateIcon(nContamin, sfpm->partyColor(idx.row()));
|
||||
|
||||
QString durationString = rowData(idx, AreaEffectSimulation::NContaminationsModel::BcEffectDuration).toString();
|
||||
if (!durationString.isEmpty() && durationString != QLatin1String("0"))
|
||||
{
|
||||
m_ui->lblEffectDuration->setText(durationString);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ui->label_4->hide();
|
||||
m_ui->lblEffectDuration->hide();
|
||||
m_ui->label_6->hide();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CustomViewNContamination::calculateIcon(const NContamination &nContamination, const QColor &color)
|
||||
{
|
||||
Database::AesNContamination nContaOut;
|
||||
nContaOut.borderLengthInner = nContamination.borderLengthInner();
|
||||
nContaOut.borderLengthOuter = nContamination.borderLengthOuter();
|
||||
nContaOut.impactPosition = QPointF(nContamination.impactPosition().lon(), nContamination.impactPosition().lat());
|
||||
nContaOut.impactRadius = nContamination.impactRadius();
|
||||
nContaOut.rotationAngle = nContamination.rotationAngle();
|
||||
nContaOut.spanAngle = nContamination.spanAngle();
|
||||
|
||||
QPolygonF poly = AreaEffectSimulation::Polygons::nContamination(nContaOut);
|
||||
Qt::BrushStyle bStyle = PixmapLabel::checkForBrushStyle(nContamination.effectStateId());
|
||||
const auto pix = Polygons::pixmapFromPolygon(PixmapLabel::geographic2Utm(poly), color, ICON_RESOLUTION, bStyle);
|
||||
m_ui->lblIcon->setPixmap(pix);
|
||||
|
||||
return true;
|
||||
}
|
||||
} // namespace AreaEffectSimulation
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* CustomView for AES NContamination
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Mike Wille, SLSE, 2016-04-08
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <Viewer/LtsDataView/abstract_display_widget.h>
|
||||
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class CustomViewNContamination;
|
||||
}
|
||||
|
||||
namespace AreaEffectSimulation
|
||||
{
|
||||
class NContamination;
|
||||
class CustomViewNContamination final : public LtsDataView::AbstractDisplayWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit CustomViewNContamination(QWidget *parent = nullptr);
|
||||
~CustomViewNContamination();
|
||||
bool init(const QModelIndex &idx) override final;
|
||||
|
||||
private:
|
||||
bool calculateIcon(const AreaEffectSimulation::NContamination &nContamination, const QColor &color);
|
||||
|
||||
Ui::CustomViewNContamination *m_ui;
|
||||
|
||||
};
|
||||
} // namespace AreaEffectSimulation
|
||||
+155
@@ -0,0 +1,155 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CustomViewNContamination</class>
|
||||
<widget class="QWidget" name="CustomViewNContamination">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>350</width>
|
||||
<height>200</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="lblIdentifier">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">Name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblChargeType">
|
||||
<property name="font">
|
||||
<font>
|
||||
<italic>true</italic>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">Type</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<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="label">
|
||||
<property name="text">
|
||||
<string>State:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblEffectState">
|
||||
<property name="text">
|
||||
<string notr="true">State</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="AreaEffectSimulation::PixmapLabel" name="lblIcon">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">icon</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="lblEffectStart">
|
||||
<property name="text">
|
||||
<string notr="true">Time</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string notr="true">for</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblEffectDuration">
|
||||
<property name="text">
|
||||
<string notr="true">Duration</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>seconds</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>AreaEffectSimulation::PixmapLabel</class>
|
||||
<extends>QLabel</extends>
|
||||
<header>AreaEffectSimulation/Gui/Base/aes_pixmap_label.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
+419
@@ -0,0 +1,419 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* AreaEffectSimulation - NContamination Edit Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-07-07
|
||||
*/
|
||||
|
||||
|
||||
#include "aes_ncontamination_edit.h"
|
||||
#include "ui_aes_ncontamination_edit.h"
|
||||
|
||||
#include <LtsSession/lts_session_data.h>
|
||||
#include <Plugins/AreaEffectSimulation/aes_data_plugin_interface.h>
|
||||
#include <Plugins/ProjectDataManagement/pdm_gui_plugin_interface.h>
|
||||
#include <Plugins/ProjectDataManagement/pdm_data_plugin_interface.h>
|
||||
#include <Plugins/SituationMapPlugin/situation_map_gui_plugin_interface.h>
|
||||
#include <PluginInterfaces/gui_plugin_interface.h>
|
||||
#include <AreaEffectSimulation/aes_translation.h>
|
||||
|
||||
#include <QDoubleSpinBox>
|
||||
|
||||
namespace AreaEffectSimulation
|
||||
{
|
||||
|
||||
double NContaminationEdit::s_minRadiusKm;
|
||||
double NContaminationEdit::s_maxRadiusKm;
|
||||
double NContaminationEdit::s_stepRadiusKm;
|
||||
double NContaminationEdit::s_minBorderLengthInnerKm;
|
||||
double NContaminationEdit::s_maxBorderLengthInnerKm;
|
||||
double NContaminationEdit::s_stepBorderLengthInnerKm;
|
||||
double NContaminationEdit::s_minBorderLengthOuterKm;
|
||||
double NContaminationEdit::s_maxBorderLengthOuterKm;
|
||||
double NContaminationEdit::s_stepBorderLengthOuterKm;
|
||||
double NContaminationEdit::s_minSpanAngle;
|
||||
double NContaminationEdit::s_maxSpanAngle;
|
||||
double NContaminationEdit::s_minYield;
|
||||
double NContaminationEdit::s_maxYield;
|
||||
double NContaminationEdit::s_stepYield;
|
||||
int NContaminationEdit::s_minDurationMinutes;
|
||||
int NContaminationEdit::s_maxDurationMinutes;
|
||||
int NContaminationEdit::s_stepDurationMinutes;
|
||||
|
||||
NContaminationEdit::NContaminationEdit(const QString &menuGroup, QWidget *parent)
|
||||
: BaseEdit(menuGroup, QLatin1String("NContaminationEdit"), parent)
|
||||
, m_ui(new Ui::NContaminationEdit)
|
||||
, m_previewCircleRadius(0.0)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
s_minRadiusKm = 0.050;
|
||||
s_maxRadiusKm = 5.000;
|
||||
s_stepRadiusKm = 0.010;
|
||||
s_minBorderLengthInnerKm = 0.000;
|
||||
s_maxBorderLengthInnerKm = 65.000;
|
||||
s_stepBorderLengthInnerKm = 0.010;
|
||||
s_minBorderLengthOuterKm = 0.000;
|
||||
s_maxBorderLengthOuterKm = 65.000;
|
||||
s_stepBorderLengthOuterKm = 0.010;
|
||||
s_minSpanAngle = 10.0;
|
||||
s_maxSpanAngle = 90.0;
|
||||
s_minYield = 0.0;
|
||||
s_maxYield = 99999.9;
|
||||
s_stepYield = 0.01;
|
||||
s_minDurationMinutes = 0.0;
|
||||
s_maxDurationMinutes = 10000.0;
|
||||
s_stepDurationMinutes = 10.0;
|
||||
|
||||
m_ui->rotationAngleEdit->initAngleEditWidget(2); // radial spinbox 1&2
|
||||
m_ui->cbWeather->setCurrentIndex(AesWeatherSource::AwsNone);
|
||||
|
||||
m_ui->sbRadiusKm->setMinimum(s_minRadiusKm);
|
||||
m_ui->sbRadiusKm->setMaximum(s_maxRadiusKm);
|
||||
m_ui->sbRadiusKm->setSingleStep(s_stepRadiusKm);
|
||||
m_ui->sbRange1Km->setMinimum(s_minBorderLengthInnerKm);
|
||||
m_ui->sbRange1Km->setMaximum(s_maxBorderLengthInnerKm);
|
||||
m_ui->sbRange1Km->setSingleStep(s_stepBorderLengthInnerKm);
|
||||
m_ui->sbRange2Km->setMinimum(s_minBorderLengthOuterKm);
|
||||
m_ui->sbRange2Km->setMaximum(s_maxBorderLengthOuterKm);
|
||||
m_ui->sbRange2Km->setSingleStep(s_stepBorderLengthOuterKm);
|
||||
m_ui->sbYield->setMinimum(s_minYield);
|
||||
m_ui->sbYield->setMaximum(s_maxYield);
|
||||
m_ui->sbYield->setSingleStep(s_stepYield);
|
||||
m_ui->stackedWidget->addWidget(m_ui->lbRadials);
|
||||
m_ui->stackedWidget->addWidget(m_ui->lbAngle);
|
||||
|
||||
// m_ui->sbDuration->setMinimum(s_minDurationMinutes);
|
||||
// m_ui->sbDuration->setMaximum(s_maxDurationMinutes);
|
||||
// m_ui->sbDuration->setSingleStep(s_stepDurationMinutes);
|
||||
|
||||
m_uiRequirements->addRequirement({m_ui->lblPosition, [this]() { return (!m_ui->positionEdit->coordinate().isNull()); }});
|
||||
m_uiRequirements->addRequirement({m_ui->lblIdentifier, [this]() { return (!m_ui->leIdentifier->text().isEmpty()); }});
|
||||
m_uiRequirements->addRequirement({m_ui->lblEffectStart, [this]() { return hasValidEffectStart(m_ui->dteEffectStart); }});
|
||||
m_uiRequirements->addRequirement({m_ui->lbRadials, [this]() { return ((spanAngle() >= s_minSpanAngle) && (spanAngle() <= s_maxSpanAngle)); }});
|
||||
m_uiRequirements->addRequirement({m_ui->lbAngle, [this]() { return (m_ui->rotationAngleEdit->getAngle(0) >= 0);}} );//m_ui->sbRadials1->value()
|
||||
m_uiRequirements->addRequirement({m_ui->lblChargeType, [this]() { return (m_ui->cbChargeType->currentData().toInt() > 0); }});
|
||||
|
||||
connect(m_ui->sbRadiusKm, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
||||
this, &NContaminationEdit::onRadiusChanged);
|
||||
connect(m_ui->cbWeather, QOverload<int>::of(&LtsWidgets::LtsComboBox::currentIndexChanged),
|
||||
this, &NContaminationEdit::onWeatherChanged);
|
||||
|
||||
connect(m_ui->pbClear, &QPushButton::clicked, m_ui->positionEdit, &LtsCoordWidget::LtsCoordWidget::clear);
|
||||
|
||||
// connect(m_ui->sbRadials1, &QDoubleSpinBox::editingFinished, this, &NContaminationEdit::correctSpinBoxValue);
|
||||
// connect(m_ui->sbRadials2, &QDoubleSpinBox::editingFinished, this, &NContaminationEdit::correctSpinBoxValue);
|
||||
connect(m_ui->sbRadiusKm, &QDoubleSpinBox::editingFinished, this, &NContaminationEdit::correctSpinBoxValue);
|
||||
connect(m_ui->sbRange1Km, &QDoubleSpinBox::editingFinished, this, &NContaminationEdit::correctSpinBoxValue);
|
||||
connect(m_ui->sbRange2Km, &QDoubleSpinBox::editingFinished, this, &NContaminationEdit::correctSpinBoxValue);
|
||||
connect(m_ui->sbYield, &QDoubleSpinBox::editingFinished, this, &NContaminationEdit::correctSpinBoxValue);
|
||||
|
||||
m_ui->cbWeather->addItem(toString(AesWeatherSource::AwsNone), AesWeatherSource::AwsNone);
|
||||
m_ui->cbWeather->addItem(toString(AesWeatherSource::AwsStatic), AesWeatherSource::AwsStatic);
|
||||
m_ui->cbWeather->addItem(toString(AesWeatherSource::AwsDynamic), AesWeatherSource::AwsDynamic);
|
||||
|
||||
m_ui->lblChargeType->hide();
|
||||
m_ui->cbChargeType->hide();
|
||||
|
||||
enaDisa();
|
||||
|
||||
setOnlineHelpFilename(QStringLiteral("Situation-Add_N-Contamination"));
|
||||
}
|
||||
|
||||
void NContaminationEdit::retranslate()
|
||||
{
|
||||
translate(m_ui, m_aesItem, tr("N-Contamination"));
|
||||
}
|
||||
|
||||
void NContaminationEdit::onRadiusChanged(double radiusKm)
|
||||
{
|
||||
m_ui->sbRange1Km->setMinimum(radiusKm);
|
||||
}
|
||||
|
||||
void NContaminationEdit::onPresetChanged(int id)
|
||||
{
|
||||
if (id == 0)
|
||||
return;
|
||||
|
||||
ProjectDataManagement::NuclearPreset ps = m_presets.value(id);
|
||||
if (ps.id() != id)
|
||||
return;
|
||||
|
||||
m_ui->sbYield->setValue(ps.detonationValue());
|
||||
m_ui->sbRadiusKm->setValue(ps.impactRadius() / 1000.0);
|
||||
m_ui->sbRange1Km->setValue(ps.borderLengthInner() / 1000.0);
|
||||
m_ui->sbRange2Km->setValue(ps.borderLengthOuter() / 1000.0);
|
||||
}
|
||||
|
||||
void NContaminationEdit::showPreviewObject()
|
||||
{
|
||||
if (!m_sitMapGuiIfc)
|
||||
return;
|
||||
|
||||
if (m_previewCircleCenter.isNull())
|
||||
return;
|
||||
|
||||
m_sitMapGuiIfc->displayPreviewObject(this, m_previewCircleCenter, m_previewCircleRadius);
|
||||
}
|
||||
|
||||
void NContaminationEdit::onWeatherChanged(int index )
|
||||
{
|
||||
Q_UNUSED(index);
|
||||
|
||||
AreaEffectSimulation::AesWeatherSource weather = static_cast<AreaEffectSimulation::AesWeatherSource::inner_enum>(m_ui->cbWeather->currentData().toInt());
|
||||
if (weather == AreaEffectSimulation::AesWeatherSource_def::AwsDynamic ||
|
||||
weather == AreaEffectSimulation::AesWeatherSource_def::AwsStatic)
|
||||
{
|
||||
m_ui->rotationAngleEdit->showSpinbox(1, false); //sbRadials2
|
||||
m_ui->stackedWidget->setCurrentWidget(m_ui->lbAngle);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ui->rotationAngleEdit->showSpinbox(1, true); //sbRadials2
|
||||
m_ui->stackedWidget->setCurrentWidget(m_ui->lbRadials);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
NContaminationEdit::~NContaminationEdit()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
void NContaminationEdit::setRadials(double direction, double spanAngle)
|
||||
{
|
||||
double radial1 = direction - (fabs(spanAngle) / 2.0);
|
||||
double radial2 = direction + (fabs(spanAngle) / 2.0);
|
||||
|
||||
AreaEffectSimulation::AesWeatherSource weather = static_cast<AreaEffectSimulation::AesWeatherSource::inner_enum>(m_ui->cbWeather->currentData().toInt());
|
||||
if (weather == AreaEffectSimulation::AesWeatherSource_def::AwsDynamic ||
|
||||
weather == AreaEffectSimulation::AesWeatherSource_def::AwsStatic)
|
||||
{
|
||||
radial1 = spanAngle;
|
||||
}
|
||||
|
||||
radial1 = fmod(radial1, 360.0);
|
||||
radial2 = fmod(radial2, 360.0);
|
||||
m_ui->rotationAngleEdit->setValue(radial1, LtsAngleEditBase::AngleUnitType::Deg, 0); // 0 für index 0
|
||||
m_ui->rotationAngleEdit->setValue(radial2, LtsAngleEditBase::AngleUnitType::Deg, 1); // 1 für index 1
|
||||
}
|
||||
|
||||
double NContaminationEdit::spanAngle() const
|
||||
{
|
||||
double radial1 = m_ui->rotationAngleEdit->getAngleConverted(m_ui->rotationAngleEdit->getAngle(0), LtsAngleEditBase::AngleUnitType::Deg,
|
||||
m_ui->rotationAngleEdit->getAngleCurrentUnit()); //m_ui->sbRadials1->value();
|
||||
double radial2 = m_ui->rotationAngleEdit->getAngleConverted(m_ui->rotationAngleEdit->getAngle(1), LtsAngleEditBase::AngleUnitType::Deg,
|
||||
m_ui->rotationAngleEdit->getAngleCurrentUnit()); //m_ui->sbRadials2->value();
|
||||
|
||||
if (m_ui->cbWeather->currentData().toInt() != AreaEffectSimulation::AesWeatherSource_def::AwsNone)
|
||||
return radial1;
|
||||
|
||||
double spanAngle = radial2 - radial1;
|
||||
if (spanAngle < 0)
|
||||
spanAngle += 360.0;
|
||||
return spanAngle;
|
||||
}
|
||||
|
||||
double NContaminationEdit::rotatianAngle() const
|
||||
{
|
||||
if (m_ui->cbWeather->currentData().toInt() != AreaEffectSimulation::AesWeatherSource_def::AwsNone)
|
||||
return 0.0;
|
||||
|
||||
double radial1 = m_ui->rotationAngleEdit->getAngleConverted(m_ui->rotationAngleEdit->getAngle(0), LtsAngleEditBase::AngleUnitType::Deg,
|
||||
m_ui->rotationAngleEdit->getAngleCurrentUnit()); //m_ui->sbRadials1->value();
|
||||
double radial2 = m_ui->rotationAngleEdit->getAngleConverted(m_ui->rotationAngleEdit->getAngle(1), LtsAngleEditBase::AngleUnitType::Deg,
|
||||
m_ui->rotationAngleEdit->getAngleCurrentUnit()); //m_ui->sbRadials2->value();
|
||||
|
||||
double direction = (radial2 + radial1) / 2.0;
|
||||
if (radial1 > radial2)
|
||||
direction += 180.0;
|
||||
return fmod(direction, 360.0);
|
||||
}
|
||||
|
||||
void NContaminationEdit::enableUiElements(bool enable)
|
||||
{
|
||||
m_ui->leIdentifier->setMaxLength(30);
|
||||
m_ui->rotationAngleEdit->setEnabled(enable);
|
||||
m_ui->cbStandardValues->setEnabled(enable);
|
||||
m_ui->sbRadiusKm->setEnabled(enable);
|
||||
m_ui->sbRange1Km->setEnabled(enable);
|
||||
m_ui->sbRange2Km->setEnabled(enable);
|
||||
m_ui->sbYield->setEnabled(enable);
|
||||
m_ui->cbChargeType->setEnabled(enable);
|
||||
setEffectStartEnabled(m_ui->dteEffectStart, enable);
|
||||
m_ui->pbPosition->setEnabled(m_sitMapGuiIfc && enable);
|
||||
m_ui->positionEdit->setEnabled(enable);
|
||||
m_ui->pbClear->setEnabled(enable);
|
||||
m_ui->leIdentifier->setEnabled(enable || isOnlyNameModifiable());
|
||||
m_ui->cbWeather->setEnabled(enable);
|
||||
|
||||
if (m_aesItem.effectStateId() == AesEffectState_def::EsExpired)
|
||||
{
|
||||
m_ui->leIdentifier->setText(QString::fromStdString(m_aesItem.name()));
|
||||
__unchange__();
|
||||
}
|
||||
if (m_aesItem.effectStateId() == AesEffectState_def::EsActivated)
|
||||
{
|
||||
QString name = m_ui->leIdentifier->text();
|
||||
auto baseData = m_dtc->nContamination(m_aesItem.id());
|
||||
setData(baseData, false);
|
||||
__unchange__();
|
||||
if (name != m_ui->leIdentifier->text())
|
||||
m_ui->leIdentifier->setText(name);
|
||||
}
|
||||
}
|
||||
|
||||
bool NContaminationEdit::init(int aesItemId, bool copy,
|
||||
LtsSession::LtsSession *session)
|
||||
{
|
||||
if (!BaseEdit::init(aesItemId, session))
|
||||
return false;
|
||||
|
||||
bool editable = LtsSessionData::LtsSessionData::getInstance()->hasOperatorRight(OperatorRights::NContaminationsEdit) ||
|
||||
m_session->app() == LtsAppDescriptor::App::OC;
|
||||
bool readable = LtsSessionData::LtsSessionData::getInstance()->hasOperatorRight(OperatorRights::NContaminationsShow);
|
||||
|
||||
if (!readable && !editable)
|
||||
return false;
|
||||
|
||||
std::shared_ptr<ProjectDataManagement::ForeignGuiInterface> pdmGuiIfc;
|
||||
if (!m_session->getForeignGuiInterface<ProjectDataManagement::ForeignGuiInterface>(pdmGuiIfc))
|
||||
return false;
|
||||
|
||||
m_ui->cbStandardValues->addItem(QLatin1String("---"), 0);
|
||||
std::shared_ptr<ProjectDataManagement::Interface::Dtc> pdmDtc;
|
||||
if (m_session->getDtc<ProjectDataManagement::DataInterface>(pdmDtc))
|
||||
{
|
||||
m_presets = pdmDtc->nuclearPresets();
|
||||
for (const ProjectDataManagement::NuclearPreset &preset : qAsConst(m_presets))
|
||||
m_ui->cbStandardValues->addItem(pdmDtc->trNuclearPresetName(preset.id()), preset.id());
|
||||
connect(m_ui->cbStandardValues, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &NContaminationEdit::onPresetChanged);
|
||||
}
|
||||
else
|
||||
INFO_LOG(m_logger) << "Could not fetch Presets from PDM.";
|
||||
|
||||
m_ui->dteEffectStart->setMinimumTimeMSec(m_session->partitionTime());
|
||||
m_ui->dteEffectStart->setRetrieveCurrentTimeCallback([this]() { return m_session->partitionTime(); });
|
||||
|
||||
if (m_sitMapGuiIfc)
|
||||
connect(m_ui->pbPosition, &QPushButton::clicked, this, &NContaminationEdit::getPosition);
|
||||
else
|
||||
m_ui->pbPosition->setEnabled(false);
|
||||
|
||||
pdmGuiIfc->fillNComboBox(m_ui->cbChargeType);
|
||||
|
||||
if (aesItemId > 0)
|
||||
{
|
||||
auto baseData = m_dtc->nContamination(aesItemId);
|
||||
setData(baseData, copy);
|
||||
// Note: @GUEZ, SpanAngle, RotationAngle, Name and Range Lengths are modifiable
|
||||
// even, when it is active! Not possible here (yet)!
|
||||
}
|
||||
|
||||
enableUiElements(editable && isModifiable() && !isOnlyNameModifiable());
|
||||
|
||||
connect(m_dtc.get(), &AreaEffectSimulation::Interface::Dtc::nContaminationChanged,
|
||||
this, &BaseEdit::onAreaChanged);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void NContaminationEdit::setData(const NContamination &contamination, bool copy)
|
||||
{
|
||||
m_aesItem = contamination;
|
||||
|
||||
if (copy)
|
||||
{
|
||||
m_aesItem.id(0);
|
||||
m_aesItem.effectStateId(AreaEffectSimulation::AesEffectState_def::get_default());
|
||||
}
|
||||
|
||||
m_ui->leIdentifier->setText(QString::fromStdString(contamination.name()));
|
||||
m_ui->dteEffectStart->setMsecsSinceEpoch(contamination.effectStart().is_set() ? contamination.effectStart().get() : 0);
|
||||
m_ui->cbChargeType->setCurrentIndex(m_ui->cbChargeType->findData(contamination.chargeStruct().chargeTypeId()));
|
||||
m_ui->cbWeather->setCurrentIndex(m_ui->cbWeather->findData(contamination.weatherSource().underlying()));
|
||||
|
||||
const QPointF pos(contamination.impactPosition().lon(), contamination.impactPosition().lat());
|
||||
if (!pos.isNull())
|
||||
m_ui->positionEdit->setCoordinate(pos);
|
||||
|
||||
m_ui->sbYield->setValue(contamination.detonationValue());
|
||||
m_ui->sbRange1Km->setValue(contamination.borderLengthInner() / 1000.0);
|
||||
m_ui->sbRange2Km->setValue(contamination.borderLengthOuter() / 1000.0);
|
||||
m_ui->sbRadiusKm->setValue(contamination.impactRadius() / 1000.0);
|
||||
setRadials(contamination.rotationAngle(), contamination.spanAngle());
|
||||
}
|
||||
|
||||
void NContaminationEdit::getPosition()
|
||||
{
|
||||
if (!has2DMap())
|
||||
return;
|
||||
|
||||
// Todo: Correct Rubberband!
|
||||
|
||||
m_sitMapGuiIfc->getCircle(this
|
||||
, SLOT(onCircleData(QPointF, double))
|
||||
, nullptr
|
||||
, s_minRadiusKm * 1000.0 //min
|
||||
, s_maxRadiusKm * 1000.0 //max
|
||||
, m_ui->positionEdit->coordinate()
|
||||
, m_ui->sbRadiusKm->value() * 1000); //max
|
||||
}
|
||||
|
||||
void NContaminationEdit::onCircleData(const QPointF &position, double radius)
|
||||
{
|
||||
m_previewCircleCenter = position;
|
||||
m_ui->positionEdit->setCoordinate(position);
|
||||
m_ui->sbRadiusKm->setValue(radius/1000.0);
|
||||
// SB corrects value if SingleStep is set
|
||||
m_previewCircleRadius = m_ui->sbRadiusKm->value()*1000;
|
||||
if( m_ui->sbRadiusKm->value() > m_ui->sbRange1Km->value())
|
||||
m_ui->sbRange1Km->setValue(radius/1000.0);
|
||||
|
||||
showPreviewObject();
|
||||
}
|
||||
|
||||
bool NContaminationEdit::apply()
|
||||
{
|
||||
std::string name = m_ui->leIdentifier->text().toStdString();
|
||||
qint64 effectStart = m_ui->dteEffectStart->msecsSinceEpoch();
|
||||
int duration = 0; // Infinite
|
||||
double borderInner = m_ui->sbRange1Km->value() * 1000.0;
|
||||
double borderOuter = m_ui->sbRange2Km->value() * 1000.0;
|
||||
double impactRadius = m_ui->sbRadiusKm->value() * 1000.0;
|
||||
int chargeType = m_ui->cbChargeType->currentData().toInt();
|
||||
double sAngle = spanAngle();
|
||||
double rAngle = rotatianAngle();
|
||||
double detonationValue = m_ui->sbYield->value();
|
||||
int partyId = 0;
|
||||
int playerId = 0;
|
||||
|
||||
AesWeatherSource weatherSourceId = static_cast<AesWeatherSource::inner_enum>(m_ui->cbWeather->currentData().toInt());
|
||||
const QPointF p(m_ui->positionEdit->coordinate());
|
||||
const Core::GeoPosition2D pos(p.x(), p.y());
|
||||
const NContaminationModifyRequest req(m_aesItem.id(),
|
||||
name,
|
||||
LtsUtils::toOptional(effectStart),
|
||||
duration,
|
||||
chargeType,
|
||||
pos,
|
||||
borderInner,
|
||||
borderOuter,
|
||||
impactRadius,
|
||||
sAngle,
|
||||
rAngle,
|
||||
detonationValue,
|
||||
weatherSourceId,
|
||||
LtsUtils::toOptional(partyId),
|
||||
LtsUtils::toOptional(playerId),
|
||||
dds::core::optional<rti::core::int64>());
|
||||
|
||||
return m_requestHelper->startSingleRequest([this, req]()
|
||||
{
|
||||
return m_ftc->nContaminationModifyRequest(req, this);
|
||||
});
|
||||
}
|
||||
|
||||
} // namespace AreaEffectSimulation
|
||||
+91
@@ -0,0 +1,91 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* AreaEffectSimulation - Explosion Edit Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-07-07
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Plugins/AreaEffectSimulation/Gui/Base/aes_base_edit.h>
|
||||
#include <AreaEffectSimulation/aes_ftc.h>
|
||||
#include <LtsWidgets/lts_angle_edit.h>
|
||||
#include <ProjectDataManagement/pdm.hpp>
|
||||
|
||||
class QDoubleSpinBox;
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class NContaminationEdit;
|
||||
}
|
||||
|
||||
namespace AreaEffectSimulation
|
||||
{
|
||||
|
||||
class NContaminationEdit final
|
||||
: public BaseEdit
|
||||
, protected AreaEffectSimulation::Interface::Ftc::NContaminationModifyReplyHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit NContaminationEdit(const QString &menuGroup, QWidget *parent = nullptr);
|
||||
~NContaminationEdit();
|
||||
|
||||
using LtsAngleEditBase = LtsWidgets::LtsAngleEdit;
|
||||
|
||||
QString dialogIdentifier() const override
|
||||
{
|
||||
return m_aesItem.id() <= 0 ? QStringLiteral("AddNContamination") : QStringLiteral("EditContamination%1").arg(m_aesItem.id());
|
||||
}
|
||||
bool init(int aesItemId, bool copy, LtsSession::LtsSession *session);
|
||||
|
||||
void onNContaminationModifyReply(const Core::FunctionReplyObject &replyObject) override final { onAesItemModifyReply(replyObject); }
|
||||
|
||||
private:
|
||||
void retranslate() override;
|
||||
|
||||
static double s_minRadiusKm;
|
||||
static double s_maxRadiusKm;
|
||||
static double s_stepRadiusKm;
|
||||
static double s_minBorderLengthInnerKm;
|
||||
static double s_maxBorderLengthInnerKm;
|
||||
static double s_stepBorderLengthInnerKm;
|
||||
static double s_minBorderLengthOuterKm;
|
||||
static double s_maxBorderLengthOuterKm;
|
||||
static double s_stepBorderLengthOuterKm;
|
||||
static double s_minSpanAngle;
|
||||
static double s_maxSpanAngle;
|
||||
static double s_minYield;
|
||||
static double s_maxYield;
|
||||
static double s_stepYield;
|
||||
static int s_minDurationMinutes;
|
||||
static int s_maxDurationMinutes;
|
||||
static int s_stepDurationMinutes;
|
||||
|
||||
void setData(const NContamination &contamination, bool copy);
|
||||
void enableUiElements(bool enable) override;
|
||||
|
||||
double spanAngle() const;
|
||||
double rotatianAngle() const;
|
||||
|
||||
private Q_SLOTS:
|
||||
void getPosition();
|
||||
void onCircleData(const QPointF &position, double radius);
|
||||
bool apply() override;
|
||||
|
||||
void setRadials(double direction, double spanAngle);
|
||||
void onRadiusChanged(double radiusKm);
|
||||
void onPresetChanged(int id);
|
||||
void showPreviewObject() override;
|
||||
void onWeatherChanged(int index);
|
||||
private:
|
||||
Ui::NContaminationEdit *m_ui;
|
||||
QMap<int, ProjectDataManagement::NuclearPreset> m_presets;
|
||||
QPointF m_previewCircleCenter;
|
||||
double m_previewCircleRadius;
|
||||
};
|
||||
|
||||
} //namespace AreaEffectSimulation
|
||||
+307
@@ -0,0 +1,307 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>NContaminationEdit</class>
|
||||
<widget class="QWidget" name="NContaminationEdit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>837</width>
|
||||
<height>244</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">Aes N-Contamination Edit</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="4" column="1">
|
||||
<widget class="LtsWidgets::LtsComboBox" name="cbWeather">
|
||||
<property name="currentText">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="3">
|
||||
<widget class="QLabel" name="lbRange1">
|
||||
<property name="text">
|
||||
<string>Range I [km]:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="4" colspan="2">
|
||||
<widget class="LtsWidgets::LtsAngleEdit" name="rotationAngleEdit" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="6">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QLabel" name="lblYield">
|
||||
<property name="text">
|
||||
<string>Yield [kT]:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="LtsCoordWidget::LtsCoordWidget" name="positionEdit" native="true"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pbPosition">
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normaloff>:/style/position.svg</normaloff>:/style/position.svg</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pbClear">
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normaloff>:/style/remove.svg</normaloff>:/style/remove.svg</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="leIdentifier">
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="4">
|
||||
<widget class="QDoubleSpinBox" name="sbRadiusKm"/>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lblEffectStart">
|
||||
<property name="text">
|
||||
<string>Activation Time:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="lblIdentifier">
|
||||
<property name="text">
|
||||
<string>Identifier:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" rowspan="2">
|
||||
<widget class="LtsWidgets::LtsDateTimeEdit" name="dteEffectStart" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="withButtons" stdset="0">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="withSlider" stdset="0">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="checkable" stdset="0">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="withReset" stdset="0">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="3">
|
||||
<widget class="QLabel" name="lblRadius">
|
||||
<property name="text">
|
||||
<string>Radius [km]:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3" rowspan="2">
|
||||
<widget class="QStackedWidget" name="stackedWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="radial">
|
||||
<widget class="QLabel" name="lbRadials">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>10</y>
|
||||
<width>43</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Radials:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="angle">
|
||||
<widget class="QLabel" name="lbAngle">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>10</y>
|
||||
<width>52</width>
|
||||
<height>15</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Angle:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="lblChargeType">
|
||||
<property name="text">
|
||||
<string>Charge Type:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="lblPosition">
|
||||
<property name="text">
|
||||
<string>Position:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="3">
|
||||
<widget class="QLabel" name="lbRange2">
|
||||
<property name="text">
|
||||
<string>Range II [km]:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="4">
|
||||
<widget class="QDoubleSpinBox" name="sbRange2Km"/>
|
||||
</item>
|
||||
<item row="0" column="4" rowspan="2">
|
||||
<widget class="QDoubleSpinBox" name="sbYield"/>
|
||||
</item>
|
||||
<item row="3" column="4">
|
||||
<widget class="QDoubleSpinBox" name="sbRange1Km"/>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="LtsWidgets::LtsComboBox" name="cbChargeType">
|
||||
<property name="currentText">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="lblStandardUnits">
|
||||
<property name="text">
|
||||
<string>Standard Values:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" 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>
|
||||
<item row="6" column="1">
|
||||
<widget class="QComboBox" name="cbStandardValues">
|
||||
<property name="currentText">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="lblWeather">
|
||||
<property name="text">
|
||||
<string>Weather:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>LtsCoordWidget::LtsCoordWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>LtsCoordTrans/lts_coord_widget.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>LtsWidgets::LtsComboBox</class>
|
||||
<extends>QComboBox</extends>
|
||||
<header>LtsWidgets/lts_combo_box.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>LtsWidgets::LtsDateTimeEdit</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>LtsWidgets/lts_date_time_edit.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>LtsWidgets::LtsAngleEdit</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>LtsWidgets/lts_angle_edit.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>dteEffectStart</tabstop>
|
||||
<tabstop>positionEdit</tabstop>
|
||||
<tabstop>pbPosition</tabstop>
|
||||
<tabstop>leIdentifier</tabstop>
|
||||
<tabstop>cbChargeType</tabstop>
|
||||
<tabstop>sbYield</tabstop>
|
||||
<tabstop>sbRange1Km</tabstop>
|
||||
<tabstop>sbRange2Km</tabstop>
|
||||
<tabstop>sbRadiusKm</tabstop>
|
||||
<tabstop>cbStandardValues</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
+119
@@ -0,0 +1,119 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* GUI Plugin for AreaEffectSimulation - NContaminations
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-07-07
|
||||
*/
|
||||
|
||||
#include "aes_ncontamination_gui_plugin.h"
|
||||
#include "aes_ncontamination_edit.h"
|
||||
#include "aes_ncontamination_list.h"
|
||||
|
||||
#include <AreaEffectSimulation/aes_operator_rights.h>
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <LtsUtilsSettings/settings.h>
|
||||
|
||||
namespace AreaEffectSimulation
|
||||
{
|
||||
|
||||
std::shared_ptr<GuiPluginBase::Interface> GuiPlugin::createGuiInterface(LtsSession::LtsSession *session)
|
||||
{
|
||||
return std::make_shared<InterfaceImpl>(session);
|
||||
}
|
||||
|
||||
InterfaceImpl::InterfaceImpl(LtsSession::LtsSession *session)
|
||||
: AesBaseInterface(session, getLogger("Plugins.Gui.NContamination"))
|
||||
, ForeignGuiInterface()
|
||||
, m_enableB(false)
|
||||
, m_enableC(false)
|
||||
, m_enableN(false)
|
||||
{
|
||||
LtsUtils::ProjectSettings *ps = LtsUtils::ProjectSettings::getInstance();
|
||||
m_enableB = ps->value(QStringLiteral("aes"),
|
||||
QStringLiteral("enableBiologicalContamination")).toBool();
|
||||
m_enableC = ps->value(QStringLiteral("aes"),
|
||||
QStringLiteral("enableChemicalContamination")).toBool();
|
||||
m_enableN = ps->value(QStringLiteral("aes"),
|
||||
QStringLiteral("enableNuclearContaminations")).toBool();
|
||||
}
|
||||
|
||||
QString InterfaceImpl::menuGroup() const
|
||||
{
|
||||
if (!m_enableB && !m_enableC && m_enableN)
|
||||
return tr("Area Effect Simulation N");
|
||||
if (m_enableB && !m_enableC && m_enableN)
|
||||
return tr("Area Effect Simulation NB");
|
||||
if (!m_enableB && m_enableC && m_enableN)
|
||||
return tr("Area Effect Simulation NC");
|
||||
if (m_enableB && !m_enableC && !m_enableN)
|
||||
return tr("Area Effect Simulation B");
|
||||
if (m_enableB && m_enableC && !m_enableN)
|
||||
return tr("Area Effect Simulation BC");
|
||||
if (!m_enableB && m_enableC && !m_enableN)
|
||||
return tr("Area Effect Simulation C");
|
||||
return tr("Area Effect Simulation NBC");
|
||||
}
|
||||
|
||||
QVector<LtsWidgets::PluginData> InterfaceImpl::getActions()
|
||||
{
|
||||
QVector<LtsWidgets::PluginData> ret;
|
||||
|
||||
if (m_enableN)
|
||||
{
|
||||
// N-Contamination
|
||||
ret.append(LtsWidgets::PluginData(menuGroup(),
|
||||
tr("N-Contaminations"),
|
||||
QLatin1String("ListNContaminations"),
|
||||
QIcon(QLatin1String("icon:nuclear_agents.svg")),
|
||||
[this](QWidget *parent) { return onShowNContaminationListDialog(parent);},
|
||||
OperatorRights::NContaminationsShow,
|
||||
LtsWidgets::ExercisePart::eExecution));
|
||||
|
||||
|
||||
if (m_session->isExercisePartition() && appId() != LtsAppDescriptor::App::OC)
|
||||
ret.append(LtsWidgets::PluginData(menuGroup(),
|
||||
tr("Add N-Contamination"),
|
||||
QLatin1String("AddNContamination"),
|
||||
QIcon(QLatin1String("icon:nuclear_agents_add.svg")),
|
||||
[this](QWidget *parent) { return onShowAddNContaminationDialog(parent);},
|
||||
OperatorRights::NContaminationsEdit,
|
||||
LtsWidgets::ExercisePart::eExecution,
|
||||
LtsWidgets::ExerciseState::eCreated | LtsWidgets::ExerciseState::eStarted | LtsWidgets::ExerciseState::ePaused));
|
||||
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
AreaEffectSimulation::BaseEdit *InterfaceImpl::showEditWindow(int aesEntityId, QWidget *parent)
|
||||
{
|
||||
NContaminationEdit *editWidget = new NContaminationEdit(menuGroup(), parent);
|
||||
if (editWidget->init(aesEntityId, false, m_session))
|
||||
return editWidget;
|
||||
|
||||
delete editWidget;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
LtsWidgets::LtsDialog *InterfaceImpl::onShowAddNContaminationDialog(QWidget *parent)
|
||||
{
|
||||
NContaminationEdit *editWidget = new NContaminationEdit(menuGroup(), parent);
|
||||
if (editWidget->init(0, false, m_session))
|
||||
return editWidget;
|
||||
|
||||
delete editWidget;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
LtsWidgets::LtsDialog *InterfaceImpl::onShowNContaminationListDialog(QWidget *parent)
|
||||
{
|
||||
NContaminationList *listWidget = new NContaminationList(menuGroup(), parent);
|
||||
if (listWidget->init(m_session))
|
||||
return listWidget;
|
||||
|
||||
delete listWidget;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace AreaEffectSimulation
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Gui Plugin for AreaEffectSimulation - NContamniations
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-07-07
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Plugins/AreaEffectSimulation/Gui/Base/aes_base_gui_plugin.h>
|
||||
#include "aes_ncontamination_gui_plugin_interface.h"
|
||||
|
||||
namespace AreaEffectSimulation
|
||||
{
|
||||
|
||||
class GuiPlugin final : public AesBaseGuiPlugin
|
||||
{
|
||||
Q_PLUGIN_METADATA(IID "gui:3:aes.ncontaminations")
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GuiPlugin() = default;
|
||||
~GuiPlugin() = default;
|
||||
|
||||
QString pluginName() override { return QStringLiteral("AreaEffectSimuationNContaminationGui"); }
|
||||
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 AesBaseInterface, public AesNContamination::ForeignGuiInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit InterfaceImpl(LtsSession::LtsSession *session);
|
||||
|
||||
QString menuGroup() const override final;
|
||||
QVector<LtsWidgets::PluginData> getActions() override;
|
||||
|
||||
AreaEffectSimulation::BaseEdit *showEditWindow(int aesEntityId, QWidget *parent) override;
|
||||
|
||||
private:
|
||||
LtsWidgets::LtsDialog *onShowAddNContaminationDialog(QWidget *parent);
|
||||
LtsWidgets::LtsDialog *onShowNContaminationListDialog(QWidget *parent);
|
||||
bool m_enableB;
|
||||
bool m_enableC;
|
||||
bool m_enableN;
|
||||
};
|
||||
|
||||
} // namespace AreaEffectSimulation
|
||||
Executable
+30
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for AreaEffectSimulation (Interface for access from other Plugins)
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-07-01
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
class QWidget;
|
||||
|
||||
namespace AreaEffectSimulation
|
||||
{
|
||||
class BaseEdit;
|
||||
}
|
||||
|
||||
namespace AesNContamination
|
||||
{
|
||||
class ForeignGuiInterface
|
||||
{
|
||||
public:
|
||||
ForeignGuiInterface() = default;
|
||||
virtual ~ForeignGuiInterface() = default;
|
||||
|
||||
virtual AreaEffectSimulation::BaseEdit *showEditWindow(int aesEntityId, QWidget *parent) = 0;
|
||||
};
|
||||
} // namespace AesNContamination
|
||||
|
||||
+99
@@ -0,0 +1,99 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* ContaminationManangement - NContamination Overview Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-07-07
|
||||
*/
|
||||
|
||||
#include "aes_ncontamination_list.h"
|
||||
#include "aes_ncontaminations_model.h"
|
||||
#include "aes_ncontamination_edit.h"
|
||||
#include "CustomView/aes_ncontamination.h"
|
||||
|
||||
#include <LtsSession/lts_session_data.h>
|
||||
|
||||
namespace AreaEffectSimulation
|
||||
{
|
||||
bool NContaminationList::init(LtsSession::LtsSession *session)
|
||||
{
|
||||
if (!AesItemList::init(session))
|
||||
return false;
|
||||
|
||||
m_bHasAddEditOperatorRights = LtsSessionData::LtsSessionData::getInstance()->hasOperatorRight(OperatorRights::NContaminationsEdit);
|
||||
|
||||
setDataViewModel(m_model, [this]() { return new CustomViewNContamination(this); });
|
||||
|
||||
#ifndef LTS_DEBUG
|
||||
hideColumn(NContaminationsModel::BcId);
|
||||
#endif
|
||||
hideColumn(NContaminationsModel::BcParticipant);
|
||||
hideColumn(NContaminationsModel::BcParty);
|
||||
hideColumn(NContaminationsModel::BcEffectSource);
|
||||
|
||||
setSortIndicator(NContaminationsModel::BcName);
|
||||
|
||||
enaDisa();
|
||||
|
||||
setOnlineHelpFilename(QStringLiteral("Situation-N-Contaminations"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void NContaminationList::createModel()
|
||||
{
|
||||
m_model = new AesItemSortFilterProxyModelTmpl<NContamination>(m_session, this);
|
||||
|
||||
NContaminationsModel *sourceModel = new NContaminationsModel(this);
|
||||
sourceModel->initModel(m_session);
|
||||
m_model->setSourceModel(sourceModel);
|
||||
}
|
||||
|
||||
void NContaminationList::onAddAesItem()
|
||||
{
|
||||
NContaminationEdit *dialog = new NContaminationEdit(m_menuGroup, this);
|
||||
|
||||
const int aesItemId = model()->aesId(currentRow());
|
||||
if (dialog->init(aesItemId, aesItemId > 0, m_session))
|
||||
addDialog(dialog, m_menuGroup, dialog->dialogIdentifier(), LtsWidgets::LayoutArea::eDialogTab);
|
||||
else
|
||||
delete dialog;
|
||||
}
|
||||
|
||||
void NContaminationList::onEditAesItem()
|
||||
{
|
||||
const int aesItemId = model()->aesId(currentRow());
|
||||
|
||||
if (aesItemId < 0)
|
||||
return;
|
||||
|
||||
DEBUG_LOG(m_logger) << "current NContaminationId: " << aesItemId;
|
||||
|
||||
NContaminationEdit *dialog = new NContaminationEdit(m_menuGroup, this);
|
||||
if (dialog->init(aesItemId, false, m_session))
|
||||
addDialog(dialog, m_menuGroup, dialog->dialogIdentifier(), LtsWidgets::LayoutArea::eDialogTab);
|
||||
else
|
||||
delete dialog;
|
||||
}
|
||||
|
||||
void NContaminationList::onRemoveAesItem()
|
||||
{
|
||||
const int aesItemId = model()->aesId(currentRow());
|
||||
Core::RemoveElementRequest req(aesItemId);
|
||||
m_requestHelper->startSingleRequest([req, this]()
|
||||
{
|
||||
return m_ftc->nContaminationRemoveRequest(req, this);
|
||||
});
|
||||
}
|
||||
|
||||
void NContaminationList::retranslate()
|
||||
{
|
||||
translateBase(tr("N-Contaminations"));
|
||||
}
|
||||
|
||||
void NContaminationList::onNContaminationRemoveReply(const Core::FunctionReplyObject &replyObject)
|
||||
{
|
||||
m_requestHelper->requestReply(replyObject);
|
||||
}
|
||||
} // namespace AreaEffectSimulation
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* AreaEffectSimulation - Contamination Overview Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-07-07
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Plugins/AreaEffectSimulation/Gui/Base/aes_itemlist.h>
|
||||
#include <Plugins/AreaEffectSimulation/Gui/Base/aes_base_model.h>
|
||||
|
||||
namespace AreaEffectSimulation
|
||||
{
|
||||
|
||||
class NContaminationList final : public AesItemListTmpl<NContamination>
|
||||
, protected AreaEffectSimulation::Interface::Ftc::NContaminationRemoveReplyHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
using AesItemListTmpl<NContamination>::AesItemListTmpl;
|
||||
|
||||
bool init(LtsSession::LtsSession *session) override;
|
||||
|
||||
private slots:
|
||||
void onAddAesItem() override;
|
||||
void onEditAesItem() override;
|
||||
void onRemoveAesItem() override;
|
||||
|
||||
private:
|
||||
void createModel() override;
|
||||
void retranslate() override;
|
||||
void onNContaminationRemoveReply(const Core::FunctionReplyObject &replyObject) override;
|
||||
};
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* AreaEffectManangement - N Contamination Overview Dialog Model
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*
|
||||
* Created by Malte Diers, SLSE, 2017-02-21
|
||||
*/
|
||||
|
||||
#include "aes_ncontaminations_model.h"
|
||||
#include <Plugins/ProjectDataManagement/pdm_data_plugin_interface.h>
|
||||
#include <QLocale>
|
||||
|
||||
namespace AreaEffectSimulation
|
||||
{
|
||||
|
||||
NContaminationsModel::NContaminationsModel(QObject *parent)
|
||||
: AesGuiBaseModel<NContamination>(parent)
|
||||
{}
|
||||
|
||||
bool NContaminationsModel::initModel(LtsSession::LtsSession *session)
|
||||
{
|
||||
if (!AesGuiBaseModel::initModel(session))
|
||||
return false;
|
||||
|
||||
connect(m_aesDtc.get(), &Interface::Dtc::nContaminationChanged,
|
||||
this, &NContaminationsModel::onDataChanged);
|
||||
m_aesDtc->nContaminations([this](const NContamination &item) { insertRow(item);});
|
||||
return true;
|
||||
}
|
||||
} // namespace AreaEffectSimulation
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for AreaEffectSimulation - Contaminations Overview Dialog Model
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*
|
||||
* Created by Malte Diers, SLSE, 2017-02-20
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Plugins/AreaEffectSimulation/Gui/Base/aes_base_model.h>
|
||||
|
||||
namespace LtsSession
|
||||
{
|
||||
class LtsSession;
|
||||
}
|
||||
|
||||
namespace AreaEffectSimulation
|
||||
{
|
||||
class NContaminationsModel : public AesGuiBaseModel<NContamination>
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit NContaminationsModel(QObject *parent = nullptr);
|
||||
|
||||
bool initModel(LtsSession::LtsSession *session);
|
||||
};
|
||||
|
||||
} //namespace AreaEffectSimulation
|
||||
Reference in new issue
Block a user