Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
@@ -0,0 +1,65 @@
|
||||
#
|
||||
# $Id$
|
||||
# $HeadURL$
|
||||
# $Author$
|
||||
# Created by Patric Karwat, SLSE, 2016-07-03
|
||||
#
|
||||
|
||||
ADD_INTERFACE_LIBRARY(
|
||||
AesMineSingleVirtualGuiPluginInterface
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/aes_mine_single_virtual_gui_plugin_interface.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/..
|
||||
)
|
||||
|
||||
SET(aes_mine_single_virtual_gui_SRCS
|
||||
aes_mine_single_virtual_gui_plugin.cpp
|
||||
aes_mine_single_virtual_gui_plugin.h
|
||||
aes_booby_trap_edit.cpp
|
||||
aes_booby_trap_edit.h
|
||||
aes_booby_trap_list.cpp
|
||||
aes_booby_trap_list.h
|
||||
aes_booby_trap_model.cpp
|
||||
aes_booby_trap_model.h
|
||||
aes_off_route_mine_edit.cpp
|
||||
aes_off_route_mine_edit.h
|
||||
aes_off_route_mine_list.cpp
|
||||
aes_off_route_mine_list.h
|
||||
aes_off_route_mine_model.cpp
|
||||
aes_off_route_mine_model.h
|
||||
CustomView/aes_booby_trap.cpp
|
||||
CustomView/aes_booby_trap.h
|
||||
CustomView/aes_off_route_mine.cpp
|
||||
CustomView/aes_off_route_mine.h
|
||||
InfoView/aes_booby_trap_info.cpp
|
||||
InfoView/aes_booby_trap_info.h
|
||||
InfoView/aes_off_route_mine_info.cpp
|
||||
InfoView/aes_off_route_mine_info.h
|
||||
)
|
||||
|
||||
NGL_WRAP_UI(aes_mine_single_virtual_gui_SRCS
|
||||
aes_booby_trap_edit.ui
|
||||
aes_off_route_mine_edit.ui
|
||||
CustomView/aes_booby_trap.ui
|
||||
CustomView/aes_off_route_mine.ui
|
||||
InfoView/aes_booby_trap_info.ui
|
||||
InfoView/aes_off_route_mine_info.ui
|
||||
)
|
||||
|
||||
NGL_ADD_LIBRARY(WS AesMineSingleVirtualGuiPlugin MODULE ${aes_mine_single_virtual_gui_SRCS})
|
||||
NGL_TARGET_LINK_LIBRARIES(AesMineSingleVirtualGuiPlugin
|
||||
AesBaseGui
|
||||
AesMineSingleVirtualGuiPluginInterface
|
||||
ngltools
|
||||
LtsSessionData
|
||||
NGLLogger
|
||||
LtsSession
|
||||
AesDataPluginInterface
|
||||
AesInfoGuiPluginInterface
|
||||
Qt5::Widgets
|
||||
LtsWidgets
|
||||
LtsUtilsSettings
|
||||
)
|
||||
|
||||
NGL_INSTALL_TARGET(AesMineSingleVirtualGuiPlugin)
|
||||
|
||||
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* CustomView for Mine Single Virtual
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Hanna E. Rathje, SLSE, 2023-07-14
|
||||
*/
|
||||
|
||||
#include "aes_booby_trap.h"
|
||||
#include "ui_aes_booby_trap.h"
|
||||
|
||||
#include "aes_booby_trap_model.h"
|
||||
#include <Services/AreaEffectSimulation/Utils/polygons.h>
|
||||
|
||||
namespace AreaEffectSimulation
|
||||
{
|
||||
CustomViewBoobyTrap::CustomViewBoobyTrap(QWidget *parent)
|
||||
: AbstractDisplayWidget(parent)
|
||||
, m_ui(new Ui::CustomViewBoobyTrap)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
}
|
||||
|
||||
CustomViewBoobyTrap::~CustomViewBoobyTrap()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
bool CustomViewBoobyTrap::init(const QModelIndex &idx)
|
||||
{
|
||||
if (!idx.isValid())
|
||||
return false;
|
||||
|
||||
m_ui->lbName->setText(rowData(idx, AreaEffectSimulation::BoobyTrapModel::BcName).toString());
|
||||
m_ui->lbType->setText(rowData(idx, AreaEffectSimulation::BoobyTrapModel::BcChargeType).toString());
|
||||
m_ui->lbState->setText(rowData(idx, AreaEffectSimulation::BoobyTrapModel::BcEffectState).toString());
|
||||
m_ui->lbTime->setText(rowData(idx, AreaEffectSimulation::BoobyTrapModel::BcEffectStart).toString());
|
||||
m_ui->lblIcon->clear();
|
||||
m_ui->lblIcon->setAutoFillBackground(true);
|
||||
|
||||
const AesItemSortFilterProxyModel *sfpm = qobject_cast<const AesItemSortFilterProxyModel*>(idx.model());
|
||||
if (!sfpm)
|
||||
return false;
|
||||
const BoobyTrapModel *aesModel = qobject_cast<const BoobyTrapModel*>(sfpm->sourceModel());
|
||||
if (!aesModel)
|
||||
return false;
|
||||
const auto srcIdx = sfpm->mapToSource(idx);
|
||||
BoobyTrap bcContamin = aesModel->getRowData(srcIdx.row());
|
||||
calculateIcon(bcContamin, sfpm->partyColor(idx.row()));
|
||||
|
||||
qint64 durationMSecs = rowData(idx, AreaEffectSimulation::BoobyTrapModel::BcEffectDuration).toInt();
|
||||
if (durationMSecs > 0)
|
||||
{
|
||||
QString duration;
|
||||
if (durationMSecs % 1000 == 0 || durationMSecs > 60 * 1000)
|
||||
duration = QString::number(durationMSecs / 1000.0, 'f', 0);
|
||||
else
|
||||
duration = QString::number(durationMSecs / 1000.0, 'f', 3);
|
||||
|
||||
m_ui->lbDuration->setText(duration);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ui->label_4->hide();
|
||||
m_ui->lbDuration->hide();
|
||||
m_ui->label_6->hide();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CustomViewBoobyTrap::calculateIcon(const BoobyTrap &bt, const QColor &color)
|
||||
{
|
||||
QPointF impactPosition = QPointF(bt.impactPosition().lon(), bt.impactPosition().lat());
|
||||
const QPolygonF poly = Polygons::circle(impactPosition, bt.triggerRadius());
|
||||
|
||||
Qt::BrushStyle bStyle = PixmapLabel::checkForBrushStyle(bt.effectStateId());
|
||||
const auto pix = Polygons::pixmapFromPolygon(PixmapLabel::geographic2Utm(poly), color, ICON_RESOLUTION, bStyle);
|
||||
m_ui->lblIcon->setPixmap(pix);
|
||||
|
||||
return true;
|
||||
}
|
||||
} // namespace AreaEffectSimulation
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* CustomView for AES Mine Single Virtual
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Hanna E. Rathje, SLSE, 2023-07-14
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <Viewer/LtsDataView/abstract_display_widget.h>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class CustomViewBoobyTrap;
|
||||
}
|
||||
|
||||
namespace AreaEffectSimulation
|
||||
{
|
||||
class BoobyTrap;
|
||||
class CustomViewBoobyTrap final : public LtsDataView::AbstractDisplayWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit CustomViewBoobyTrap(QWidget *parent = nullptr);
|
||||
~CustomViewBoobyTrap();
|
||||
bool init(const QModelIndex &idx) override final;
|
||||
|
||||
private:
|
||||
bool calculateIcon(const AreaEffectSimulation::BoobyTrap &bt, const QColor &color);
|
||||
|
||||
Ui::CustomViewBoobyTrap *m_ui;
|
||||
|
||||
};
|
||||
} // namespace AreaEffectSimulation
|
||||
+179
@@ -0,0 +1,179 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CustomViewBoobyTrap</class>
|
||||
<widget class="QWidget" name="CustomViewBoobyTrap">
|
||||
<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="lbName">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">Name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lbType">
|
||||
<property name="font">
|
||||
<font>
|
||||
<italic>true</italic>
|
||||
</font>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</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="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>State:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lbState">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<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="lbTime">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">Time</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">for</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lbDuration">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">Duration</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<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>
|
||||
+90
@@ -0,0 +1,90 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* CustomView for Mine Single Virtual
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Hanna E. Rathje, SLSE, 2023-07-14
|
||||
*/
|
||||
|
||||
#include "aes_off_route_mine.h"
|
||||
#include "ui_aes_off_route_mine.h"
|
||||
|
||||
#include "aes_off_route_mine_model.h"
|
||||
#include <Services/AreaEffectSimulation/Utils/polygons.h>
|
||||
|
||||
namespace AreaEffectSimulation
|
||||
{
|
||||
CustomViewOffRouteMine::CustomViewOffRouteMine(QWidget *parent)
|
||||
: AbstractDisplayWidget(parent)
|
||||
, m_ui(new Ui::CustomViewOffRouteMine)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
}
|
||||
|
||||
CustomViewOffRouteMine::~CustomViewOffRouteMine()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
bool CustomViewOffRouteMine::init(const QModelIndex &idx)
|
||||
{
|
||||
if (!idx.isValid())
|
||||
return false;
|
||||
|
||||
m_ui->lbName->setText(rowData(idx, AreaEffectSimulation::OffRouteMineModel::BcName).toString());
|
||||
m_ui->lbType->setText(rowData(idx, AreaEffectSimulation::OffRouteMineModel::BcChargeType).toString());
|
||||
m_ui->lbState->setText(rowData(idx, AreaEffectSimulation::OffRouteMineModel::BcEffectState).toString());
|
||||
m_ui->lbTime->setText(rowData(idx, AreaEffectSimulation::OffRouteMineModel::BcEffectStart).toString());
|
||||
m_ui->lblIcon->clear();
|
||||
m_ui->lblIcon->setAutoFillBackground(true);
|
||||
|
||||
const AesItemSortFilterProxyModel *sfpm = qobject_cast<const AesItemSortFilterProxyModel*>(idx.model());
|
||||
if (!sfpm)
|
||||
return false;
|
||||
const OffRouteMineModel *aesModel = qobject_cast<const OffRouteMineModel*>(sfpm->sourceModel());
|
||||
if (!aesModel)
|
||||
return false;
|
||||
const auto srcIdx = sfpm->mapToSource(idx);
|
||||
OffRouteMine bcContamin = aesModel->getRowData(srcIdx.row());
|
||||
calculateIcon(bcContamin, sfpm->partyColor(idx.row()));
|
||||
|
||||
qint64 durationMSecs = rowData(idx, AreaEffectSimulation::OffRouteMineModel::BcEffectDuration).toInt();
|
||||
if (durationMSecs > 0)
|
||||
{
|
||||
QString duration;
|
||||
if (durationMSecs % 1000 == 0 || durationMSecs > 60 * 1000)
|
||||
duration = QString::number(durationMSecs / 1000.0, 'f', 0);
|
||||
else
|
||||
duration = QString::number(durationMSecs / 1000.0, 'f', 3);
|
||||
|
||||
m_ui->lbDuration->setText(duration);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ui->label_4->hide();
|
||||
m_ui->lbDuration->hide();
|
||||
m_ui->label_6->hide();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CustomViewOffRouteMine::calculateIcon(const OffRouteMine &orm, const QColor &color)
|
||||
{
|
||||
Database::AesOffRouteMine ormOut;
|
||||
ormOut.id = orm.id();
|
||||
ormOut.chargeTypeId = orm.chargeStruct().chargeTypeId();
|
||||
ormOut.effectStart = QDateTime::fromMSecsSinceEpoch(orm.effectStart().is_set() ? orm.effectStart().get() : 0);
|
||||
ormOut.impactPosition = QPointF(orm.area().cornerBottomLeft().lon(), orm.area().cornerBottomLeft().lat());
|
||||
if (orm.impactRadius().is_set())
|
||||
ormOut.impactRadius = orm.impactRadius().get();
|
||||
|
||||
const QPolygonF poly = AreaEffectSimulation::Polygons::offRouteMineArea(ormOut);
|
||||
|
||||
Qt::BrushStyle bStyle = PixmapLabel::checkForBrushStyle(orm.effectStateId());
|
||||
const auto pix = Polygons::pixmapFromPolygon(PixmapLabel::geographic2Utm(poly), color, ICON_RESOLUTION, bStyle);
|
||||
m_ui->lblIcon->setPixmap(pix);
|
||||
|
||||
return true;
|
||||
}
|
||||
} // namespace AreaEffectSimulation
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* CustomView for AES Mine Single Virtual
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Hanna E. Rathje, SLSE, 2023-07-14
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <Viewer/LtsDataView/abstract_display_widget.h>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class CustomViewOffRouteMine;
|
||||
}
|
||||
|
||||
namespace AreaEffectSimulation
|
||||
{
|
||||
class OffRouteMine;
|
||||
class CustomViewOffRouteMine final : public LtsDataView::AbstractDisplayWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit CustomViewOffRouteMine(QWidget *parent = nullptr);
|
||||
~CustomViewOffRouteMine();
|
||||
bool init(const QModelIndex &idx) override final;
|
||||
|
||||
private:
|
||||
bool calculateIcon(const AreaEffectSimulation::OffRouteMine &orm, const QColor &color);
|
||||
|
||||
Ui::CustomViewOffRouteMine *m_ui;
|
||||
|
||||
};
|
||||
} // namespace AreaEffectSimulation
|
||||
+179
@@ -0,0 +1,179 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CustomViewOffRouteMine</class>
|
||||
<widget class="QWidget" name="CustomViewOffRouteMine">
|
||||
<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="lbName">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">Name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lbType">
|
||||
<property name="font">
|
||||
<font>
|
||||
<italic>true</italic>
|
||||
</font>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</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="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>State:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lbState">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<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="lbTime">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">Time</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">for</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lbDuration">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">Duration</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<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>
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Info Dialog for Mine Single Virtual
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Hanna E. Rathje, SLSE, 2023-07-14
|
||||
*/
|
||||
|
||||
#include "aes_booby_trap_info.h"
|
||||
#include "ui_aes_booby_trap_info.h"
|
||||
|
||||
#include <Plugins/AreaEffectSimulation/Gui/Base/InfoView/aes_base_info.h>
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <LtsCoordTrans/lts_coord_trans.h>
|
||||
#include <QDateTime>
|
||||
|
||||
namespace AreaEffectSimulation
|
||||
{
|
||||
|
||||
BoobyTrapInfo::BoobyTrapInfo(QWidget *parent)
|
||||
: LtsDialog(parent)
|
||||
, m_ui(new Ui::BoobyTrapInfo)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
}
|
||||
|
||||
BoobyTrapInfo::~BoobyTrapInfo()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
void BoobyTrapInfo::retranslate()
|
||||
{
|
||||
translate(m_ui, tr("Booby Trap"));
|
||||
}
|
||||
|
||||
bool BoobyTrapInfo::setData(const BoobyTrap *item)
|
||||
{
|
||||
m_ui->wBaseData->setData(item);
|
||||
|
||||
m_ui->lblImpactRadius->setText(QString::number(item->impactRadius()));
|
||||
m_ui->lblTriggerRadius->setText(QString::number(item->triggerRadius()));
|
||||
m_ui->lblImpactPosition->setText(LtsCoordTrans::mgrsFromGeographic(item->impactPosition().lon(), item->impactPosition().lat()));
|
||||
return true;
|
||||
}
|
||||
|
||||
void BoobyTrapInfo::init(LtsSession::LtsSession *session)
|
||||
{
|
||||
m_ui->wBaseData->init(session);
|
||||
}
|
||||
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Info Dialog for Booby Trap
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Hanna E. Rathje, SLSE, 2023-07-14
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <Services/AreaEffectSimulation/aes.hpp>
|
||||
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class BoobyTrapInfo;
|
||||
}
|
||||
|
||||
namespace LtsSession
|
||||
{
|
||||
class LtsSession;
|
||||
}
|
||||
|
||||
namespace AreaEffectSimulation
|
||||
{
|
||||
|
||||
class BoobyTrapInfo : public LtsWidgets::LtsDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit BoobyTrapInfo(QWidget *parent = nullptr);
|
||||
~BoobyTrapInfo();
|
||||
|
||||
bool setData(const BoobyTrap *item);
|
||||
void init(LtsSession::LtsSession *session);
|
||||
|
||||
private:
|
||||
void retranslate() override;
|
||||
|
||||
Ui::BoobyTrapInfo *m_ui;
|
||||
};
|
||||
|
||||
}
|
||||
+131
@@ -0,0 +1,131 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>BoobyTrapInfo</class>
|
||||
<widget class="QWidget" name="BoobyTrapInfo">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>328</width>
|
||||
<height>196</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">Aes B/C-Contamination Info</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="leftMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLabel" name="lblRotation">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">90° = 1600'</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lbxImpactRadius">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Impact Radius [m]:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="lblImpactPosition">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">32U MD 12345 67890</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0" colspan="2">
|
||||
<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="2" column="0">
|
||||
<widget class="QLabel" name="lbxImpactPosition">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Impact Position:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="lblImpactRadius">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">0</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="AreaEffectSimulation::BaseInfo" name="wBaseData" native="true"/>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="lbxTriggerRadius">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Trigger Radius:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLabel" name="lblTriggerRadius">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">12:34</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="lbxRotation">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Rotation:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>AreaEffectSimulation::BaseInfo</class>
|
||||
<extends>QWidget</extends>
|
||||
<header location="global">Plugins/AreaEffectSimulation/Gui/Base/InfoView/aes_base_info.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
Executable
+51
@@ -0,0 +1,51 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Info Dialog for Mine Single Virtual
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Hanna E. Rathje, SLSE, 2023-07-14
|
||||
*/
|
||||
|
||||
#include "aes_off_route_mine_info.h"
|
||||
#include "ui_aes_off_route_mine_info.h"
|
||||
|
||||
#include <Plugins/AreaEffectSimulation/Gui/Base/InfoView/aes_base_info.h>
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <LtsCoordTrans/lts_coord_trans.h>
|
||||
#include <QDateTime>
|
||||
|
||||
namespace AreaEffectSimulation
|
||||
{
|
||||
|
||||
OffRouteMineInfo::OffRouteMineInfo(QWidget *parent)
|
||||
: LtsDialog(parent)
|
||||
, m_ui(new Ui::OffRouteMineInfo)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
}
|
||||
|
||||
OffRouteMineInfo::~OffRouteMineInfo()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
void OffRouteMineInfo::retranslate()
|
||||
{
|
||||
translate(m_ui, tr("Off Route Mine"));
|
||||
}
|
||||
|
||||
bool OffRouteMineInfo::setData(const OffRouteMine *item)
|
||||
{
|
||||
m_ui->wBaseData->setData(item);
|
||||
|
||||
//m_ui->lblImpactRadius->setText(QString::number(item->impactRadius()));
|
||||
m_ui->lblImpactPosition->setText(LtsCoordTrans::mgrsFromGeographic(item->area().cornerBottomLeft().lon(), item->area().cornerBottomLeft().lat()));
|
||||
return true;
|
||||
}
|
||||
void OffRouteMineInfo::init(LtsSession::LtsSession *session)
|
||||
{
|
||||
m_ui->wBaseData->init(session);
|
||||
}
|
||||
|
||||
}
|
||||
Executable
+46
@@ -0,0 +1,46 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Info Dialog for B/C Contamination
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Hanna E. Rathje, SLSE, 2023-07-14
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <Services/AreaEffectSimulation/aes.hpp>
|
||||
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class OffRouteMineInfo;
|
||||
}
|
||||
|
||||
namespace LtsSession
|
||||
{
|
||||
class LtsSession;
|
||||
}
|
||||
|
||||
namespace AreaEffectSimulation
|
||||
{
|
||||
|
||||
class OffRouteMineInfo : public LtsWidgets::LtsDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit OffRouteMineInfo(QWidget *parent = nullptr);
|
||||
~OffRouteMineInfo();
|
||||
|
||||
bool setData(const OffRouteMine *item);
|
||||
void init(LtsSession::LtsSession *session);
|
||||
|
||||
private:
|
||||
void retranslate() override;
|
||||
|
||||
Ui::OffRouteMineInfo *m_ui;
|
||||
};
|
||||
|
||||
}
|
||||
Executable
+171
@@ -0,0 +1,171 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>OffRouteMineInfo</class>
|
||||
<widget class="QWidget" name="OffRouteMineInfo">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>328</width>
|
||||
<height>196</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">Aes B/C-Contamination Info</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="leftMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLabel" name="lblPropagationDirection">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">90° = 1600'</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="lbxWindSpeed">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Wind Speed [m/s]:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="lbxImpactPosition">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Impact Position:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="lbxWeatherTimestamp">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Weather Timestamp:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lbxImpactRadius">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Impact Radius [m]:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="lbxPropagationDirection">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Propagation Direction:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="lblImpactPosition">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">32U MD 12345 67890</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="AreaEffectSimulation::BaseInfo" name="wBaseData" native="true"/>
|
||||
</item>
|
||||
<item row="7" column="0" colspan="2">
|
||||
<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="4" column="1">
|
||||
<widget class="QLabel" name="lblWindSpeed">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">2.34</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="lblImpactRadius">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">0</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="lbxWeatherPosition">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Weather Position:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QLabel" name="lblWeatherTimestamp">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">12:34</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QLabel" name="lblWeatherPosition">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">32U MD 23456 78901</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>AreaEffectSimulation::BaseInfo</class>
|
||||
<extends>QWidget</extends>
|
||||
<header location="global">Plugins/AreaEffectSimulation/Gui/Base/InfoView/aes_base_info.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
+482
@@ -0,0 +1,482 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* AreaEffectSimulation - Mine Single Virtual Edit Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Hanna E. Rathje, SLSE, 2023-07-14
|
||||
*/
|
||||
|
||||
|
||||
#include "aes_booby_trap_edit.h"
|
||||
#include "ui_aes_booby_trap_edit.h"
|
||||
|
||||
#include <LtsWidgets/lts_message_dialog.h>
|
||||
#include <LtsSession/lts_session_data.h>
|
||||
#include <PluginInterfaces/gui_plugin_interface.h>
|
||||
#include <Plugins/AreaEffectSimulation/aes_data_plugin_interface.h>
|
||||
#include <Plugins/SituationMapPlugin/situation_map_gui_plugin_interface.h>
|
||||
#include <Plugins/AreaEffectSimulation/aes_info_gui_plugin_interface.h>
|
||||
|
||||
#include <AreaEffectSimulation/aes_translation.h>
|
||||
#include <LtsUtilsSettings/settings.h>
|
||||
|
||||
namespace AreaEffectSimulation
|
||||
{
|
||||
double BoobyTrapEdit::s_minTriggerRadius;
|
||||
double BoobyTrapEdit::s_maxTriggerRadius;
|
||||
double BoobyTrapEdit::s_defaultTriggerRadius;
|
||||
double BoobyTrapEdit::s_minImpactRadius;
|
||||
double BoobyTrapEdit::s_maxImpactRadius;
|
||||
double BoobyTrapEdit::s_defaultImpactRadius;
|
||||
double BoobyTrapEdit::s_stepRadius;
|
||||
int BoobyTrapEdit::s_minDurationHours;
|
||||
int BoobyTrapEdit::s_maxDurationHours;
|
||||
int BoobyTrapEdit::s_defaultCentralAngle;
|
||||
static int s_lastChargeTypeBoobyTrap = 251;
|
||||
static int s_boobyTrap2 = 252;
|
||||
|
||||
// Todo: Höhe und Radius in Abhängigkeit der Munitionsart berechnen
|
||||
|
||||
BoobyTrapEdit::BoobyTrapEdit(const QString &menuGroup, QWidget *parent)
|
||||
: BaseEdit(menuGroup, QLatin1String("BoobyTrapEdit"), parent)
|
||||
, m_ui(new Ui::BoobyTrapEdit)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
s_minTriggerRadius = 5;
|
||||
s_maxTriggerRadius = 5;
|
||||
s_defaultTriggerRadius = 5;
|
||||
s_minImpactRadius = 10;
|
||||
s_maxImpactRadius = 10;
|
||||
s_defaultImpactRadius = 10;
|
||||
s_stepRadius = 1;
|
||||
s_minDurationHours = 1;
|
||||
s_maxDurationHours = 4;
|
||||
s_defaultCentralAngle = 90;
|
||||
|
||||
m_ui->sbTriggerRadius->setMinimum(s_minTriggerRadius);
|
||||
m_ui->sbTriggerRadius->setMaximum(s_maxTriggerRadius);
|
||||
m_ui->sbTriggerRadius->setSingleStep(s_stepRadius);
|
||||
m_ui->sbTriggerRadius->setValue(s_defaultTriggerRadius);
|
||||
|
||||
m_ui->sbImpactRadius->setMinimum(s_minImpactRadius);
|
||||
m_ui->sbImpactRadius->setMaximum(s_maxImpactRadius);
|
||||
m_ui->sbImpactRadius->setSingleStep(s_stepRadius);
|
||||
m_ui->sbImpactRadius->setValue(s_defaultImpactRadius);
|
||||
|
||||
#if GUEZ_MODE
|
||||
m_ui->sbCentralAngle->setMaximum(90.0);
|
||||
#endif
|
||||
m_ui->sbCentralAngle->setValue(s_defaultCentralAngle);
|
||||
|
||||
m_ui->sbDurationHours->setMinimum(s_minDurationHours);
|
||||
m_ui->sbDurationHours->setMaximum(s_maxDurationHours);
|
||||
m_ui->rotationAngleEdit->initAngleEditWidget(1); // need to be done to create spinboxes.
|
||||
|
||||
#ifndef LTS_DEBUG
|
||||
m_ui->lblTriggerRadius->setHidden(true);
|
||||
m_ui->sbTriggerRadius->setHidden(true);
|
||||
m_ui->lblImpactRadius->setHidden(true);
|
||||
m_ui->sbImpactRadius->setHidden(true);
|
||||
m_ui->sbCentralAngle->setHidden(true);
|
||||
#endif
|
||||
|
||||
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->lblChargeType, [this]() { return (m_ui->cbChargeType->currentData().toInt() > 0); }});
|
||||
|
||||
connect(m_ui->pbClear, &QPushButton::clicked, m_ui->positionEdit, &LtsCoordWidget::LtsCoordWidget::clear);
|
||||
|
||||
//connect(m_ui->sbTriggerRadius, &QSpinBox::editingFinished, this, &BoobyTrapEdit::correctSpinBoxValue);
|
||||
connect(m_ui->sbImpactRadius, &QSpinBox::editingFinished, this, &BoobyTrapEdit::correctSpinBoxValue);
|
||||
|
||||
|
||||
// Not yet needed, as no step is defined:
|
||||
// connect(m_ui->sbAltitude, &QSpinBox::editingFinished, this, &BoobyTrapEdit::correctSpinBoxValue);
|
||||
// connect(m_ui->sbDurationMinutes, &QSpinBox::editingFinished, this, &BoobyTrapEdit::correctSpinBoxValue);
|
||||
|
||||
enaDisa();
|
||||
|
||||
setOnlineHelpFilename(QStringLiteral("Situation-Add_Mine_VLad"));
|
||||
}
|
||||
|
||||
BoobyTrapEdit::~BoobyTrapEdit()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
void BoobyTrapEdit::retranslate()
|
||||
{
|
||||
translate(m_ui, m_aesItem, tr("BoobyTrap"));
|
||||
|
||||
m_pdmGuiIfc->fillBoobyTrapComboBox(m_ui->cbChargeType);
|
||||
setCombobxToValueIfPossible(m_ui->cbChargeType, s_lastChargeTypeBoobyTrap );
|
||||
}
|
||||
|
||||
void BoobyTrapEdit::enableUiElements(bool enable)
|
||||
{
|
||||
m_ui->leIdentifier->setMaxLength(30);
|
||||
|
||||
m_ui->cbChargeType->setEnabled(enable);
|
||||
m_ui->sbDurationHours->setEnabled(enable);
|
||||
m_ui->cbParty->setEnabled(enable);
|
||||
setEffectStartEnabled(m_ui->dteEffectStart, enable);
|
||||
|
||||
m_ui->pbPosition->setEnabled(m_sitMapGuiIfc && enable);
|
||||
m_ui->positionEdit->setEnabled(enable);
|
||||
m_ui->rotationAngleEdit->setEnabled(enable);
|
||||
m_ui->sbTriggerRadius->setEnabled(enable);
|
||||
m_ui->sbImpactRadius->setEnabled(enable);
|
||||
m_ui->leIdentifier->setEnabled(enable || isOnlyNameModifiable());
|
||||
|
||||
m_ui->pbClear->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->boobyTrap(m_aesItem.id());
|
||||
setData(baseData, false);
|
||||
__unchange__();
|
||||
if (name != m_ui->leIdentifier->text())
|
||||
m_ui->leIdentifier->setText(name);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bool BoobyTrapEdit::init(int aesItemId, bool copy,
|
||||
LtsSession::LtsSession *session)
|
||||
{
|
||||
if (!BaseEdit::init(aesItemId, session))
|
||||
return false;
|
||||
|
||||
bool editable = (LtsSessionData::LtsSessionData::getInstance()->hasOperatorRight(OperatorRights::MineSingleVirtualEdit)) ||
|
||||
m_session->app() == LtsAppDescriptor::App::OC;
|
||||
|
||||
bool readable = (LtsSessionData::LtsSessionData::getInstance()->hasOperatorRight(OperatorRights::MineSingleVirtualShow));
|
||||
;
|
||||
|
||||
if (!readable && !editable)
|
||||
return false;
|
||||
|
||||
// FIXME: in GUI plugin, nicht ausserhalb!
|
||||
if (!m_session->getForeignGuiInterface<ProjectDataManagement::ForeignGuiInterface>(m_pdmGuiIfc))
|
||||
return false;
|
||||
|
||||
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, &BoobyTrapEdit::getPosition);
|
||||
else
|
||||
m_ui->pbPosition->setEnabled(false);
|
||||
|
||||
m_pdmGuiIfc->fillBoobyTrapComboBox(m_ui->cbChargeType);
|
||||
m_ppmGuiCbxIfc->fillPartyComboBox(m_ui->cbParty);
|
||||
|
||||
connect(m_ui->cbChargeType,static_cast<void (LtsWidgets::LtsComboBox::*)(int)>(&LtsWidgets::LtsComboBox::currentIndexChanged),
|
||||
this, &BoobyTrapEdit::onChargeTypeChanged);
|
||||
|
||||
if (aesItemId > 0)
|
||||
{
|
||||
auto baseData = m_dtc->boobyTrap(aesItemId);
|
||||
setData(baseData, copy);
|
||||
}
|
||||
onChargeTypeChanged(0);
|
||||
|
||||
enableUiElements(editable && isModifiable() && !isOnlyNameModifiable());
|
||||
|
||||
connect(m_dtc.get(), &AreaEffectSimulation::Interface::Dtc::boobyTrapChanged,
|
||||
this, &BaseEdit::onAreaChanged);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void BoobyTrapEdit::onChargeTypeChanged(int index)
|
||||
{
|
||||
Q_UNUSED(index);
|
||||
|
||||
int chargeType = m_ui->cbChargeType->currentData().toInt();
|
||||
|
||||
if ( chargeType != s_boobyTrap2)
|
||||
{
|
||||
m_ui->lblRotation->hide();
|
||||
m_ui->rotationAngleEdit->hide();
|
||||
m_ui->lblCentralAngle->hide();
|
||||
m_ui->sbCentralAngle->hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ui->lblRotation->show();
|
||||
m_ui->rotationAngleEdit->show();
|
||||
#ifdef LTS_DEBUG
|
||||
m_ui->lblCentralAngle->show();
|
||||
m_ui->sbCentralAngle->show();
|
||||
#else
|
||||
m_ui->lblCentralAngle->hide();
|
||||
m_ui->sbCentralAngle->hide();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BoobyTrapEdit::setData(const BoobyTrap &bt, bool copy)
|
||||
{
|
||||
m_aesItem = bt;
|
||||
if (copy)
|
||||
{
|
||||
m_aesItem.id(0);
|
||||
m_aesItem.effectStateId(AreaEffectSimulation::AesEffectState_def::get_default());
|
||||
}
|
||||
m_ui->leIdentifier->setText(QString::fromStdString(bt.name()));
|
||||
m_ui->dteEffectStart->setMsecsSinceEpoch(bt.effectStart().is_set() ? bt.effectStart().get() : 0);
|
||||
m_ui->cbChargeType->setCurrentIndex(m_ui->cbChargeType->findData(bt.chargeStruct().chargeTypeId()));
|
||||
s_lastChargeTypeBoobyTrap = bt.chargeStruct().chargeTypeId();
|
||||
m_ui->sbDurationHours->setValue(bt.effectDuration() / 1000 / 60/ 60); // msecs -> mins -> hours
|
||||
m_ui->sbTriggerRadius->setValue(bt.triggerRadius());
|
||||
m_ui->sbImpactRadius->setValue(bt.impactRadius());
|
||||
|
||||
if (bt.rotationAngle().is_set())
|
||||
{
|
||||
// assumed that angle is in degree else need to be converted first
|
||||
m_ui->rotationAngleEdit->setValue(bt.rotationAngle().get(), LtsAngleEditBase::AngleUnitType::Deg);
|
||||
}
|
||||
|
||||
if (bt.centralAngle().is_set())
|
||||
m_ui->sbCentralAngle->setValue(bt.centralAngle().get());
|
||||
|
||||
m_ui->cbParty->setCurrentIndex(m_ui->cbParty->findData(bt.partyId().is_set() ? bt.partyId().get() : 0));
|
||||
|
||||
QPointF impactPosition(bt.impactPosition().lon(), bt.impactPosition().lat());
|
||||
if (!impactPosition.isNull())
|
||||
m_ui->positionEdit->setCoordinate(impactPosition);
|
||||
}
|
||||
|
||||
void BoobyTrapEdit::getPosition()
|
||||
{
|
||||
if (!has2DMap())
|
||||
return;
|
||||
|
||||
// convert angle in degree before displaying
|
||||
const double &rotation = m_ui->rotationAngleEdit->getAngleConverted(m_ui->rotationAngleEdit->getAngle(),
|
||||
LtsAngleEditBase::AngleUnitType::Deg,
|
||||
m_ui->rotationAngleEdit->getAngleCurrentUnit());
|
||||
const double &angle = m_ui->sbCentralAngle->value();
|
||||
const int chargeType = m_ui->cbChargeType->currentData().toInt();
|
||||
|
||||
if (chargeType == s_boobyTrap2)
|
||||
{
|
||||
// sector:
|
||||
|
||||
double trigger = m_ui->sbTriggerRadius->value();
|
||||
double triggerMin = s_minTriggerRadius;
|
||||
double triggerMax = s_maxTriggerRadius;
|
||||
// if all 3 are more or less equal, the screenresolution leads to problems at checkMinMaxRadiusConstraints
|
||||
// so in that case skip tranfering to rubberband and let the user enter just one CircleSector:
|
||||
const bool bTriggerRelevant = (!qFuzzyCompare(trigger, triggerMin) && !qFuzzyCompare(trigger, triggerMax)); // Maybe this has to be improved
|
||||
|
||||
double impact = m_ui->sbImpactRadius->value();
|
||||
double impactMin = s_minImpactRadius;
|
||||
double impactMax = s_maxImpactRadius;
|
||||
const bool bImpactRelevant = (!qFuzzyCompare(impact, impactMin) && !qFuzzyCompare(impact, impactMax)); // Maybe this has to be improved
|
||||
|
||||
if (bTriggerRelevant && bImpactRelevant)
|
||||
{
|
||||
if (!m_sitMapGuiIfc->getTwoCircleSector(this,
|
||||
SLOT(onTwoCircleSectorData(QPointF, double, double, double, double)),
|
||||
nullptr,
|
||||
m_ui->sbTriggerRadius->value(), s_minTriggerRadius, s_maxTriggerRadius,
|
||||
m_ui->sbImpactRadius->value(), s_minImpactRadius, s_maxImpactRadius,
|
||||
m_ui->positionEdit->coordinate(),
|
||||
angle,
|
||||
rotation)) //max
|
||||
{
|
||||
ERROR_LOG(m_logger) << LOGFUNCTION << " getTwoCircleSector failed, checkSlots??";
|
||||
}
|
||||
|
||||
} else if (!bTriggerRelevant && bImpactRelevant)
|
||||
{
|
||||
// enter impactRadius
|
||||
if (!m_sitMapGuiIfc->getCircleSector(this,
|
||||
SLOT(onCircleSectorData(QPointF, double, double, double)),
|
||||
nullptr,
|
||||
m_ui->sbImpactRadius->value(), s_minImpactRadius, s_maxImpactRadius,
|
||||
m_ui->positionEdit->coordinate(),
|
||||
angle,
|
||||
rotation)) //max
|
||||
{
|
||||
ERROR_LOG(m_logger) << LOGFUNCTION << " getCircleSector failed, checkSlots??";
|
||||
}
|
||||
|
||||
} else if (!bTriggerRelevant && !bImpactRelevant)
|
||||
{
|
||||
if (!m_sitMapGuiIfc->getCircleSectorFixRadius(this,
|
||||
SLOT(onCircleSectorFixRadiusData(QPointF, double, double, double)),
|
||||
nullptr,
|
||||
m_ui->sbImpactRadius->value(),
|
||||
m_ui->positionEdit->coordinate(),
|
||||
angle,
|
||||
rotation))
|
||||
{
|
||||
ERROR_LOG(m_logger) << LOGFUNCTION << " getCircleSectorFixRadius failed, checkSlots??";
|
||||
}
|
||||
|
||||
} else if (bTriggerRelevant && !bImpactRelevant)
|
||||
{
|
||||
ERROR_LOG(m_logger) << LOGFUNCTION << " not supported yet";
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// circle
|
||||
if (!m_sitMapGuiIfc->getCircle(this,
|
||||
SLOT(onCircleData(QPointF, double)),
|
||||
nullptr,
|
||||
s_minTriggerRadius,
|
||||
s_maxTriggerRadius,
|
||||
m_ui->positionEdit->coordinate(),
|
||||
m_ui->sbTriggerRadius->value())) //max
|
||||
{
|
||||
ERROR_LOG(m_logger) << LOGFUNCTION << " getCircle failed, checkSlots??";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BoobyTrapEdit::onCircleData(const QPointF &position, double radius)
|
||||
{
|
||||
m_previewCircleCenter = position;
|
||||
|
||||
// SB corrects value acc. singleStep
|
||||
m_ui->sbTriggerRadius->setValue(radius);
|
||||
m_previewCircleRadius = m_ui->sbTriggerRadius->value();
|
||||
|
||||
m_ui->positionEdit->setCoordinate(position);
|
||||
DEBUG_LOG(m_logger) << "Pos X: " << position.x() << " Y: " << position.y() << " R: " << radius;
|
||||
|
||||
showPreviewObject();
|
||||
}
|
||||
|
||||
void BoobyTrapEdit::onCircleSectorFixRadiusData(const QPointF &position, double radius, double rotationDeg, double centralAngleDeg)
|
||||
{
|
||||
// radius may modified, use original:
|
||||
Q_UNUSED(radius);
|
||||
onCircleSectorData(position, m_ui->sbImpactRadius->value(), rotationDeg, centralAngleDeg);
|
||||
}
|
||||
|
||||
|
||||
void BoobyTrapEdit::onCircleSectorData(const QPointF &position, double radius, double rotationDeg, double centralAngleDeg)
|
||||
{
|
||||
m_previewCircleCenter = position;
|
||||
|
||||
// SB corrects value acc. singleStep
|
||||
if (radius > 0)
|
||||
m_ui->sbImpactRadius->setValue(radius);
|
||||
|
||||
m_previewCircleRadius = m_ui->sbTriggerRadius->value();
|
||||
m_previewRotationDeg = rotationDeg;
|
||||
m_previewCentralAngleDeg = centralAngleDeg;
|
||||
|
||||
m_ui->positionEdit->setCoordinate(position);
|
||||
m_ui->rotationAngleEdit->setValue(rotationDeg, LtsAngleEditBase::AngleUnitType::Deg);
|
||||
m_ui->sbCentralAngle->setValue(std::ceil(centralAngleDeg));
|
||||
DEBUG_LOG(m_logger) << "Pos X: " << position.x() << " Y: " << position.y()
|
||||
<< ", R1: " << radius
|
||||
<<", rotation[deg]:" << rotationDeg << ", angle[deg]:" << centralAngleDeg;
|
||||
|
||||
showPreviewObject();
|
||||
}
|
||||
|
||||
void BoobyTrapEdit::onTwoCircleSectorData(const QPointF &position, double radius1, double radius2, double rotationDeg, double centralAngleDeg)
|
||||
{
|
||||
m_previewCircleCenter = position;
|
||||
|
||||
// SB corrects value acc. singleStep
|
||||
if (radius1 > 0)
|
||||
m_ui->sbTriggerRadius->setValue(radius1);
|
||||
|
||||
if (radius2 > 0)
|
||||
m_ui->sbImpactRadius->setValue(radius2);
|
||||
|
||||
m_previewCircleRadius = m_ui->sbTriggerRadius->value();
|
||||
m_previewRotationDeg = rotationDeg;
|
||||
m_previewCentralAngleDeg = centralAngleDeg;
|
||||
|
||||
m_ui->positionEdit->setCoordinate(position);
|
||||
m_ui->rotationAngleEdit->setValue(rotationDeg, LtsAngleEditBase::AngleUnitType::Deg);
|
||||
m_ui->sbCentralAngle->setValue(std::ceil(centralAngleDeg));
|
||||
DEBUG_LOG(m_logger) << "Pos X: " << position.x() << " Y: " << position.y()
|
||||
<< ", R1: " << radius1 << " R2: " << radius2
|
||||
<<", rotation[deg]:" << rotationDeg << ", angle[deg]:" << centralAngleDeg;
|
||||
showPreviewObject();
|
||||
}
|
||||
|
||||
bool BoobyTrapEdit::apply()
|
||||
{
|
||||
std::string name = m_ui->leIdentifier->text().toStdString();
|
||||
qint64 effectStart = m_ui->dteEffectStart->msecsSinceEpoch();
|
||||
int duration = m_ui->sbDurationHours->value() * 60 * 1000 * 60; //hours -> mins -> msecs
|
||||
int chargeType = m_ui->cbChargeType->currentData().toInt();
|
||||
s_lastChargeTypeBoobyTrap = chargeType;
|
||||
int partyId = m_ui->cbParty->currentData().toInt();
|
||||
int triggerRadius = m_ui->sbTriggerRadius->value();
|
||||
int impactRadius = m_ui->sbImpactRadius->value();
|
||||
|
||||
QPointF p(m_ui->positionEdit->coordinate());
|
||||
const Core::GeoPosition2D pos(p.x(), p.y());
|
||||
|
||||
BoobyTrapModifyRequest req(m_aesItem.id(),
|
||||
name,
|
||||
duration,
|
||||
chargeType,
|
||||
pos,
|
||||
impactRadius,
|
||||
triggerRadius,
|
||||
dds::core::optional<double>(),
|
||||
dds::core::optional<double>(),
|
||||
LtsUtils::toOptional(effectStart),
|
||||
LtsUtils::toOptional(partyId)
|
||||
);
|
||||
|
||||
if (chargeType == s_boobyTrap2)
|
||||
{
|
||||
// the angle is sent in deg. Check if value is in degree
|
||||
double rotValue = m_ui->rotationAngleEdit->getAngleConverted(m_ui->rotationAngleEdit->getAngle(),
|
||||
LtsAngleEditBase::AngleUnitType::Deg,
|
||||
m_ui->rotationAngleEdit->getAngleCurrentUnit());
|
||||
req.rotationAngle().set(rotValue);
|
||||
|
||||
req.centralAngle().set(m_ui->sbCentralAngle->value());
|
||||
}
|
||||
|
||||
m_requestHelper->addRequest([this,req]()
|
||||
{
|
||||
return m_ftc->boobyTrapModifyRequest(req, this);
|
||||
});
|
||||
|
||||
return m_requestHelper->startRequests();
|
||||
}
|
||||
|
||||
void BoobyTrapEdit::showPreviewObject()
|
||||
{
|
||||
if (!m_sitMapGuiIfc)
|
||||
return;
|
||||
|
||||
if (m_previewCircleCenter.isNull())
|
||||
return;
|
||||
if (m_ui->cbChargeType->currentData().toInt() == s_boobyTrap2)
|
||||
{
|
||||
m_sitMapGuiIfc->displayPreviewObject(this, m_previewCircleCenter, m_previewCircleRadius, m_previewRotationDeg, m_previewCentralAngleDeg);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_sitMapGuiIfc->displayPreviewObject(this, m_previewCircleCenter, m_previewCircleRadius);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace AreaEffectSimulation
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* AreaEffectSimulation - Mine Single Virtual Edit Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Hanna E. Rathje, SLSE, 2023-07-14
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Plugins/AreaEffectSimulation/Gui/Base/aes_base_edit.h>
|
||||
#include <Plugins/ProjectDataManagement/pdm_gui_plugin_interface.h>
|
||||
#include <LtsWidgets/lts_angle_edit.h>
|
||||
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class BoobyTrapEdit;
|
||||
}
|
||||
|
||||
namespace AreaEffectSimulation
|
||||
{
|
||||
|
||||
class BoobyTrapEdit final
|
||||
: public BaseEdit
|
||||
, protected AreaEffectSimulation::Interface::Ftc::BoobyTrapModifyReplyHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit BoobyTrapEdit(const QString &menuGroup, QWidget *parent = nullptr);
|
||||
~BoobyTrapEdit();
|
||||
|
||||
using LtsAngleEditBase = LtsWidgets::LtsAngleEdit;
|
||||
|
||||
QString dialogIdentifier() const override
|
||||
{
|
||||
return m_aesItem.id() <= 0 ? QStringLiteral("AddBoobyTrap") : QStringLiteral("EditBoobyTrap%1").arg(m_aesItem.id());
|
||||
}
|
||||
bool init(int aesItemId, bool copy, LtsSession::LtsSession *session);
|
||||
|
||||
void onBoobyTrapModifyReply(const Core::FunctionReplyObject &replyObject) override final { onAesItemModifyReply(replyObject); }
|
||||
|
||||
private:
|
||||
static double s_minTriggerRadius;
|
||||
static double s_maxTriggerRadius;
|
||||
static double s_defaultTriggerRadius;
|
||||
static double s_minImpactRadius;
|
||||
static double s_maxImpactRadius;
|
||||
static double s_defaultImpactRadius;
|
||||
static double s_stepRadius;
|
||||
static int s_minDurationHours;
|
||||
static int s_maxDurationHours;
|
||||
static int s_defaultCentralAngle;
|
||||
|
||||
void retranslate() override;
|
||||
void setData(const BoobyTrap &bt, bool copy);
|
||||
void enableUiElements(bool enable) override;
|
||||
void setPbDangerAreaText();
|
||||
|
||||
private Q_SLOTS:
|
||||
void getPosition();
|
||||
void onChargeTypeChanged(int index);
|
||||
void onCircleData(const QPointF &position, double radius);
|
||||
void onCircleSectorFixRadiusData(const QPointF &position, double radius, double rotationDeg, double centralAngleDeg);
|
||||
void onCircleSectorData(const QPointF &position, double radius, double rotationDeg, double centralAngleDeg);
|
||||
void onTwoCircleSectorData(const QPointF &position, double radius1, double radius2, double rotationDeg, double centralAngleDeg);
|
||||
bool apply() override;
|
||||
void showPreviewObject() override;
|
||||
|
||||
private:
|
||||
QPointF m_previewCircleCenter;
|
||||
double m_previewCircleRadius;
|
||||
double m_previewRotationDeg;
|
||||
double m_previewCentralAngleDeg;
|
||||
Ui::BoobyTrapEdit *m_ui;
|
||||
std::shared_ptr<ProjectDataManagement::ForeignGuiInterface> m_pdmGuiIfc;
|
||||
};
|
||||
|
||||
} //namespace AreaEffectSimulation
|
||||
+336
@@ -0,0 +1,336 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>BoobyTrapEdit</class>
|
||||
<widget class="QWidget" name="BoobyTrapEdit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>731</width>
|
||||
<height>230</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">Aes Contamination Edit</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="2" column="5">
|
||||
<widget class="QSpinBox" name="sbImpactRadius"/>
|
||||
</item>
|
||||
<item row="4" 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="0" column="0">
|
||||
<widget class="QLabel" name="lblIdentifier">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Identifier:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="5">
|
||||
<widget class="LtsWidgets::LtsComboBox" name="cbParty">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="currentText">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QSpinBox" name="sbDurationHours">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>4</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lblEffectStart">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Effect Start:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="3">
|
||||
<widget class="QLabel" name="lblCentralAngle">
|
||||
<property name="text">
|
||||
<string>Central Angle:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="lblDuration">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Duration [h]:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3" colspan="2">
|
||||
<widget class="QLabel" name="lblTriggerRadius">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Trigger Radius [m]:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="6" rowspan="5">
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>2</width>
|
||||
<height>31</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="LtsWidgets::LtsDateTimeEdit" name="dteEffectStart" native="true">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</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>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QLabel" name="lblParty">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Firing Party:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="5">
|
||||
<widget class="QSpinBox" name="sbTriggerRadius">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>1000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="lblChargeType">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Mine Type:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="leIdentifier">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="5">
|
||||
<widget class="QSpinBox" name="sbCentralAngle">
|
||||
<property name="maximum">
|
||||
<number>359</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="lblPosition">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Position:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="LtsCoordWidget::LtsCoordWidget" name="positionEdit" native="true">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="showToolTip" stdset="0">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pbPosition">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<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="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normaloff>:/style/remove.svg</normaloff>:/style/remove.svg</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<spacer name="horizontalSpacer">
|
||||
<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="2" column="3" colspan="2">
|
||||
<widget class="QLabel" name="lblImpactRadius">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Impact Radius [m]:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1" colspan="6">
|
||||
<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="2" column="1">
|
||||
<widget class="LtsWidgets::LtsComboBox" name="cbChargeType">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="currentText">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="3">
|
||||
<widget class="QLabel" name="lblRotation">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Rotation:</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>leIdentifier</tabstop>
|
||||
<tabstop>dteEffectStart</tabstop>
|
||||
<tabstop>cbChargeType</tabstop>
|
||||
<tabstop>sbDurationHours</tabstop>
|
||||
<tabstop>positionEdit</tabstop>
|
||||
<tabstop>pbPosition</tabstop>
|
||||
<tabstop>pbClear</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
+117
@@ -0,0 +1,117 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* BoobyTrap Management - Booby Trap Overview Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Hanna E. Rathje, 2023-07-17
|
||||
*/
|
||||
|
||||
#include "aes_booby_trap_list.h"
|
||||
#include "aes_booby_trap_model.h"
|
||||
#include "aes_booby_trap_edit.h"
|
||||
#include "CustomView/aes_booby_trap.h"
|
||||
|
||||
#include <LtsSession/lts_session_data.h>
|
||||
|
||||
namespace AreaEffectSimulation
|
||||
{
|
||||
|
||||
BoobyTrapList::BoobyTrapList(const QString &menuGroup, QWidget *parent)
|
||||
: AesItemListTmpl<BoobyTrap>(menuGroup, parent)
|
||||
{
|
||||
}
|
||||
|
||||
bool BoobyTrapList::init(LtsSession::LtsSession *session)
|
||||
{
|
||||
if (!AesItemList::init(session))
|
||||
return false;
|
||||
|
||||
bool editable = (LtsSessionData::LtsSessionData::getInstance()->hasOperatorRight(OperatorRights::MineSingleVirtualEdit) ) ||
|
||||
m_session->app() == LtsAppDescriptor::App::OC;
|
||||
if (session->isReplayPartition())
|
||||
editable = false;
|
||||
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Edit, editable);
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Add, editable);
|
||||
|
||||
QSortFilterProxyModel *m = m_model;
|
||||
setDataViewModel(m, [this]() { return new CustomViewBoobyTrap(this); });
|
||||
|
||||
#ifndef LTS_DEBUG
|
||||
hideColumn(BoobyTrapModel::BcId);
|
||||
hideColumn(BoobyTrapModel::ColTriggerRadius);
|
||||
hideColumn(BoobyTrapModel::ColImpactRadius);
|
||||
hideColumn(BoobyTrapModel::ColRotationAngle);
|
||||
hideColumn(BoobyTrapModel::ColCentralAngle);
|
||||
#endif
|
||||
hideColumn(BoobyTrapModel::BcParticipant);
|
||||
hideColumn(BoobyTrapModel::BcEffectSource);
|
||||
|
||||
setSortIndicator(BoobyTrapModel::BcName);
|
||||
|
||||
enaDisa();
|
||||
|
||||
setOnlineHelpFilename(QStringLiteral("Situation-Mine_VLad"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void BoobyTrapList::createModel()
|
||||
{
|
||||
m_model = new AesItemSortFilterProxyModelTmpl<BoobyTrap>(m_session, this);
|
||||
BoobyTrapModel *sourceModel = new BoobyTrapModel(this);
|
||||
sourceModel->initModel(m_session);
|
||||
m_model->setSourceModel(sourceModel);
|
||||
}
|
||||
|
||||
void BoobyTrapList::onAddAesItem()
|
||||
{
|
||||
BoobyTrapEdit *dialog = new BoobyTrapEdit(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 BoobyTrapList::onEditAesItem()
|
||||
{
|
||||
const int aesItemId = model()->aesId(currentRow());
|
||||
|
||||
if (aesItemId <= 0)
|
||||
return;
|
||||
|
||||
DEBUG_LOG(m_logger) << "current BoobTrapId: " << aesItemId;
|
||||
|
||||
BoobyTrapEdit *dialog = new BoobyTrapEdit(m_menuGroup, this);
|
||||
if (dialog->init(aesItemId, false, m_session))
|
||||
addDialog(dialog, m_menuGroup, dialog->dialogIdentifier(), LtsWidgets::LayoutArea::eDialogTab);
|
||||
else
|
||||
delete dialog;
|
||||
}
|
||||
|
||||
void BoobyTrapList::onRemoveAesItem()
|
||||
{
|
||||
// TODO: change for different item
|
||||
const int aesItemId = model()->aesId(currentRow());
|
||||
Core::RemoveElementRequest req(aesItemId);
|
||||
m_requestHelper->startSingleRequest([req, this]()
|
||||
{
|
||||
return m_ftc->boobyTrapRemoveRequest(req, this);
|
||||
});
|
||||
}
|
||||
|
||||
void BoobyTrapList::retranslate()
|
||||
{
|
||||
translateBase(tr("BoobyTrap"));
|
||||
}
|
||||
|
||||
void BoobyTrapList::onBoobyTrapRemoveReply(const Core::FunctionReplyObject &replyObject)
|
||||
{
|
||||
m_requestHelper->requestReply(replyObject);
|
||||
}
|
||||
|
||||
|
||||
} // namespace AreaEffectSimulation
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* BoobyTrap Management - Booby Trap Overview Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Hanna E. Rathje, 2023-07-17
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Plugins/AreaEffectSimulation/Gui/Base/aes_itemlist.h>
|
||||
#include <Plugins/AreaEffectSimulation/Gui/Base/aes_base_model.h>
|
||||
|
||||
namespace AreaEffectSimulation
|
||||
{
|
||||
|
||||
class BoobyTrapList final : public AesItemListTmpl<BoobyTrap>
|
||||
, protected AreaEffectSimulation::Interface::Ftc::BoobyTrapRemoveReplyHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit BoobyTrapList(const QString &menuGroup, QWidget *parent = nullptr);
|
||||
|
||||
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 onBoobyTrapRemoveReply(const Core::FunctionReplyObject &replyObject) override;
|
||||
};
|
||||
}
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for AreaEffectSimulation - Booby Trap Overview Dialog Model
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*
|
||||
* Created by Hanna E. Rathje, 20-23-07-14
|
||||
*/
|
||||
|
||||
#include "aes_booby_trap_model.h"
|
||||
|
||||
namespace AreaEffectSimulation
|
||||
{
|
||||
|
||||
bool BoobyTrapModel::initModel(LtsSession::LtsSession *session)
|
||||
{
|
||||
if (!AesGuiBaseModel::initModel(session))
|
||||
return false;
|
||||
|
||||
connect(m_aesDtc.get(), &Interface::Dtc::boobyTrapChanged,
|
||||
this, &BoobyTrapModel::onDataChanged);
|
||||
|
||||
fillAvailableChargeIds(ProjectDataManagement::GearClass::BoobyTrap);
|
||||
|
||||
m_aesDtc->boobyTraps([this](const BoobyTrap &item) { insertRow(item); });
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
QVariant BoobyTrapModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (!indexIsValid(index))
|
||||
return QVariant();
|
||||
|
||||
const BoobyTrap &bt = getRowData(index.row());
|
||||
|
||||
if (index.column() < cntBaseColumns())
|
||||
return AesGuiBaseModel::data(bt, index.column(), role);
|
||||
|
||||
if (role != Qt::DisplayRole)
|
||||
return QVariant();
|
||||
|
||||
switch (index.column())
|
||||
{
|
||||
case ColTriggerRadius:
|
||||
return QLocale().toString(bt.triggerRadius(), 'f', 2);
|
||||
case ColImpactRadius:
|
||||
return QLocale().toString(bt.impactRadius(), 'f', 2);
|
||||
case ColRotationAngle:
|
||||
{
|
||||
if (bt.rotationAngle().is_set())
|
||||
return QLocale().toString(bt.rotationAngle().get(), 'f', 2);
|
||||
else
|
||||
return {};
|
||||
}
|
||||
case ColCentralAngle:
|
||||
{
|
||||
if (bt.centralAngle().is_set())
|
||||
return QLocale().toString(bt.centralAngle().get(), 'f', 2);
|
||||
else
|
||||
return {};
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
} // namespace AreaEffectSimulation
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for AreaEffectSimulation - Booby Trap Overview Dialog Model
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*
|
||||
* Created by Hanna E. Rathje, SLSE, 2023-07-14
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QSet>
|
||||
#include <Plugins/AreaEffectSimulation/Gui/Base/aes_base_model.h>
|
||||
#include <ProjectDataManagement/pdm_enums.hpp>
|
||||
|
||||
namespace LtsSession
|
||||
{
|
||||
class LtsSession;
|
||||
}
|
||||
|
||||
namespace AreaEffectSimulation
|
||||
{
|
||||
|
||||
|
||||
/************ Abstract Class for Mine Single Virtual ***************/
|
||||
class BoobyTrapModel : public AesGuiBaseModel<BoobyTrap>
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum AdditionalColumns {ColTriggerRadius = BcCount,
|
||||
ColImpactRadius = BcCount + 1,
|
||||
ColRotationAngle = BcCount + 2,
|
||||
ColCentralAngle = BcCount + 3};
|
||||
|
||||
bool initModel(LtsSession::LtsSession *session) override;
|
||||
|
||||
explicit BoobyTrapModel(QObject *parent = nullptr)
|
||||
: AesGuiBaseModel<BoobyTrap>(parent, {tr("Trigger Radius"), tr("Impact Radius"), tr("Rotation Angle"), tr("Central Angle")})
|
||||
{}
|
||||
|
||||
QVariant data(const QModelIndex &index, int role) const override final;
|
||||
};
|
||||
|
||||
} //namespace AreaEffectSimulation
|
||||
|
||||
|
||||
Executable
+156
@@ -0,0 +1,156 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* GUI Plugin for AreaEffectSimulation - MineSingle Virtual
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Hanna E. Rathje, SLSE, 2023-07-14
|
||||
*/
|
||||
|
||||
#include "aes_mine_single_virtual_gui_plugin.h"
|
||||
#include "aes_booby_trap_edit.h"
|
||||
#include "aes_booby_trap_list.h"
|
||||
#include "aes_off_route_mine_edit.h"
|
||||
#include "aes_off_route_mine_list.h"
|
||||
|
||||
#include "InfoView/aes_booby_trap_info.h"
|
||||
#include "InfoView/aes_off_route_mine_info.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.MineSingleVirtual"))
|
||||
, ForeignGuiInterface()
|
||||
{
|
||||
}
|
||||
|
||||
QString InterfaceImpl::menuGroup() const
|
||||
{
|
||||
return tr("Area Effect Simulation Mines");
|
||||
}
|
||||
|
||||
QVector<LtsWidgets::PluginData> InterfaceImpl::getActions()
|
||||
{
|
||||
QVector<LtsWidgets::PluginData> ret;
|
||||
|
||||
LtsUtils::ProjectSettings *ps = LtsUtils::ProjectSettings::getInstance();
|
||||
const bool enableMineSingleVirtual = ps->value(QStringLiteral("aes"),
|
||||
QStringLiteral("enableMineSingleVirtual")).toBool();
|
||||
|
||||
if (enableMineSingleVirtual)
|
||||
{
|
||||
ret.append(LtsWidgets::PluginData(menuGroup(),
|
||||
tr("Booby Trap"),
|
||||
QLatin1String("ListBoobyTrap"),
|
||||
QIcon(QLatin1String("icon:vlad.svg")),
|
||||
[this](QWidget *parent) { return onShowBoobyTrapListDialog(parent);},
|
||||
OperatorRights::MineSingleVirtualShow,
|
||||
LtsWidgets::ExercisePart::eExecution));
|
||||
|
||||
|
||||
if (m_session->isExercisePartition() && appId() != LtsAppDescriptor::App::OC)
|
||||
ret.append(LtsWidgets::PluginData(menuGroup(),
|
||||
tr("Add Booby Trap"),
|
||||
QLatin1String("AddBoobyTrap"),
|
||||
QIcon(QLatin1String("icon:vlad_add.svg")),
|
||||
[this](QWidget *parent) { return onShowAddBoobyTrapDialog(parent);},
|
||||
OperatorRights::MineSingleVirtualEdit,
|
||||
LtsWidgets::ExercisePart::eExecution,
|
||||
LtsWidgets::ExerciseState::eCreated | LtsWidgets::ExerciseState::eStarted | LtsWidgets::ExerciseState::ePaused));
|
||||
|
||||
ret.append(LtsWidgets::PluginData(menuGroup(),
|
||||
tr("Off Route Mine"),
|
||||
QLatin1String("ListOffRouteMine"),
|
||||
QIcon(QLatin1String("icon:pzab.svg")),
|
||||
[this](QWidget *parent) { return onShowOffRouteMineListDialog(parent);},
|
||||
OperatorRights::MineSingleVirtualShow,
|
||||
LtsWidgets::ExercisePart::eExecution));
|
||||
|
||||
|
||||
if (m_session->isExercisePartition() && appId() != LtsAppDescriptor::App::OC)
|
||||
ret.append(LtsWidgets::PluginData(menuGroup(),
|
||||
tr("Add Off Route Mine"),
|
||||
QLatin1String("AddOffRouteMine"),
|
||||
QIcon(QLatin1String("icon:pzab_add.svg")),
|
||||
[this](QWidget *parent) { return onShowAddOffRouteMineDialog(parent);},
|
||||
OperatorRights::MineSingleVirtualEdit,
|
||||
LtsWidgets::ExercisePart::eExecution,
|
||||
LtsWidgets::ExerciseState::eCreated | LtsWidgets::ExerciseState::eStarted | LtsWidgets::ExerciseState::ePaused));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool InterfaceImpl::fetchInterfaces()
|
||||
{
|
||||
std::shared_ptr<ProjectDataManagement::ForeignGuiInterface> pdmGuiIfc;
|
||||
if (!m_session->getForeignGuiInterface<ProjectDataManagement::ForeignGuiInterface>(pdmGuiIfc))
|
||||
return false;
|
||||
|
||||
return AesBaseInterface::fetchInterfaces();
|
||||
}
|
||||
|
||||
LtsWidgets::LtsDialog *InterfaceImpl::showBoobyTrapInfoWindow(const AesItem *item)
|
||||
{
|
||||
const BoobyTrap *bt = static_cast<const BoobyTrap*>(item);
|
||||
|
||||
BoobyTrapInfo *dialog = new BoobyTrapInfo();
|
||||
dialog->init(m_session);
|
||||
dialog->setData(bt);
|
||||
return dialog;
|
||||
}
|
||||
|
||||
LtsWidgets::LtsDialog *InterfaceImpl::showOffRouteMineInfoWindow(const AesItem *item)
|
||||
{
|
||||
const OffRouteMine *bt = static_cast<const OffRouteMine*>(item);
|
||||
|
||||
OffRouteMineInfo *dialog = new OffRouteMineInfo();
|
||||
dialog->init(m_session);
|
||||
dialog->setData(bt);
|
||||
return dialog;
|
||||
}
|
||||
|
||||
AreaEffectSimulation::BaseEdit *InterfaceImpl::showBoobyTrapEditWindow(int aesEntityId, QWidget *parent)
|
||||
{
|
||||
return LtsWidgets::initDialog(new BoobyTrapEdit(menuGroup(), parent),
|
||||
aesEntityId, false, m_session);
|
||||
}
|
||||
|
||||
AreaEffectSimulation::BaseEdit *InterfaceImpl::showOffRouteMineEditWindow(int aesEntityId, QWidget *parent)
|
||||
{
|
||||
return LtsWidgets::initDialog(new OffRouteMineEdit(menuGroup(), parent),
|
||||
aesEntityId, false, m_session);
|
||||
}
|
||||
|
||||
|
||||
LtsWidgets::LtsDialog *InterfaceImpl::onShowAddBoobyTrapDialog(QWidget *parent)
|
||||
{
|
||||
return showBoobyTrapEditWindow(0, parent);
|
||||
}
|
||||
|
||||
LtsWidgets::LtsDialog *InterfaceImpl::onShowAddOffRouteMineDialog(QWidget *parent)
|
||||
{
|
||||
return showOffRouteMineEditWindow(0, parent);
|
||||
}
|
||||
|
||||
LtsWidgets::LtsDialog *InterfaceImpl::onShowBoobyTrapListDialog(QWidget *parent)
|
||||
{
|
||||
return LtsWidgets::initDialog(new BoobyTrapList(menuGroup(), parent),
|
||||
m_session);
|
||||
}
|
||||
|
||||
LtsWidgets::LtsDialog *InterfaceImpl::onShowOffRouteMineListDialog(QWidget *parent)
|
||||
{
|
||||
return LtsWidgets::initDialog(new OffRouteMineList(menuGroup(), parent),
|
||||
m_session);
|
||||
}
|
||||
} // namespace AreaEffectSimulation
|
||||
Executable
+58
@@ -0,0 +1,58 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Gui Plugin for AreaEffectSimulation - Mine Single Virtual
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Hanna E. Rathje, 2023-07-17
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Plugins/AreaEffectSimulation/Gui/Base/aes_base_gui_plugin.h>
|
||||
#include "aes_mine_single_virtual_gui_plugin_interface.h"
|
||||
|
||||
namespace AreaEffectSimulation
|
||||
{
|
||||
class GuiPlugin final : public AesBaseGuiPlugin
|
||||
{
|
||||
Q_PLUGIN_METADATA(IID "gui:3:aes.minesinglevirtual")
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GuiPlugin() = default;
|
||||
~GuiPlugin() = default;
|
||||
|
||||
QString pluginName() override { return QStringLiteral("AreaEffectSimuationMineSingleVirtualGui"); }
|
||||
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 AesMineSingleVirtual::ForeignGuiInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit InterfaceImpl(LtsSession::LtsSession *session);
|
||||
|
||||
QString menuGroup() const override final;
|
||||
QVector<LtsWidgets::PluginData> getActions() override;
|
||||
LtsWidgets::LtsDialog *showBoobyTrapInfoWindow(const AesItem *item) override;
|
||||
AreaEffectSimulation::BaseEdit *showBoobyTrapEditWindow(int aesEntityId, QWidget *parent) override;
|
||||
LtsWidgets::LtsDialog *showOffRouteMineInfoWindow(const AesItem *item) override;
|
||||
AreaEffectSimulation::BaseEdit *showOffRouteMineEditWindow(int aesEntityId, QWidget *parent) override;
|
||||
bool fetchInterfaces() override;
|
||||
|
||||
private:
|
||||
LtsWidgets::LtsDialog *onShowAddBoobyTrapDialog(QWidget *parent);
|
||||
LtsWidgets::LtsDialog *onShowBoobyTrapListDialog(QWidget *parent);
|
||||
LtsWidgets::LtsDialog *onShowAddOffRouteMineDialog(QWidget *parent);
|
||||
LtsWidgets::LtsDialog *onShowOffRouteMineListDialog(QWidget *parent);
|
||||
};
|
||||
|
||||
} // namespace AreaEffectSimulation
|
||||
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* @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 LtsWidgets
|
||||
{
|
||||
class LtsDialog;
|
||||
}
|
||||
|
||||
namespace AreaEffectSimulation
|
||||
{
|
||||
class AesItem;
|
||||
class BaseEdit;
|
||||
}
|
||||
|
||||
namespace AesMineSingleVirtual
|
||||
{
|
||||
class ForeignGuiInterface
|
||||
{
|
||||
public:
|
||||
ForeignGuiInterface() = default;
|
||||
virtual ~ForeignGuiInterface() = default;
|
||||
|
||||
virtual LtsWidgets::LtsDialog *showBoobyTrapInfoWindow(const AreaEffectSimulation::AesItem *item) = 0;
|
||||
virtual AreaEffectSimulation::BaseEdit *showBoobyTrapEditWindow(int aesEntityId, QWidget *parent) = 0;
|
||||
virtual LtsWidgets::LtsDialog *showOffRouteMineInfoWindow(const AreaEffectSimulation::AesItem *item) = 0;
|
||||
virtual AreaEffectSimulation::BaseEdit *showOffRouteMineEditWindow(int aesEntityId, QWidget *parent) = 0;
|
||||
};
|
||||
} // namespace AesMineSingleVirtual
|
||||
|
||||
+489
@@ -0,0 +1,489 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* AreaEffectSimulation - Off Route Mine Edit Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Hanna E. Rathje, SLSE, 2023-07-14
|
||||
*/
|
||||
|
||||
|
||||
#include "aes_off_route_mine_edit.h"
|
||||
#include "ui_aes_off_route_mine_edit.h"
|
||||
|
||||
#include <LtsWidgets/lts_message_dialog.h>
|
||||
#include <LtsSession/lts_session_data.h>
|
||||
#include <PluginInterfaces/gui_plugin_interface.h>
|
||||
#include <Plugins/AreaEffectSimulation/aes_data_plugin_interface.h>
|
||||
#include <Plugins/SituationMapPlugin/situation_map_gui_plugin_interface.h>
|
||||
#include <Plugins/AreaEffectSimulation/aes_info_gui_plugin_interface.h>
|
||||
#include <Services/AreaEffectSimulation/Utils/polygons.h>
|
||||
|
||||
#include <AreaEffectSimulation/aes_translation.h>
|
||||
#include <LtsUtilsSettings/settings.h>
|
||||
|
||||
#include <LtsCoordTrans/lts_coord_trans.h>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
namespace AreaEffectSimulation
|
||||
{
|
||||
double OffRouteMineEdit::s_minImpactRadius;
|
||||
double OffRouteMineEdit::s_maxImpactRadius;
|
||||
double OffRouteMineEdit::s_stepImpactRadius;
|
||||
double OffRouteMineEdit::s_defaultImpactRadius;
|
||||
int OffRouteMineEdit::s_minDurationHours;
|
||||
int OffRouteMineEdit::s_maxDurationHours;
|
||||
double OffRouteMineEdit::s_minWidth;
|
||||
double OffRouteMineEdit::s_maxWidth;
|
||||
double OffRouteMineEdit::s_stepWidth;
|
||||
double OffRouteMineEdit::s_minHeight;
|
||||
double OffRouteMineEdit::s_maxHeight;
|
||||
double OffRouteMineEdit::s_stepHeight;
|
||||
double OffRouteMineEdit::s_minRotation;
|
||||
double OffRouteMineEdit::s_maxRotation;
|
||||
double OffRouteMineEdit::s_stepRotation;
|
||||
|
||||
static int s_lastChargeTypeOffRouteMine = 253;
|
||||
static int s_offRouteMine2 = 254;
|
||||
|
||||
|
||||
// helper :
|
||||
QPointF bottomCenterToBottomLeftGeo(const QPointF &bottomCenterGeo, double width, double rotationDeg)
|
||||
{
|
||||
LtsCoordTrans::UtmCoordinate bottomCenterUtm = LtsCoordTrans::UtmCoordinate::fromGeographic(bottomCenterGeo);
|
||||
|
||||
QTransform trans;
|
||||
trans.rotate(-rotationDeg); // QTransform::rotate - counterclockwise
|
||||
|
||||
// calculate cornerBottomLeft
|
||||
QPointF point(-width/2.0, 0);
|
||||
point = trans.map(point); // point entsprechend rotieren
|
||||
|
||||
return bottomCenterUtm.geographic(point); // offset :-)
|
||||
}
|
||||
|
||||
QPointF bottomLeftToBottomCenterToGeo(const QPointF &bottomLeft, double width, double rotationDeg)
|
||||
{
|
||||
LtsCoordTrans::UtmCoordinate bottomLeftUtm = LtsCoordTrans::UtmCoordinate::fromGeographic(bottomLeft);
|
||||
|
||||
QTransform trans;
|
||||
trans.rotate(-rotationDeg); // QTransform::rotate - counterclockwise
|
||||
|
||||
// calculate cornerBottomLeft
|
||||
QPointF point(width/2.0, 0);
|
||||
point = trans.map(point); // point entsprechend rotieren
|
||||
|
||||
return bottomLeftUtm.geographic(point); // offset :-)
|
||||
}
|
||||
|
||||
|
||||
// : helper
|
||||
|
||||
|
||||
// Todo: Höhe und Radius in Abhängigkeit der Munitionsart berechnen
|
||||
|
||||
OffRouteMineEdit::OffRouteMineEdit(const QString &menuGroup, QWidget *parent)
|
||||
: BaseEdit(menuGroup, QLatin1String("OffRouteMineEdit"), parent)
|
||||
, m_ui(new Ui::OffRouteMineEdit)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
|
||||
|
||||
s_minImpactRadius = 1;
|
||||
s_maxImpactRadius = 10;
|
||||
s_stepImpactRadius = 1;
|
||||
s_defaultImpactRadius = 10;
|
||||
s_minDurationHours = 1;
|
||||
s_maxDurationHours = 72;
|
||||
s_minWidth = 1;
|
||||
s_maxWidth = 1;
|
||||
s_stepWidth = 1;
|
||||
s_minHeight = 1; // GUEZE-2742 Grenzwerte PzAbwRiMi
|
||||
s_maxHeight = 50;
|
||||
s_stepHeight = 1;
|
||||
s_minRotation = 1;
|
||||
s_maxRotation = 6400;
|
||||
s_stepRotation = 1;
|
||||
|
||||
m_ui->sbImpactRadius->setMinimum(s_minImpactRadius);
|
||||
m_ui->sbImpactRadius->setMaximum(s_maxImpactRadius);
|
||||
m_ui->sbImpactRadius->setSingleStep(s_stepImpactRadius);
|
||||
m_ui->sbImpactRadius->setValue(s_defaultImpactRadius);
|
||||
m_ui->sbDurationHours->setMinimum(s_minDurationHours);
|
||||
m_ui->sbDurationHours->setMaximum(s_maxDurationHours);
|
||||
m_ui->sbDimensionX->setMinimum(s_minWidth);
|
||||
m_ui->sbDimensionX->setMaximum(s_maxWidth);
|
||||
m_ui->sbDimensionX->setSingleStep(s_stepWidth);
|
||||
m_ui->sbDimensionY->setMinimum(s_minHeight);
|
||||
m_ui->sbDimensionY->setMaximum(s_maxHeight);
|
||||
m_ui->sbDimensionY->setSingleStep(s_stepHeight);
|
||||
// m_ui->sbRotation->setMinimum(s_minRotation);
|
||||
// m_ui->sbRotation->setMaximum(s_maxRotation);
|
||||
// m_ui->sbRotation->setSingleStep(s_stepRotation);
|
||||
|
||||
m_ui->rotationAngleEdit->initAngleEditWidget(1); // int angle edit with 1 spinbox
|
||||
|
||||
#ifdef LTS_DEBUG
|
||||
m_ui->lblImpactRadius->setHidden(true);
|
||||
m_ui->sbImpactRadius->setHidden(true);
|
||||
#endif
|
||||
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->lblChargeType, [this]() { return (m_ui->cbChargeType->currentData().toInt() > 0); }});
|
||||
|
||||
connect(m_ui->pbClear, &QPushButton::clicked, m_ui->positionEdit, &LtsCoordWidget::LtsCoordWidget::clear);
|
||||
|
||||
connect(m_ui->sbImpactRadius, &QSpinBox::editingFinished, this, &OffRouteMineEdit::correctSpinBoxValue);
|
||||
//connect(m_ui->sbRotation, &QSpinBox::editingFinished, this, &OffRouteMineEdit::correctSpinBoxValue); // which purpose?
|
||||
|
||||
enaDisa();
|
||||
|
||||
setOnlineHelpFilename(QStringLiteral("Situation-Add_Mine_PzAbwRiMi"));
|
||||
}
|
||||
|
||||
OffRouteMineEdit::~OffRouteMineEdit()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
void OffRouteMineEdit::retranslate()
|
||||
{
|
||||
translate(m_ui, m_aesItem, tr("OffRouteMine"));
|
||||
|
||||
m_pdmGuiIfc->fillOffRouteMineComboBox(m_ui->cbChargeType);
|
||||
setCombobxToValueIfPossible(m_ui->cbChargeType, s_lastChargeTypeOffRouteMine );
|
||||
}
|
||||
|
||||
void OffRouteMineEdit::enableUiElements(bool enable)
|
||||
{
|
||||
m_ui->leIdentifier->setMaxLength(30);
|
||||
m_ui->sbDimensionY->setCorrectionMode(QAbstractSpinBox::CorrectionMode::CorrectToNearestValue);
|
||||
|
||||
m_ui->cbChargeType->setEnabled(enable);
|
||||
m_ui->sbDurationHours->setEnabled(enable);
|
||||
m_ui->cbParty->setEnabled(enable);
|
||||
setEffectStartEnabled(m_ui->dteEffectStart, enable);
|
||||
|
||||
m_ui->pbPosition->setEnabled(m_sitMapGuiIfc && enable);
|
||||
|
||||
// X Value is currently not editable
|
||||
m_ui->sbDimensionX->setEnabled(false);
|
||||
m_ui->lblOperatorA->setEnabled(false);
|
||||
|
||||
m_ui->sbDimensionY->setEnabled(enable);
|
||||
m_ui->positionEdit->setEnabled(enable);
|
||||
//m_ui->sbRotation->setEnabled(enable);
|
||||
m_ui->rotationAngleEdit->setEnabled(enable);
|
||||
m_ui->sbImpactRadius->setEnabled(enable);
|
||||
m_ui->leIdentifier->setEnabled(enable || isOnlyNameModifiable());
|
||||
|
||||
m_ui->pbClear->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->offRouteMine(m_aesItem.id());
|
||||
setData(baseData, false);
|
||||
__unchange__();
|
||||
if (name != m_ui->leIdentifier->text())
|
||||
m_ui->leIdentifier->setText(name);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bool OffRouteMineEdit::init(int aesItemId, bool copy,
|
||||
LtsSession::LtsSession *session)
|
||||
{
|
||||
if (!BaseEdit::init(aesItemId, session))
|
||||
return false;
|
||||
|
||||
bool editable = (LtsSessionData::LtsSessionData::getInstance()->hasOperatorRight(OperatorRights::MineSingleVirtualEdit)) ||
|
||||
m_session->app() == LtsAppDescriptor::App::OC;
|
||||
|
||||
bool readable = (LtsSessionData::LtsSessionData::getInstance()->hasOperatorRight(OperatorRights::MineSingleVirtualShow));
|
||||
;
|
||||
|
||||
if (!readable && !editable)
|
||||
return false;
|
||||
|
||||
// FIXME: in GUI plugin, nicht ausserhalb!
|
||||
if (!m_session->getForeignGuiInterface<ProjectDataManagement::ForeignGuiInterface>(m_pdmGuiIfc))
|
||||
return false;
|
||||
|
||||
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, &OffRouteMineEdit::getPositionPolyline);
|
||||
}
|
||||
else
|
||||
m_ui->pbPosition->setEnabled(false);
|
||||
|
||||
m_pdmGuiIfc->fillOffRouteMineComboBox(m_ui->cbChargeType);
|
||||
m_ppmGuiCbxIfc->fillPartyComboBox(m_ui->cbParty);
|
||||
|
||||
connect(m_ui->cbChargeType,static_cast<void (LtsWidgets::LtsComboBox::*)(int)>(&LtsWidgets::LtsComboBox::currentIndexChanged),
|
||||
this, &OffRouteMineEdit::onChargeTypeChanged);
|
||||
|
||||
if (aesItemId > 0)
|
||||
{
|
||||
auto baseData = m_dtc->offRouteMine(aesItemId);
|
||||
setData(baseData, copy);
|
||||
}
|
||||
onChargeTypeChanged(0);
|
||||
|
||||
enableUiElements(editable && isModifiable() && !isOnlyNameModifiable());
|
||||
|
||||
connect(m_dtc.get(), &AreaEffectSimulation::Interface::Dtc::offRouteMineChanged,
|
||||
this, &BaseEdit::onAreaChanged);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void OffRouteMineEdit::setData(const OffRouteMine &orm, bool copy)
|
||||
{
|
||||
m_aesItem = orm;
|
||||
if (copy)
|
||||
{
|
||||
m_aesItem.id(0);
|
||||
m_aesItem.effectStateId(AreaEffectSimulation::AesEffectState_def::get_default());
|
||||
}
|
||||
const Area &area = orm.area();
|
||||
if (!qFuzzyCompare(area.cornerBottomLeft().lon(), 0) ||
|
||||
!qFuzzyCompare(area.cornerBottomLeft().lat(), 0))
|
||||
{
|
||||
QPointF bottomCenter = bottomLeftToBottomCenterToGeo(QPointF(orm.area().cornerBottomLeft().lon(), orm.area().cornerBottomLeft().lat()),
|
||||
area.width(), area.rotation());
|
||||
m_ui->positionEdit->setCoordinate(bottomCenter);
|
||||
}
|
||||
|
||||
m_ui->leIdentifier->setText(QString::fromStdString(orm.name()));
|
||||
m_ui->dteEffectStart->setMsecsSinceEpoch(orm.effectStart().is_set() ? orm.effectStart().get() : 0);
|
||||
m_ui->cbChargeType->setCurrentIndex(m_ui->cbChargeType->findData(orm.chargeStruct().chargeTypeId()));
|
||||
s_lastChargeTypeOffRouteMine = orm.chargeStruct().chargeTypeId();
|
||||
m_ui->sbDurationHours->setValue(orm.effectDuration() / 1000 / 60/ 60); // msecs -> mins -> hours
|
||||
if (orm.impactRadius().is_set())
|
||||
m_ui->sbImpactRadius->setValue(orm.impactRadius().get());
|
||||
|
||||
|
||||
//m_ui->sbRotation->setValue(fmod((static_cast <double>(area.rotation())) * (6400.0 / 360.0), 6400));
|
||||
m_ui->rotationAngleEdit->setValue(area.rotation(), LtsAngleEditBase::AngleUnitType::Deg);
|
||||
|
||||
m_ui->sbDimensionX->setValue(area.width());
|
||||
m_ui->sbDimensionY->setValue(area.height());
|
||||
|
||||
m_ui->cbParty->setCurrentIndex(m_ui->cbParty->findData(orm.partyId().is_set() ? orm.partyId().get() : 0));
|
||||
|
||||
}
|
||||
|
||||
void OffRouteMineEdit::getPositionPolyline()
|
||||
{
|
||||
if (!has2DMap())
|
||||
return;
|
||||
|
||||
const QPointF &bottomCenter = m_ui->positionEdit->coordinate(); // bottomCenter
|
||||
const double heightLength = m_ui->sbDimensionY->value();
|
||||
const double rotationDeg = m_ui->rotationAngleEdit->getAngleConverted(m_ui->rotationAngleEdit->getAngle(),
|
||||
LtsAngleEditBase::AngleUnitType::Deg,
|
||||
m_ui->rotationAngleEdit->getAngleCurrentUnit()); //(m_ui->sbRotation->value()) / 6400. * 360; // ui has angle as 'strich'
|
||||
|
||||
bool isOriginNull = qFuzzyIsNull(bottomCenter.x()) && qFuzzyIsNull(bottomCenter.y());
|
||||
bool isDimNull = qFuzzyIsNull(heightLength);
|
||||
|
||||
QPolygonF coordinates;
|
||||
|
||||
// prepare coordinates if ui contains valid data:
|
||||
if (!isOriginNull && !isDimNull)
|
||||
{
|
||||
coordinates.reserve(2);
|
||||
|
||||
// coord1
|
||||
LtsCoordTrans::UtmCoordinate bottomCenterUtm = LtsCoordTrans::UtmCoordinate::fromGeographic(bottomCenter);
|
||||
coordinates.append(bottomCenter);
|
||||
|
||||
// coord2
|
||||
// interpret length as point:
|
||||
QPoint point(0, heightLength);
|
||||
|
||||
QTransform trans;
|
||||
trans.rotate(-rotationDeg); // QTransform::rotate - counterclockwise
|
||||
point = trans.map(point); // point entsprechend rotieren
|
||||
coordinates.append(bottomCenterUtm.geographic(point)); // offset :-)
|
||||
}
|
||||
|
||||
m_sitMapGuiIfc->getPolyline(this,
|
||||
SLOT(onPolylineData(QPolygonF)),
|
||||
nullptr,
|
||||
2, // minPoints
|
||||
2, // maxPoints
|
||||
s_minHeight, // minSegmentLength
|
||||
s_maxHeight, // maxSegmentLength
|
||||
coordinates);
|
||||
}
|
||||
|
||||
double getAngleDegreeNorth(const QPointF &p1, const QPointF &p2)
|
||||
{
|
||||
double x = p2.x() - p1.x();
|
||||
double y = p2.y() - p1.y();
|
||||
|
||||
// Winkel dcenterUtmer Geraden bestimmen
|
||||
double alphaRad = atan2(y, x);
|
||||
|
||||
// // Fuer Winkel > PI liefert atan2 math. rechts drehende (also negative) Werte.
|
||||
// // Um Werte von 0-2PI zu bekommen muss deshalb hier von 2Pi abgezogen werden.
|
||||
|
||||
alphaRad -= M_PI / 2.0;
|
||||
alphaRad *= -1.0;
|
||||
|
||||
if (alphaRad < 0.0)
|
||||
alphaRad = 2 * M_PI + alphaRad;
|
||||
|
||||
return (alphaRad * 180.0 / M_PI);
|
||||
}
|
||||
|
||||
void OffRouteMineEdit::onPolylineData(const QPolygonF &polyline)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " numberOfPoints: " << polyline.size();
|
||||
|
||||
if (polyline.size() != 2)
|
||||
return;
|
||||
|
||||
// polyline has geoCoords
|
||||
const QPointF &geoCoord1 = polyline[0];
|
||||
const QPointF &geoCoord2 = polyline[1];
|
||||
|
||||
const LtsCoordTrans::UtmCoordinate utm1 = LtsCoordTrans::UtmCoordinate::fromGeographic(geoCoord1);
|
||||
const LtsCoordTrans::UtmCoordinate utm2 = LtsCoordTrans::UtmCoordinate::fromGeographic(geoCoord2);
|
||||
|
||||
// calculate angle, distance using utm, not geo
|
||||
double angleDegNorth = getAngleDegreeNorth(QPointF(utm1.x, utm1.y), QPointF(utm2.x, utm2.y));
|
||||
double distance = LtsCoordTrans::distance(utm1, utm2);
|
||||
|
||||
|
||||
DEBUG_LOG(m_logger) << " distance" << distance;
|
||||
|
||||
// update gui:
|
||||
m_ui->positionEdit->setCoordinate(geoCoord1); // bottomCenter
|
||||
// m_ui->sbDimensionX->setValue(round(width)); // width ist fixed
|
||||
m_ui->sbDimensionY->setValue(round(distance));
|
||||
|
||||
//m_ui->sbRotation->setValue(fmod((angleDegNorth) * 6400 / 360, 6400));
|
||||
m_ui->rotationAngleEdit->setValue(angleDegNorth, LtsAngleEditBase::AngleUnitType::Deg);
|
||||
|
||||
// previewObject:
|
||||
double widthHalf = m_ui->sbDimensionX->value() / 2.0;
|
||||
double height = m_ui->sbDimensionY->value();
|
||||
QPolygonF relativeRect = { {QPointF(- widthHalf , 0 ), // bottomLeft
|
||||
QPointF(- widthHalf , height ), // topLeft
|
||||
QPointF( widthHalf , height ), // topRight
|
||||
QPointF( widthHalf , 0 ) // bottomRight
|
||||
} };
|
||||
QTransform trans;
|
||||
trans.rotate(-angleDegNorth); // rotate is counterclockwise ; move to zero can be skipped here :-)
|
||||
relativeRect = trans.map(relativeRect);
|
||||
|
||||
m_previewPolygon.clear();
|
||||
m_previewPolygon.reserve(relativeRect.size());
|
||||
for (const QPointF &item : qAsConst(relativeRect))
|
||||
m_previewPolygon.append(utm1.geographic(item));
|
||||
|
||||
showPreviewObject();
|
||||
}
|
||||
|
||||
bool OffRouteMineEdit::apply()
|
||||
{
|
||||
std::string name = m_ui->leIdentifier->text().toStdString();
|
||||
qint64 effectStart = m_ui->dteEffectStart->msecsSinceEpoch();
|
||||
int duration = m_ui->sbDurationHours->value() * 60 * 1000 * 60; //hours -> mins -> msecs
|
||||
int chargeType = m_ui->cbChargeType->currentData().toInt();
|
||||
s_lastChargeTypeOffRouteMine = chargeType;
|
||||
double rotation = m_ui->rotationAngleEdit->getAngleConverted(m_ui->rotationAngleEdit->getAngle(),
|
||||
LtsAngleEditBase::AngleUnitType::Deg,
|
||||
m_ui->rotationAngleEdit->getAngleCurrentUnit());//(m_ui->sbRotation->value()) * 360.0 / 6400;
|
||||
int partyId = m_ui->cbParty->currentData().toInt();
|
||||
|
||||
Area area;
|
||||
area.width() = m_ui->sbDimensionX->value();
|
||||
area.height() = m_ui->sbDimensionY->value();
|
||||
area.rotation() = rotation;
|
||||
|
||||
|
||||
// m_ui->positionEdit contains bottomCenter (point to be rotated around)
|
||||
// For request we need cornerBottomLeft:
|
||||
const double width = m_ui->sbDimensionX->value();
|
||||
const double rotationDeg = m_ui->rotationAngleEdit->getAngleConverted(m_ui->rotationAngleEdit->getAngle(),
|
||||
LtsAngleEditBase::AngleUnitType::Deg,
|
||||
m_ui->rotationAngleEdit->getAngleCurrentUnit());//(m_ui->sbRotation->value()) / 6400. * 360; // ui has angle as 'strich'
|
||||
|
||||
QPointF bottomLeftGeo = bottomCenterToBottomLeftGeo(m_ui->positionEdit->coordinate(), width, rotationDeg);
|
||||
area.cornerBottomLeft() = Core::GeoPosition2D(bottomLeftGeo.x(), bottomLeftGeo.y());
|
||||
|
||||
OffRouteMineModifyRequest req(m_aesItem.id(),
|
||||
name,
|
||||
duration,
|
||||
chargeType,
|
||||
area,
|
||||
dds::core::optional<double>(),
|
||||
LtsUtils::toOptional(effectStart),
|
||||
LtsUtils::toOptional(partyId)
|
||||
);
|
||||
|
||||
if (chargeType == s_offRouteMine2)
|
||||
req.impactRadius().set(m_ui->sbImpactRadius->value());
|
||||
|
||||
DEBUG_LOG(m_logger) << " req=" << req;
|
||||
|
||||
m_requestHelper->addRequest([this,req]()
|
||||
{
|
||||
return m_ftc->offRouteMineModifyRequest(req, this);
|
||||
});
|
||||
|
||||
return m_requestHelper->startRequests();
|
||||
}
|
||||
|
||||
void OffRouteMineEdit::showPreviewObject()
|
||||
{
|
||||
if (!m_sitMapGuiIfc)
|
||||
return;
|
||||
|
||||
if (m_previewPolygon.isEmpty())
|
||||
return;
|
||||
|
||||
m_sitMapGuiIfc->displayPreviewObject(this, m_previewPolygon, true);
|
||||
}
|
||||
|
||||
void OffRouteMineEdit::onChargeTypeChanged(int index)
|
||||
{
|
||||
Q_UNUSED(index);
|
||||
|
||||
int chargeType = m_ui->cbChargeType->currentData().toInt();
|
||||
|
||||
if ( chargeType != s_offRouteMine2 )
|
||||
{
|
||||
s_maxHeight = 40;
|
||||
m_ui->sbDimensionY->setMaximum(s_maxHeight);
|
||||
m_ui->lblImpactRadius->hide();
|
||||
m_ui->sbImpactRadius->hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
s_maxHeight = 70;
|
||||
m_ui->sbDimensionY->setMaximum(s_maxHeight);
|
||||
#ifdef LTS_DEBUG
|
||||
m_ui->lblImpactRadius->show();
|
||||
m_ui->sbImpactRadius->show();
|
||||
#else
|
||||
m_ui->lblImpactRadius->hide();
|
||||
m_ui->sbImpactRadius->hide();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
} // namespace AreaEffectSimulation
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* AreaEffectSimulation - Off Route Mine Edit Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Hanna E. Rathje, SLSE, 2023-07-14
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Plugins/AreaEffectSimulation/Gui/Base/aes_base_edit.h>
|
||||
#include <Plugins/ProjectDataManagement/pdm_gui_plugin_interface.h>
|
||||
#include <LtsWidgets/lts_angle_edit.h>
|
||||
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class OffRouteMineEdit;
|
||||
}
|
||||
|
||||
namespace AreaEffectSimulation
|
||||
{
|
||||
|
||||
class OffRouteMineEdit final
|
||||
: public BaseEdit
|
||||
, protected AreaEffectSimulation::Interface::Ftc::OffRouteMineModifyReplyHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit OffRouteMineEdit(const QString &menuGroup, QWidget *parent = nullptr);
|
||||
~OffRouteMineEdit();
|
||||
|
||||
using LtsAngleEditBase = LtsWidgets::LtsAngleEdit;
|
||||
|
||||
QString dialogIdentifier() const override
|
||||
{
|
||||
return m_aesItem.id() <= 0 ? QStringLiteral("AddOffRouteMine") : QStringLiteral("EditOffRouteMine%1").arg(m_aesItem.id());
|
||||
}
|
||||
bool init(int aesItemId, bool copy, LtsSession::LtsSession *session);
|
||||
|
||||
void onOffRouteMineModifyReply(const Core::FunctionReplyObject &replyObject) override final { onAesItemModifyReply(replyObject); }
|
||||
|
||||
private:
|
||||
static double s_minImpactRadius;
|
||||
static double s_maxImpactRadius;
|
||||
static double s_stepImpactRadius;
|
||||
static double s_defaultImpactRadius;
|
||||
static int s_minDurationHours;
|
||||
static int s_maxDurationHours;
|
||||
static double s_minWidth;
|
||||
static double s_maxWidth;
|
||||
static double s_stepWidth;
|
||||
static double s_minHeight;
|
||||
static double s_maxHeight;
|
||||
static double s_stepHeight;
|
||||
static double s_minRotation;
|
||||
static double s_maxRotation;
|
||||
static double s_stepRotation;
|
||||
|
||||
|
||||
void retranslate() override;
|
||||
void setData(const OffRouteMine &orm, bool copy);
|
||||
void enableUiElements(bool enable) override;
|
||||
void setPbDangerAreaText();
|
||||
|
||||
private Q_SLOTS:
|
||||
void getPositionPolyline();
|
||||
void onPolylineData(const QPolygonF &polyline);
|
||||
|
||||
void onChargeTypeChanged(int index);
|
||||
bool apply() override;
|
||||
void showPreviewObject() override;
|
||||
|
||||
private:
|
||||
QPolygonF m_previewPolygon;
|
||||
Ui::OffRouteMineEdit *m_ui;
|
||||
std::shared_ptr<ProjectDataManagement::ForeignGuiInterface> m_pdmGuiIfc;
|
||||
};
|
||||
|
||||
} //namespace AreaEffectSimulation
|
||||
+343
@@ -0,0 +1,343 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>OffRouteMineEdit</class>
|
||||
<widget class="QWidget" name="OffRouteMineEdit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>757</width>
|
||||
<height>230</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">Aes Contamination Edit</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lblIdentifier">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Identifier:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="leIdentifier">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QLabel" name="lblParty">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Firing Party:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="4">
|
||||
<widget class="LtsWidgets::LtsComboBox" name="cbParty">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="currentText">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lblEffectStart">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Effect Start:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="LtsWidgets::LtsDateTimeEdit" name="dteEffectStart" native="true">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</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>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="5" rowspan="5">
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>2</width>
|
||||
<height>31</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="0" rowspan="2">
|
||||
<widget class="QLabel" name="lblChargeType">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Mine Type:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" rowspan="2">
|
||||
<widget class="LtsWidgets::LtsComboBox" name="cbChargeType">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="currentText">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<spacer name="horizontalSpacer">
|
||||
<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="3" column="3">
|
||||
<widget class="QLabel" name="lblRotation">
|
||||
<property name="text">
|
||||
<string>Aiming Axis:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="4">
|
||||
<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="4" column="0">
|
||||
<widget class="QLabel" name="lblDuration">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Duration [h]:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QSpinBox" name="sbDurationHours">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>4</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="lblPosition">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Position:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="LtsCoordWidget::LtsCoordWidget" name="positionEdit" native="true">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="showToolTip" stdset="0">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pbPosition">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<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="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normaloff>:/style/remove.svg</normaloff>:/style/remove.svg</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="6" column="1" colspan="5">
|
||||
<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="1" column="3">
|
||||
<widget class="QLabel" name="lblDimension">
|
||||
<property name="text">
|
||||
<string>Dimension [m]:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="4">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QSpinBox" name="sbDimensionX">
|
||||
<property name="correctionMode">
|
||||
<enum>QAbstractSpinBox::CorrectToPreviousValue</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblOperatorA">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">x</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="sbDimensionY"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="4" column="3">
|
||||
<widget class="QLabel" name="lblImpactRadius">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>ImpactRadius [m]:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="4">
|
||||
<widget class="QSpinBox" name="sbImpactRadius">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>1000</number>
|
||||
</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>leIdentifier</tabstop>
|
||||
<tabstop>dteEffectStart</tabstop>
|
||||
<tabstop>cbChargeType</tabstop>
|
||||
<tabstop>sbDurationHours</tabstop>
|
||||
<tabstop>positionEdit</tabstop>
|
||||
<tabstop>pbPosition</tabstop>
|
||||
<tabstop>pbClear</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
+112
@@ -0,0 +1,112 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* AreaEffectSimulation - Off Route Mine Overview Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-07-07
|
||||
*/
|
||||
|
||||
#include "aes_off_route_mine_list.h"
|
||||
#include "aes_off_route_mine_model.h"
|
||||
#include "aes_off_route_mine_edit.h"
|
||||
#include "CustomView/aes_off_route_mine.h"
|
||||
|
||||
#include <LtsSession/lts_session_data.h>
|
||||
|
||||
namespace AreaEffectSimulation
|
||||
{
|
||||
|
||||
OffRouteMineList::OffRouteMineList(const QString &menuGroup, QWidget *parent)
|
||||
: AesItemListTmpl<OffRouteMine>(menuGroup, parent)
|
||||
{
|
||||
}
|
||||
|
||||
bool OffRouteMineList::init(LtsSession::LtsSession *session)
|
||||
{
|
||||
if (!AesItemList::init(session))
|
||||
return false;
|
||||
|
||||
bool editable = (LtsSessionData::LtsSessionData::getInstance()->hasOperatorRight(OperatorRights::MineSingleVirtualEdit) ) ||
|
||||
m_session->app() == LtsAppDescriptor::App::OC;
|
||||
if (session->isReplayPartition())
|
||||
editable = false;
|
||||
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Edit, editable);
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Add, editable);
|
||||
|
||||
QSortFilterProxyModel *m = m_model;
|
||||
setDataViewModel(m, [this]() { return new CustomViewOffRouteMine(this); });
|
||||
|
||||
#ifndef LTS_DEBUG
|
||||
hideColumn(OffRouteMineModel::BcId);
|
||||
hideColumn(OffRouteMineModel::ColImpactRadius);
|
||||
#endif
|
||||
hideColumn(OffRouteMineModel::BcParticipant);
|
||||
hideColumn(OffRouteMineModel::BcEffectSource);
|
||||
|
||||
setSortIndicator(OffRouteMineModel::BcName);
|
||||
|
||||
enaDisa();
|
||||
|
||||
setOnlineHelpFilename(QStringLiteral("Situation-Mine_PzAbwRiMi"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void OffRouteMineList::createModel()
|
||||
{
|
||||
m_model = new AesItemSortFilterProxyModelTmpl<OffRouteMine>(m_session, this);
|
||||
OffRouteMineModel *sourceModel = new OffRouteMineModel(this);
|
||||
sourceModel->initModel(m_session);
|
||||
m_model->setSourceModel(sourceModel);
|
||||
}
|
||||
|
||||
void OffRouteMineList::onAddAesItem()
|
||||
{
|
||||
OffRouteMineEdit *dialog = new OffRouteMineEdit(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 OffRouteMineList::onEditAesItem()
|
||||
{
|
||||
const int aesItemId = model()->aesId(currentRow());
|
||||
|
||||
if (aesItemId <= 0)
|
||||
return;
|
||||
|
||||
DEBUG_LOG(m_logger) << "current OffRouteMineId: " << aesItemId;
|
||||
|
||||
OffRouteMineEdit *dialog = new OffRouteMineEdit(m_menuGroup, this);
|
||||
if (dialog->init(aesItemId, false, m_session))
|
||||
addDialog(dialog, m_menuGroup, dialog->dialogIdentifier(), LtsWidgets::LayoutArea::eDialogTab);
|
||||
else
|
||||
delete dialog;
|
||||
}
|
||||
|
||||
void OffRouteMineList::onRemoveAesItem()
|
||||
{
|
||||
const int aesItemId = model()->aesId(currentRow());
|
||||
Core::RemoveElementRequest req(aesItemId);
|
||||
m_requestHelper->startSingleRequest([req, this]()
|
||||
{
|
||||
return m_ftc->offRouteMineRemoveRequest(req, this);
|
||||
});
|
||||
}
|
||||
|
||||
void OffRouteMineList::retranslate()
|
||||
{
|
||||
translateBase(tr("OffRouteMine"));
|
||||
}
|
||||
|
||||
void OffRouteMineList::onOffRouteMineRemoveReply(const Core::FunctionReplyObject &replyObject)
|
||||
{
|
||||
m_requestHelper->requestReply(replyObject);
|
||||
}
|
||||
|
||||
} // namespace AreaEffectSimulation
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* AreaEffectSimulation - Off Route Mine Overview Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Hanna E. Rathje, 2023-07-17
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Plugins/AreaEffectSimulation/Gui/Base/aes_itemlist.h>
|
||||
#include <Plugins/AreaEffectSimulation/Gui/Base/aes_base_model.h>
|
||||
|
||||
namespace AreaEffectSimulation
|
||||
{
|
||||
|
||||
class OffRouteMineList final : public AesItemListTmpl<OffRouteMine>
|
||||
, protected AreaEffectSimulation::Interface::Ftc::OffRouteMineRemoveReplyHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit OffRouteMineList(const QString &menuGroup, QWidget *parent = nullptr);
|
||||
|
||||
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 onOffRouteMineRemoveReply(const Core::FunctionReplyObject &replyObject) override;
|
||||
|
||||
};
|
||||
}
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for AreaEffectSimulation - Off Route Mine Overview Dialog Model
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*
|
||||
* Created by Hanna E. Rathje, 20-23-07-14
|
||||
*/
|
||||
|
||||
#include "aes_off_route_mine_model.h"
|
||||
|
||||
namespace AreaEffectSimulation
|
||||
{
|
||||
|
||||
bool OffRouteMineModel::initModel(LtsSession::LtsSession *session)
|
||||
{
|
||||
if (!AesGuiBaseModel::initModel(session))
|
||||
return false;
|
||||
|
||||
connect(m_aesDtc.get(), &Interface::Dtc::offRouteMineChanged,
|
||||
this, &OffRouteMineModel::onDataChanged);
|
||||
|
||||
fillAvailableChargeIds(ProjectDataManagement::GearClass::OffRouteMine);
|
||||
|
||||
m_aesDtc->offRouteMines([this](const OffRouteMine &item) { insertRow(item); });
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
QVariant OffRouteMineModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (!indexIsValid(index))
|
||||
return QVariant();
|
||||
|
||||
const OffRouteMine &orm = getRowData(index.row());
|
||||
|
||||
if (index.column() < cntBaseColumns())
|
||||
return AesGuiBaseModel::data(orm, index.column(), role);
|
||||
|
||||
if (role != Qt::DisplayRole)
|
||||
return QVariant();
|
||||
|
||||
switch (index.column())
|
||||
{
|
||||
case ColImpactRadius:
|
||||
{
|
||||
if (orm.impactRadius().is_set())
|
||||
return QLocale().toString(orm.impactRadius().get(), 'f', 2);
|
||||
else
|
||||
return {};
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
} // namespace AreaEffectSimulation
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for AreaEffectSimulation - Off Route Mine Overview Dialog Model
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*
|
||||
* Created by Hanna E. Rathje, SLSE, 2023-07-14
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QSet>
|
||||
#include <Plugins/AreaEffectSimulation/Gui/Base/aes_base_model.h>
|
||||
#include <ProjectDataManagement/pdm_enums.hpp>
|
||||
|
||||
namespace LtsSession
|
||||
{
|
||||
class LtsSession;
|
||||
}
|
||||
|
||||
namespace AreaEffectSimulation
|
||||
{
|
||||
|
||||
|
||||
/************ Abstract Class for Mine Single Virtual ***************/
|
||||
class OffRouteMineModel : public AesGuiBaseModel<OffRouteMine>
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum AdditionalColumns {ColImpactRadius = BcCount };
|
||||
bool initModel(LtsSession::LtsSession *session) override;
|
||||
|
||||
explicit OffRouteMineModel(QObject *parent = nullptr)
|
||||
: AesGuiBaseModel<OffRouteMine>(parent, {tr("Impact Radius")})
|
||||
{}
|
||||
|
||||
QVariant data(const QModelIndex &index, int role) const override final;
|
||||
};
|
||||
|
||||
} //namespace AreaEffectSimulation
|
||||
|
||||
|
||||
Reference in new issue
Block a user