Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
@@ -0,0 +1,52 @@
|
||||
#
|
||||
# $Id$
|
||||
# $HeadURL$
|
||||
# $Author$
|
||||
# Created by hjl, SLSE, 2017-06-06
|
||||
#
|
||||
|
||||
ADD_INTERFACE_LIBRARY(
|
||||
AesGasPipeGuiPluginInterface
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/aes_gas_pipe_gui_plugin_interface.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/..
|
||||
)
|
||||
|
||||
|
||||
SET(aes_gas_pipe_gui_SRCS
|
||||
aes_gas_pipe_gui_plugin.h
|
||||
aes_gas_pipe_gui_plugin.cpp
|
||||
aes_gas_pipe_list.h
|
||||
aes_gas_pipe_list.cpp
|
||||
aes_gas_pipes_model.h
|
||||
aes_gas_pipes_model.cpp
|
||||
aes_gas_pipe_edit.h
|
||||
aes_gas_pipe_edit.cpp
|
||||
CustomView/aes_gas_pipe.h
|
||||
CustomView/aes_gas_pipe.cpp
|
||||
)
|
||||
|
||||
NGL_WRAP_UI(aes_gas_pipe_gui_SRCS
|
||||
aes_gas_pipe_edit.ui
|
||||
CustomView/aes_gas_pipe.ui
|
||||
)
|
||||
|
||||
NGL_ADD_LIBRARY(WS AesGasPipeGuiPlugin MODULE ${aes_gas_pipe_gui_SRCS})
|
||||
NGL_TARGET_LINK_LIBRARIES(AesGasPipeGuiPlugin
|
||||
AesBaseGui
|
||||
AesGasPipeGuiPluginInterface
|
||||
ngltools
|
||||
AesDataPluginInterface
|
||||
PdmGuiPluginInterface
|
||||
AesInfoGuiPluginInterface
|
||||
NGLLogger
|
||||
Qt5::Widgets
|
||||
LtsWidgets
|
||||
LtsSession
|
||||
LtsSessionData
|
||||
LtsDataView
|
||||
SituationMapGuiPluginInterface
|
||||
LtsUtilsGuiDds
|
||||
LtsUtilsSettings
|
||||
)
|
||||
|
||||
NGL_INSTALL_TARGET(AesGasPipeGuiPlugin)
|
||||
@@ -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>
|
||||
@@ -0,0 +1,232 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* AreaEffectSimulation - NContamination Edit Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-07-07
|
||||
*/
|
||||
|
||||
|
||||
#include "aes_gas_pipe_edit.h"
|
||||
#include "ui_aes_gas_pipe_edit.h"
|
||||
|
||||
#include <LtsSession/lts_session_data.h>
|
||||
#include <Plugins/AreaEffectSimulation/aes_data_plugin_interface.h>
|
||||
#include <Plugins/SituationMapPlugin/situation_map_gui_plugin_interface.h>
|
||||
#include <PluginInterfaces/gui_plugin_interface.h>
|
||||
|
||||
#include <QDoubleSpinBox>
|
||||
|
||||
namespace AreaEffectSimulation
|
||||
{
|
||||
|
||||
GasPipeEdit::GasPipeEdit(const QString &menuGroup, QWidget *parent)
|
||||
: BaseEdit(menuGroup, QLatin1String("GasPipeEdit"), parent)
|
||||
, m_ui(new Ui::GasPipeEdit)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
m_ui->sbWidth->setMinimum(s_minWidth);
|
||||
m_ui->sbWidth->setMaximum(s_maxWidth);
|
||||
m_ui->sbWidth->setSingleStep(s_stepWidth);
|
||||
|
||||
m_uiRequirements->addRequirement({m_ui->lblGeometry, [this]() { return (!m_ui->positionEdit_1->coordinate().isNull() &&
|
||||
!m_ui->positionEdit_2->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); }});
|
||||
|
||||
enaDisa();
|
||||
connect(m_ui->sbWidth, &QSpinBox::editingFinished, this, &GasPipeEdit::correctSpinBoxValue);
|
||||
connect(m_ui->pbClear, &QPushButton::clicked, this, &GasPipeEdit::clearCoordinates);
|
||||
|
||||
setOnlineHelpFilename(QStringLiteral("Situation-Add_Gas_Pipeline"));
|
||||
}
|
||||
|
||||
GasPipeEdit::~GasPipeEdit()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
void GasPipeEdit::retranslate()
|
||||
{
|
||||
translate(m_ui, m_aesItem, tr("Gas Pipe"));
|
||||
}
|
||||
|
||||
std::vector<LtsCoordWidget::LtsCoordWidget *> GasPipeEdit::coordWidgets() const
|
||||
{
|
||||
return {m_ui->positionEdit_1,
|
||||
m_ui->positionEdit_2,
|
||||
m_ui->positionEdit_3,
|
||||
m_ui->positionEdit_4,
|
||||
m_ui->positionEdit_5,
|
||||
m_ui->positionEdit_6,
|
||||
m_ui->positionEdit_7,
|
||||
m_ui->positionEdit_8,
|
||||
m_ui->positionEdit_9,
|
||||
m_ui->positionEdit_10,
|
||||
m_ui->positionEdit_11};
|
||||
}
|
||||
|
||||
void GasPipeEdit::enableUiElements(bool enable)
|
||||
{
|
||||
|
||||
m_ui->leIdentifier->setMaxLength(30);
|
||||
|
||||
m_ui->pbPosition->setEnabled(m_sitMapGuiIfc && enable);
|
||||
setEffectStartEnabled(m_ui->dteEffectStart, enable);
|
||||
enabledCoordinates(enable);
|
||||
m_ui->sbWidth->setEnabled(enable);
|
||||
m_ui->pbClear->setEnabled(enable);
|
||||
m_ui->leIdentifier->setEnabled(enable || isOnlyNameModifiable());
|
||||
m_ui->cbParty->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->gasPipe(m_aesItem.id());
|
||||
setData(baseData, false);
|
||||
__unchange__();
|
||||
if (name != m_ui->leIdentifier->text())
|
||||
m_ui->leIdentifier->setText(name);
|
||||
}
|
||||
}
|
||||
|
||||
bool GasPipeEdit::init(int aesItemId, bool copy,
|
||||
LtsSession::LtsSession *session)
|
||||
{
|
||||
if (!BaseEdit::init(aesItemId, session))
|
||||
return false;
|
||||
|
||||
bool editable = LtsSessionData::LtsSessionData::getInstance()->hasOperatorRight(OperatorRights::GasPipesEdit) ||
|
||||
m_session->app() == LtsAppDescriptor::App::OC;
|
||||
bool readable = LtsSessionData::LtsSessionData::getInstance()->hasOperatorRight(OperatorRights::GasPipesShow);
|
||||
|
||||
if (!readable && !editable)
|
||||
return false;
|
||||
|
||||
// Todo: Older allowed?
|
||||
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, &GasPipeEdit::getPolygon);
|
||||
else
|
||||
m_ui->pbPosition->setEnabled(false);
|
||||
|
||||
m_ppmGuiCbxIfc->fillPartyComboBox(m_ui->cbParty);
|
||||
|
||||
if (aesItemId > 0)
|
||||
{
|
||||
auto baseData = m_dtc->gasPipe(aesItemId);
|
||||
setData(baseData, copy);
|
||||
}
|
||||
|
||||
enableUiElements(editable && isModifiable() && !isOnlyNameModifiable());
|
||||
|
||||
connect(m_dtc.get(), &AreaEffectSimulation::Interface::Dtc::gasPipeChanged,
|
||||
this, &BaseEdit::onAreaChanged);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void GasPipeEdit::setData(const GasPipe &aesItem, bool copy)
|
||||
{
|
||||
m_aesItem = aesItem;
|
||||
if (copy)
|
||||
{
|
||||
m_aesItem.id(0);
|
||||
m_aesItem.effectStateId(AreaEffectSimulation::AesEffectState_def::get_default());
|
||||
}
|
||||
m_ui->leIdentifier->setText(QString::fromStdString(aesItem.name()));
|
||||
m_ui->sbWidth->setValue(aesItem.width());
|
||||
m_ui->dteEffectStart->setMsecsSinceEpoch(aesItem.effectStart().is_set() ? aesItem.effectStart().get() : 0);
|
||||
if ( aesItem.partyId().is_set())
|
||||
m_ui->cbParty->setCurrentIndex(m_ui->cbParty->findData(aesItem.partyId().get()));
|
||||
|
||||
setCoordinates(aesItem.segments());
|
||||
}
|
||||
|
||||
void GasPipeEdit::getPolygon()
|
||||
{
|
||||
if (!has2DMap())
|
||||
return;
|
||||
|
||||
m_sitMapGuiIfc->getCorridor(this,
|
||||
SLOT(onPolygonData(double, QVector<QPointF>, QPolygonF)),
|
||||
nullptr,
|
||||
s_minWidth,
|
||||
s_maxWidth,
|
||||
s_maxLength,
|
||||
s_maxSegments,
|
||||
true,
|
||||
getCoordinatesQPointF(),
|
||||
50);
|
||||
}
|
||||
|
||||
|
||||
void GasPipeEdit::onPolygonData(const double width, const QVector<QPointF> &polygon, const QPolygonF &bufferOutlinePolygon)
|
||||
{
|
||||
if (polygon.size() < 2)
|
||||
return;
|
||||
|
||||
m_previewPolygon = bufferOutlinePolygon;
|
||||
|
||||
// Only Centerline allowed, no reverse polygon
|
||||
setCoordinates(polygon, false);
|
||||
m_ui->sbWidth->setValue(std::abs(width));
|
||||
|
||||
showPreviewObject();
|
||||
}
|
||||
|
||||
bool GasPipeEdit::apply()
|
||||
{
|
||||
std::string name = m_ui->leIdentifier->text().toStdString();
|
||||
double width = m_ui->sbWidth->value();
|
||||
qint64 effectStart = m_ui->dteEffectStart->msecsSinceEpoch();
|
||||
int partyId = m_ui->cbParty->currentData().toInt();
|
||||
int effectDuration = 10000; // 10 Seconds
|
||||
|
||||
if (!checkSegementLengths(this))
|
||||
return false;
|
||||
|
||||
const GasPipeModifyRequest req(m_aesItem.id(),
|
||||
LtsUtils::toOptional(effectStart),
|
||||
LtsUtils::toOptional(partyId),
|
||||
name,
|
||||
getCoordinates(),
|
||||
width,
|
||||
effectDuration);
|
||||
/*const GasPipeModifyRequest req(m_aesItem.id(),
|
||||
name,
|
||||
1 * 60 * 1000, // 1min
|
||||
width,
|
||||
getCoordinates(),
|
||||
LtsUtils::toOptional(effectStart),
|
||||
dds::core::optional<int32_t>(),
|
||||
dds::core::optional<int32_t>());*/
|
||||
|
||||
return m_requestHelper->startSingleRequest([this, req]()
|
||||
{
|
||||
return m_ftc->gasPipeModifyRequest(req, this);
|
||||
});
|
||||
}
|
||||
|
||||
void GasPipeEdit::showPreviewObject()
|
||||
{
|
||||
if (!m_sitMapGuiIfc)
|
||||
return;
|
||||
|
||||
if (m_previewPolygon.isEmpty())
|
||||
return;
|
||||
|
||||
m_sitMapGuiIfc->displayPreviewObject(this, m_previewPolygon, true);
|
||||
}
|
||||
|
||||
} // namespace AreaEffectSimulation
|
||||
@@ -0,0 +1,69 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* AreaEffectSimulation - Explosion Edit Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-07-07
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Plugins/AreaEffectSimulation/Gui/Base/aes_base_edit.h>
|
||||
#include <AreaEffectSimulation/aes_ftc.h>
|
||||
|
||||
class QDoubleSpinBox;
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class GasPipeEdit;
|
||||
}
|
||||
|
||||
namespace AreaEffectSimulation
|
||||
{
|
||||
|
||||
class GasPipeEdit final
|
||||
: public BaseEdit
|
||||
, protected AreaEffectSimulation::Interface::Ftc::GasPipeModifyReplyHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit GasPipeEdit(const QString &menuGroup, QWidget *parent = nullptr);
|
||||
~GasPipeEdit();
|
||||
|
||||
QString dialogIdentifier() const override
|
||||
{
|
||||
return m_aesItem.id() <= 0 ? QStringLiteral("AddGasPipe") : QStringLiteral("EditGasPipe%1").arg(m_aesItem.id());
|
||||
}
|
||||
bool init(int aesItemId, bool copy, LtsSession::LtsSession *session);
|
||||
|
||||
void onGasPipeModifyReply(const Core::FunctionReplyObject &replyObject) override final { onAesItemModifyReply(replyObject); }
|
||||
|
||||
private:
|
||||
void retranslate() override;
|
||||
std::vector<LtsCoordWidget::LtsCoordWidget *> coordWidgets() const override;
|
||||
|
||||
static constexpr int s_minWidth = 5;
|
||||
static constexpr int s_maxWidth = 50;
|
||||
static constexpr int s_stepWidth = 1;
|
||||
static constexpr int s_maxLength = 1000;
|
||||
static constexpr int s_maxSegments = 11;
|
||||
|
||||
void setData(const GasPipe &aesItem, bool copy);
|
||||
void enableUiElements(bool enable) override;
|
||||
AesItem aesItem(int aesItemId) const;
|
||||
double getMaxLength() const override { return s_maxLength; }
|
||||
|
||||
private Q_SLOTS:
|
||||
void getPolygon();
|
||||
void onPolygonData(const double width, const QVector<QPointF> &polygon, const QPolygonF &bufferOutlinePolygon);
|
||||
bool apply() override;
|
||||
void showPreviewObject() override;
|
||||
|
||||
private:
|
||||
Ui::GasPipeEdit *m_ui;
|
||||
QPolygonF m_previewPolygon;
|
||||
};
|
||||
|
||||
} //namespace AreaEffectSimulation
|
||||
@@ -0,0 +1,238 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>GasPipeEdit</class>
|
||||
<widget class="QWidget" name="GasPipeEdit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1069</width>
|
||||
<height>250</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">Aes Gas Pipe Edit</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="2" column="6">
|
||||
<widget class="LtsCoordWidget::LtsCoordWidget" name="positionEdit_9" native="true"/>
|
||||
</item>
|
||||
<item row="6" column="4">
|
||||
<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="5" column="4">
|
||||
<widget class="LtsCoordWidget::LtsCoordWidget" name="positionEdit_6" native="true"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lblIdentifier">
|
||||
<property name="text">
|
||||
<string>Identifier:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="4">
|
||||
<widget class="LtsCoordWidget::LtsCoordWidget" name="positionEdit_3" native="true"/>
|
||||
</item>
|
||||
<item row="3" column="4">
|
||||
<widget class="LtsCoordWidget::LtsCoordWidget" name="positionEdit_4" native="true"/>
|
||||
</item>
|
||||
<item row="1" column="7">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="4" column="4">
|
||||
<widget class="LtsCoordWidget::LtsCoordWidget" name="positionEdit_5" native="true"/>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="LtsWidgets::LtsDateTimeEdit" name="dteEffectStart" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="checkable" stdset="0">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="withButtons" stdset="0">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="withSlider" stdset="0">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="withReset" stdset="0">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lblEffectStart">
|
||||
<property name="text">
|
||||
<string>Activation Time:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="6">
|
||||
<widget class="LtsCoordWidget::LtsCoordWidget" name="positionEdit_11" native="true"/>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QPushButton" name="pbPosition">
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../Styles/Light/resources/rme_light_style.qrc">
|
||||
<normaloff>:/style/position.svg</normaloff>:/style/position.svg</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QLabel" name="lblGeometry">
|
||||
<property name="text">
|
||||
<string>Geometry:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="4">
|
||||
<widget class="LtsCoordWidget::LtsCoordWidget" name="positionEdit_2" native="true"/>
|
||||
</item>
|
||||
<item row="0" column="6">
|
||||
<widget class="LtsCoordWidget::LtsCoordWidget" name="positionEdit_7" native="true"/>
|
||||
</item>
|
||||
<item row="3" column="6">
|
||||
<widget class="LtsCoordWidget::LtsCoordWidget" name="positionEdit_10" native="true"/>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="leIdentifier"/>
|
||||
</item>
|
||||
<item row="1" column="6">
|
||||
<widget class="LtsCoordWidget::LtsCoordWidget" name="positionEdit_8" native="true"/>
|
||||
</item>
|
||||
<item row="0" column="4">
|
||||
<widget class="LtsCoordWidget::LtsCoordWidget" name="positionEdit_1" native="true"/>
|
||||
</item>
|
||||
<item row="2" column="5">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<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="0">
|
||||
<widget class="QLabel" name="lblWidth">
|
||||
<property name="text">
|
||||
<string>Width [m]:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="3">
|
||||
<widget class="QPushButton" name="pbClear">
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../Styles/Light/resources/rme_light_style.qrc">
|
||||
<normaloff>:/style/remove.svg</normaloff>:/style/remove.svg</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="lblParty">
|
||||
<property name="text">
|
||||
<string>Party:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="LtsWidgets::LtsComboBox" name="cbParty"/>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QSpinBox" name="sbWidth"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>LtsCoordWidget::LtsCoordWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>LtsCoordTrans/lts_coord_widget.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::LtsComboBox</class>
|
||||
<extends>QComboBox</extends>
|
||||
<header>LtsWidgets/lts_combo_box.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>dteEffectStart</tabstop>
|
||||
<tabstop>leIdentifier</tabstop>
|
||||
<tabstop>sbWidth</tabstop>
|
||||
<tabstop>pbPosition</tabstop>
|
||||
<tabstop>pbClear</tabstop>
|
||||
<tabstop>positionEdit_1</tabstop>
|
||||
<tabstop>positionEdit_2</tabstop>
|
||||
<tabstop>positionEdit_3</tabstop>
|
||||
<tabstop>positionEdit_4</tabstop>
|
||||
<tabstop>positionEdit_5</tabstop>
|
||||
<tabstop>positionEdit_6</tabstop>
|
||||
<tabstop>positionEdit_7</tabstop>
|
||||
<tabstop>positionEdit_8</tabstop>
|
||||
<tabstop>positionEdit_9</tabstop>
|
||||
<tabstop>positionEdit_10</tabstop>
|
||||
<tabstop>positionEdit_11</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="../../../Styles/Light/resources/rme_light_style.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -0,0 +1,93 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Gui Plugin for AreaEffectSimulation - GasPipes
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by hjl, SLSE, 2017-06-06
|
||||
*/
|
||||
|
||||
#include "aes_gas_pipe_gui_plugin.h"
|
||||
#include "aes_gas_pipe_list.h"
|
||||
#include "aes_gas_pipe_edit.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);
|
||||
} // end of createGuiInterface()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
InterfaceImpl::InterfaceImpl(LtsSession::LtsSession *session)
|
||||
: AesBaseInterface(session, getLogger("Plugins.Gui.GasPipe"))
|
||||
, ForeignGuiInterface()
|
||||
{} // end of ctor()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
QVector<LtsWidgets::PluginData> InterfaceImpl::getActions()
|
||||
{
|
||||
QVector<LtsWidgets::PluginData> ret;
|
||||
|
||||
LtsUtils::ProjectSettings *ps = LtsUtils::ProjectSettings::getInstance();
|
||||
const bool enableGasPipes = ps->value(QStringLiteral("aes"),
|
||||
QStringLiteral("enableGasPipes")).toBool();
|
||||
|
||||
if (enableGasPipes)
|
||||
{
|
||||
// Action 'Show GasPipes' anlegen
|
||||
ret.append(LtsWidgets::PluginData(menuGroup(),
|
||||
tr("Gas Pipes"),
|
||||
QLatin1String("ListGasPipes"),
|
||||
QIcon(QLatin1String("icon:gaspipe.svg")),
|
||||
[this](QWidget *parent) { return onShowGasPipeListDialog(parent);},
|
||||
OperatorRights::GasPipesShow,
|
||||
LtsWidgets::ExercisePart::eExecution));
|
||||
|
||||
|
||||
|
||||
// Action 'New GasPipe' anlegen
|
||||
if (m_session->isExercisePartition() && appId() != LtsAppDescriptor::App::OC)
|
||||
ret.append(LtsWidgets::PluginData(menuGroup(),
|
||||
tr("Add Gas Pipe"),
|
||||
QLatin1String("AddGasPipe"),
|
||||
QIcon(QLatin1String("icon:gaspipe_add.svg")),
|
||||
[this](QWidget *parent) { return onShowAddGasPipeDialog(parent);},
|
||||
OperatorRights::GasPipesEdit,
|
||||
LtsWidgets::ExercisePart::eExecution,
|
||||
LtsWidgets::ExerciseState::eCreated | LtsWidgets::ExerciseState::eStarted | LtsWidgets::ExerciseState::ePaused));
|
||||
|
||||
}
|
||||
return ret;
|
||||
} // end of getActions()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
AreaEffectSimulation::BaseEdit *InterfaceImpl::showEditWindow(int aesEntityId, QWidget *parent)
|
||||
{
|
||||
return LtsWidgets::initDialog(new GasPipeEdit(menuGroup(), parent),
|
||||
aesEntityId, false, m_session);
|
||||
} // end of showEditWindow()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
LtsWidgets::LtsDialog *InterfaceImpl::onShowGasPipeListDialog(QWidget *parent)
|
||||
{
|
||||
return LtsWidgets::initDialog(new GasPipeList(menuGroup(), parent),
|
||||
m_session);
|
||||
} // end of onShowGasPipeListDialog()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
LtsWidgets::LtsDialog *InterfaceImpl::onShowAddGasPipeDialog(QWidget *parent)
|
||||
{
|
||||
return LtsWidgets::initDialog(new GasPipeEdit(menuGroup(), parent),
|
||||
0, false, m_session);
|
||||
} // end of onShowAddGasPipeDialog()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
} // namespace AreaEffectSimulation
|
||||
@@ -0,0 +1,51 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Gui Plugin for AreaEffectSimulation GasPipe
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by hjl, SLSE, 2017-06-06
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Plugins/AreaEffectSimulation/Gui/Base/aes_base_gui_plugin.h>
|
||||
#include "aes_gas_pipe_gui_plugin_interface.h"
|
||||
|
||||
namespace AreaEffectSimulation
|
||||
{
|
||||
|
||||
class GuiPlugin final : public AesBaseGuiPlugin
|
||||
{
|
||||
Q_PLUGIN_METADATA(IID "gui:3:aes.gaspipes")
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GuiPlugin() = default;
|
||||
~GuiPlugin() = default;
|
||||
QString pluginName() override { return QLatin1String("AreaEffectSimulationGasPipeGui"); }
|
||||
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 AesGasPipe::ForeignGuiInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit InterfaceImpl(LtsSession::LtsSession *session);
|
||||
|
||||
QVector<LtsWidgets::PluginData> getActions() override;
|
||||
AreaEffectSimulation::BaseEdit *showEditWindow(int aesEntityId, QWidget *parent) override;
|
||||
|
||||
private:
|
||||
LtsWidgets::LtsDialog *onShowGasPipeListDialog(QWidget *parent);
|
||||
LtsWidgets::LtsDialog *onShowAddGasPipeDialog(QWidget *parent);
|
||||
|
||||
};
|
||||
|
||||
} // namespace AreaEffectSimulation
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for AreaEffectSimulation GasPipe (Interface for access from other Plugins)
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by hjl, SLSE, 2017-06-06
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
class QWidget;
|
||||
namespace AreaEffectSimulation
|
||||
{
|
||||
class BaseEdit;
|
||||
}
|
||||
|
||||
namespace AesGasPipe
|
||||
{
|
||||
class ForeignGuiInterface
|
||||
{
|
||||
public:
|
||||
ForeignGuiInterface() = default;
|
||||
virtual ~ForeignGuiInterface() = default;
|
||||
|
||||
virtual AreaEffectSimulation::BaseEdit *showEditWindow(int aesEntityId, QWidget *parent) = 0;
|
||||
};
|
||||
|
||||
} //namespace AesGasPipe
|
||||
@@ -0,0 +1,115 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for AreaEffectSimulation - GasPipe Overview Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by hjl, SLSE, 2017-06-19
|
||||
*/
|
||||
|
||||
#include "aes_gas_pipe_list.h"
|
||||
#include "aes_gas_pipe_edit.h"
|
||||
#include "aes_gas_pipes_model.h"
|
||||
#include "CustomView/aes_gas_pipe.h"
|
||||
#include <PluginInterfaces/gui_plugin_interface.h>
|
||||
|
||||
#include <LtsSession/lts_session_data.h>
|
||||
|
||||
namespace AreaEffectSimulation
|
||||
{
|
||||
bool GasPipeList::init(LtsSession::LtsSession *session)
|
||||
{
|
||||
if (!AesItemList::init(session))
|
||||
return false;
|
||||
|
||||
m_bHasAddEditOperatorRights = LtsSessionData::LtsSessionData::getInstance()->hasOperatorRight(OperatorRights::GasPipesEdit);
|
||||
|
||||
setDataViewModel(m_model, [this]() { return new CustomViewGasPipe(this); });
|
||||
|
||||
#ifndef LTS_DEBUG
|
||||
hideColumn(GasPipesModel::BcId);
|
||||
#endif
|
||||
hideColumn(GasPipesModel::BcChargeType);
|
||||
hideColumn(GasPipesModel::BcEffectDuration);
|
||||
hideColumn(GasPipesModel::BcParticipant);
|
||||
hideColumn(GasPipesModel::BcEffectSource);
|
||||
|
||||
setSortIndicator(GasPipesModel::BcName);
|
||||
|
||||
enaDisa();
|
||||
|
||||
setOnlineHelpFilename(QStringLiteral("Situation-Gas_Pipeline"));
|
||||
|
||||
return true;
|
||||
} // end of init()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void GasPipeList::createModel()
|
||||
{
|
||||
m_model = new AesItemSortFilterProxyModelTmpl<GasPipe>(m_session, this);
|
||||
|
||||
m_gasPipessModel = new GasPipesModel(this);
|
||||
m_gasPipessModel->initModel(m_session);
|
||||
m_model->setSourceModel(m_gasPipessModel);
|
||||
} // end of createModel()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void GasPipeList::onAddAesItem()
|
||||
{
|
||||
GasPipeEdit *dialog = new GasPipeEdit(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;
|
||||
} // end of onAddAesItem()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void GasPipeList::onEditAesItem()
|
||||
{
|
||||
const int aesItemId = model()->aesId(currentRow());
|
||||
|
||||
if (aesItemId < 0)
|
||||
return;
|
||||
|
||||
DEBUG_LOG(m_logger) << "current GasPipeId: " << aesItemId;
|
||||
|
||||
GasPipeEdit *dialog = new GasPipeEdit(m_menuGroup, this);
|
||||
if (dialog->init(aesItemId, false, m_session))
|
||||
addDialog(dialog, m_menuGroup, dialog->dialogIdentifier(), LtsWidgets::LayoutArea::eDialogTab);
|
||||
else
|
||||
delete dialog;
|
||||
} // end of onEditAesItem()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void GasPipeList::onRemoveAesItem()
|
||||
{
|
||||
const int aesItemId = model()->aesId(currentRow());
|
||||
Core::RemoveElementRequest req(aesItemId);
|
||||
m_requestHelper->startSingleRequest([req, this]()
|
||||
{
|
||||
return m_ftc->gasPipeRemoveRequest(req, this);
|
||||
});
|
||||
} // end of onRemoveAesItem()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void GasPipeList::retranslate()
|
||||
{
|
||||
translateBase(tr("Gas Pipes"));
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void GasPipeList::onGasPipeModifyReply(const Core::FunctionReplyObject &replyObject)
|
||||
{
|
||||
m_requestHelper->requestReply(replyObject);
|
||||
} // end of onGasPipeRemoveReply()
|
||||
|
||||
void GasPipeList::onGasPipeRemoveReply(const Core::FunctionReplyObject &replyObject)
|
||||
{
|
||||
m_requestHelper->requestReply(replyObject);
|
||||
} // end of onGasPipeRemoveReply()
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
} // namespace AreaEffectSimulation
|
||||
@@ -0,0 +1,44 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for AreaEffectSimulation - GasPipe Overview Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by hjl, SLSE, 2017-06-19
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Plugins/AreaEffectSimulation/Gui/Base/aes_itemlist.h>
|
||||
#include <Plugins/AreaEffectSimulation/Gui/Base/aes_base_model.h>
|
||||
#include <Plugins/FileManagement/flm_explorer_gui_plugin_interface.h>
|
||||
#include "aes_gas_pipes_model.h"
|
||||
|
||||
namespace AreaEffectSimulation
|
||||
{
|
||||
|
||||
class GasPipeList final : public AesItemListTmpl<GasPipe>
|
||||
, protected AreaEffectSimulation::Interface::Ftc::GasPipeModifyReplyHandler
|
||||
, protected AreaEffectSimulation::Interface::Ftc::GasPipeRemoveReplyHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
using AesItemListTmpl<GasPipe>::AesItemListTmpl;
|
||||
|
||||
bool init(LtsSession::LtsSession *session) override;
|
||||
|
||||
private slots:
|
||||
void onAddAesItem() override;
|
||||
void onEditAesItem() override;
|
||||
void onRemoveAesItem() override;
|
||||
|
||||
private:
|
||||
void createModel() override;
|
||||
void retranslate() override;
|
||||
void onGasPipeModifyReply(const Core::FunctionReplyObject &replyObject) override;
|
||||
void onGasPipeRemoveReply(const Core::FunctionReplyObject &replyObject) override;
|
||||
GasPipesModel *m_gasPipessModel = nullptr;
|
||||
std::shared_ptr<FileManagement::ForeignGuiInterface> m_flmGui;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for AreaEffectSimulation - GasPipe Overview Dialog Model
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by hjl, SLSE, 2017-06-19
|
||||
*/
|
||||
|
||||
|
||||
#include "aes_gas_pipes_model.h"
|
||||
|
||||
#include <LtsSession/lts_session_data.h>
|
||||
#include <FileManagement/flm_translation.h>
|
||||
|
||||
namespace AreaEffectSimulation
|
||||
{
|
||||
|
||||
GasPipesModel::GasPipesModel(QObject *parent)
|
||||
: AesGuiBaseModel<GasPipe>(parent, {})
|
||||
{
|
||||
} // end of ctor()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
bool GasPipesModel::initModel(LtsSession::LtsSession *session)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "--- Start GasPipesModel::initModel()";
|
||||
|
||||
if (!AesGuiBaseModel::initModel(session))
|
||||
return false;
|
||||
|
||||
connect(m_aesDtc.get(), &AreaEffectSimulation::Interface::Dtc::gasPipeChanged,
|
||||
this, &GasPipesModel::onDataChanged);
|
||||
m_aesDtc->gasPipes([this](const GasPipe &item) { insertRow(item); });
|
||||
|
||||
return true;
|
||||
} // end of initModel()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
QVariant GasPipesModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (!indexIsValid(index))
|
||||
return QVariant();
|
||||
|
||||
const GasPipe &item = m_vecData.at(index.row());
|
||||
|
||||
if (index.column() < cntBaseColumns())
|
||||
return AesGuiBaseModel::data(item, index.column(), role);
|
||||
|
||||
if (role != Qt::DisplayRole)
|
||||
return QVariant();
|
||||
|
||||
return QVariant();
|
||||
} // end of data()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
bool GasPipesModel::isFiltered(const GasPipe &data, DataModification modType) const
|
||||
{
|
||||
return AesGuiBaseModel::isFiltered(data, modType);
|
||||
} // end of isFiltered()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
} // namespace AreaEffectSimulation
|
||||
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for AreaEffectSimulation - GasPipe Overview Dialog Model
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by hjl, SLSE, 2017-06-19
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Plugins/AreaEffectSimulation/Gui/Base/aes_base_model.h>
|
||||
|
||||
namespace AreaEffectSimulation
|
||||
{
|
||||
class GasPipesModel final : public AesGuiBaseModel<GasPipe>
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit GasPipesModel(QObject *parent = nullptr);
|
||||
|
||||
bool initModel(LtsSession::LtsSession *session) override;
|
||||
QVariant data(const QModelIndex &index, int role) const override;
|
||||
|
||||
protected:
|
||||
bool isFiltered(const GasPipe &data, DataModification modType) const override;
|
||||
};
|
||||
} //namespace AreaEffectSimulation
|
||||
Reference in new issue
Block a user