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,74 @@
/**
* @RDE_HEADER@
* CustomView for AES GasPipe
* $Id$
* $HeadURL$
* $Author$
* Created by hjl, SLSE, 2017-06-20
*/
#include "aes_gas_pipe.h"
#include "ui_aes_gas_pipe.h"
#include "aes_gas_pipes_model.h"
#include <Services/AreaEffectSimulation/Utils/polygons.h>
namespace AreaEffectSimulation
{
CustomViewGasPipe::CustomViewGasPipe(QWidget *parent)
: AbstractDisplayWidget(parent)
, m_ui(new Ui::CustomViewGasPipe)
{
m_ui->setupUi(this);
}
CustomViewGasPipe::~CustomViewGasPipe()
{
delete m_ui;
}
bool CustomViewGasPipe::init(const QModelIndex &idx)
{
if (!idx.isValid())
return false;
m_ui->lblName->setText(rowData(idx, AreaEffectSimulation::GasPipesModel::BcName).toString());
m_ui->lblIcon->clear();
m_ui->lblIcon->setAutoFillBackground(true);
const AesItemSortFilterProxyModel *sfpm = qobject_cast<const AesItemSortFilterProxyModel*>(idx.model());
if (!sfpm)
return false;
const GasPipesModel *aesModel = qobject_cast<const GasPipesModel*>(sfpm->sourceModel());
if (!aesModel)
return false;
const auto srcIdx = sfpm->mapToSource(idx);
GasPipe gasPipe = aesModel->getRowData(srcIdx.row());
calculateIcon(gasPipe, sfpm->partyColor(idx.row()));
return true;
}
bool CustomViewGasPipe::calculateIcon(const AreaEffectSimulation::GasPipe &line, const QColor &color)
{
if (line.segments().size() == 0)
return false;
QVector<Database::AesGasPipeSegment> segments;
segments.reserve(line.segments().size());
int counter = 0;
for (const Core::GeoPosition2D &s : line.segments())
{
Database::AesGasPipeSegment segment;
segment.position = QPointF(s.lon(), s.lat());
segments.append(segment);
counter++;
}
QPolygonF poly = AreaEffectSimulation::Polygons::gasPipe(segments, line.width());
Qt::BrushStyle bStyle = Qt::BrushStyle::NoBrush;
const auto pix = Polygons::pixmapFromPolygon(poly, color, ICON_RESOLUTION, bStyle, true);
m_ui->lblIcon->setPixmap(pix);
return true;
}
} // namespace AreaEffectSimulation
@@ -0,0 +1,36 @@
/**
* @RDE_HEADER@
* CustomView for AES GasPipe
* $Id$
* $HeadURL$
* $Author$
* Created by hjl, SLSE, 2017-06-20
*/
#pragma once
#include <Viewer/LtsDataView/abstract_display_widget.h>
namespace Ui
{
class CustomViewGasPipe;
}
namespace AreaEffectSimulation
{
class GasPipe;
class CustomViewGasPipe final : public LtsDataView::AbstractDisplayWidget
{
Q_OBJECT
public:
explicit CustomViewGasPipe(QWidget *parent = nullptr);
~CustomViewGasPipe();
bool init(const QModelIndex &idx) override final;
private:
bool calculateIcon(const AreaEffectSimulation::GasPipe &line, const QColor &color);
Ui::CustomViewGasPipe *m_ui;
};
} // namespace AreaEffectSimulation
@@ -0,0 +1,73 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CustomViewGasPipe</class>
<widget class="QWidget" name="CustomViewGasPipe">
<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>
<property name="toolTip">
<string/>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="lblName">
<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>
</layout>
</item>
<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>
</widget>
<customwidgets>
<customwidget>
<class>AreaEffectSimulation::PixmapLabel</class>
<extends>QLabel</extends>
<header>AreaEffectSimulation/Gui/Base/aes_pixmap_label.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>