138 lines
4.7 KiB
C++
Executable File
138 lines
4.7 KiB
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
* Dialog to edit drone Simulation
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
* Created by Steve Kemayou, ESZS, 2025-04-08
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
#include <LtsWidgets/lts_dialog.h>
|
|
#include <LtsWidgets/lts_frameless_dialog.h>
|
|
#include <LtsSession/lts_session.h>
|
|
#include <CentralEffectSimulation/ces_ftc.h>
|
|
#include <Plugins/SituationMapPlugin/situation_map_gui_plugin_interface.h>
|
|
#include <Plugins/FileManagement/flm_explorer_gui_plugin_interface.h>
|
|
#include <Plugins/ProjectDataManagement/pdm_data_plugin_interface.h>
|
|
#include <Plugins/ParticipantManagement/ppm_gui_combobox_plugin_interface.h>
|
|
|
|
|
|
#include <ParticipantManagement/ppm_dtc.h>
|
|
#include <ParticipantManagement/ppm_ftc.h>
|
|
#include <CentralEffectSimulation/ces_dtc.h>
|
|
#include <LtsWidgets/lts_date_time_edit.h>
|
|
#include <LtsUtilsGuiDds/request_helper.h>
|
|
#include "logger.h"
|
|
|
|
#include <QWidget>
|
|
|
|
namespace Ui {
|
|
class MissionPlanEdit;
|
|
}
|
|
namespace CentralEffectSimulation
|
|
{
|
|
struct WayPointParam
|
|
{
|
|
double lon;
|
|
double lat;
|
|
double z = 0.0;
|
|
int idleTime = 0;
|
|
double speed = 0.0;
|
|
int chargeTypeId = -1;
|
|
QString identifier;
|
|
};
|
|
|
|
class MissionPlanEdit : public LtsWidgets::LtsDialog
|
|
, protected ParticipantManagement::Interface::Ftc::ModifyMissionPlanReplyHandler
|
|
, protected ParticipantManagement::Interface::Ftc::SetMissionActionFulfilledReplyHandler
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
enum SegmentColumns
|
|
{
|
|
Name,
|
|
Position,
|
|
Altitude,
|
|
IdleTime, // [sec]
|
|
Charges
|
|
};
|
|
|
|
explicit MissionPlanEdit(QWidget *parent = nullptr);
|
|
~MissionPlanEdit();
|
|
|
|
bool init(const int missionPlanId, LtsSession::LtsSessionDataDds *session, bool asCopy = false);
|
|
|
|
void retranslate() override;
|
|
|
|
void onModifyMissionPlanReply(const Core::FunctionReplyObject &replyObject) override;
|
|
void onSetMissionActionFulfilledReply(const Core::FunctionReplyObject &replyObject) override;
|
|
QStringList tableColLabelList() const;
|
|
void setAllUiElementsEnabled(bool enable);
|
|
ParticipantManagement::MissionPlan missionPlan() const;
|
|
bool isUiEnabled() const;
|
|
signals:
|
|
void editUasDialogClosed(const int participantId);
|
|
|
|
private:
|
|
void enaDisa();
|
|
bool apply() override;
|
|
void clearCoordinates();
|
|
void clearContent();
|
|
void enableUiElements(bool enable);
|
|
bool hasValidEffectStart(LtsWidgets::LtsDateTimeEdit *dte) const;
|
|
void initTableHeader();
|
|
void insertPos(const WayPointParam &wpp);
|
|
void showPreview(bool show);
|
|
const std::vector<ParticipantManagement::MissionItem> itemsRequestContent();
|
|
|
|
void setUASCharges();
|
|
void setData(int mpId);
|
|
void fillParties();
|
|
void fillParticipants();
|
|
void gatherUASParticipants(int partyId, QVector<ParticipantManagement::Participant> &participant);
|
|
void setReady(bool isReady);
|
|
|
|
private slots:
|
|
void onParticipantTimerTimedout();
|
|
void onParticipantChanged(const ParticipantManagement::Participant &data, DataModification modType);
|
|
void onPartyChanged();
|
|
void onGetPolyline();
|
|
void onPolylineData(const QPolygonF &polyline); // callback for onGetPolyline()
|
|
void onFocus();
|
|
void onApplyNow();
|
|
void onUasChanged(const ParticipantManagement::UAS &uas);
|
|
void onDynamicParticipantDataChanged(const ParticipantManagement::DynamicParticipantData &data, DataModification modType);
|
|
void onMissionPlanChanged(const ParticipantManagement::MissionPlan &data, const DataModification modType);
|
|
|
|
private:
|
|
std::shared_ptr<FileManagement::ForeignGuiInterface> m_flmGui;
|
|
std::shared_ptr<ProjectDataManagement::Interface::Dtc> m_pdmDtc;
|
|
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_ppmDtc;
|
|
std::shared_ptr<ParticipantManagement::Interface::Ftc> m_ppmFtc;
|
|
LtsSession::LtsSessionDataDds *m_session;
|
|
ParticipantManagement::Participant m_participantData;
|
|
ParticipantManagement::MissionPlan m_missionPlan;
|
|
int m_missionPlanId;
|
|
bool m_uiEnabled;
|
|
QSet<int> m_usedUasSet;
|
|
|
|
std::shared_ptr<SituationMap::ForeignGuiInterface> m_sitMapGuiIfc;
|
|
std::shared_ptr<ParticipantManagement::ForeignGuiComboboxInterface> m_ppmCbxGui;
|
|
LtsUtils::RequestHelper *m_requestHelper;
|
|
QMap<int, QString> m_uasCharges;
|
|
QTimer *m_participantTimer; // used when participant were updated
|
|
|
|
QPolygonF m_polyline;
|
|
ParticipantManagement::Participant m_participant;
|
|
bool m_participantReady { false };
|
|
LOGGER_T m_logger;
|
|
|
|
Ui::MissionPlanEdit *m_ui;
|
|
};
|
|
|
|
}
|