135 lines
4.3 KiB
C++
Executable File
135 lines
4.3 KiB
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
* AreaEffectSimulation - Explosion Edit Dialog
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
* Created by Patric Karwat, SLSE, 2016-07-05
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <Plugins/AreaEffectSimulation/Gui/Base/aes_base_edit.h>
|
|
#include <Plugins/ProjectDataManagement/pdm_data_plugin_interface.h>
|
|
#include <Plugins/ParticipantManagement/ppm_data_plugin_interface.h>
|
|
#include <Plugins/ProjectDataManagement/pdm_gui_plugin_interface.h>
|
|
|
|
#include <AreaEffectSimulation/aes_ftc.h>
|
|
#include <ProjectDataManagement/pdm.hpp>
|
|
|
|
namespace Ui
|
|
{
|
|
class ExplosionEdit;
|
|
}
|
|
|
|
class QSpinBox;
|
|
|
|
namespace AdvancedSymbology {
|
|
class SymbolResultWatcherLabel;
|
|
class ForeignDataInterface;
|
|
}
|
|
|
|
namespace AreaEffectSimulation
|
|
{
|
|
|
|
class ExplosionEdit final
|
|
: public BaseEdit
|
|
, protected AreaEffectSimulation::Interface::Ftc::ExplosionAreaModifyReplyHandler
|
|
, protected AreaEffectSimulation::Interface::Ftc::ExplosionSingleModifyReplyHandler
|
|
, protected AreaEffectSimulation::Interface::Ftc::ExplosionAreaPauseResumeReplyHandler
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
enum ExplosionType
|
|
{
|
|
etSingle,
|
|
etArea,
|
|
etSingleCentral
|
|
};
|
|
|
|
explicit ExplosionEdit(const QString &menuGroup, ExplosionType type, ProjectDataManagement::GearClass gc, QWidget *parent = nullptr);
|
|
~ExplosionEdit();
|
|
|
|
bool init(int aesItemId, bool copy, LtsSession::LtsSession *session);
|
|
QString dialogIdentifier() const override;
|
|
|
|
void onExplosionAreaModifyReply(const Core::FunctionReplyObject &replyObject) override final { onAesItemModifyReply(replyObject); }
|
|
void onExplosionSingleModifyReply(const Core::FunctionReplyObject &replyObject) override final { onAesItemModifyReply(replyObject); }
|
|
|
|
void onExplosionAreaPauseResumeReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
|
|
|
|
void setFireButton(AesEffectState effectState);
|
|
|
|
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;
|
|
static double s_minRadius;
|
|
static double s_maxRadius;
|
|
static double s_stepRadius;
|
|
static int s_maxChargeUsage;
|
|
static double s_minAltitude;
|
|
static double s_maxAltitude;
|
|
static qint64 s_maxDurationSeconds;
|
|
|
|
void setBaseData(const AesItem &baseData, bool copy);
|
|
void setSingleData(const ExplosionSingle &singleData);
|
|
void setAreaData(const ExplosionArea &areaData, bool copy = false);
|
|
void enableUiElements(bool enable) override;
|
|
int maxAvailableRounds() const;
|
|
void updateCannonsRounds(bool modifiedFromExternal = false);
|
|
void updateMaxLabel(bool modifiedFromExternal = false);
|
|
quint32 partyForItem(const AesItem &aesItem) const;
|
|
|
|
private Q_SLOTS:
|
|
void getPosition();
|
|
void onMapRecData(const QPointF &bottomLeft, double width, double height, double angleDegNorth, const QPolygonF &bufferOutlinePolygon);
|
|
void onCoordinate(const QPointF ¢erPoint);
|
|
void onChargeTypeChanged();
|
|
void onPartyChanged();
|
|
bool apply() override final;
|
|
void onFireClicked();
|
|
void onParticipantClicked();
|
|
void onCannonsChanged(int cannons, bool modifiedFromExternal = false);
|
|
void onRoundsChanged(int rounds, bool modifiedFromExternal = false);
|
|
void onChargeCountChanged(const AreaEffectSimulation::ChargeAdministration &data, DataModification modType);
|
|
void showPreviewObject() override;
|
|
|
|
void onParticipant(const QVector<int> &participants);
|
|
private:
|
|
|
|
struct Charges
|
|
{
|
|
ProjectDataManagement::ChargeType chargeType;
|
|
QMap<int, int> available; // PartyId
|
|
Charges() {}
|
|
explicit Charges(const ProjectDataManagement::ChargeType &type) : chargeType(type) {}
|
|
};
|
|
|
|
ExplosionType m_type;
|
|
bool m_editable;
|
|
ProjectDataManagement::GearClass m_gearClass;
|
|
QPointF m_previewCircleCenter;
|
|
double m_previewCircleRadius;
|
|
QPolygonF m_previewPolygon;
|
|
QMap<qint32, Charges> m_chargeTypeMap; // ChargeTypeId
|
|
|
|
std::shared_ptr<ProjectDataManagement::Interface::Dtc> m_pdmDtc;
|
|
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_ppmDtc;
|
|
std::shared_ptr<AdvancedSymbology::ForeignDataInterface> m_asbIfc;
|
|
std::shared_ptr<ProjectDataManagement::ForeignGuiInterface> m_pdmCbx;
|
|
|
|
AdvancedSymbology::SymbolResultWatcherLabel *m_symbolWatcher;
|
|
ParticipantManagement::Participant m_participant;
|
|
Ui::ExplosionEdit *m_ui;
|
|
};
|
|
|
|
} //namespace AreaEffectSimulation
|