Files
qt5-legatus-legacy/Lts/Plugins/AreaEffectSimulation/Gui/MineArea/aes_mine_area_edit.h
T
2026-08-13 18:33:10 +02:00

84 lines
2.7 KiB
C++
Executable File

/**
* @RDE_HEADER@
* AreaEffectSimulation - MineArea Edit Dialog
* $Id$
* $HeadURL$
* $Author$
*
* Created by Mike Wille, SLSE, 2016-09-26
*/
#pragma once
#include <Plugins/AreaEffectSimulation/Gui/Base/aes_base_edit.h>
#include <Plugins/ProjectDataManagement/pdm_gui_plugin_interface.h>
#include <Plugins/ProjectDataManagement/pdm_data_plugin_interface.h>
namespace Ui
{
class MineAreaEdit;
}
namespace AreaEffectSimulation
{
class MineAreaEdit final
: public BaseEdit
, protected AreaEffectSimulation::Interface::Ftc::MineAreaModifyReplyHandler
, protected AreaEffectSimulation::Interface::Ftc::MineResetReplyHandler
{
Q_OBJECT
public:
explicit MineAreaEdit(const QString &menuGroup, QWidget *parent = nullptr);
~MineAreaEdit();
QString dialogIdentifier() const override
{
return m_aesItem.id() <= 0 ? QStringLiteral("AddMineArea") : QStringLiteral("EditMineArea%1").arg(m_aesItem.id());
}
bool init(int aesItemId, bool copy, LtsSession::LtsSession *session);
void onMineAreaModifyReply(const Core::FunctionReplyObject &replyObject) override final { onAesItemModifyReply(replyObject); }
void onMineResetReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
private:
std::vector<LtsCoordWidget::LtsCoordWidget *> coordWidgets() const override;
void retranslate() override;
static constexpr double s_minWidth = 1;
static constexpr double s_maxWidth = 250;
static constexpr double s_stepWidth = 1;
static constexpr double s_minDensity = 0.1;
static constexpr double s_maxDensity = 0.9;
static constexpr double s_stepDensity = 0.1;
static constexpr double s_maxLength = 2500;
static constexpr int s_maxSegments = 10;
static constexpr int s_maxDurationHours = 96;
void setData(const MineArea &data, bool copy);
void enableUiElements(bool enable) override;
double getMaxLength() const override { return s_maxLength; }
private slots:
void getPosition();
void onMapRecData(const double width, const QVector<QPointF> &polygon, const QPolygonF &bufferOutlinePolygon);
void onPolygonData(const QPolygonF &polygon);
bool onResetDusMines();
bool apply() override final;
void onLayingProcedureChanged();
void showPreviewObject() override;
void onChargeTypeChanged(int index);
private:
std::shared_ptr<ProjectDataManagement::ForeignGuiInterface> m_pdmGuiIfc;
std::shared_ptr<ProjectDataManagement::Interface::Dtc> m_pdmDtc;
std::shared_ptr<AreaEffectSimulation::Interface::Dtc> m_aesDtc;
Ui::MineAreaEdit *m_ui;
QMap<int, LtsCoordWidget::LtsCoordWidget*> m_coordMap;
QPolygonF m_previewPolygon;
int m_segments;
};
} //namespace AreaEffectSimulation