Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
@@ -0,0 +1,190 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for MeteoDataManagement - Weather Station Overview Dialog Model
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-10.05
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
#include <AreaEffectSimulation/aes_dtc.h>
|
||||
#include <EffectShowManagement/esm_dtc.h>
|
||||
#include <EffectShowManagement/logger.h>
|
||||
|
||||
#include <LtsWidgets/lts_abstract_table_model.h>
|
||||
#include <LtsWidgets/lts_column_filter_proxy_model.h>
|
||||
|
||||
namespace LtsSession
|
||||
{
|
||||
class LtsSession;
|
||||
}
|
||||
|
||||
namespace EffectShowManagement
|
||||
{
|
||||
class EffectShowActorProxyModel;
|
||||
class EffectShowActorModel;
|
||||
class EffectShowActorRelocationModel;
|
||||
|
||||
/**
|
||||
* @brief The EffectShowModel provides all not completed effect show orders.
|
||||
*/
|
||||
class EffectShowModel final : public LtsWidgets::LtsAbstractTableModel<EffectShowManagement::EffectShow>
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum Columns
|
||||
{
|
||||
Name_AES,
|
||||
Id,
|
||||
StartTime,
|
||||
Duration,
|
||||
Position,
|
||||
AesStatus,
|
||||
EffectShowActor,
|
||||
Volley,
|
||||
ShotsInTotal,
|
||||
Size,
|
||||
Rotation,
|
||||
Status,
|
||||
Answer
|
||||
};
|
||||
explicit EffectShowModel(QObject *parent);
|
||||
~EffectShowModel();
|
||||
|
||||
bool initModel(LtsSession::LtsSession *session);
|
||||
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
|
||||
EffectShowActorModel *getEffectShowActorModel() { return m_effectShowActorModel; }
|
||||
EffectShowActorProxyModel *getEffectShowActorProxyModel() { return m_effectShowActorProxyModel; }
|
||||
EffectShowActorRelocationModel *getEffetShowActorRelocationModel() { return m_effectShowActorRelocationModel; }
|
||||
|
||||
/**
|
||||
* @brief Provides the list with the names of all selectable effect show actors via gui.
|
||||
* If the effect show actor has sent its operational status at least one time, the
|
||||
* actor will be part of the list.
|
||||
* @return list the list with the names of all selectable effect show actors
|
||||
*/
|
||||
QMap<int, QString> getParticipantList() const;
|
||||
|
||||
|
||||
/**
|
||||
* @brief Provides the list with the names of all selectable effect show actors via gui.
|
||||
* If the effect show actor has sent its operational status at least one time, the
|
||||
* actor will be part of the list.
|
||||
* @param is_smoke filters the list for smoke or pyro effect actors
|
||||
* @return list the list with the names of all selectable effect show actors
|
||||
*/
|
||||
QMap<int, QString> getParticipantList(bool is_smoke) const;
|
||||
|
||||
/**
|
||||
* @brief Provides the list with the names of all selectable effect show actors via gui.
|
||||
* If the effect show actor has sent its operational status at least one time, the
|
||||
* actor will be part of the list.
|
||||
* @details The list is sorted by distance to the given point.
|
||||
* There are additional outputs added to the string
|
||||
* @param is_smoke filters the list for smoke or pyro effect actors
|
||||
* @param origin the origin position of the effect show. Used for calculating the distance
|
||||
* @return QVector<QPair<int, QString>> the list with the names of all selectable effect show actors sort by distance
|
||||
*/
|
||||
QVector<QPair<int, QString>> getParticipantListByDistance(bool is_smoke, const Core::GeoPosition2D &origin);
|
||||
|
||||
/**
|
||||
* @brief Returns the name of the actor related to the ID of the actor from the EffectShowActorModel.
|
||||
* @param id ID of the effect show actor
|
||||
* @return Name of the effect show actor
|
||||
*/
|
||||
QString getParticipantName(int id) const;
|
||||
|
||||
/**
|
||||
* @brief Returns a string indicating ammunition in magazine and ammunition available from the EffectShowActorModel.
|
||||
* @param id ID of the effect show actor
|
||||
* @return String indicating ammunition in magazine and ammunition available
|
||||
*/
|
||||
QString getParticipantAmmunition(int id) const;
|
||||
|
||||
/**
|
||||
* @brief Returns, if the effect show actor has sent its status at least one time from the EffectShowVehicleStatusModel.
|
||||
* @param equipmentNum Equipment Number allocated to the effect show actor
|
||||
* @return (true)The effect show actor has sent its status at least one time
|
||||
*/
|
||||
bool isVehicleStatus(int equipmentNum) const;
|
||||
/**
|
||||
* @brief Returns, if the vehicle status from the EffectShowVehicleStatusModel.
|
||||
* @param equipmentNum Equipment Number of the vehicle
|
||||
* @return Vehicle status
|
||||
*/
|
||||
bool getVehicleStatus(int equipmentNum, EffectShowManagement::EffectShowVehicleStatus &vehicleStatus) const;
|
||||
/**
|
||||
* @brief wasVehicleOperationalToday returns true if the vehicle was operational today.
|
||||
* @param equipmentNum Equipment Number of the vehicle
|
||||
* @return Reported as operational today
|
||||
*/
|
||||
bool hasVehicleReportedOperationalToday(int equipmentNum) const;
|
||||
|
||||
/**
|
||||
* @brief Returns the time and position of the next effect show allocated to the participant
|
||||
* @param idParticipant ID of the participant
|
||||
* @return Time and position of the next effect show.
|
||||
*/
|
||||
QString getTimeAndPositionOfNextEffectShow(int idParticipant) const;
|
||||
/**
|
||||
* @brief Returns the time and position of the next effect show actor relocation allocated to the participant
|
||||
* @param idParticipant ID of the participant
|
||||
* @return Time and positionof the next effect show actor relocation.
|
||||
*/
|
||||
QString getTimeAndPositionOfNextActorRelocation(int idParticipant) const;
|
||||
|
||||
/**
|
||||
* @brief Updates the model and the contained models.
|
||||
*/
|
||||
void updateAll();
|
||||
|
||||
private:
|
||||
bool onEffectShowVehicleStatusChanged(const EffectShowManagement::EffectShowVehicleStatus &data, DataModification modType);
|
||||
|
||||
signals:
|
||||
void effectShowVehicleStatusChanged(const EffectShowManagement::EffectShowVehicleStatus &, const DataModification &);
|
||||
|
||||
private:
|
||||
std::shared_ptr<EffectShowManagement::Interface::Dtc> m_dtc;
|
||||
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_dtcPpm;
|
||||
std::shared_ptr<AreaEffectSimulation::Interface::Dtc> m_dtcAes;
|
||||
|
||||
QMap<int, EffectShowManagement::EffectShowVehicleStatus> m_effectShowVehicleStatus;
|
||||
QMap<int, qint64> m_effectShowVehicleLastTimeOperational;
|
||||
|
||||
EffectShowActorProxyModel *m_effectShowActorProxyModel;
|
||||
EffectShowActorModel *m_effectShowActorModel;
|
||||
EffectShowActorRelocationModel *m_effectShowActorRelocationModel;
|
||||
|
||||
friend class EffectShowProxyModel;
|
||||
LOGGER_T m_logger;
|
||||
|
||||
};
|
||||
|
||||
class EffectShowProxyModel final : public LtsWidgets::LtsColumnFilterProxyModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
using LtsWidgets::LtsColumnFilterProxyModel::LtsColumnFilterProxyModel;
|
||||
void setSourceModel(QAbstractItemModel *sourceModel) override;
|
||||
bool showExpired() const { return m_showExpired; }
|
||||
|
||||
public slots:
|
||||
void setShowExpired(bool show);
|
||||
|
||||
protected:
|
||||
bool lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const override;
|
||||
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override final;
|
||||
private:
|
||||
bool checkFilter(int source_row) const;
|
||||
private:
|
||||
bool m_showExpired = false;
|
||||
|
||||
EffectShowModel *m_sourceModel = nullptr;
|
||||
};
|
||||
} //namespace EffectShowManagement
|
||||
Reference in new issue
Block a user