Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
@@ -0,0 +1,47 @@
|
||||
#
|
||||
# $Id$
|
||||
# $HeadURL$
|
||||
# $Author$
|
||||
# Created by Malte Diers, SLSE, 2017-04-06
|
||||
#
|
||||
|
||||
ADD_INTERFACE_LIBRARY(
|
||||
AesTechnicalAreaGuiPluginInterface
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/aes_technical_area_gui_plugin_interface.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/..
|
||||
)
|
||||
|
||||
SET(aes_technical_area_gui_SRCS
|
||||
aes_technical_area_gui_plugin.cpp
|
||||
aes_technical_area_gui_plugin.h
|
||||
aes_technical_area_edit.cpp
|
||||
aes_technical_area_edit.h
|
||||
aes_technical_area_list.cpp
|
||||
aes_technical_area_list.h
|
||||
aes_technical_areas_model.cpp
|
||||
aes_technical_areas_model.h
|
||||
CustomView/aes_technical_area.cpp
|
||||
CustomView/aes_technical_area.h
|
||||
)
|
||||
|
||||
NGL_WRAP_UI(aes_technical_area_gui_SRCS
|
||||
aes_technical_area_edit.ui
|
||||
CustomView/aes_technical_area.ui
|
||||
)
|
||||
|
||||
NGL_ADD_LIBRARY(WS AesTechnicalAreaGuiPlugin MODULE ${aes_technical_area_gui_SRCS})
|
||||
NGL_TARGET_LINK_LIBRARIES(AesTechnicalAreaGuiPlugin
|
||||
AesBaseGui
|
||||
AesTechnicalAreaGuiPluginInterface
|
||||
ngltools
|
||||
NGLLogger
|
||||
LtsSessionData
|
||||
AesDataPluginInterface
|
||||
Qt5::Widgets
|
||||
LtsWidgets
|
||||
LtsUtilsSettings
|
||||
)
|
||||
|
||||
NGL_INSTALL_TARGET(AesTechnicalAreaGuiPlugin)
|
||||
|
||||
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* CustomView for Technical Area
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Philipp Dassow, SLEA, 2017-06-09
|
||||
*/
|
||||
|
||||
#include "aes_technical_area.h"
|
||||
#include "ui_aes_technical_area.h"
|
||||
|
||||
#include "aes_technical_areas_model.h"
|
||||
#include <Services/AreaEffectSimulation/Utils/polygons.h>
|
||||
|
||||
namespace AreaEffectSimulation
|
||||
{
|
||||
CustomViewTechnicalArea::CustomViewTechnicalArea(QWidget *parent)
|
||||
: AbstractDisplayWidget(parent)
|
||||
, m_ui(new Ui::CustomViewTechnicalArea)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
}
|
||||
|
||||
CustomViewTechnicalArea::~CustomViewTechnicalArea()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
bool CustomViewTechnicalArea::init(const QModelIndex &idx)
|
||||
{
|
||||
if (!idx.isValid())
|
||||
return false;
|
||||
|
||||
m_ui->lbName->setText(rowData(idx, AreaEffectSimulation::TechnicalAreasModel::BcName).toString());
|
||||
m_ui->lbType->setText(rowData(idx, AreaEffectSimulation::TechnicalAreasModel::BcChargeType).toString());
|
||||
m_ui->lbState->setText(rowData(idx, AreaEffectSimulation::TechnicalAreasModel::BcEffectState).toString());
|
||||
m_ui->lbTime->setText(rowData(idx, AreaEffectSimulation::TechnicalAreasModel::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 TechnicalAreasModel *aesModel = qobject_cast<const TechnicalAreasModel*>(sfpm->sourceModel());
|
||||
if (!aesModel)
|
||||
return false;
|
||||
const auto srcIdx = sfpm->mapToSource(idx);
|
||||
TechnicalArea tecArea = aesModel->getRowData(srcIdx.row());
|
||||
calculateIcon(tecArea, sfpm->partyColor(idx.row()));
|
||||
|
||||
qint64 durationMSecs = rowData(idx, AreaEffectSimulation::TechnicalAreasModel::BcEffectDuration).toInt();
|
||||
if (durationMSecs > 0)
|
||||
{
|
||||
m_ui->lbDuration->setText(QString::number(durationMSecs / (1000 * 60), 'f', 0));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ui->label_4->hide();
|
||||
m_ui->lbDuration->hide();
|
||||
m_ui->label_6->hide();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CustomViewTechnicalArea::calculateIcon(const AreaEffectSimulation::TechnicalArea &tecArea, const QColor &color)
|
||||
{
|
||||
Database::AesTechnicalArea tecOut;
|
||||
tecOut.position = QPointF(tecArea.area().cornerBottomLeft().lon(),
|
||||
tecArea.area().cornerBottomLeft().lat());
|
||||
tecOut.width = tecArea.area().width();
|
||||
tecOut.length = tecArea.area().height();
|
||||
|
||||
QPolygonF poly = AreaEffectSimulation::Polygons::technicalArea(tecOut);
|
||||
Qt::BrushStyle bStyle = PixmapLabel::checkForBrushStyle(tecArea.effectStateId());
|
||||
const auto pix = Polygons::pixmapFromPolygon(PixmapLabel::geographic2Utm(poly), color, ICON_RESOLUTION, bStyle);
|
||||
m_ui->lblIcon->setPixmap(pix);
|
||||
|
||||
return true;
|
||||
}
|
||||
} // namespace AreaEffectSimulation
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* CustomView for Functional Area
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Philipp Dassow, SLEA, 2017-06-09
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <Viewer/LtsDataView/abstract_display_widget.h>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class CustomViewTechnicalArea;
|
||||
}
|
||||
|
||||
namespace AreaEffectSimulation
|
||||
{
|
||||
class TechnicalArea;
|
||||
class CustomViewTechnicalArea final : public LtsDataView::AbstractDisplayWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit CustomViewTechnicalArea(QWidget *parent = nullptr);
|
||||
~CustomViewTechnicalArea();
|
||||
bool init(const QModelIndex &idx) override final;
|
||||
|
||||
private:
|
||||
bool calculateIcon(const AreaEffectSimulation::TechnicalArea &tecArea, const QColor &color);
|
||||
|
||||
Ui::CustomViewTechnicalArea *m_ui;
|
||||
};
|
||||
} // namespace AreaEffectSimulation
|
||||
+155
@@ -0,0 +1,155 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CustomViewTechnicalArea</class>
|
||||
<widget class="QWidget" name="CustomViewTechnicalArea">
|
||||
<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="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="text">
|
||||
<string notr="true">Type</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>State:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lbState">
|
||||
<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="text">
|
||||
<string notr="true">Time</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string notr="true">for</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lbDuration">
|
||||
<property name="text">
|
||||
<string notr="true">Duration</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>minutes</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>
|
||||
+244
@@ -0,0 +1,244 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* AreaEffectSimulation - Functional Area Edit Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Philipp Dassow, SLEA, 2017-06-09
|
||||
*/
|
||||
|
||||
|
||||
#include "aes_technical_area_edit.h"
|
||||
#include "ui_aes_technical_area_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 <AreaEffectSimulation/aes_translation.h>
|
||||
#include <AreaEffectSimulation/Utils/polygons.h>
|
||||
#include <LtsUtilsSettings/settings.h>
|
||||
|
||||
namespace AreaEffectSimulation
|
||||
{
|
||||
|
||||
double TechnicalAreaEdit::s_minWidth;
|
||||
double TechnicalAreaEdit::s_maxWidth;
|
||||
double TechnicalAreaEdit::s_stepWidth;
|
||||
double TechnicalAreaEdit::s_minHeight;
|
||||
double TechnicalAreaEdit::s_maxHeight;
|
||||
double TechnicalAreaEdit::s_stepHeight;
|
||||
|
||||
|
||||
// Todo: Höhe und Radius in Abhängigkeit der Munitionsart berechnen
|
||||
|
||||
TechnicalAreaEdit::TechnicalAreaEdit(const QString &menuGroup, QWidget *parent)
|
||||
: BaseEdit(menuGroup, QLatin1String("TechnicalAreaEdit"), parent)
|
||||
, m_ui(new Ui::TechnicalAreaEdit)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
s_minWidth = 5;
|
||||
s_maxWidth = 1275;
|
||||
s_stepWidth = 5;
|
||||
s_minHeight = 5;
|
||||
s_maxHeight = 1275;
|
||||
s_stepHeight = 5;
|
||||
|
||||
m_ui->sbWidth->setMinimum(s_minWidth);
|
||||
m_ui->sbWidth->setMaximum(s_maxWidth);
|
||||
m_ui->sbWidth->setSingleStep(s_stepWidth);
|
||||
m_ui->sbHeight->setMinimum(s_minHeight);
|
||||
m_ui->sbHeight->setMaximum(s_maxHeight);
|
||||
m_ui->sbHeight->setSingleStep(s_stepHeight);
|
||||
|
||||
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->chbDecon, [this]() { return (m_ui->chbDecon->isChecked() || m_ui->chbMaint->isChecked() || m_ui->chbMedic->isChecked()); }});
|
||||
|
||||
connect(m_ui->sbWidth, &QSpinBox::editingFinished, this, &TechnicalAreaEdit::correctSpinBoxValue);
|
||||
connect(m_ui->sbHeight, &QSpinBox::editingFinished, this, &TechnicalAreaEdit::correctSpinBoxValue);
|
||||
connect(m_ui->pbClear, &QPushButton::clicked, m_ui->positionEdit, &LtsCoordWidget::LtsCoordWidget::clear);
|
||||
|
||||
enaDisa();
|
||||
|
||||
setOnlineHelpFilename(QStringLiteral("Situation-Add_Technical_Area"));
|
||||
}
|
||||
|
||||
TechnicalAreaEdit::~TechnicalAreaEdit()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
void TechnicalAreaEdit::retranslate()
|
||||
{
|
||||
translate(m_ui, m_aesItem, tr("Technical Area"));
|
||||
}
|
||||
|
||||
void TechnicalAreaEdit::enableUiElements(bool enable)
|
||||
{
|
||||
|
||||
m_ui->leIdentifier->setMaxLength(30);
|
||||
|
||||
m_ui->pbPosition->setEnabled(m_sitMapGuiIfc && enable);
|
||||
m_ui->positionEdit->setEnabled(enable);
|
||||
m_ui->sbHeight->setEnabled(enable);
|
||||
m_ui->sbWidth->setEnabled(enable);
|
||||
m_ui->pbClear->setEnabled(enable);
|
||||
m_ui->leIdentifier->setEnabled(enable || isOnlyNameModifiable());
|
||||
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->technicalArea(m_aesItem.id());
|
||||
setData(baseData, false);
|
||||
__unchange__();
|
||||
if (name != m_ui->leIdentifier->text())
|
||||
m_ui->leIdentifier->setText(name);
|
||||
}
|
||||
}
|
||||
|
||||
bool TechnicalAreaEdit::init(int areaId, bool copy,
|
||||
LtsSession::LtsSession *session)
|
||||
{
|
||||
if (!BaseEdit::init(areaId, session))
|
||||
return false;
|
||||
|
||||
bool editable = LtsSessionData::LtsSessionData::getInstance()->hasOperatorRight(OperatorRights::TechnicalAreasEdit) ||
|
||||
m_session->app() == LtsAppDescriptor::App::OC;
|
||||
bool readable = LtsSessionData::LtsSessionData::getInstance()->hasOperatorRight(OperatorRights::TechnicalAreasShow);
|
||||
|
||||
if (!readable && !editable)
|
||||
return false;
|
||||
|
||||
if (m_sitMapGuiIfc)
|
||||
connect(m_ui->pbPosition, &QPushButton::clicked, this, &TechnicalAreaEdit::getPosition);
|
||||
else
|
||||
m_ui->pbPosition->setEnabled(false);
|
||||
|
||||
fillCbx();
|
||||
|
||||
if (areaId > 0)
|
||||
{
|
||||
auto baseData = m_dtc->technicalArea(areaId);
|
||||
setData(baseData, copy);
|
||||
}
|
||||
|
||||
enableUiElements(editable);
|
||||
|
||||
connect(m_dtc.get(), &AreaEffectSimulation::Interface::Dtc::technicalAreaChanged,
|
||||
this, &BaseEdit::onAreaChanged);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void TechnicalAreaEdit::setData(const TechnicalArea &area, bool copy)
|
||||
{
|
||||
m_aesItem = area;
|
||||
if (copy)
|
||||
{
|
||||
m_aesItem.id(0);
|
||||
m_aesItem.effectStateId(AreaEffectSimulation::AesEffectState_def::get_default());
|
||||
}
|
||||
m_ui->leIdentifier->setText(QString::fromStdString(area.name()));
|
||||
m_ui->sbWidth->setValue(area.area().width());
|
||||
m_ui->sbHeight->setValue(area.area().height());
|
||||
|
||||
QPointF bottomLeft(area.area().cornerBottomLeft().lon(), area.area().cornerBottomLeft().lat());
|
||||
QPointF centerpoint = Polygons::bottomLeft2CenterPoint(bottomLeft, area.area().width(), area.area().height(), 0.0);
|
||||
if (!centerpoint.isNull())
|
||||
m_ui->positionEdit->setCoordinate(centerpoint);
|
||||
|
||||
m_ui->cbType->setCurrentIndex(m_ui->cbType->findData(area.type().underlying()));
|
||||
}
|
||||
|
||||
inline void TechnicalAreaEdit::fillCbx()
|
||||
{
|
||||
int curIdxType = m_ui->cbType->currentIndex();
|
||||
LtsUtils::ProjectSettings *ps = LtsUtils::ProjectSettings::getInstance();
|
||||
|
||||
const bool enableSoundZones = ps->value(QStringLiteral("bld"),
|
||||
QStringLiteral("enableSoundZones")).toBool();
|
||||
|
||||
|
||||
m_ui->cbType->clear();
|
||||
m_ui->cbType->addItem(AreaEffectSimulation::toString(AesTechnicalAreaType_def::TatMout), AesTechnicalAreaType_def::TatMout);
|
||||
if ( enableSoundZones )
|
||||
m_ui->cbType->addItem(AreaEffectSimulation::toString(AesTechnicalAreaType_def::TatSoundZone), AesTechnicalAreaType_def::TatSoundZone);
|
||||
//m_ui->cbType->addItem(AreaEffectSimulation::toString(AesTechnicalAreaType_def::TatRestingAreaPersonnel), AesTechnicalAreaType_def::TatRestingAreaPersonnel);
|
||||
//m_ui->cbType->addItem(AreaEffectSimulation::toString(AesTechnicalAreaType_def::TatRestingAreaVehicle), AesTechnicalAreaType_def::TatRestingAreaVehicle);
|
||||
//m_ui->cbType->addItem(AreaEffectSimulation::toString(AesTechnicalAreaType_def::TatRestingAreaPersonnelAndVehicle), AesTechnicalAreaType_def::TatRestingAreaPersonnelAndVehicle);
|
||||
|
||||
if (curIdxType >= 0)
|
||||
m_ui->cbType->setCurrentIndex(curIdxType);
|
||||
}
|
||||
|
||||
void TechnicalAreaEdit::getPosition()
|
||||
{
|
||||
if (!has2DMap())
|
||||
return;
|
||||
|
||||
m_sitMapGuiIfc->getRectangleNorth(this,
|
||||
SLOT(onRectData(QPointF, double, double, QPolygonF)),
|
||||
nullptr,
|
||||
s_minWidth,
|
||||
s_maxWidth,
|
||||
s_minHeight,
|
||||
s_maxHeight,
|
||||
m_ui->positionEdit->coordinate(),
|
||||
m_ui->sbWidth->value(),
|
||||
m_ui->sbHeight->value()
|
||||
);
|
||||
}
|
||||
|
||||
void TechnicalAreaEdit::onRectData(const QPointF ¢erPoint, double width, double height, const QPolygonF &coordinates)
|
||||
{
|
||||
m_previewPolygon = coordinates;
|
||||
m_ui->positionEdit->setCoordinate(centerPoint);
|
||||
m_ui->sbWidth->setValue(width);
|
||||
m_ui->sbHeight->setValue(height);
|
||||
DEBUG_LOG(m_logger) << "Pos X: " << centerPoint.x() << " Y: " << centerPoint.y() << " W: " << width << " H: " << height;
|
||||
|
||||
showPreviewObject();
|
||||
}
|
||||
|
||||
bool TechnicalAreaEdit::apply()
|
||||
{
|
||||
std::string name = m_ui->leIdentifier->text().toStdString();
|
||||
AesTechnicalAreaType type = static_cast<AesTechnicalAreaType::inner_enum>(m_ui->cbType->currentData().toInt());
|
||||
QPointF bottomLeft(Polygons::centerPoint2BottomLeft(m_ui->positionEdit->coordinate(),
|
||||
m_ui->sbWidth->value(),
|
||||
m_ui->sbHeight->value(),
|
||||
0.0));
|
||||
const Core::GeoPosition2D bottomLeftGeo(bottomLeft.x(), bottomLeft.y());
|
||||
const Area area(bottomLeftGeo, m_ui->sbWidth->value(), m_ui->sbHeight->value(), 0.0);
|
||||
const TechnicalAreaModifyRequest req(m_aesItem.id(),
|
||||
name,
|
||||
area,
|
||||
type);
|
||||
|
||||
m_requestHelper->addRequest([this, req]()
|
||||
{
|
||||
return m_ftc->technicalAreaModifyRequest(req, this);
|
||||
});
|
||||
|
||||
return m_requestHelper->startRequests();
|
||||
}
|
||||
|
||||
void TechnicalAreaEdit::showPreviewObject()
|
||||
{
|
||||
if (!m_sitMapGuiIfc)
|
||||
return;
|
||||
|
||||
if (m_previewPolygon.isEmpty())
|
||||
return;
|
||||
|
||||
m_sitMapGuiIfc->displayPreviewObject(this, m_previewPolygon, true);
|
||||
}
|
||||
|
||||
} // namespace AreaEffectSimulation
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* AreaEffectSimulation - Functional Area Edit Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Philipp Dassow, SLEA, 2017-06-09
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Plugins/AreaEffectSimulation/Gui/Base/aes_base_edit.h>
|
||||
#include <AreaEffectSimulation/aes_ftc.h>
|
||||
#include <QPolygonF>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class TechnicalAreaEdit;
|
||||
}
|
||||
|
||||
namespace AreaEffectSimulation
|
||||
{
|
||||
|
||||
class TechnicalAreaEdit final
|
||||
: public BaseEdit
|
||||
, protected AreaEffectSimulation::Interface::Ftc::TechnicalAreaModifyReplyHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit TechnicalAreaEdit(const QString &menuGroup, QWidget *parent = nullptr);
|
||||
~TechnicalAreaEdit();
|
||||
|
||||
QString dialogIdentifier() const override
|
||||
{
|
||||
return m_aesItem.id() <= 0 ? QStringLiteral("AddTechnicalArea") : QStringLiteral("EditTechnicalArea%1").arg(m_aesItem.id());
|
||||
}
|
||||
bool init(int areaId, bool copy, LtsSession::LtsSession *session);
|
||||
|
||||
void onTechnicalAreaModifyReply(const Core::FunctionReplyObject &replyObject) override final { onAesItemModifyReply(replyObject); }
|
||||
|
||||
private:
|
||||
void retranslate() override;
|
||||
|
||||
static double s_minWidth;
|
||||
static double s_maxWidth;
|
||||
static double s_stepWidth;
|
||||
static double s_minHeight;
|
||||
static double s_maxHeight;
|
||||
static double s_stepHeight;
|
||||
|
||||
void setData(const TechnicalArea &area, bool copy);
|
||||
void fillCbx();
|
||||
void enableUiElements(bool enable) override;
|
||||
|
||||
private Q_SLOTS:
|
||||
void getPosition();
|
||||
void onRectData(const QPointF ¢erPoint, double width, double height, const QPolygonF &coordinates);
|
||||
bool apply() override;
|
||||
void showPreviewObject() override;
|
||||
|
||||
private:
|
||||
Ui::TechnicalAreaEdit *m_ui;
|
||||
QPolygonF m_previewPolygon;
|
||||
};
|
||||
|
||||
} //namespace AreaEffectSimulation
|
||||
+173
@@ -0,0 +1,173 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>TechnicalAreaEdit</class>
|
||||
<widget class="QWidget" name="TechnicalAreaEdit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>560</width>
|
||||
<height>182</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">Aes Technical Area Edit</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lblIdentifier">
|
||||
<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="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lblType">
|
||||
<property name="text">
|
||||
<string>Type:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="LtsWidgets::LtsComboBox" name="cbType">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="currentText">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" 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="0">
|
||||
<widget class="QLabel" name="lblPosition">
|
||||
<property name="text">
|
||||
<string>Center Point:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="LtsCoordWidget::LtsCoordWidget" name="positionEdit"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pbPosition">
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../Styles/Light/resources/rde_light_style.qrc">
|
||||
<normaloff>:/style/position.svg</normaloff>:/style/position.svg</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pbClear">
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../Styles/Light/resources/rde_light_style.qrc">
|
||||
<normaloff>:/style/remove.svg</normaloff>:/style/remove.svg</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="lblDimensions">
|
||||
<property name="text">
|
||||
<string>Dimensions [m]:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QSpinBox" name="sbWidth">
|
||||
<property name="maximum">
|
||||
<number>1000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="sbHeight">
|
||||
<property name="maximum">
|
||||
<number>1000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<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>
|
||||
</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>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>leIdentifier</tabstop>
|
||||
<tabstop>positionEdit</tabstop>
|
||||
<tabstop>pbPosition</tabstop>
|
||||
<tabstop>pbClear</tabstop>
|
||||
<tabstop>sbWidth</tabstop>
|
||||
<tabstop>sbHeight</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="../../../Styles/Light/resources/rde_light_style.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
+84
@@ -0,0 +1,84 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* GUI Plugin for AreaEffectSimulation - Technical Area
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Philipp Dassow, SLEA, 2017-06-09
|
||||
*/
|
||||
|
||||
#include "aes_technical_area_gui_plugin.h"
|
||||
#include "aes_technical_area_edit.h"
|
||||
#include "aes_technical_area_list.h"
|
||||
|
||||
#include <AreaEffectSimulation/aes_operator_rights.h>
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <LtsUtilsSettings/settings.h>
|
||||
|
||||
namespace AreaEffectSimulation
|
||||
{
|
||||
|
||||
std::shared_ptr<GuiPluginBase::Interface> GuiPlugin::createGuiInterface(LtsSession::LtsSession *session)
|
||||
{
|
||||
return std::make_shared<InterfaceImpl>(session);
|
||||
}
|
||||
|
||||
InterfaceImpl::InterfaceImpl(LtsSession::LtsSession *session)
|
||||
: AesBaseInterface(session, getLogger("Plugins.Gui.TechnicalArea"))
|
||||
, ForeignGuiInterface()
|
||||
{}
|
||||
|
||||
QVector<LtsWidgets::PluginData> InterfaceImpl::getActions()
|
||||
{
|
||||
QVector<LtsWidgets::PluginData> ret;
|
||||
|
||||
LtsUtils::ProjectSettings *ps = LtsUtils::ProjectSettings::getInstance();
|
||||
const bool enableTechnicalAreas = ps->value(QStringLiteral("aes"),
|
||||
QStringLiteral("enableTechnicalAreas")).toBool();
|
||||
|
||||
if (enableTechnicalAreas)
|
||||
{
|
||||
ret.append(LtsWidgets::PluginData(menuGroup(),
|
||||
tr("Technical Areas"),
|
||||
QLatin1String("ListTechnicalAreas"),
|
||||
QIcon(QLatin1String("icon:technical_area.svg")),
|
||||
[this](QWidget *parent) { return onShowTechnicalAreaListDialog(parent);},
|
||||
OperatorRights::TechnicalAreasShow,
|
||||
LtsWidgets::ExercisePart::eExecution));
|
||||
|
||||
|
||||
if (m_session->isExercisePartition() && appId() != LtsAppDescriptor::App::OC)
|
||||
ret.append(LtsWidgets::PluginData(menuGroup(),
|
||||
tr("Add Technical Area"),
|
||||
QLatin1String("AddTechnicalArea"),
|
||||
QIcon(QLatin1String("icon:technical_area.svg")),
|
||||
[this](QWidget *parent) { return onShowAddTechnicalAreaDialog(parent);},
|
||||
OperatorRights::TechnicalAreasEdit,
|
||||
LtsWidgets::ExercisePart::eExecution,
|
||||
LtsWidgets::ExerciseState::eCreated | LtsWidgets::ExerciseState::eStarted | LtsWidgets::ExerciseState::ePaused));
|
||||
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
LtsWidgets::LtsDialog *InterfaceImpl::onShowAddTechnicalAreaDialog(QWidget *parent)
|
||||
{
|
||||
TechnicalAreaEdit *editWidget = new TechnicalAreaEdit(menuGroup(), parent);
|
||||
if (editWidget->init(0, false, m_session))
|
||||
return editWidget;
|
||||
|
||||
delete editWidget;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
LtsWidgets::LtsDialog *InterfaceImpl::onShowTechnicalAreaListDialog(QWidget *parent)
|
||||
{
|
||||
TechnicalAreaList *listWidget = new TechnicalAreaList(menuGroup(), parent);
|
||||
if (listWidget->init(m_session))
|
||||
return listWidget;
|
||||
|
||||
delete listWidget;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace AreaEffectSimulation
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Gui Plugin for AreaEffectSimulation - Technical Area
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Philipp Dassow, SLEA, 2017-06-09
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Plugins/AreaEffectSimulation/Gui/Base/aes_base_gui_plugin.h>
|
||||
#include "aes_technical_area_gui_plugin_interface.h"
|
||||
|
||||
namespace AreaEffectSimulation
|
||||
{
|
||||
class GuiPlugin final : public AesBaseGuiPlugin
|
||||
{
|
||||
Q_PLUGIN_METADATA(IID "gui:3:aes.technical_areas")
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GuiPlugin() = default;
|
||||
~GuiPlugin() = default;
|
||||
|
||||
QString pluginName() override { return QStringLiteral("AreaEffectSimuationTechnicalAreaGui"); }
|
||||
std::shared_ptr<GuiPluginBase::Interface> createGuiInterface(LtsSession::LtsSession *session) override;
|
||||
bool availableInPartition(IDL::PartitionType partition) const override
|
||||
{
|
||||
return partition == IDL::PartitionType::Exercise;
|
||||
}
|
||||
};
|
||||
|
||||
class InterfaceImpl final : public AesBaseInterface, public AesTechnicalArea::ForeignGuiInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit InterfaceImpl(LtsSession::LtsSession *session);
|
||||
|
||||
QVector<LtsWidgets::PluginData> getActions() override;
|
||||
|
||||
private:
|
||||
LtsWidgets::LtsDialog *onShowAddTechnicalAreaDialog(QWidget *parent);
|
||||
LtsWidgets::LtsDialog *onShowTechnicalAreaListDialog(QWidget *parent);
|
||||
|
||||
};
|
||||
|
||||
} // namespace AreaEffectSimulation
|
||||
Executable
+21
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for AreaEffectSimulation / Technical Area (Interface for access from other Plugins)
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Philipp Dassow, SLEA, 2017-06-09
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace AesTechnicalArea
|
||||
{
|
||||
class ForeignGuiInterface
|
||||
{
|
||||
public:
|
||||
ForeignGuiInterface() = default;
|
||||
virtual ~ForeignGuiInterface() = default;
|
||||
};
|
||||
} // namespace AesTechnicalArea
|
||||
|
||||
+103
@@ -0,0 +1,103 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* AreaEffectSimulation - Technical Area Overview Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Philipp Dassow, SLEA, 2017-06-09
|
||||
*/
|
||||
|
||||
#include "aes_technical_area_list.h"
|
||||
#include "aes_technical_areas_model.h"
|
||||
#include "aes_technical_area_edit.h"
|
||||
#include "CustomView/aes_technical_area.h"
|
||||
|
||||
#include <LtsSession/lts_session_data.h>
|
||||
|
||||
namespace AreaEffectSimulation
|
||||
{
|
||||
bool TechnicalAreaList::init(LtsSession::LtsSession *session)
|
||||
{
|
||||
if (!AesItemList::init(session))
|
||||
return false;
|
||||
|
||||
m_bHasAddEditOperatorRights = LtsSessionData::LtsSessionData::getInstance()->hasOperatorRight(OperatorRights::TechnicalAreasEdit);
|
||||
|
||||
setDataViewModel(m_model, [this]() { return new CustomViewTechnicalArea(this); });
|
||||
|
||||
enaDisa();
|
||||
|
||||
#ifndef LTS_DEBUG
|
||||
hideColumn(TechnicalAreasModel::BcId);
|
||||
#endif
|
||||
//hideColumn(TechnicalAreasModel::BcChargeType); // used for AesTechnicalAreaType
|
||||
hideColumn(TechnicalAreasModel::BcEffectDuration);
|
||||
hideColumn(TechnicalAreasModel::BcEffectStart);
|
||||
hideColumn(TechnicalAreasModel::BcEffectSource);
|
||||
hideColumn(TechnicalAreasModel::BcParticipant);
|
||||
hideColumn(TechnicalAreasModel::BcParty);
|
||||
|
||||
setSortIndicator(TechnicalAreasModel::BcName);
|
||||
|
||||
setOnlineHelpFilename(QStringLiteral("Situation-Technical_Areas"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void TechnicalAreaList::createModel()
|
||||
{
|
||||
m_model = new AesItemSortFilterProxyModelTmpl<TechnicalArea>(m_session, this);
|
||||
|
||||
TechnicalAreasModel *sourceModel = new TechnicalAreasModel(this);
|
||||
sourceModel->initModel(m_session);
|
||||
connect(sourceModel, &TechnicalAreasModel::dataChanged, this, &TechnicalAreaList::enaDisa);
|
||||
m_model->setSourceModel(sourceModel);
|
||||
}
|
||||
|
||||
void TechnicalAreaList::onAddAesItem()
|
||||
{
|
||||
onAddEditAesItem(false);
|
||||
}
|
||||
|
||||
void TechnicalAreaList::onEditAesItem()
|
||||
{
|
||||
onAddEditAesItem(true);
|
||||
}
|
||||
|
||||
void TechnicalAreaList::onAddEditAesItem(bool bEdit)
|
||||
{
|
||||
const int aesItemId = model()->aesId(currentRow());
|
||||
if (aesItemId <= 0 && bEdit)
|
||||
return;
|
||||
|
||||
bool bCopy = bEdit ? false : aesItemId > 0;
|
||||
TechnicalAreaEdit *dialog = new TechnicalAreaEdit(m_menuGroup, this);
|
||||
if (dialog->init(aesItemId, bCopy, m_session))
|
||||
addDialog(dialog, m_menuGroup, dialog->dialogIdentifier(), LtsWidgets::LayoutArea::eDialogTab);
|
||||
else
|
||||
delete dialog;
|
||||
}
|
||||
|
||||
|
||||
void TechnicalAreaList::onRemoveAesItem()
|
||||
{
|
||||
const int aesItemId = model()->aesId(currentRow());
|
||||
Core::RemoveElementRequest req(aesItemId);
|
||||
m_requestHelper->startSingleRequest([req, this]()
|
||||
{
|
||||
return m_ftc->technicalAreaRemoveRequest(req, this);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
void TechnicalAreaList::retranslate()
|
||||
{
|
||||
translateBase(tr("Technical Areas"));
|
||||
}
|
||||
|
||||
void TechnicalAreaList::onTechnicalAreaRemoveReply(const Core::FunctionReplyObject &replyObject)
|
||||
{
|
||||
m_requestHelper->requestReply(replyObject);
|
||||
}
|
||||
|
||||
} // namespace AreaEffectSimulation
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* AreaEffectSimulation - Technical Area Overview Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Philipp Dassow, SLEA, 2017-06-09
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Plugins/AreaEffectSimulation/Gui/Base/aes_itemlist.h>
|
||||
#include <Plugins/AreaEffectSimulation/Gui/Base/aes_base_model.h>
|
||||
|
||||
namespace AreaEffectSimulation
|
||||
{
|
||||
|
||||
class TechnicalAreaList : public AesItemListTmpl<TechnicalArea>
|
||||
, protected AreaEffectSimulation::Interface::Ftc::TechnicalAreaRemoveReplyHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
using AesItemListTmpl<TechnicalArea>::AesItemListTmpl;
|
||||
|
||||
bool init(LtsSession::LtsSession *session) override;
|
||||
|
||||
private slots:
|
||||
void onAddAesItem() override final;
|
||||
void onEditAesItem() override final;
|
||||
void onAddEditAesItem(bool bEdit);
|
||||
void onRemoveAesItem() override final;
|
||||
|
||||
private:
|
||||
void createModel() override;
|
||||
void retranslate() override;
|
||||
void onTechnicalAreaRemoveReply(const Core::FunctionReplyObject &replyObject) override final;
|
||||
};
|
||||
}
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* AreaEffectManangement - Technical Area Overview Dialog Model
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Philipp Dassow, SLEA, 2017-06-09
|
||||
*/
|
||||
|
||||
#include "aes_technical_areas_model.h"
|
||||
#include <Plugins/ProjectDataManagement/pdm_data_plugin_interface.h>
|
||||
#include <QLocale>
|
||||
#include <QSet>
|
||||
|
||||
namespace AreaEffectSimulation
|
||||
{
|
||||
|
||||
TechnicalAreasModel::TechnicalAreasModel(QObject *parent)
|
||||
: AesGuiBaseModel<TechnicalArea>(parent)
|
||||
{}
|
||||
|
||||
bool TechnicalAreasModel::initModel(LtsSession::LtsSession *session)
|
||||
{
|
||||
if (!AesGuiBaseModel::initModel(session))
|
||||
return false;
|
||||
|
||||
connect(m_aesDtc.get(), &Interface::Dtc::technicalAreaChanged,
|
||||
this, &TechnicalAreasModel::onDataChanged);
|
||||
|
||||
connect(m_aesDtc.get(), &Interface::Dtc::technicalAreaChanged,
|
||||
this, &TechnicalAreasModel::dataChanged);
|
||||
|
||||
m_aesDtc->technicalAreas([this](const TechnicalArea & item) { insertRow(item); });
|
||||
return true;
|
||||
}
|
||||
|
||||
QVariant TechnicalAreasModel::headerData(int section, Qt::Orientation orientation, int role) const
|
||||
{
|
||||
if (section == BcChargeType && orientation == Qt::Horizontal && role == Qt::DisplayRole)
|
||||
return tr("Type");
|
||||
if (section == BcEffectState && orientation == Qt::Horizontal && role == Qt::DisplayRole)
|
||||
return tr("State");
|
||||
return AesGuiBaseModel::headerData(section, orientation, role);
|
||||
}
|
||||
|
||||
QVariant TechnicalAreasModel::data(const QModelIndex &idx, int role) const
|
||||
{
|
||||
if (!indexIsValid(idx))
|
||||
return QVariant();
|
||||
// misissue ChargeType for Type :)
|
||||
if (role == Qt::DisplayRole && idx.column() == BcChargeType)
|
||||
{
|
||||
const TechnicalArea &ta = m_vecData.at(idx.row());
|
||||
return AreaEffectSimulation::toString(ta.type());
|
||||
}
|
||||
if (role == Qt::DisplayRole && idx.column() == BcEffectState)
|
||||
{
|
||||
const TechnicalArea &ta = m_vecData.at(idx.row());
|
||||
return AreaEffectSimulation::toString(ta.effectStateId());
|
||||
}
|
||||
return AesGuiBaseModel::data(idx, role);
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // namespace AreaEffectSimulation
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for AreaEffectSimulation - Technical Area Overview Dialog Model
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Philipp Dassow, SLEA, 2017-06-09
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Plugins/AreaEffectSimulation/Gui/Base/aes_base_model.h>
|
||||
#include <ProjectDataManagement/pdm_enums.hpp>
|
||||
|
||||
namespace LtsSession
|
||||
{
|
||||
class LtsSession;
|
||||
}
|
||||
|
||||
namespace AreaEffectSimulation
|
||||
{
|
||||
|
||||
|
||||
/************ Class for Technical Area ***************/
|
||||
class TechnicalAreasModel final : public AesGuiBaseModel<TechnicalArea>
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
signals:
|
||||
void dataChanged();
|
||||
public:
|
||||
explicit TechnicalAreasModel(QObject *parent = nullptr);
|
||||
|
||||
bool initModel(LtsSession::LtsSession *session) override;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
|
||||
QVariant data(const QModelIndex &idx, int role) const override;
|
||||
};
|
||||
|
||||
|
||||
|
||||
} //namespace AreaEffectSimulation
|
||||
|
||||
|
||||
Reference in new issue
Block a user