Initial commit

This commit is contained in:
torsten committed 2026-08-13 18:33:10 +02:00
commit b7d90b9afe
16245 files changed
+3396666

No files matched your search

@@ -0,0 +1,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
@@ -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
@@ -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>
@@ -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
@@ -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
@@ -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>