Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
+37
@@ -0,0 +1,37 @@
|
||||
#
|
||||
# $Id$
|
||||
# $HeadURL$
|
||||
# $Author$
|
||||
#
|
||||
|
||||
ADD_SUBDIRECTORY(Data)
|
||||
ADD_SUBDIRECTORY(Gui)
|
||||
|
||||
#
|
||||
# Gui Plugin Interface
|
||||
#
|
||||
ADD_INTERFACE_LIBRARY(EsmGuiPluginInterface
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/esm_gui_plugin_interface.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../
|
||||
GuiPluginInterface
|
||||
)
|
||||
|
||||
#
|
||||
# Combobox Gui Plugin Interface
|
||||
#
|
||||
ADD_INTERFACE_LIBRARY(EsmGuiComboboxPluginInterface
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/esm_gui_combobox_plugin_interface.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../
|
||||
GuiPluginInterface
|
||||
svcEsmCommon
|
||||
)
|
||||
|
||||
#
|
||||
# Data Plugin Interface
|
||||
#
|
||||
ADD_INTERFACE_LIBRARY(EsmDataPluginInterface
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/esm_data_plugin_interface.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../
|
||||
DataPluginInterface
|
||||
svcEsmCommon
|
||||
)
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
#
|
||||
# $Id$
|
||||
# $HeadURL$
|
||||
# $Author$
|
||||
# Created by Mike Wille, SLSE; 2016-09-06
|
||||
#
|
||||
|
||||
#
|
||||
# Data Plugin
|
||||
#
|
||||
NGL_ADD_LIBRARY2(WS EsmDataPlugin MODULE esm_data_plugin.cpp esm_data_plugin.h)
|
||||
NGL_TARGET_LINK_LIBRARIES(EsmDataPlugin
|
||||
Qt5::Core
|
||||
EsmDataPluginInterface
|
||||
svcEsmClient
|
||||
NGLLogger
|
||||
LtsSessionDataDds
|
||||
)
|
||||
|
||||
NGL_INSTALL_TARGET(EsmDataPlugin)
|
||||
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Data Plugin for MeteoDataManangement
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-10-05
|
||||
*/
|
||||
|
||||
#include "esm_data_plugin.h"
|
||||
|
||||
#include <DDS/DDSConnector/dds_connector.h>
|
||||
#include <LtsSession/lts_session_data_dds.h>
|
||||
|
||||
namespace EffectShowManagement
|
||||
{
|
||||
std::shared_ptr<DataPluginBase::Interface> DataPlugin::createDataInterface(LtsSession::LtsSessionDataDds *session)
|
||||
{
|
||||
std::shared_ptr<EffectShowManagement::Interface::Dtc> dtc;
|
||||
std::shared_ptr<EffectShowManagement::Interface::Ftc> ftc;
|
||||
|
||||
if (!session->createTopicClient(dtc, ftc))
|
||||
return std::shared_ptr<DataPluginBase::Interface>();
|
||||
|
||||
return std::make_shared<DataInterfaceImpl>(dtc,ftc);
|
||||
}
|
||||
|
||||
DataInterfaceImpl::DataInterfaceImpl(const std::shared_ptr<EffectShowManagement::Interface::Dtc> &dtc,
|
||||
const std::shared_ptr<EffectShowManagement::Interface::Ftc> &ftc)
|
||||
: DataInterface()
|
||||
, m_dtc(dtc)
|
||||
, m_ftc(ftc)
|
||||
{}
|
||||
|
||||
} // namespace EffectShowManagement
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Data Plugin for MeteoDataManagement
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-10-05
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <PluginInterfaces/data_plugin_interface.h>
|
||||
#include <Plugins/EffectShowManagement/esm_data_plugin_interface.h>
|
||||
|
||||
namespace EffectShowManagement
|
||||
{
|
||||
|
||||
class DataPlugin final : public QObject, public DataPluginBase::Plugin
|
||||
{
|
||||
Q_PLUGIN_METADATA(IID "data:3:esm")
|
||||
Q_INTERFACES(DataPluginBase::Plugin)
|
||||
|
||||
Q_OBJECT
|
||||
public:
|
||||
DataPlugin() = default;
|
||||
~DataPlugin() = default;
|
||||
|
||||
QString pluginName() const override { return QStringLiteral("EffectShowManagement"); }
|
||||
std::shared_ptr<DataPluginBase::Interface> createDataInterface(LtsSession::LtsSessionDataDds *session) override;
|
||||
bool availableInPartition(IDL::PartitionType partition) const override
|
||||
{
|
||||
return partition == IDL::PartitionType::Exercise;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class DataInterfaceImpl final : public DataInterface
|
||||
{
|
||||
public:
|
||||
DataInterfaceImpl(const std::shared_ptr<EffectShowManagement::Interface::Dtc> &dtc,
|
||||
const std::shared_ptr<EffectShowManagement::Interface::Ftc> &ftc);
|
||||
|
||||
std::shared_ptr<EffectShowManagement::Interface::Dtc> getDtc() override { return m_dtc; }
|
||||
std::shared_ptr<EffectShowManagement::Interface::Ftc> getFtc() override { return m_ftc; }
|
||||
|
||||
private:
|
||||
std::shared_ptr<EffectShowManagement::Interface::Dtc> m_dtc;
|
||||
std::shared_ptr<EffectShowManagement::Interface::Ftc> m_ftc;
|
||||
};
|
||||
|
||||
} // namespace EffectShowManagement
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
#
|
||||
# $Id$
|
||||
# $HeadURL$
|
||||
# $Author$
|
||||
# Created by Patric Karwat, SLSE, 2016-10-05
|
||||
#
|
||||
|
||||
SET(esm_effect_show_gui_SRCS
|
||||
esm_effect_show_gui_plugin.cpp
|
||||
esm_effect_show_gui_plugin.h
|
||||
esm_effect_show_model.cpp
|
||||
esm_effect_show_model.h
|
||||
esm_effect_show_actor_model.cpp
|
||||
esm_effect_show_actor_model.h
|
||||
esm_effect_show_actor_relocation_model.cpp
|
||||
esm_effect_show_actor_relocation_model.h
|
||||
esm_effect_show_list.cpp
|
||||
esm_effect_show_list.h
|
||||
esm_effect_show_edit.cpp
|
||||
esm_effect_show_edit.h
|
||||
esm_effect_show_actor_relocation_list.cpp
|
||||
esm_effect_show_actor_relocation_list.h
|
||||
esm_effect_show_actor_relocation_edit.cpp
|
||||
esm_effect_show_actor_relocation_edit.h
|
||||
esm_effect_show_actor_list.cpp
|
||||
esm_effect_show_actor_list.h
|
||||
|
||||
)
|
||||
|
||||
NGL_WRAP_UI(esm_effect_show_gui_SRCS
|
||||
esm_effect_show_list.ui
|
||||
esm_effect_show_edit.ui
|
||||
esm_effect_show_actor_relocation_list.ui
|
||||
esm_effect_show_actor_relocation_edit.ui
|
||||
esm_effect_show_actor_list.ui
|
||||
)
|
||||
|
||||
NGL_ADD_LIBRARY(WS EsmEffectShowGuiPlugin MODULE ${esm_effect_show_gui_SRCS})
|
||||
NGL_TARGET_LINK_LIBRARIES(EsmEffectShowGuiPlugin
|
||||
NGLLogger
|
||||
ngltools
|
||||
LtsPrinting
|
||||
LtsSession
|
||||
EsmGuiPluginInterface
|
||||
EsmDataPluginInterface
|
||||
Qt5::Widgets
|
||||
LtsWidgets
|
||||
LtsDataView
|
||||
LtsUtilsGuiDds
|
||||
ltsCoordWidget
|
||||
LtsCoordTrans
|
||||
AesDataPluginInterface
|
||||
PpmDataPluginInterface
|
||||
PdmDataPluginInterface
|
||||
TabDataPluginInterface
|
||||
PpmCommon
|
||||
LtsUtilsSettings
|
||||
)
|
||||
|
||||
NGL_INSTALL_TARGET(EsmEffectShowGuiPlugin)
|
||||
|
||||
ADD_SUBDIRECTORY(EsmComboBox)
|
||||
@@ -0,0 +1,44 @@
|
||||
#
|
||||
# $Id$
|
||||
# $HeadURL$
|
||||
# $Author$
|
||||
# Created by Mike Wille, SLSE, 2016-05-05
|
||||
#
|
||||
|
||||
SET(esm_combobox_gui_SRCS
|
||||
esm_combobox_foreign_gui_interface_impl.cpp
|
||||
esm_combobox_foreign_gui_interface_impl.h
|
||||
esm_combobox.cpp
|
||||
esm_combobox.h
|
||||
)
|
||||
NGL_WRAP_UI(esm_combobox_gui_SRCS )
|
||||
NGL_ADD_LIBRARY(WS EsmComboBoxGui STATIC ${esm_combobox_gui_SRCS})
|
||||
NGL_TARGET_INCLUDE_DIRECTORIES(EsmComboBoxGui
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../..
|
||||
)
|
||||
NGL_TARGET_LINK_LIBRARIES(EsmComboBoxGui
|
||||
PRIVATE
|
||||
LtsWidgets
|
||||
PUBLIC
|
||||
LtsSession
|
||||
EsmGuiComboboxPluginInterface
|
||||
Qt5::Core
|
||||
svcEsmClient
|
||||
svcPpmClient
|
||||
svcAesClient
|
||||
)
|
||||
|
||||
SET(esm_combobox_gui_plugin_SRCS
|
||||
esm_combobox_gui_plugin.cpp
|
||||
esm_combobox_gui_plugin.h
|
||||
)
|
||||
NGL_ADD_LIBRARY(WS EsmComboBoxGuiPlugin MODULE ${esm_combobox_gui_plugin_SRCS})
|
||||
NGL_TARGET_LINK_LIBRARIES(EsmComboBoxGuiPlugin
|
||||
LtsSessionData
|
||||
NGLLogger
|
||||
EsmComboBoxGui
|
||||
EsmDataPluginInterface
|
||||
)
|
||||
|
||||
NGL_INSTALL_TARGET(EsmComboBoxGuiPlugin)
|
||||
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* EffectShowManagement - PpmComboBox
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-09-12
|
||||
*/
|
||||
|
||||
#include "esm_combobox.h"
|
||||
#include <QComboBox>
|
||||
#include <EffectShowManagement/esm_translation.h>
|
||||
|
||||
namespace EffectShowManagement
|
||||
{
|
||||
|
||||
|
||||
} // namespace EffectShowManagement
|
||||
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for EffectShowManagement - EsmComboBox
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-09-12
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
//DDS
|
||||
#include <EffectShowManagement/esm_dtc.h>
|
||||
|
||||
class QComboBox;
|
||||
|
||||
namespace EffectShowManagement
|
||||
{
|
||||
|
||||
// --------------------------------------------------------
|
||||
// ComboBox
|
||||
// --------------------------------------------------------
|
||||
namespace EsmComboBox
|
||||
{
|
||||
}
|
||||
|
||||
} // namespace EffectShowManagement
|
||||
Executable
+199
@@ -0,0 +1,199 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* GUI Plugin for EffectShowManagement - EsmComboBox
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-09-12
|
||||
*/
|
||||
#include "esm_combobox_gui_plugin.h"
|
||||
#include "esm_combobox.h"
|
||||
#include <EffectShowManagement/esm_translation.h>
|
||||
#include <LtsWidgets/lts_combo_box.h>
|
||||
#include <LtsCoordTrans/lts_coord_trans.h>
|
||||
|
||||
namespace EffectShowManagement
|
||||
{
|
||||
|
||||
ForeignGuiComboboxInterfaceImpl::ForeignGuiComboboxInterfaceImpl()
|
||||
: m_dtc(nullptr)
|
||||
{}
|
||||
|
||||
bool ForeignGuiComboboxInterfaceImpl::init(const std::shared_ptr<EffectShowManagement::Interface::Dtc> &dtc,
|
||||
const std::shared_ptr<ParticipantManagement::Interface::Dtc> &ppmDtc,
|
||||
const std::shared_ptr<AreaEffectSimulation::Interface::Dtc> &aesDtc)
|
||||
{
|
||||
// qCritical() << "ForeignGuiComboboxInterfaceImpl::init";
|
||||
m_dtc = dtc;
|
||||
//return m_dtc != nullptr;
|
||||
|
||||
m_ppmDtc = ppmDtc;
|
||||
//return m_ppmDtc != nullptr;
|
||||
|
||||
m_aesDtc = aesDtc;
|
||||
|
||||
// E _S_ M
|
||||
m_dtc->enableEffectShowVehicleStatus();
|
||||
m_dtc->waitForHistoricalDataEffectShowVehicleStatus(1000);
|
||||
m_dtc->enableEffectShow();
|
||||
m_dtc->waitForHistoricalDataEffectShow(1000);
|
||||
initEffectShowActors();
|
||||
|
||||
// A _E_ S
|
||||
m_aesDtc->enableExplosionCluster();
|
||||
m_aesDtc->waitForHistoricalDataExplosionCluster(1000);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ForeignGuiComboboxInterfaceImpl::uninit()
|
||||
{
|
||||
m_dtc = nullptr;
|
||||
}
|
||||
|
||||
|
||||
bool ForeignGuiComboboxInterfaceImpl::fillActorComboBox(QComboBox *cbx, const Core::GeoPosition &targetPosition, const bool isSmoke, const int featureFilter)
|
||||
{
|
||||
// qCritical() << "ForeignGuiComboboxInterfaceImpl::fillAcorComboBox"
|
||||
// << ", targetPosition: " << targetPosition.lon() << "/" << targetPosition.lat()
|
||||
// << ", isFog: " << isSmoke;
|
||||
// m_ppmDtc = ppmDtc;
|
||||
// m_aesDtc = aesDtc;
|
||||
m_cbx = cbx;
|
||||
cbx->clear();
|
||||
cbx->addItem(QLatin1String("---"), 0);
|
||||
m_coord = targetPosition;
|
||||
m_isSmoke = isSmoke;
|
||||
m_featureFilter = featureFilter;
|
||||
|
||||
initEffectShowActors();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
QString ForeignGuiComboboxInterfaceImpl::getAssignedAesField (const int participantId)
|
||||
{
|
||||
QString result = {};
|
||||
|
||||
for (const auto &explosionCluster : m_aesDtc->explosionClusters())
|
||||
{
|
||||
if (explosionCluster.effectStateId() == AreaEffectSimulation::AesEffectState_def::EsExpired)
|
||||
continue;
|
||||
for ( const auto &esmParticipant : explosionCluster.esmParticipantIds())
|
||||
{
|
||||
if ( esmParticipant == participantId)
|
||||
result.append(tr(" | Assigned: %1").arg(QString::fromStdString(explosionCluster.name())));
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void ForeignGuiComboboxInterfaceImpl::initEffectShowActors()
|
||||
{
|
||||
// qCritical() << "ForeignGuiComboboxInterfaceImpl::initEffectShowActors";
|
||||
QVector<QPair<int, QString>> ret;
|
||||
QVector<int> participants;
|
||||
QMap<double, int> sortedParticipants;
|
||||
QMap<int,EffectShowManagement::EffectShowVehicleStatus> effectShowVehicleStatuss;
|
||||
if (qFuzzyCompare(m_coord.lon(), 0) && qFuzzyCompare(m_coord.lat(), 0))
|
||||
{
|
||||
// qCritical() << "ForeignGuiComboboxInterfaceImpl::Keine Pos"
|
||||
// << ", pos: " << m_coord.lon() << "/" << m_coord.lat();
|
||||
return;
|
||||
}
|
||||
for (const auto &state : m_dtc->effectShowVehicleStatuss())
|
||||
{
|
||||
// qCritical() << "ForeignGuiComboboxInterfaceImpl::esmParticipantId" << state.esmParticipantId();
|
||||
participants.append(state.esmParticipantId());
|
||||
effectShowVehicleStatuss.insert(state.esmParticipantId(), state);
|
||||
}
|
||||
sortedParticipants = m_ppmDtc->sortByDistance(m_coord.lon(), m_coord.lat(), participants);
|
||||
// qCritical() << "ForeignGuiComboboxInterfaceImpl::sortedParticipants.size=" << sortedParticipants.size();
|
||||
for ( auto it = sortedParticipants.cbegin(); it!= sortedParticipants.cend(); ++it)
|
||||
{
|
||||
ParticipantManagement::Participant participant = m_ppmDtc->participant(it.value());
|
||||
EffectShowManagement::EffectShowVehicleStatus effectShowVehicleStatus = effectShowVehicleStatuss.value(it.value());
|
||||
int equipmentNumber = m_ppmDtc->equipmentNumberByParticipantId(effectShowVehicleStatus.esmParticipantId());
|
||||
bool isSmokeVehicle = effectShowVehicleStatus.feature() == Feature_e_def::Smoke;
|
||||
// qCritical() << "ForeignGuiComboboxInterfaceImpl::it.key() distance=" << it.key()
|
||||
// << ", it.value() participantId:" << it.value()
|
||||
// << ", ammunitionMagazine :" << effectShowVehicleStatus.ammunitionMagazine()
|
||||
// << ", ammunitionAvailable :" << effectShowVehicleStatus.ammunitionAvailable()
|
||||
// << ", equipmentNumber :" << equipmentNumber
|
||||
// << ", designator :" << participant.designator().c_str()
|
||||
// << ", tacticalIdentifier :" << participant.tacticalIdentifier().c_str()
|
||||
// << ", m_isSmoke" << m_isSmoke
|
||||
// << ", effectShowVehicleStatus.feature()" << isSmokeVehicle;
|
||||
if ( !m_isSmoke && isSmokeVehicle)
|
||||
{
|
||||
// qCritical() << "!m_isSmoke && isSmokeVehicle";
|
||||
continue;
|
||||
}
|
||||
else if ( m_isSmoke && !isSmokeVehicle)
|
||||
{
|
||||
// qCritical() << "m_isSmoke && !isSmokeVehicle";
|
||||
continue;
|
||||
}
|
||||
//Example: OC 2 - OC 2 (2502) Mag: 3 |Verfügbar: 3 | Abstand: 85[m]
|
||||
QString newString = QStringLiteral("%1 - %2 (%3)").arg(QString::fromStdString(participant.designator())).arg(QString::fromStdString(participant.tacticalIdentifier())).arg(equipmentNumber);
|
||||
newString.append(QStringLiteral(" "));
|
||||
if (!m_isSmoke)
|
||||
newString.append(tr("Mag: %1 | Avail: %2").arg(effectShowVehicleStatus.ammunitionMagazine()).arg(effectShowVehicleStatus.ammunitionAvailable()));
|
||||
else
|
||||
newString.append(tr("Avail: %1").arg(effectShowVehicleStatus.ammunitionAvailable()));
|
||||
newString.append(tr(" | Dist: %1[m]").arg(QString::number(int(it.key()))));
|
||||
newString.append(getAssignedAesField(it.value()));
|
||||
// qCritical() << "ForeignGuiComboboxInterfaceImpl::newString=" << newString;
|
||||
ret.append(QPair<int, QString>(it.value(), newString));
|
||||
if (isMatchedByFilter(effectShowVehicleStatus, m_featureFilter))
|
||||
m_cbx->addItem(newString, it.value()); // it.value = ParticipantId
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
bool ForeignGuiComboboxInterfaceImpl::isMatchedByFilter(const EffectShowVehicleStatus &vehicleStatus, const int &featureFilter) const
|
||||
{
|
||||
|
||||
enum eFeature
|
||||
{
|
||||
NotSpecified = Feature_e_def::NotSpecified, // not used (for now?)
|
||||
Smoke = Feature_e_def::Smoke,
|
||||
Explosion24 = Feature_e_def::Explosion24,
|
||||
Explosion48 = Feature_e_def::Explosion48,
|
||||
SmokeAndExplosion48 = Explosion48 + 1
|
||||
};
|
||||
|
||||
int feature = static_cast<int>(vehicleStatus.feature().underlying());
|
||||
|
||||
switch (featureFilter)
|
||||
{
|
||||
case eFeature::SmokeAndExplosion48:
|
||||
if (feature != eFeature::Smoke && feature != eFeature::Explosion48)
|
||||
return false;
|
||||
break;
|
||||
|
||||
case eFeature::Smoke:
|
||||
if (feature != eFeature::Smoke)
|
||||
return false;
|
||||
break;
|
||||
|
||||
case eFeature::Explosion48:
|
||||
if (feature != eFeature::Explosion48)
|
||||
return false;
|
||||
break;
|
||||
|
||||
case eFeature::Explosion24:
|
||||
if (feature != eFeature::Explosion24)
|
||||
return false;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
} // switch
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace EffectShowManagement
|
||||
Executable
+49
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
*@RDE_HEADER@
|
||||
* Gui Plugin for EffectShowManagement - PpmComboBox
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-09-12
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <EffectShowManagement/esm_dtc.h>
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
#include <AreaEffectSimulation/aes_dtc.h>
|
||||
#include <EffectShowManagement/esm_gui_combobox_plugin_interface.h>
|
||||
#include <LtsSession/lts_session.h>
|
||||
|
||||
namespace EffectShowManagement
|
||||
{
|
||||
enum class ComboBoxType;
|
||||
|
||||
class ForeignGuiComboboxInterfaceImpl : public QObject, public ForeignGuiComboboxInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ForeignGuiComboboxInterfaceImpl();
|
||||
|
||||
bool init(const std::shared_ptr<EffectShowManagement::Interface::Dtc> &dtc,
|
||||
const std::shared_ptr<ParticipantManagement::Interface::Dtc> &ppmDtc,
|
||||
const std::shared_ptr<AreaEffectSimulation::Interface::Dtc> &aesDtc);
|
||||
void uninit();
|
||||
|
||||
bool fillActorComboBox(QComboBox *cbx, const Core::GeoPosition &targetPosition, const bool isSmoke, const int featureFilter) override;
|
||||
|
||||
private:
|
||||
void initEffectShowActors();
|
||||
QString getAssignedAesField (const int participantId);
|
||||
bool isMatchedByFilter(const EffectShowVehicleStatus &vehicleStatus, const int &featureFilter) const;
|
||||
|
||||
std::shared_ptr<EffectShowManagement::Interface::Dtc> m_dtc;
|
||||
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_ppmDtc;
|
||||
std::shared_ptr<AreaEffectSimulation::Interface::Dtc> m_aesDtc;
|
||||
Core::GeoPosition m_coord;
|
||||
bool m_isSmoke;
|
||||
int m_featureFilter;
|
||||
QComboBox *m_cbx;
|
||||
};
|
||||
|
||||
} // namespace EffectShowManagement
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* GUI Plugin for EffectShowManagement - EsmComboBox
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-09-12
|
||||
*/
|
||||
|
||||
#include "esm_combobox_gui_plugin.h"
|
||||
#include <EffectShowManagement/logger.h>
|
||||
#include <LtsSession/lts_session_data.h>
|
||||
#include <ParticipantManagement/ppm_data_plugin_interface.h>
|
||||
#include <AreaEffectSimulation/aes_data_plugin_interface.h>
|
||||
|
||||
namespace EffectShowManagement
|
||||
{
|
||||
|
||||
std::shared_ptr<GuiPluginBase::Interface> GuiPlugin::createGuiInterface(LtsSession::LtsSession *session)
|
||||
{
|
||||
return std::make_shared<InterfaceImpl>(session);
|
||||
}
|
||||
|
||||
InterfaceImpl::InterfaceImpl(LtsSession::LtsSession *session)
|
||||
: GuiPluginBase::Interface(session, getLogger("Plugins.Gui.Esm.EsmCombobox"))
|
||||
{}
|
||||
|
||||
bool InterfaceImpl::fetchInterfaces()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "InterfaceImpl::fetchInterfaces";
|
||||
std::shared_ptr<EffectShowManagement::Interface::Dtc> dtc;
|
||||
if (!m_session->getDtc<EffectShowManagement::DataInterface>(dtc))
|
||||
return false;
|
||||
std::shared_ptr<ParticipantManagement::Interface::Dtc> ppmDtc;
|
||||
if (!m_session->getDtc<ParticipantManagement::DataInterface>(ppmDtc))
|
||||
return false;
|
||||
std::shared_ptr<AreaEffectSimulation::Interface::Dtc> aesDtc;
|
||||
if (!m_session->getDtc<AreaEffectSimulation::DataInterface>(aesDtc))
|
||||
return false;
|
||||
return ForeignGuiComboboxInterfaceImpl::init(dtc, ppmDtc, aesDtc);
|
||||
}
|
||||
|
||||
void InterfaceImpl::clearInterfaces()
|
||||
{
|
||||
ForeignGuiComboboxInterfaceImpl::uninit();
|
||||
}
|
||||
|
||||
|
||||
} // namespace EffectShowManagement
|
||||
@@ -0,0 +1,54 @@
|
||||
/**
|
||||
*@RDE_HEADER@
|
||||
* Gui Plugin for EffectShowManagement - PpmComboBox
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-09-12
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LtsSession/lts_session.h>
|
||||
|
||||
#include <PluginInterfaces/gui_plugin_interface.h>
|
||||
#include <Plugins/EffectShowManagement/esm_data_plugin_interface.h>
|
||||
|
||||
#include "esm_combobox_foreign_gui_interface_impl.h"
|
||||
|
||||
namespace EffectShowManagement
|
||||
{
|
||||
|
||||
class GuiPlugin final : public QObject, public GuiPluginBase::Plugin
|
||||
{
|
||||
Q_PLUGIN_METADATA(IID "gui:3:esm.combobox")
|
||||
Q_INTERFACES(GuiPluginBase::Plugin)
|
||||
|
||||
Q_OBJECT
|
||||
public:
|
||||
GuiPlugin() = default;
|
||||
~GuiPlugin() = default;
|
||||
|
||||
QString pluginName() override { return QStringLiteral("EffectShowManagement.GuiPlugin.ComboBox"); }
|
||||
std::shared_ptr<GuiPluginBase::Interface> createGuiInterface(LtsSession::LtsSession *session) override;
|
||||
bool availableInPartition(IDL::PartitionType partition) const override
|
||||
{
|
||||
return (partition == IDL::PartitionType::Global ||
|
||||
partition == IDL::PartitionType::Exercise ||
|
||||
partition == IDL::PartitionType::Replay);
|
||||
}
|
||||
};
|
||||
|
||||
class InterfaceImpl final : public ForeignGuiComboboxInterfaceImpl, public GuiPluginBase::Interface
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit InterfaceImpl(LtsSession::LtsSession *session);
|
||||
|
||||
bool fetchInterfaces() override;
|
||||
void clearInterfaces() override;
|
||||
QString menuGroup() const override { return QString(); }
|
||||
bool availableInPartition(IDL::PartitionType partition) const override { return partition == IDL::PartitionType::Exercise || partition == IDL::PartitionType::Global; }
|
||||
};
|
||||
|
||||
} // namespace EffectShowManagement
|
||||
@@ -0,0 +1,79 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for MeteoDataManagement - Meteo Data Overview Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-10-05
|
||||
*/
|
||||
#include "esm_effect_show_model.h"
|
||||
#include "esm_effect_show_actor_model.h"
|
||||
#include "esm_effect_show_actor_list.h"
|
||||
#include "ui_esm_effect_show_actor_list.h"
|
||||
|
||||
#include <LtsPrinting/printing.h>
|
||||
#include <LtsDataView/search_model.h>
|
||||
#include <QTreeView>
|
||||
|
||||
namespace EffectShowManagement
|
||||
{
|
||||
|
||||
EffectShowActorList::EffectShowActorList(QWidget *parent)
|
||||
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::CloseOnly)
|
||||
, m_effectShowModel(nullptr)
|
||||
, m_session(nullptr)
|
||||
, m_ui(new Ui::EffectShowActorList)
|
||||
, m_logger(getLogger("EffectShowActorList"))
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
// Print-Button erzeugen
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Print, this, &EffectShowActorList::onPrint);
|
||||
|
||||
setOnlineHelpFilename(QStringLiteral("Situation-Effect_Show_Actors"));
|
||||
|
||||
} // end of ctor()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
EffectShowActorList::~EffectShowActorList()
|
||||
{
|
||||
delete m_ui;
|
||||
} // end of dtor()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void EffectShowActorList::retranslate()
|
||||
{
|
||||
translate(m_ui, tr("Effect Actors"));
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
bool EffectShowActorList::init(LtsSession::LtsSession *session)
|
||||
{
|
||||
if (!session)
|
||||
return false;
|
||||
|
||||
m_session = session;
|
||||
m_effectShowModel = new EffectShowModel(this);
|
||||
m_effectShowModel->initModel(session);
|
||||
|
||||
m_ui->widget->setModel(m_effectShowModel->getEffectShowActorProxyModel(), nullptr);
|
||||
m_ui->widget->setInitialSearchContent(EffectShowActorModel::Columns::Status, EffectShowActorModel::eStatus::Operational);
|
||||
m_ui->widget->setInitialSearchContent(EffectShowActorModel::Columns::Feature, EffectShowActorModel::eFeature::SmokeAndExplosion48);
|
||||
|
||||
return true;
|
||||
} // end of init()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void EffectShowActorList::onPrint()
|
||||
{
|
||||
LtsPrinting::printView(m_session, this, m_ui->widget->treeView());
|
||||
} // end of onPrint()
|
||||
|
||||
void EffectShowActorList::tableColumnOrganiserSetting()
|
||||
{
|
||||
//LtsColumnOrganiser
|
||||
m_ui->widget->setColumnsOrganiserEnabled(identifier(), true);
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
} // namespace EffectShowManagement
|
||||
@@ -0,0 +1,55 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for MeteoDataManagement - Meteo Data Overview Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-10-05
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "esm_effect_show_model.h"
|
||||
|
||||
#include <Services/EffectShowManagement/esm_dtc.h>
|
||||
#include <Services/ParticipantManagement/ppm_dtc.h>
|
||||
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <LtsSession/lts_session.h>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class EffectShowActorList;
|
||||
}
|
||||
namespace EffectShowManagement
|
||||
{
|
||||
|
||||
/**
|
||||
* @brief The EffectShowActorList is the view (selected columns) related to #EffectShowActorProxyModel.
|
||||
*/
|
||||
class EffectShowActorList : public LtsWidgets::LtsDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit EffectShowActorList(QWidget *parent = nullptr);
|
||||
~EffectShowActorList();
|
||||
bool init(LtsSession::LtsSession *session);
|
||||
|
||||
private:
|
||||
void retranslate() override;
|
||||
void onSelectionChanged();
|
||||
void onShowEffectShowActor();
|
||||
void onPrint();
|
||||
void tableColumnOrganiserSetting() override;
|
||||
|
||||
private:
|
||||
EffectShowModel *m_effectShowModel;
|
||||
LtsSession::LtsSession *m_session;
|
||||
Ui::EffectShowActorList *m_ui;
|
||||
|
||||
LOGGER_T m_logger;
|
||||
|
||||
};
|
||||
|
||||
} // namespace EffectShowManagement
|
||||
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>EffectShowActorList</class>
|
||||
<widget class="QWidget" name="EffectShowActorList">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>455</width>
|
||||
<height>341</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">Effect Show</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="LtsDataView::LtsDataView" name="widget">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>250</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>LtsDataView::LtsDataView</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>LtsDataView/lts_data_view.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -0,0 +1,398 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for EffectShowManagement - Effect Show Overview Dialog Model
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-10.05
|
||||
*/
|
||||
|
||||
#include "esm_effect_show_actor_model.h"
|
||||
#include "esm_effect_show_model.h"
|
||||
#include <ParticipantManagement/ppm_data_plugin_interface.h>
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <LtsCoordTrans/lts_coord_trans.h>
|
||||
#include <ngltools/ngltools_dtg.h>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
|
||||
namespace EffectShowManagement
|
||||
{
|
||||
//-----------------------------------------------------------------------------------------------------------------------------
|
||||
// Effect Show Actor Proxy Model
|
||||
//-----------------------------------------------------------------------------------------------------------------------------
|
||||
EffectShowActorProxyModel::EffectShowActorProxyModel(EffectShowActorModel *sourceModel,
|
||||
EffectShowModel *effectShowModel,
|
||||
QObject *parent)
|
||||
: LtsWidgets::LtsColumnFilterProxyModel(parent)
|
||||
, m_effectShowModel(effectShowModel)
|
||||
, m_sourceModel(sourceModel)
|
||||
{
|
||||
this->setSourceModel(sourceModel);
|
||||
}
|
||||
|
||||
bool EffectShowActorProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
|
||||
{
|
||||
if (!m_sourceModel || source_parent.isValid() || source_row < 0 || source_row >= m_sourceModel->m_vecData.size())
|
||||
return LtsColumnFilterProxyModel::filterAcceptsRow(source_row, source_parent);
|
||||
|
||||
auto equipmentNumber = m_sourceModel->m_vecData.at(source_row).equipmentNumber();
|
||||
if (!equipmentNumber.is_set())
|
||||
return false;
|
||||
if (!m_effectShowModel->isVehicleStatus(equipmentNumber.get()))
|
||||
return false;
|
||||
|
||||
// filter status and type ---------------------------------------------------------------------------------------------------
|
||||
QHash<int, QVariant> cdf = columnDataFilters();
|
||||
EffectShowVehicleStatus vehicleStatus;
|
||||
m_effectShowModel->getVehicleStatus(equipmentNumber.get(), vehicleStatus);
|
||||
|
||||
if (cdf.contains(EffectShowActorModel::Status))
|
||||
{
|
||||
int statusFilter = cdf.value(EffectShowActorModel::Status).toInt();
|
||||
if ((statusFilter == EffectShowActorModel::eStatus::Operational && !vehicleStatus.operational()) ||
|
||||
(statusFilter == EffectShowActorModel::eStatus::NotOperational && vehicleStatus.operational()))
|
||||
return false;
|
||||
} // if
|
||||
|
||||
if (cdf.contains(EffectShowActorModel::Columns::Feature))
|
||||
{
|
||||
int feature = static_cast<int>(vehicleStatus.feature().underlying());
|
||||
switch(cdf.value(EffectShowActorModel::Columns::Feature).toInt())
|
||||
{
|
||||
case static_cast<int>(EffectShowActorModel::eFeature::SmokeAndExplosion48):
|
||||
if (feature != EffectShowActorModel::eFeature::Smoke &&
|
||||
feature != EffectShowActorModel::eFeature::Explosion48)
|
||||
return false;
|
||||
break;
|
||||
|
||||
case static_cast<int>(EffectShowActorModel::eFeature::Smoke):
|
||||
if (feature != EffectShowActorModel::eFeature::Smoke)
|
||||
return false;
|
||||
break;
|
||||
|
||||
case static_cast<int>(EffectShowActorModel::eFeature::Explosion48):
|
||||
if (feature != EffectShowActorModel::eFeature::Explosion48)
|
||||
return false;
|
||||
break;
|
||||
|
||||
case static_cast<int>(EffectShowActorModel::eFeature::Explosion24):
|
||||
if (feature != EffectShowActorModel::eFeature::Explosion24)
|
||||
return false;
|
||||
break;
|
||||
|
||||
default:
|
||||
return false;
|
||||
} // switch
|
||||
} // if
|
||||
|
||||
// regular expression filters -----------------------------------------------------------------------------------------------
|
||||
QHash<int, QRegularExpression> csf = columnStringFilters();
|
||||
for (auto it = csf.begin(); it != csf.end(); ++it)
|
||||
{
|
||||
const QRegularExpression &rx = it.value();
|
||||
if (!rx.isValid())
|
||||
continue;
|
||||
const QModelIndex idx = m_sourceModel->index(source_row, it.key(), source_parent);
|
||||
const QString _data = m_sourceModel->data(idx, Qt::DisplayRole).toString();
|
||||
if (!_data.contains(rx))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------------------------------------------------
|
||||
// Effect Show Actor Model
|
||||
//-----------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
QVector<EffectShowActorModel::eFeature> EffectShowActorModel::s_features =
|
||||
{
|
||||
EffectShowActorModel::eFeature::SmokeAndExplosion48,
|
||||
EffectShowActorModel::eFeature::Smoke,
|
||||
EffectShowActorModel::eFeature::Explosion48,
|
||||
EffectShowActorModel::eFeature::Explosion24
|
||||
};
|
||||
|
||||
QVector<EffectShowActorModel::eStatus> EffectShowActorModel::s_status =
|
||||
{
|
||||
EffectShowActorModel::eStatus::Operational,
|
||||
EffectShowActorModel::eStatus::NotOperational
|
||||
};
|
||||
|
||||
EffectShowActorModel::EffectShowActorModel(EffectShowModel *effectShowModel, QObject *parent)
|
||||
: LtsWidgets::LtsAbstractTableModel<ParticipantManagement::Participant>(
|
||||
{
|
||||
tr("Name"),
|
||||
tr("Status"),
|
||||
tr("BITE"),
|
||||
tr("Feature"),
|
||||
tr("Position"),
|
||||
tr("Effect Show (Time,Position)"),
|
||||
tr("Relocation (Time, Position)"),
|
||||
tr("Magazine"),
|
||||
tr("Ammunition Available")
|
||||
},
|
||||
parent)
|
||||
, m_dtc(nullptr)
|
||||
, m_effectShowModel(effectShowModel)
|
||||
, m_logger(getLogger("EffectShowActorModel"))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool EffectShowActorModel::initModel(LtsSession::LtsSession *session)
|
||||
{
|
||||
if (!session)
|
||||
return false;
|
||||
|
||||
if (!session->getDtc<ParticipantManagement::DataInterface>(m_dtc))
|
||||
return false;
|
||||
|
||||
connect(m_dtc.get(), &ParticipantManagement::Interface::Dtc::participantChanged,
|
||||
this, &EffectShowActorModel::onDataChanged);
|
||||
connect(m_dtc.get(), &ParticipantManagement::Interface::Dtc::participantPositionChanged,
|
||||
this, &EffectShowActorModel::onParticipantPositionChanged);
|
||||
|
||||
|
||||
auto cb = [this](const ParticipantManagement::Participant & part)
|
||||
{
|
||||
ParticipantManagement::TypeClass typeClass = m_dtc->type(part.typeId()).typeClass();
|
||||
if (typeClass != ParticipantManagement::TypeClass::SupportEntity)
|
||||
return;
|
||||
insertRow(part);
|
||||
};
|
||||
|
||||
// insert Model
|
||||
m_dtc->participantPositions([this](const ParticipantManagement::ParticipantPosition & participantPos) { onParticipantPositionChanged(participantPos, DataModification::eAdded); });
|
||||
m_dtc->participants(cb);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
QVariant EffectShowActorModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (role != Qt::DisplayRole || !indexIsValid(index))
|
||||
return QVariant();
|
||||
|
||||
const ParticipantManagement::Participant &participant = m_vecData.at(index.row());
|
||||
EffectShowManagement::EffectShowVehicleStatus vehicleStatus;
|
||||
bool isVehicleStatus = m_effectShowModel->getVehicleStatus(participant.equipmentNumber().get(), vehicleStatus);
|
||||
QString eqNumber = QStringLiteral("-");
|
||||
|
||||
switch (index.column())
|
||||
{
|
||||
case Name:
|
||||
if (participant.equipmentNumber().is_set())
|
||||
eqNumber = QString::number(participant.equipmentNumber().get());
|
||||
return QStringLiteral("%1 - %2 (%3)").arg(QString::fromStdString(participant.designator())).arg(QString::fromStdString(participant.tacticalIdentifier())).arg(eqNumber);
|
||||
case Status:
|
||||
{
|
||||
if (!isVehicleStatus)
|
||||
return QVariant();
|
||||
return vehicleStatus.operational() ? tr("Operational") : tr("Not Operational");
|
||||
}
|
||||
case BITE:
|
||||
{
|
||||
if (!isVehicleStatus)
|
||||
return QVariant();
|
||||
return vehicleStatus.magazineFail() ? tr("Error") : tr("Ok");
|
||||
}
|
||||
case Position:
|
||||
{
|
||||
auto it = m_ppmPositions.find(participant.id());
|
||||
if (it == m_ppmPositions.end())
|
||||
return QVariant();
|
||||
Core::GeoPosition2D pos = it.value();
|
||||
return LtsCoordTrans::mgrsFromGeographic(pos.lon(), pos.lat());
|
||||
}
|
||||
case EffectShow:
|
||||
return m_effectShowModel->getTimeAndPositionOfNextEffectShow(participant.id());
|
||||
case Relocation:
|
||||
return m_effectShowModel->getTimeAndPositionOfNextActorRelocation(participant.id());
|
||||
case RestMagazine:
|
||||
{
|
||||
if (!isVehicleStatus)
|
||||
return QVariant();
|
||||
return vehicleStatus.ammunitionMagazine();
|
||||
}
|
||||
case RestAmmunition:
|
||||
{
|
||||
if (!isVehicleStatus)
|
||||
return QVariant();
|
||||
return vehicleStatus.ammunitionAvailable();
|
||||
}
|
||||
case Feature:
|
||||
{
|
||||
if (!isVehicleStatus)
|
||||
return QVariant();
|
||||
switch (vehicleStatus.feature().underlying())
|
||||
{
|
||||
case EffectShowManagement::Feature_e_def::Smoke:
|
||||
return tr("Smoke");
|
||||
case EffectShowManagement::Feature_e_def::Explosion24:
|
||||
return tr("Explosion (24)");
|
||||
case EffectShowManagement::Feature_e_def::Explosion48:
|
||||
return tr("Explosion (48)");
|
||||
case EffectShowManagement::Feature_e_def::NotSpecified:
|
||||
return tr("Not specified");
|
||||
}
|
||||
return tr("Unknown (%1)").arg(vehicleStatus.feature().underlying());
|
||||
}
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
QVariant EffectShowActorModel::headerData(int section, Qt::Orientation orientation, int role) const
|
||||
{
|
||||
if (role == LtsWidgets::LtsColumnFilterProxyModel::ComboboxFilterRole && orientation == Qt::Horizontal)
|
||||
{
|
||||
if (section == Columns::Status)
|
||||
{
|
||||
LtsWidgets::ComboboxFilterContent cfc;
|
||||
cfc.data.reserve(s_status.size());
|
||||
LtsWidgets::ComboboxFilterData cfd;
|
||||
for (const auto &status : qAsConst(s_status))
|
||||
{
|
||||
cfd.data = static_cast<int>(status);
|
||||
cfd.text = status == eStatus::Operational ? tr("Operational") : tr("Not Operational");
|
||||
cfc.data.push_back(cfd);
|
||||
} // for
|
||||
return cfc.toVariant();
|
||||
} // if
|
||||
else if (section == Columns::Feature)
|
||||
{
|
||||
LtsWidgets::ComboboxFilterContent cfc;
|
||||
cfc.data.reserve(s_features.size());
|
||||
LtsWidgets::ComboboxFilterData cfd;
|
||||
for (const auto &feature : qAsConst(s_features))
|
||||
{
|
||||
cfd.data = static_cast<int>(feature);
|
||||
cfd.text = getFeatureName(feature);
|
||||
cfc.data.push_back(cfd);
|
||||
} // for
|
||||
return cfc.toVariant();
|
||||
} // else if
|
||||
} // if
|
||||
|
||||
return LtsWidgets::LtsAbstractTableModel<ParticipantManagement::Participant>::headerData(section, orientation, role);
|
||||
}
|
||||
|
||||
bool EffectShowActorModel::isFiltered(const ParticipantManagement::Participant &data, DataModification modType) const
|
||||
{
|
||||
Q_UNUSED(modType);
|
||||
ParticipantManagement::TypeClass typeClass = m_dtc->type(data.typeId()).typeClass();
|
||||
bool filtered = (typeClass != ParticipantManagement::TypeClass::SupportEntity);
|
||||
return filtered;
|
||||
}
|
||||
|
||||
void EffectShowActorModel::onParticipantPositionChanged(const ParticipantManagement::ParticipantPosition &data, DataModification modType)
|
||||
{
|
||||
switch (modType)
|
||||
{
|
||||
case DataModification::eAdded:
|
||||
case DataModification::eModified:
|
||||
m_ppmPositions[data.participantId()] = data.pos();
|
||||
break;
|
||||
case DataModification::eRemoved:
|
||||
m_ppmPositions.remove(data.participantId());
|
||||
break;
|
||||
}
|
||||
const QModelIndex idx = findIndexForId(data.participantId(), Position);
|
||||
if (idx.isValid())
|
||||
emit dataChanged(idx, idx, {Qt::DisplayRole});
|
||||
}
|
||||
|
||||
|
||||
QVector<ParticipantManagement::Participant>::const_iterator EffectShowActorModel::getIt(int id) const
|
||||
{
|
||||
if (id == -1) return m_vecData.end();
|
||||
|
||||
auto it = m_vecData.begin();
|
||||
while (it != m_vecData.end())
|
||||
{
|
||||
if (id == it->id())
|
||||
return it;
|
||||
++it;
|
||||
}
|
||||
|
||||
return m_vecData.end();
|
||||
}
|
||||
|
||||
EffectShowManagement::Feature_e EffectShowActorModel::getFeature(int rowId) const
|
||||
{
|
||||
const ParticipantManagement::Participant &participant = m_vecData.at(rowId);
|
||||
EffectShowManagement::EffectShowVehicleStatus vehicleStatus;
|
||||
if (!m_effectShowModel->getVehicleStatus(participant.equipmentNumber().get(), vehicleStatus))
|
||||
return EffectShowManagement::Feature_e();
|
||||
return vehicleStatus.feature();
|
||||
}
|
||||
|
||||
bool EffectShowActorModel::isOperational(int rowId) const
|
||||
{
|
||||
const ParticipantManagement::Participant &participant = m_vecData.at(rowId);
|
||||
EffectShowManagement::EffectShowVehicleStatus vehicleStatus;
|
||||
if (m_effectShowModel->getVehicleStatus(participant.equipmentNumber().get(), vehicleStatus))
|
||||
return vehicleStatus.operational();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool EffectShowActorModel::isMatchedByFilter(const int &equipmentNumber, const int &featureFilter) const
|
||||
{
|
||||
EffectShowVehicleStatus vehicleStatus;
|
||||
m_effectShowModel->getVehicleStatus(equipmentNumber, vehicleStatus);
|
||||
int feature = static_cast<int>(vehicleStatus.feature().underlying());
|
||||
|
||||
switch (featureFilter)
|
||||
{
|
||||
case EffectShowActorModel::eFeature::SmokeAndExplosion48:
|
||||
if (feature != EffectShowActorModel::eFeature::Smoke && feature != EffectShowActorModel::eFeature::Explosion48)
|
||||
return false;
|
||||
break;
|
||||
|
||||
case EffectShowActorModel::eFeature::Smoke:
|
||||
if (feature != EffectShowActorModel::eFeature::Smoke)
|
||||
return false;
|
||||
break;
|
||||
|
||||
case EffectShowActorModel::eFeature::Explosion48:
|
||||
if (feature != EffectShowActorModel::eFeature::Explosion48)
|
||||
return false;
|
||||
break;
|
||||
|
||||
case EffectShowActorModel::eFeature::Explosion24:
|
||||
if (feature != EffectShowActorModel::eFeature::Explosion24)
|
||||
return false;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
} // switch
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
QString EffectShowActorModel::faultStatus(bool fault) const
|
||||
{
|
||||
if (fault)
|
||||
return tr("Fault");
|
||||
|
||||
return tr("OK");
|
||||
}
|
||||
|
||||
QString EffectShowActorModel::getFeatureName(const eFeature &feature)
|
||||
{
|
||||
switch (feature)
|
||||
{
|
||||
case eFeature::Smoke: return tr("Smoke");
|
||||
case eFeature::Explosion24: return tr("Explosion (24)");
|
||||
case eFeature::Explosion48: return tr("Explosion (48)");
|
||||
case eFeature::SmokeAndExplosion48: return tr("Smoke + Explosion (48)");
|
||||
default:
|
||||
return tr("ERROR");
|
||||
} // switch
|
||||
}
|
||||
|
||||
} // namespace EffectShowActorModel
|
||||
@@ -0,0 +1,121 @@
|
||||
/**
|
||||
* @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 "esm_effect_show_model.h"
|
||||
|
||||
#include <ParticipantManagement/ppm_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 EffectShowManagement
|
||||
{
|
||||
/**
|
||||
* @brief The EffectShowActorProxyModel filters from the available participants the ones, which
|
||||
* have send their "operational" status.
|
||||
*/
|
||||
class EffectShowActorProxyModel final : public LtsWidgets::LtsColumnFilterProxyModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
EffectShowActorProxyModel(EffectShowActorModel *sourceModel, EffectShowModel *effectShowModel, QObject *parent);
|
||||
|
||||
protected:
|
||||
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override;
|
||||
|
||||
EffectShowModel *m_effectShowModel;
|
||||
EffectShowActorModel *m_sourceModel;
|
||||
};
|
||||
|
||||
|
||||
class EffectShowModel;
|
||||
/**
|
||||
* @brief The EffectShowActorModel class provides all available participants.
|
||||
* The following information is also Provided:\n
|
||||
* (1)The position of the effect show actor (if avialble)\n
|
||||
* (2)The status of the allocated vehicle\n
|
||||
* (3)The next allocated effect show (if allocated)\n
|
||||
* (4)The next allocated relocation (if allocated)\n
|
||||
*/
|
||||
class EffectShowActorModel final : public LtsWidgets::LtsAbstractTableModel<ParticipantManagement::Participant>
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum Columns
|
||||
{
|
||||
Name,
|
||||
Status,
|
||||
BITE,
|
||||
Feature,
|
||||
Position,
|
||||
EffectShow,
|
||||
Relocation,
|
||||
RestMagazine,
|
||||
RestAmmunition
|
||||
};
|
||||
|
||||
enum eFeature
|
||||
{
|
||||
NotSpecified = Feature_e_def::NotSpecified, // not used (for now?)
|
||||
Smoke = Feature_e_def::Smoke,
|
||||
Explosion24 = Feature_e_def::Explosion24,
|
||||
Explosion48 = Feature_e_def::Explosion48,
|
||||
SmokeAndExplosion48 = Explosion48 + 1
|
||||
};
|
||||
static QVector<eFeature> s_features;
|
||||
|
||||
enum eStatus
|
||||
{
|
||||
NotOperational = 0,
|
||||
Operational = 1
|
||||
};
|
||||
static QVector<eStatus> s_status;
|
||||
|
||||
explicit EffectShowActorModel(EffectShowModel *effectShowModel, QObject *parent);
|
||||
|
||||
bool initModel(LtsSession::LtsSession *session);
|
||||
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
|
||||
|
||||
/**
|
||||
* @brief Filters for support entity participants.
|
||||
*/
|
||||
bool isFiltered(const ParticipantManagement::Participant &data, DataModification modType) const override final;
|
||||
|
||||
QVector<ParticipantManagement::Participant>::const_iterator getIt(int id) const;
|
||||
QVector<ParticipantManagement::Participant>::const_iterator getItBegin() const { return m_vecData.begin(); }
|
||||
QVector<ParticipantManagement::Participant>::const_iterator getItEnd() const { return m_vecData.end(); }
|
||||
Feature_e getFeature(int rowId) const;
|
||||
static QString getFeatureName(const eFeature &feature);
|
||||
bool isOperational(int rowId) const;
|
||||
bool isMatchedByFilter(const int &equipmentNumber, const int &featureFilter) const;
|
||||
|
||||
private:
|
||||
void onParticipantPositionChanged(const ParticipantManagement::ParticipantPosition &data, DataModification modType);
|
||||
|
||||
QString faultStatus(bool fault) const;
|
||||
|
||||
private:
|
||||
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_dtc;
|
||||
|
||||
QHash<int, Core::GeoPosition2D> m_ppmPositions;
|
||||
|
||||
EffectShowModel *m_effectShowModel;
|
||||
LOGGER_T m_logger;
|
||||
|
||||
friend class EffectShowActorProxyModel;
|
||||
|
||||
};
|
||||
} //namespace EffectShowManagement
|
||||
+195
@@ -0,0 +1,195 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* MeteoDataManagement - Static Meteo Data Edit Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by hjl, SLSE, 2016-10-17
|
||||
*/
|
||||
|
||||
#include "esm_effect_show_actor_relocation_edit.h"
|
||||
#include "ParticipantManagement/ppm_data_plugin_interface.h"
|
||||
#include "esm_effect_show_actor_model.h"
|
||||
#include "esm_effect_show_actor_relocation_model.h"
|
||||
#include "ui_esm_effect_show_actor_relocation_list.h"
|
||||
#include "ui_esm_effect_show_actor_relocation_edit.h"
|
||||
#include <EffectShowManagement/esm_data_plugin_interface.h>
|
||||
#include <PluginInterfaces/gui_plugin_interface.h>
|
||||
#include <Plugins/SituationMapPlugin/situation_map_gui_plugin_interface.h>
|
||||
#include <LtsSession/lts_session_data_dds.h>
|
||||
#include <LtsDataView/tree_view_delegate.h>
|
||||
|
||||
|
||||
namespace EffectShowManagement
|
||||
{
|
||||
|
||||
EffectShowActorRelocationEdit::EffectShowActorRelocationEdit(QWidget *parent)
|
||||
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::OkApplyCancel)
|
||||
, m_dtc(nullptr)
|
||||
, m_ftc(nullptr)
|
||||
, m_ppmDtc(nullptr)
|
||||
, m_sitMapGuiIfc(nullptr)
|
||||
, m_model(nullptr)
|
||||
, m_session(nullptr)
|
||||
, m_ui(new Ui::EffectShowActorRelocationEdit)
|
||||
, m_requestHelper(new LtsUtils::RequestHelper(this))
|
||||
, m_logger(getLogger("EffectShowActorRelocationEdit"))
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
}
|
||||
|
||||
|
||||
EffectShowActorRelocationEdit::~EffectShowActorRelocationEdit()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
void EffectShowActorRelocationEdit::getPosition()
|
||||
{
|
||||
if (!m_sitMapGuiIfc)
|
||||
return;
|
||||
|
||||
m_sitMapGuiIfc->getCoordinate(m_ui->cwCoordinate, SLOT(setCoordinate(QPointF)), nullptr);
|
||||
}
|
||||
|
||||
void EffectShowActorRelocationEdit::onEffectShowActorFilterChanged(const int &idx)
|
||||
{
|
||||
Q_UNUSED(idx);
|
||||
|
||||
int selectedParticipantId = -1;
|
||||
if (m_ui->cbEffectShowActor->count() > 0 && m_ui->cbEffectShowActor->currentIndex() >= 0)
|
||||
selectedParticipantId = m_ui->cbEffectShowActor->currentData().toInt();
|
||||
|
||||
m_ui->cbEffectShowActor->clear();
|
||||
|
||||
const int filter = m_ui->cbEffectShowActorFilter->currentData().toInt();
|
||||
int i = 0;
|
||||
for (auto it = m_effectShowActors.begin(); it != m_effectShowActors.end(); ++it)
|
||||
{
|
||||
auto iParticipant = m_model->getEffectShowActorModel()->getIt(it.key());
|
||||
if (iParticipant == m_model->getEffectShowActorModel()->getItEnd())
|
||||
continue;
|
||||
if (!iParticipant->equipmentNumber().is_set())
|
||||
continue;
|
||||
if (!m_model->getEffectShowActorModel()->isMatchedByFilter(iParticipant->equipmentNumber().get(), filter))
|
||||
continue;
|
||||
|
||||
m_ui->cbEffectShowActor->addItem(it.value(), it.key());
|
||||
if (selectedParticipantId == it.key())
|
||||
m_ui->cbEffectShowActor->setCurrentIndex(i++);
|
||||
} // for
|
||||
}
|
||||
|
||||
void EffectShowActorRelocationEdit::onEffectShowVehicleStatusChanged(const EffectShowVehicleStatus &data,
|
||||
const DataModification &modType)
|
||||
{
|
||||
Q_UNUSED(modType);
|
||||
int equipmentNumber = m_ppmDtc->equipmentNumberByParticipantId(data.esmParticipantId());
|
||||
m_effectShowActors = m_model->getParticipantList();
|
||||
const int filter = m_ui->cbEffectShowActorFilter->currentData().toInt();
|
||||
if (m_model->getEffectShowActorModel()->isMatchedByFilter(equipmentNumber, filter))
|
||||
onEffectShowActorFilterChanged(-1);
|
||||
}
|
||||
|
||||
void EffectShowActorRelocationEdit::retranslate()
|
||||
{
|
||||
translate(m_ui, QString(), true, tr("Actor Relocation"));
|
||||
}
|
||||
|
||||
|
||||
bool EffectShowActorRelocationEdit::init(LtsSession::LtsSession *session,
|
||||
EffectShowModel *model,
|
||||
int rowToCopy)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "EffectShowActorRelocationEdit::init()";
|
||||
|
||||
if (!session)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "EffectShowActorRelocationEdit::init() Invalid shared_ptr!";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!session->getDtc<EffectShowManagement::DataInterface>(m_dtc))
|
||||
return false;
|
||||
if (!session->getFtc<EffectShowManagement::DataInterface>(m_ftc))
|
||||
return false;
|
||||
if (!session->getDtc<ParticipantManagement::DataInterface>(m_ppmDtc))
|
||||
return false;
|
||||
|
||||
m_model = model;
|
||||
m_session = session;
|
||||
|
||||
m_session->getForeignGuiInterface<SituationMap::ForeignGuiInterface>(m_sitMapGuiIfc);
|
||||
if (m_sitMapGuiIfc)
|
||||
connect(m_ui->pbPosition, &QPushButton::clicked, this, &EffectShowActorRelocationEdit::getPosition);
|
||||
|
||||
connect(m_ui->pbClear, &QPushButton::clicked,
|
||||
m_ui->cwCoordinate, &LtsCoordWidget::LtsCoordWidget::clear);
|
||||
|
||||
m_effectShowActors = m_model->getParticipantList();
|
||||
|
||||
// effect show actor filter -------------------------------------------------------------------------------------------------
|
||||
int idx = 1;
|
||||
m_ui->cbEffectShowActorFilter->addItem(tr("<No filter>"), EffectShowActorModel::eFeature::NotSpecified);
|
||||
for (const EffectShowActorModel::eFeature &feature : qAsConst(EffectShowActorModel::s_features))
|
||||
{
|
||||
m_ui->cbEffectShowActorFilter->addItem(EffectShowActorModel::getFeatureName(feature), static_cast<int>(feature));
|
||||
if (feature == EffectShowActorModel::eFeature::SmokeAndExplosion48)
|
||||
m_ui->cbEffectShowActorFilter->setCurrentIndex(idx);
|
||||
++idx;
|
||||
} // for
|
||||
onEffectShowActorFilterChanged(-1); // function argument has no effect
|
||||
|
||||
connect(m_ui->cbEffectShowActorFilter, QOverload<int>::of(&LtsWidgets::LtsComboBox::currentIndexChanged),
|
||||
this, &EffectShowActorRelocationEdit::onEffectShowActorFilterChanged);
|
||||
|
||||
// update effect show actors ------------------------------------------------------------------------------------------------
|
||||
connect(m_model, &EffectShowModel::effectShowVehicleStatusChanged,
|
||||
this, &EffectShowActorRelocationEdit::onEffectShowVehicleStatusChanged);
|
||||
|
||||
// date time edit -----------------------------------------------------------------------------------------------------------
|
||||
m_ui->dteTime->setMinimumTimeMSec(m_session->partitionTime());
|
||||
m_ui->dteTime->setRetrieveCurrentTimeCallback([this]() { return m_session->partitionTime(); });
|
||||
|
||||
// requirements -------------------------------------------------------------------------------------------------------------
|
||||
m_uiRequirements->addRequirement({m_ui->lblCoordinate, [this]() { return (!m_ui->cwCoordinate->coordinate().isNull()); }});
|
||||
m_uiRequirements->addRequirement({m_ui->lblTime, [this]() { return (m_ui->dteTime->msecsSinceEpoch() > m_session->partitionTime()); }});
|
||||
m_uiRequirements->addRequirement({m_ui->lblEffectShowActor, [this]() { return (m_ui->cbEffectShowActor->currentIndex() != -1); }});
|
||||
|
||||
if (rowToCopy >= 0)
|
||||
{
|
||||
const EffectShowActorRelocation © = m_model->getEffetShowActorRelocationModel()->getRowData(rowToCopy);
|
||||
if (copy.id() > 0)
|
||||
{
|
||||
m_ui->cwCoordinate->setCoordinate(copy.position().lon(), copy.position().lat());
|
||||
m_ui->cbEffectShowActor->setCurrentIndex(m_ui->cbEffectShowActor->findData(copy.esmParticipantId()));
|
||||
m_ui->leInfo->setText(QString::fromStdString(copy.info()));
|
||||
if (copy.arrival_time().is_set())
|
||||
m_ui->dteTime->setMsecsSinceEpoch(copy.arrival_time().get());
|
||||
slotChangesMade();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool EffectShowActorRelocationEdit::apply()
|
||||
{
|
||||
|
||||
// Send modified data via FTC call
|
||||
return m_requestHelper->startSingleRequest([this]()
|
||||
{
|
||||
EffectShowActorRelocation data;
|
||||
data.id(0);
|
||||
|
||||
data.esmParticipantId(m_ui->cbEffectShowActor->currentData().toInt());
|
||||
data.position(Core::GeoPosition2D(m_ui->cwCoordinate->coordinate().x(), m_ui->cwCoordinate->coordinate().y()));
|
||||
data.arrival_time().set(m_ui->dteTime->msecsSinceEpoch());
|
||||
data.info(m_ui->leInfo->text().toStdString());
|
||||
|
||||
return m_ftc->effectShowActorRelocationModifyRequest(data, this);
|
||||
});
|
||||
}
|
||||
|
||||
} // namespace EffectShowManagement
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* MeteoDataManagement - Static Meteo Data Edit Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by hjl, SLSE, 2016-10-17
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "esm_effect_show_model.h"
|
||||
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <Services/EffectShowManagement/esm_dtc.h>
|
||||
#include <Services/EffectShowManagement/esm_ftc.h>
|
||||
#include <Services/ParticipantManagement/ppm_dtc.h>
|
||||
#include <EffectShowManagement/logger.h>
|
||||
#include <LtsUtilsGuiDds/request_helper.h>
|
||||
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class EffectShowActorRelocationEdit;
|
||||
}
|
||||
|
||||
namespace SituationMap
|
||||
{
|
||||
class ForeignGuiInterface;
|
||||
}
|
||||
|
||||
namespace EffectShowManagement
|
||||
{
|
||||
/**
|
||||
* @brief Input mask for effect show actor relocations.
|
||||
*/
|
||||
class EffectShowActorRelocationEdit : public LtsWidgets::LtsDialog,
|
||||
protected EffectShowManagement::Interface::Ftc::EffectShowActorRelocationModifyReplyHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit EffectShowActorRelocationEdit(QWidget *parent = nullptr);
|
||||
~EffectShowActorRelocationEdit();
|
||||
|
||||
bool init(LtsSession::LtsSession *session,
|
||||
EffectShowModel *model,
|
||||
int rowToCopy = -1);
|
||||
bool apply() override;
|
||||
|
||||
private slots:
|
||||
void getPosition();
|
||||
void onEffectShowActorFilterChanged(const int &idx);
|
||||
void onEffectShowVehicleStatusChanged(const EffectShowVehicleStatus &data, const DataModification &modType);
|
||||
|
||||
private:
|
||||
void retranslate() override;
|
||||
void onEffectShowActorRelocationModifyReply(const Core::FunctionReplyObject &replyObject) override { m_requestHelper->requestReply(replyObject); }
|
||||
|
||||
private:
|
||||
std::shared_ptr<EffectShowManagement::Interface::Dtc> m_dtc;
|
||||
std::shared_ptr<EffectShowManagement::Interface::Ftc> m_ftc;
|
||||
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_ppmDtc;
|
||||
|
||||
std::shared_ptr<SituationMap::ForeignGuiInterface> m_sitMapGuiIfc;
|
||||
|
||||
QMap<int, QString> m_effectShowActors;
|
||||
|
||||
EffectShowModel *m_model;
|
||||
LtsSession::LtsSession *m_session;
|
||||
Ui::EffectShowActorRelocationEdit *m_ui;
|
||||
LtsUtils::RequestHelper *m_requestHelper;
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
|
||||
} //namespace EffectShowManagement
|
||||
+125
@@ -0,0 +1,125 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>EffectShowActorRelocationEdit</class>
|
||||
<widget class="QWidget" name="EffectShowActorRelocationEdit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>550</width>
|
||||
<height>279</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>9</x>
|
||||
<y>9</y>
|
||||
<width>498</width>
|
||||
<height>158</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="2" column="1">
|
||||
<widget class="LtsWidgets::LtsDateTimeEdit" name="dteTime"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lblEffectShowActor">
|
||||
<property name="text">
|
||||
<string>Effect Show Actor:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="lblTime">
|
||||
<property name="text">
|
||||
<string>Time:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="LtsWidgets::LtsComboBox" name="cbEffectShowActor"/>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="lblInfo">
|
||||
<property name="text">
|
||||
<string>Info:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="LtsCoordWidget::LtsCoordWidget" name="cwCoordinate"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pbPosition">
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normaloff>:/icons/svg/target.svg</normaloff>:/icons/svg/target.svg</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pbClear">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normaloff>:/icons/png/clear_plan_act.png</normaloff>:/icons/png/clear_plan_act.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="lblCoordinate">
|
||||
<property name="text">
|
||||
<string>Coordinate:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLineEdit" name="leInfo"/>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lblEffectShowActorFilter">
|
||||
<property name="text">
|
||||
<string>Effect Show Actor Filter:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="LtsWidgets::LtsComboBox" name="cbEffectShowActorFilter"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</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>
|
||||
<customwidget>
|
||||
<class>LtsWidgets::LtsDateTimeEdit</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>LtsWidgets/lts_date_time_edit.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
+153
@@ -0,0 +1,153 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for MeteoDataManagement - Meteo Data Overview Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-10-05
|
||||
*/
|
||||
|
||||
#include "esm_effect_show_actor_relocation_list.h"
|
||||
#include "ui_esm_effect_show_actor_relocation_list.h"
|
||||
#include "esm_effect_show_actor_relocation_edit.h"
|
||||
#include <EffectShowManagement/esm_data_plugin_interface.h>
|
||||
|
||||
#include <LtsPrinting/printing.h>
|
||||
#include <QTreeView>
|
||||
|
||||
namespace EffectShowManagement
|
||||
{
|
||||
|
||||
EffectShowActorRelocationList::EffectShowActorRelocationList(const QString &menuGroup, QWidget *parent)
|
||||
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::CloseOnly)
|
||||
, m_menuGroup(menuGroup)
|
||||
, m_effectShowModel(nullptr)
|
||||
, m_ftc(nullptr)
|
||||
, m_session(nullptr)
|
||||
, m_requestHelper(new LtsUtils::RequestHelper(this))
|
||||
, m_ui(new Ui::EffectShowActorRelocationList)
|
||||
, m_logger(getLogger("EffectShowActorRelocationList"))
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
m_ui->widget->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
|
||||
// connects fuer Widgetaenderungen
|
||||
connect(m_ui->widget, &LtsDataView::LtsDataView::signalSelectionChanged,
|
||||
this, &EffectShowActorRelocationList::onSelectionChanged);
|
||||
|
||||
//cbx show expired
|
||||
QCheckBox *cbExpired = new QCheckBox(tr("Show expired"), m_ui->widget);
|
||||
cbExpired->setProperty("const", true);
|
||||
m_ui->widget->setCustomWidget(cbExpired);
|
||||
connect(cbExpired, &QCheckBox::toggled, this, &EffectShowActorRelocationList::setShowExpired);
|
||||
|
||||
|
||||
// Edit-Button erzeugen
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Add, this, &EffectShowActorRelocationList::onAddEffectShowActorRelocation);
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Remove, this, &EffectShowActorRelocationList::onRemoveEffectShowActorRelocation);
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Remove, false);
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Print, this, &EffectShowActorRelocationList::onPrint);
|
||||
|
||||
setOnlineHelpFilename(QStringLiteral("Situation-Effect_Show_Actor_Relocations"));
|
||||
|
||||
} // end of ctor()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
EffectShowActorRelocationList::~EffectShowActorRelocationList()
|
||||
{
|
||||
delete m_ui;
|
||||
} // end of dtor()
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void EffectShowActorRelocationList::retranslate()
|
||||
{
|
||||
translate(m_ui, tr("Actor Position Relocations"));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool EffectShowActorRelocationList::init(LtsSession::LtsSession *session)
|
||||
{
|
||||
if (!session)
|
||||
return false;
|
||||
|
||||
if (!session->getFtc<EffectShowManagement::DataInterface>(m_ftc))
|
||||
return false;
|
||||
|
||||
m_session = session;
|
||||
m_effectShowModel = new EffectShowModel(this);
|
||||
m_effectShowModel->initModel(session);
|
||||
|
||||
m_proxyModel = new EffectShowActorRelocationProxyModel(this);
|
||||
m_proxyModel->setSourceModel(m_effectShowModel->getEffetShowActorRelocationModel());
|
||||
m_ui->widget->setModel(m_proxyModel);
|
||||
|
||||
|
||||
#ifndef LTS_DEBUG
|
||||
m_ui->widget->hideColumn(EffectShowModel::Columns::Id);
|
||||
#endif
|
||||
|
||||
return true;
|
||||
} // end of init()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void EffectShowActorRelocationList::onSelectionChanged()
|
||||
{
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Remove, m_ui->widget->selectionModel()->selectedRows().size());
|
||||
|
||||
} // end of onSelectionChanged()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void EffectShowActorRelocationList::onAddEffectShowActorRelocation()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "--- onAddEffectShowActorRelocation() ";
|
||||
EffectShowActorRelocationEdit *dialog = new EffectShowActorRelocationEdit(this);
|
||||
if (m_ui->widget->currentIndex().row() >= 0)
|
||||
dialog->init(m_session, m_effectShowModel, m_ui->widget->currentIndex().row());
|
||||
else
|
||||
dialog->init(m_session, m_effectShowModel, -1);
|
||||
|
||||
addDialog(dialog, m_menuGroup, QLatin1String("esmEffectShowActorRelocation"), LtsWidgets::LayoutArea::eDialogTab);
|
||||
|
||||
} // end of onAddEffectShowActorRelocation()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void EffectShowActorRelocationList::onRemoveEffectShowActorRelocation()
|
||||
{
|
||||
const QModelIndex idx = m_ui->widget->currentIndex();
|
||||
|
||||
int row = idx.row();
|
||||
if (row < 0)
|
||||
return;
|
||||
|
||||
EffectShowManagement::EffectShowActorRelocation esar = m_effectShowModel->getEffetShowActorRelocationModel()->getRowData(row);
|
||||
|
||||
// Send modified data via FTC call
|
||||
|
||||
m_requestHelper->startSingleRequest([esar, this]()
|
||||
{
|
||||
const Core::RemoveElementRequest req(esar.id());
|
||||
return m_ftc->effectShowActorRelocationRemoveRequest(req, this);
|
||||
});
|
||||
|
||||
} // end of onRemoveEffectShowActorRelocation()
|
||||
|
||||
|
||||
void EffectShowActorRelocationList::setShowExpired(bool show)
|
||||
{
|
||||
m_proxyModel->setShowExpired(show);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void EffectShowActorRelocationList::onPrint()
|
||||
{
|
||||
LtsPrinting::printView(m_session, this, m_ui->widget->treeView());
|
||||
}
|
||||
|
||||
void EffectShowActorRelocationList::tableColumnOrganiserSetting()
|
||||
{
|
||||
//LtsColumnOrganiser
|
||||
m_ui->widget->setColumnsOrganiserEnabled(identifier(), true);
|
||||
} // end of onPrint()
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
} // namespace EffectShowManagement
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for MeteoDataManagement - Meteo Data Overview Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-10-05
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "esm_effect_show_model.h"
|
||||
#include "esm_effect_show_actor_relocation_model.h"
|
||||
|
||||
#include <EffectShowManagement/esm_dtc.h>
|
||||
#include <EffectShowManagement/esm_ftc.h>
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <LtsUtilsGuiDds/request_helper.h>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class EffectShowActorRelocationList;
|
||||
}
|
||||
namespace EffectShowManagement
|
||||
{
|
||||
/**
|
||||
* @brief The EffectShowActorRelocationList is the view related to #EffectShowActorRelocationModel.
|
||||
*/
|
||||
class EffectShowActorRelocationList : public LtsWidgets::LtsDialog
|
||||
, protected EffectShowManagement::Interface::Ftc::EffectShowActorRelocationRemoveReplyHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit EffectShowActorRelocationList(const QString &menuGroup, QWidget *parent = nullptr);
|
||||
~EffectShowActorRelocationList();
|
||||
bool init(LtsSession::LtsSession *session);
|
||||
|
||||
private:
|
||||
void retranslate() override;
|
||||
void onSelectionChanged();
|
||||
void onAddEffectShowActorRelocation();
|
||||
void onRemoveEffectShowActorRelocation();
|
||||
void onPrint();
|
||||
void tableColumnOrganiserSetting() override;
|
||||
|
||||
void onEffectShowActorRelocationRemoveReply(const Core::FunctionReplyObject &reply) override
|
||||
{
|
||||
m_requestHelper->requestReply(reply);
|
||||
}
|
||||
|
||||
private slots:
|
||||
void setShowExpired(bool show);
|
||||
|
||||
private:
|
||||
QString m_menuGroup;
|
||||
EffectShowModel *m_effectShowModel{nullptr};
|
||||
EffectShowActorRelocationProxyModel *m_proxyModel{nullptr};
|
||||
//std::shared_ptr<EffectShowManagement::Interface::Dtc> m_dtc;
|
||||
std::shared_ptr<EffectShowManagement::Interface::Ftc> m_ftc;
|
||||
LtsSession::LtsSession *m_session{nullptr};
|
||||
LtsUtils::RequestHelper *m_requestHelper{nullptr};
|
||||
|
||||
Ui::EffectShowActorRelocationList *m_ui{nullptr};
|
||||
LOGGER_T m_logger;
|
||||
|
||||
};
|
||||
|
||||
} // namespace EffectShowManagement
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>EffectShowActorRelocationList</class>
|
||||
<widget class="QWidget" name="EffectShowActorRelocationList">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>455</width>
|
||||
<height>341</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">Effect Show</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="LtsDataView::LtsDataView" name="widget">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>250</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>LtsDataView::LtsDataView</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>LtsDataView/lts_data_view.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
+153
@@ -0,0 +1,153 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for EffectShowManagement - Effect Show Overview Dialog Model
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-10.05
|
||||
*/
|
||||
|
||||
#include "esm_effect_show_actor_relocation_model.h"
|
||||
#include "esm_effect_show_model.h"
|
||||
#include <EffectShowManagement/esm_translation.h>
|
||||
|
||||
#include <LtsCoordTrans/lts_coord_trans.h>
|
||||
#include <ngltools/ngltools_dtg.h>
|
||||
|
||||
namespace EffectShowManagement
|
||||
{
|
||||
//---------------------------------
|
||||
// Effect Show Model
|
||||
//---------------------------------
|
||||
EffectShowActorRelocationModel::EffectShowActorRelocationModel(EffectShowModel *effectShowModel, QObject *parent)
|
||||
: LtsWidgets::LtsAbstractTableModel<EffectShowManagement::EffectShowActorRelocation>({tr("Name"),
|
||||
tr("Id"),
|
||||
tr("Time"),
|
||||
tr("Position"),
|
||||
tr("Info"),
|
||||
tr("Status"),
|
||||
tr("Answer")},
|
||||
parent)
|
||||
, m_dtc(nullptr)
|
||||
, m_effectShowModel(effectShowModel)
|
||||
, m_logger(getLogger("EffectShowActorRelocationModel"))
|
||||
{}
|
||||
|
||||
|
||||
bool EffectShowActorRelocationModel::initModel(const std::shared_ptr<EffectShowManagement::Interface::Dtc> &dtc)
|
||||
{
|
||||
m_dtc = dtc;
|
||||
|
||||
connect(m_dtc.get(), &EffectShowManagement::Interface::Dtc::effectShowActorRelocationChanged,
|
||||
this, &EffectShowActorRelocationModel::onDataChanged);
|
||||
|
||||
// insert Model
|
||||
m_dtc->effectShowActorRelocations([this](const EffectShowManagement::EffectShowActorRelocation & EffectShowActorRelocation) { insertRow(EffectShowActorRelocation); });
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
QVariant EffectShowActorRelocationModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (role != Qt::DisplayRole || !indexIsValid(index))
|
||||
return QVariant();
|
||||
|
||||
const EffectShowManagement::EffectShowActorRelocation &esar = m_vecData.at(index.row());
|
||||
switch (index.column())
|
||||
{
|
||||
case Name:
|
||||
{
|
||||
int id = esar.esmParticipantId();
|
||||
return (id != -1) ? m_effectShowModel->getParticipantName(id) : QLatin1String("---");
|
||||
}
|
||||
case Id:
|
||||
return esar.id();
|
||||
case ArrivalTime:
|
||||
return QDateTime::fromMSecsSinceEpoch(esar.arrival_time().get());
|
||||
case Position:
|
||||
{
|
||||
Core::GeoPosition2D pos = esar.position();
|
||||
return LtsCoordTrans::mgrsFromGeographic(pos.lon(), pos.lat());
|
||||
}
|
||||
case Info:
|
||||
return QString::fromStdString(esar.info());
|
||||
case Status:
|
||||
return EffectShowManagement::toString(esar.orderConfirmation());
|
||||
case Answer:
|
||||
return QString::fromStdString(esar.answerText());
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void EffectShowActorRelocationProxyModel::setSourceModel(QAbstractItemModel *sourceModel)
|
||||
{
|
||||
m_sourceModel = qobject_cast<EffectShowActorRelocationModel*>(sourceModel);
|
||||
LtsWidgets::LtsColumnFilterProxyModel::setSourceModel(sourceModel);
|
||||
}
|
||||
|
||||
void EffectShowActorRelocationProxyModel::setShowExpired(bool show)
|
||||
{
|
||||
if (m_showExpired == show)
|
||||
return;
|
||||
|
||||
m_showExpired = show;
|
||||
invalidateFilter();
|
||||
}
|
||||
|
||||
bool EffectShowActorRelocationProxyModel::lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const
|
||||
{
|
||||
if (!m_sourceModel ||
|
||||
source_left.column() != source_right.column() ||
|
||||
!source_left.isValid() ||
|
||||
!source_right.isValid())
|
||||
return LtsWidgets::LtsColumnFilterProxyModel::lessThan(source_left, source_right);
|
||||
const auto &dataLeft = m_sourceModel->m_vecData.at(source_left.row());
|
||||
const auto dataRight = m_sourceModel->m_vecData.at(source_right.row());
|
||||
switch (source_left.column())
|
||||
{
|
||||
case EffectShowActorRelocationModel::ArrivalTime:
|
||||
if (dataLeft.arrival_time().is_set() && dataRight.arrival_time().is_set())
|
||||
return dataLeft.arrival_time().get() < dataRight.arrival_time().get();
|
||||
if (dataRight.arrival_time().is_set())
|
||||
return true;
|
||||
if (dataLeft.arrival_time().is_set())
|
||||
return false;
|
||||
return dataLeft.id() < dataRight.id();
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return LtsWidgets::LtsColumnFilterProxyModel::lessThan(source_left, source_right);
|
||||
}
|
||||
|
||||
bool EffectShowActorRelocationProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
|
||||
{
|
||||
bool bRet = checkFilter(source_row);
|
||||
if (!bRet)
|
||||
return false;
|
||||
return LtsWidgets::LtsColumnFilterProxyModel::filterAcceptsRow(source_row, source_parent);
|
||||
}
|
||||
|
||||
bool EffectShowActorRelocationProxyModel::checkFilter(int source_row) const
|
||||
{
|
||||
|
||||
// If showExpired: Show all
|
||||
if (showExpired())
|
||||
return true;
|
||||
|
||||
const auto effectShowSource = m_sourceModel->getRowData(source_row);
|
||||
|
||||
// show when not expired
|
||||
if (effectShowSource.orderConfirmation() != EffectShowManagement::OrderConfirmation_e_def::OrderCarriedOut &&
|
||||
effectShowSource.orderConfirmation() != EffectShowManagement::OrderConfirmation_e_def::PositionReached &&
|
||||
effectShowSource.orderConfirmation() != EffectShowManagement::OrderConfirmation_e_def::Abort &&
|
||||
effectShowSource.orderConfirmation() != EffectShowManagement::OrderConfirmation_e_def::Nonacceptance)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace EffectShowModel
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
/**
|
||||
* @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 <EffectShowManagement/esm_dtc.h>
|
||||
#include <EffectShowManagement/logger.h>
|
||||
|
||||
#include <LtsWidgets/lts_abstract_table_model.h>
|
||||
#include <LtsWidgets/lts_column_filter_proxy_model.h>
|
||||
|
||||
namespace EffectShowManagement
|
||||
{
|
||||
class EffectShowModel;
|
||||
|
||||
/**
|
||||
* @brief The EffectShowActorRelocationModel provides all not completed effect show actor relocation orders.
|
||||
*/
|
||||
class EffectShowActorRelocationModel final : public LtsWidgets::LtsAbstractTableModel<EffectShowManagement::EffectShowActorRelocation>
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum Columns
|
||||
{
|
||||
Name,
|
||||
Id,
|
||||
ArrivalTime,
|
||||
Position,
|
||||
Info,
|
||||
Status,
|
||||
Answer
|
||||
};
|
||||
explicit EffectShowActorRelocationModel(EffectShowModel *effectShowModel, QObject *parent);
|
||||
|
||||
bool initModel(const std::shared_ptr<EffectShowManagement::Interface::Dtc> &dtc);
|
||||
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
|
||||
QVector<EffectShowManagement::EffectShowActorRelocation>::const_iterator getItBegin() const { return m_vecData.begin(); }
|
||||
QVector<EffectShowManagement::EffectShowActorRelocation>::const_iterator getItEnd() const { return m_vecData.end(); }
|
||||
|
||||
private:
|
||||
std::shared_ptr<EffectShowManagement::Interface::Dtc> m_dtc;
|
||||
|
||||
EffectShowModel *m_effectShowModel;
|
||||
friend class EffectShowActorRelocationProxyModel;
|
||||
|
||||
LOGGER_T m_logger;
|
||||
|
||||
};
|
||||
|
||||
|
||||
class EffectShowActorRelocationProxyModel 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};
|
||||
|
||||
EffectShowActorRelocationModel *m_sourceModel{nullptr};
|
||||
};
|
||||
} //namespace EffectShowManagement
|
||||
@@ -0,0 +1,241 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* MeteoDataManagement - Static Meteo Data Edit Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by hjl, SLSE, 2016-10-17
|
||||
*/
|
||||
|
||||
#include "esm_effect_show_edit.h"
|
||||
#include "ui_esm_effect_show_list.h"
|
||||
#include "ui_esm_effect_show_edit.h"
|
||||
#include "esm_effect_show_actor_model.h"
|
||||
#include <LtsSession/lts_session_data.h>
|
||||
|
||||
#include <EffectShowManagement/esm_data_plugin_interface.h>
|
||||
#include <AreaEffectSimulation/aes_data_plugin_interface.h>
|
||||
#include <ProjectDataManagement/pdm_data_plugin_interface.h>
|
||||
#include <ParticipantManagement/ppm_data_plugin_interface.h>
|
||||
|
||||
namespace EffectShowManagement
|
||||
{
|
||||
|
||||
EffectShowEdit::EffectShowEdit(const EffectShow &effectShow, QWidget *parent)
|
||||
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::OkApplyCancel)
|
||||
, m_ftc(nullptr)
|
||||
, m_model(nullptr)
|
||||
, m_requestHelper(new LtsUtils::RequestHelper(this))
|
||||
, m_effectShow(effectShow)
|
||||
, m_ui(new Ui::EffectShowEdit)
|
||||
, m_logger(getLogger("EffectShowEdit"))
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
}
|
||||
|
||||
|
||||
EffectShowEdit::~EffectShowEdit()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
|
||||
void EffectShowEdit::retranslate()
|
||||
{
|
||||
translate(m_ui, tr("Edit Effect Show"));
|
||||
}
|
||||
|
||||
|
||||
bool EffectShowEdit::init(LtsSession::LtsSession *session,
|
||||
EffectShowModel *model)
|
||||
{
|
||||
m_session = session;
|
||||
if (!session->getFtc<EffectShowManagement::DataInterface>(m_ftc))
|
||||
return false;
|
||||
if (!session->getDtc<ProjectDataManagement::DataInterface>(m_pdmDtc))
|
||||
return false;
|
||||
if (!session->getDtc<ParticipantManagement::DataInterface>(m_ppmDtc))
|
||||
return false;
|
||||
if (!session->getDtc<AreaEffectSimulation::DataInterface>(m_aesDtc))
|
||||
return false;
|
||||
if (!session->getForeignGuiInterface(m_esmActorCbx))
|
||||
return false;
|
||||
|
||||
DEBUG_LOG(m_logger) << "EffectShowEdit::init()";
|
||||
m_model = model;
|
||||
|
||||
AreaEffectSimulation::AesItem aesItem;
|
||||
bool foundItem = m_aesDtc->aesItemFromId(m_effectShow.idAreaEffectSimulation(), aesItem);
|
||||
DEBUG_LOG(m_logger) << ", found :" << foundItem
|
||||
<< ", idAreaEffectSimulation :" << m_effectShow.idAreaEffectSimulation()
|
||||
<< ", aesItem.id() :" << aesItem.id()
|
||||
<< ", esmParticipantId: " << m_effectShow.esmParticipantId();
|
||||
|
||||
if (!foundItem)
|
||||
return false;
|
||||
|
||||
m_isSmoke = m_pdmDtc->isSmoke(aesItem.chargeStruct().chargeTypeId(),
|
||||
aesItem.chargeStruct().igniterTypeId(),
|
||||
aesItem.chargeStruct().igniterFunctionId());
|
||||
|
||||
if (!m_isSmoke)
|
||||
{
|
||||
connect(m_ui->sbVolley, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, [this](int val)
|
||||
{
|
||||
m_ui->sbShotsInTotal->setMinimum(val);
|
||||
if (m_ui->sbShotsInTotal->value() < val)
|
||||
m_ui->sbShotsInTotal->setValue(val);
|
||||
});
|
||||
|
||||
// initialize filter combobox
|
||||
m_ui->cbEffectShowActorFilter->addItem(tr("<No filter>"), EffectShowActorModel::eFeature::NotSpecified);
|
||||
m_ui->cbEffectShowActorFilter->addItem(EffectShowActorModel::getFeatureName(EffectShowActorModel::eFeature::SmokeAndExplosion48),
|
||||
EffectShowActorModel::eFeature::SmokeAndExplosion48);
|
||||
m_ui->cbEffectShowActorFilter->addItem(EffectShowActorModel::getFeatureName(EffectShowActorModel::eFeature::Explosion24),
|
||||
EffectShowActorModel::eFeature::Explosion24);
|
||||
m_ui->cbEffectShowActorFilter->setCurrentIndex(1); // default should be SmokeAndExplosion48 == DMF-Fz
|
||||
onEffectShowActorFilterChanged(-1); // function argument has no effect
|
||||
connect(m_ui->cbEffectShowActorFilter, QOverload<int>::of(&LtsWidgets::LtsComboBox::currentIndexChanged),
|
||||
this, &EffectShowEdit::onEffectShowActorFilterChanged);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ui->lblEffectShowActorFilter->hide();
|
||||
m_ui->cbEffectShowActorFilter->hide();
|
||||
onEffectShowActorFilterChanged(-1); // fill combobox
|
||||
}
|
||||
|
||||
connect(m_model, &EffectShowModel::effectShowVehicleStatusChanged,
|
||||
this, &EffectShowEdit::onEffectShowVehicleStatusChanged);
|
||||
|
||||
showEffectShow();
|
||||
m_ui->dteFire->setWithNowButton(false);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool EffectShowEdit::apply()
|
||||
{
|
||||
// Send modified data via FTC call
|
||||
return m_requestHelper->startSingleRequest([this]()
|
||||
{
|
||||
m_effectShow.esmParticipantId(m_ui->cbEffectShowActor->currentData().toInt());
|
||||
if (!m_isSmoke)
|
||||
{
|
||||
m_effectShow.numOfVolley(m_ui->sbVolley->value());
|
||||
m_effectShow.shotsPerVolley(m_ui->sbShotsInTotal->value());
|
||||
}
|
||||
return m_ftc->effectShowModifyRequest(m_effectShow, this);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
void EffectShowEdit::showEffectShow()
|
||||
{
|
||||
m_ui->leName->setText(QString::fromStdString(m_effectShow.nameAreaEffectSimulation()));
|
||||
// get the vehicleStatus to set the correct entry for the cbEffectShowActorFilter
|
||||
EffectShowVehicleStatus vehicleStatus;
|
||||
const int equipmentNumber = m_ppmDtc->equipmentNumberByParticipantId(m_effectShow.esmParticipantId());
|
||||
m_model->getVehicleStatus(equipmentNumber, vehicleStatus);
|
||||
const int feature = m_ui->cbEffectShowActorFilter->findData(vehicleStatus.feature().underlying());
|
||||
switch (feature)
|
||||
{
|
||||
case EffectShowManagement::Feature_e::Explosion24:
|
||||
case EffectShowManagement::Feature_e::NotSpecified:
|
||||
m_ui->cbEffectShowActorFilter->setCurrentIndex(feature);
|
||||
break;
|
||||
default:
|
||||
m_ui->cbEffectShowActorFilter->setCurrentIndex(1); // set default SmokeAndExplosion48 (DMF-Fz)
|
||||
break;
|
||||
}
|
||||
|
||||
if (m_effectShow.esmParticipantId() > 0)
|
||||
m_ui->cbEffectShowActor->setCurrentIndex(m_ui->cbEffectShowActor->findData(m_effectShow.esmParticipantId()));
|
||||
|
||||
if (m_isSmoke) //smoke
|
||||
{
|
||||
m_ui->sbVolley->hide();
|
||||
m_ui->lblVolley->hide();
|
||||
m_ui->sbShotsInTotal->hide();
|
||||
m_ui->lblShots->hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ui->lblVolley->setText(tr("Volley:"));
|
||||
m_ui->lblShots->setText(tr("Shots in Total:"));
|
||||
m_ui->sbVolley->setValue(m_effectShow.numOfVolley());
|
||||
m_ui->sbShotsInTotal->setValue(m_effectShow.shotsPerVolley());
|
||||
}
|
||||
m_ui->dteFire->setMsecsSinceEpoch(m_effectShow.startTime().is_set() ? m_effectShow.startTime().get() : 0);
|
||||
m_ui->leRemainingAmmunition->setText(m_model->getParticipantAmmunition(m_effectShow.esmParticipantId()));
|
||||
|
||||
connect(m_ui->cbEffectShowActor, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, [this]()
|
||||
{
|
||||
m_ui->leRemainingAmmunition->setText(m_model->getParticipantAmmunition(m_ui->cbEffectShowActor->currentData().toInt()));
|
||||
});
|
||||
}
|
||||
|
||||
void EffectShowEdit::updateActorComboBox(const Core::GeoPosition &coordGeo)
|
||||
{
|
||||
|
||||
bool ok;
|
||||
|
||||
int esmParticipantId = m_ui->cbEffectShowActor->currentData().toInt(&ok);
|
||||
DEBUG_LOG(m_logger) << "currentIndex: " << m_ui->cbEffectShowActor->currentIndex()
|
||||
<< ", currentText: " << m_ui->cbEffectShowActor->currentText()
|
||||
<< ", esmParticipantId: " << esmParticipantId
|
||||
<< ", ok: " << ok;
|
||||
int featureFilter = m_ui->cbEffectShowActorFilter->currentData().toInt();
|
||||
m_esmActorCbx->fillActorComboBox(m_ui->cbEffectShowActor, coordGeo, m_isSmoke, featureFilter);
|
||||
m_ui->cbEffectShowActor->setCurrentIndex(m_ui->cbEffectShowActor->findData(esmParticipantId));
|
||||
}
|
||||
|
||||
void EffectShowEdit::onEffectShowActorFilterChanged(const int &idx)
|
||||
{
|
||||
Q_UNUSED(idx);
|
||||
|
||||
const Core::GeoPosition coordGeo(m_effectShow.position().lon(), m_effectShow.position().lat(), 0);
|
||||
updateActorComboBox(coordGeo);
|
||||
|
||||
// int selectedParticipantId = -1;
|
||||
// if (m_ui->cbEffectShowActor->currentIndex() > 0)
|
||||
// selectedParticipantId = m_ui->cbEffectShowActor->currentData().toInt();
|
||||
|
||||
// m_ui->cbEffectShowActor->clear();
|
||||
// m_ui->cbEffectShowActor->addItem(QLatin1String("---"), 0);
|
||||
|
||||
// int currentIndex = 1; // value at 0 is "---"
|
||||
// const int filter = m_ui->cbEffectShowActorFilter->currentData().toInt();
|
||||
// //const auto actors = m_model->getParticipantList(m_isSmoke);
|
||||
// const auto actors = m_model->getParticipantListByDistance(m_isSmoke, m_effectShow.position());
|
||||
|
||||
// for (auto it = actors.begin(); it != actors.end(); ++it)
|
||||
// {
|
||||
// if (!m_isSmoke)
|
||||
// {
|
||||
// auto iParticipant = m_model->getEffectShowActorModel()->getIt(it->first);
|
||||
// if (iParticipant == m_model->getEffectShowActorModel()->getItEnd())
|
||||
// continue;
|
||||
// if (!iParticipant->equipmentNumber().is_set())
|
||||
// continue;
|
||||
// if (!m_model->getEffectShowActorModel()->isMatchedByFilter(iParticipant->equipmentNumber().get(), filter))
|
||||
// continue;
|
||||
// } // if
|
||||
|
||||
// m_ui->cbEffectShowActor->addItem(it->second, it->first);
|
||||
// if (selectedParticipantId == it->first)
|
||||
// m_ui->cbEffectShowActor->setCurrentIndex(currentIndex);
|
||||
// ++currentIndex;
|
||||
// } // for
|
||||
}
|
||||
|
||||
void EffectShowEdit::onEffectShowVehicleStatusChanged(const EffectShowVehicleStatus &data, const DataModification &modType)
|
||||
{
|
||||
Q_UNUSED(modType);
|
||||
int equipmentNumber = m_ppmDtc->equipmentNumberByParticipantId(data.esmParticipantId());
|
||||
const int filter = m_ui->cbEffectShowActorFilter->currentData().toInt();
|
||||
if (m_model->getEffectShowActorModel()->isMatchedByFilter(equipmentNumber, filter))
|
||||
onEffectShowActorFilterChanged(-1);
|
||||
}
|
||||
|
||||
} // namespace EffectShowManagement
|
||||
@@ -0,0 +1,79 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* MeteoDataManagement - Static Meteo Data Edit Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by hjl, SLSE, 2016-10-17
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "esm_effect_show_model.h"
|
||||
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <AreaEffectSimulation/aes_dtc.h>
|
||||
#include <ProjectDataManagement/pdm_dtc.h>
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
#include <PluginInterfaces/gui_plugin_interface.h> //der fehlte
|
||||
#include <Plugins/EffectShowManagement/esm_gui_combobox_plugin_interface.h>
|
||||
|
||||
#include <Services/EffectShowManagement/esm_dtc.h>
|
||||
#include <Services/EffectShowManagement/esm_ftc.h>
|
||||
#include <EffectShowManagement/logger.h>
|
||||
#include <LtsUtilsGuiDds/request_helper.h>
|
||||
|
||||
#include <QPair>
|
||||
#include <QVector>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class EffectShowEdit;
|
||||
}
|
||||
|
||||
namespace EffectShowManagement
|
||||
{
|
||||
/**
|
||||
* @brief Input mask for effect show changes.
|
||||
*/
|
||||
class EffectShowEdit : public LtsWidgets::LtsDialog,
|
||||
protected EffectShowManagement::Interface::Ftc::EffectShowModifyReplyHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit EffectShowEdit(const EffectShow &effectShow, QWidget *parent = nullptr);
|
||||
~EffectShowEdit();
|
||||
|
||||
bool init(LtsSession::LtsSession *session,
|
||||
EffectShowModel *model);
|
||||
bool apply() override;
|
||||
|
||||
private:
|
||||
void retranslate() override;
|
||||
void showEffectShow();
|
||||
void onEffectShowModifyReply(const Core::FunctionReplyObject &replyObject) override { m_requestHelper->requestReply(replyObject); }
|
||||
void updateActorComboBox(const Core::GeoPosition &coordGeo);
|
||||
|
||||
private slots:
|
||||
void onEffectShowActorFilterChanged(const int &idx);
|
||||
void onEffectShowVehicleStatusChanged(const EffectShowVehicleStatus &data, const DataModification &modType);
|
||||
|
||||
private:
|
||||
LtsSession::LtsSession *m_session;
|
||||
std::shared_ptr<EffectShowManagement::Interface::Ftc> m_ftc;
|
||||
std::shared_ptr<AreaEffectSimulation::Interface::Dtc> m_aesDtc;
|
||||
std::shared_ptr<ProjectDataManagement::Interface::Dtc> m_pdmDtc;
|
||||
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_ppmDtc;
|
||||
std::shared_ptr<EffectShowManagement::ForeignGuiComboboxInterface> m_esmActorCbx;
|
||||
|
||||
EffectShowModel *m_model;
|
||||
LtsUtils::RequestHelper *m_requestHelper;
|
||||
EffectShow m_effectShow;
|
||||
bool m_isSmoke{false};
|
||||
|
||||
Ui::EffectShowEdit *m_ui;
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
|
||||
} //namespace EffectShowManagement
|
||||
@@ -0,0 +1,179 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>EffectShowEdit</class>
|
||||
<widget class="QWidget" name="EffectShowEdit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>809</width>
|
||||
<height>234</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="7" column="1">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>1</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="LtsWidgets::LtsComboBox" name="cbEffectShowActor"/>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QSpinBox" name="sbVolley">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>48</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lblEffectShowActorFilter">
|
||||
<property name="text">
|
||||
<string>Effect Show Actor Filter:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="lblRemainingAmmunition">
|
||||
<property name="text">
|
||||
<string>Remaining Ammunition:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lblName">
|
||||
<property name="text">
|
||||
<string>Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="lblFire">
|
||||
<property name="text">
|
||||
<string>Fire:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,2">
|
||||
<item>
|
||||
<widget class="LtsWidgets::LtsDateTimeEdit" name="dteFire" native="true">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="checkable" stdset="0">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<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>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="lblShots">
|
||||
<property name="text">
|
||||
<string notr="true">Shots in Total:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="leName">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QLineEdit" name="leRemainingAmmunition">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QSpinBox" name="sbShotsInTotal">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>48</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="lblEffectShowActor">
|
||||
<property name="text">
|
||||
<string>Effect Show Actor:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="lblVolley">
|
||||
<property name="text">
|
||||
<string notr="true">Volley:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="LtsWidgets::LtsComboBox" name="cbEffectShowActorFilter"/>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<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>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>LtsWidgets::LtsComboBox</class>
|
||||
<extends>QComboBox</extends>
|
||||
<header>LtsWidgets/lts_combo_box.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>LtsWidgets::LtsDateTimeEdit</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>LtsWidgets/lts_date_time_edit.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -0,0 +1,137 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Gui Plugin for MeteoDataManagement
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-10-05
|
||||
*/
|
||||
|
||||
#include "esm_effect_show_list.h"
|
||||
#include "esm_effect_show_actor_relocation_list.h"
|
||||
#include "esm_effect_show_actor_list.h"
|
||||
#include "esm_effect_show_gui_plugin.h"
|
||||
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <Services/EffectShowManagement/esm_operator_rights.h>
|
||||
#include <ParticipantManagement/ppm_data_plugin_interface.h>
|
||||
#include <LtsUtilsSettings/settings.h>
|
||||
|
||||
namespace EffectShowManagement
|
||||
{
|
||||
|
||||
std::shared_ptr<GuiPluginBase::Interface> GuiPlugin::createGuiInterface(LtsSession::LtsSession *session)
|
||||
{
|
||||
return std::make_shared<InterfaceImpl>(session);
|
||||
}
|
||||
|
||||
|
||||
InterfaceImpl::InterfaceImpl(LtsSession::LtsSession *session)
|
||||
: GuiPluginBase::Interface(session, getLogger("Plugins.Gui.Esm.EffectShow"))
|
||||
, m_dtc(nullptr)
|
||||
, m_ftc(nullptr)
|
||||
, m_dtcPpm(nullptr)
|
||||
, m_dtcPdm(nullptr)
|
||||
{}
|
||||
|
||||
|
||||
bool InterfaceImpl::fetchInterfaces()
|
||||
{
|
||||
if (!m_session->getDtc<EffectShowManagement::DataInterface>(m_dtc))
|
||||
return false;
|
||||
if (!m_session->getFtc<EffectShowManagement::DataInterface>(m_ftc))
|
||||
return false;
|
||||
if (!m_session->getDtc<ParticipantManagement::DataInterface>(m_dtcPpm))
|
||||
return false;
|
||||
if (!m_session->getDtc<AreaEffectSimulation::DataInterface>(m_aesDtc))
|
||||
return false;
|
||||
if (!m_session->getDtc<ProjectDataManagement::DataInterface>(m_dtcPdm))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void InterfaceImpl::clearInterfaces()
|
||||
{
|
||||
m_dtc = nullptr;
|
||||
m_ftc = nullptr;
|
||||
m_dtcPpm = nullptr;
|
||||
m_dtcPdm = nullptr;
|
||||
}
|
||||
|
||||
|
||||
QString InterfaceImpl::menuGroup() const
|
||||
{
|
||||
return tr("Effect Representation");
|
||||
}
|
||||
|
||||
|
||||
QVector<LtsWidgets::PluginData> InterfaceImpl::getActions()
|
||||
{
|
||||
QVector<LtsWidgets::PluginData> ret;
|
||||
|
||||
LtsUtils::ProjectSettings *ps = LtsUtils::ProjectSettings::getInstance();
|
||||
const bool enableEffectShowManagement = ps->value(QStringLiteral("esm"),
|
||||
QStringLiteral("enableEffectShowManagement")).toBool();
|
||||
if (enableEffectShowManagement)
|
||||
{
|
||||
LtsWidgets::PluginData plData;
|
||||
plData.menuGroup = menuGroup();
|
||||
plData.menuText = tr("Effect Representations");
|
||||
plData.identifier = QLatin1String("esmEffectShowList");
|
||||
plData.menuIcon = QIcon(QLatin1String("icon:create_evaluation_topic.svg"));
|
||||
plData.operatorRight = OperatorRights::EffectShowEdit;
|
||||
plData.exercisePart = LtsWidgets::ExercisePart::eExecution;
|
||||
plData.createWidgetFunc = [this](QWidget * parent)
|
||||
{
|
||||
return onShowEffectShows(parent);
|
||||
};
|
||||
ret.append(plData);
|
||||
|
||||
plData.menuGroup = menuGroup();
|
||||
plData.menuText = tr("Actor Position Relocations");
|
||||
plData.identifier = QLatin1String("esmEffectShowActorRelocationList");
|
||||
plData.menuIcon = QIcon(QLatin1String("icon:reloc_vehicle.svg"));
|
||||
plData.operatorRight = OperatorRights::RelocationsEdit;
|
||||
plData.exercisePart = LtsWidgets::ExercisePart::eExecution;
|
||||
plData.createWidgetFunc = [this](QWidget * parent)
|
||||
{
|
||||
return onShowEffectShowActorRelocations(parent);
|
||||
};
|
||||
ret.append(plData);
|
||||
|
||||
plData.menuGroup = menuGroup();
|
||||
plData.menuText = tr("Effect Actors");
|
||||
plData.identifier = QLatin1String("esmEffectShowActorList");
|
||||
plData.menuIcon = QIcon(QLatin1String("icon:visible_teams.svg"));
|
||||
plData.operatorRight = OperatorRights::ActorEdit;
|
||||
plData.exercisePart = LtsWidgets::ExercisePart::eExecution;
|
||||
plData.createWidgetFunc = [this](QWidget * parent)
|
||||
{
|
||||
return onShowEffectShowActors(parent);
|
||||
};
|
||||
ret.append(plData);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
LtsWidgets::LtsDialog *InterfaceImpl::onShowEffectShows(QWidget *parent)
|
||||
{
|
||||
return LtsWidgets::initDialog(new EffectShowList(menuGroup(), parent),
|
||||
m_session);
|
||||
}
|
||||
|
||||
LtsWidgets::LtsDialog *InterfaceImpl::onShowEffectShowActorRelocations(QWidget *parent)
|
||||
{
|
||||
return LtsWidgets::initDialog(new EffectShowActorRelocationList(menuGroup(), parent),
|
||||
m_session);
|
||||
}
|
||||
|
||||
LtsWidgets::LtsDialog *InterfaceImpl::onShowEffectShowActors(QWidget *parent)
|
||||
{
|
||||
return LtsWidgets::initDialog(new EffectShowActorList(parent),
|
||||
m_session);
|
||||
}
|
||||
|
||||
} // namespace EffectShowManagement
|
||||
@@ -0,0 +1,67 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Gui Plugin for MeteoDataManagement
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-10-05
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
#include <PluginInterfaces/gui_plugin_interface.h>
|
||||
#include <Plugins/EffectShowManagement/esm_data_plugin_interface.h>
|
||||
#include <Plugins/EffectShowManagement/esm_gui_plugin_interface.h>
|
||||
#include <AreaEffectSimulation/aes_data_plugin_interface.h>
|
||||
#include <ProjectDataManagement/pdm_data_plugin_interface.h>
|
||||
|
||||
|
||||
namespace EffectShowManagement
|
||||
{
|
||||
|
||||
class GuiPlugin final : public QObject, public GuiPluginBase::Plugin
|
||||
{
|
||||
Q_PLUGIN_METADATA(IID "gui:3:esm")
|
||||
Q_INTERFACES(GuiPluginBase::Plugin)
|
||||
|
||||
Q_OBJECT
|
||||
public:
|
||||
GuiPlugin() = default;
|
||||
~GuiPlugin() = default;
|
||||
|
||||
QString pluginName() override { return QLatin1String("EffectShowManagementGuiPlugin"); }
|
||||
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 QObject, public GuiPluginBase::Interface
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit InterfaceImpl(LtsSession::LtsSession *session);
|
||||
|
||||
bool fetchInterfaces() override;
|
||||
void clearInterfaces() override;
|
||||
QString menuGroup() const override;
|
||||
QVector<LtsWidgets::PluginData> getActions() override;
|
||||
bool availableInPartition(IDL::PartitionType partition) const override { return partition == IDL::PartitionType::Exercise || partition == IDL::PartitionType::Global; }
|
||||
|
||||
private:
|
||||
LtsWidgets::LtsDialog *onShowEffectShows(QWidget *parent);
|
||||
LtsWidgets::LtsDialog *onShowEffectShowActorRelocations(QWidget *parent);
|
||||
LtsWidgets::LtsDialog *onShowEffectShowActors(QWidget *parent);
|
||||
|
||||
|
||||
std::shared_ptr<EffectShowManagement::Interface::Dtc> m_dtc;
|
||||
std::shared_ptr<EffectShowManagement::Interface::Ftc> m_ftc;
|
||||
std::shared_ptr<AreaEffectSimulation::Interface::Dtc> m_aesDtc;
|
||||
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_dtcPpm;
|
||||
std::shared_ptr<ProjectDataManagement::Interface::Dtc> m_dtcPdm;
|
||||
};
|
||||
|
||||
} // namespace EffectShowManagement
|
||||
@@ -0,0 +1,176 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for MeteoDataManagement - Meteo Data Overview Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-10-05
|
||||
*/
|
||||
|
||||
#include "esm_effect_show_list.h"
|
||||
#include "ui_esm_effect_show_list.h"
|
||||
#include "esm_effect_show_edit.h"
|
||||
#include "esm_effect_show_model.h"
|
||||
#include "esm_effect_show_actor_model.h"
|
||||
#include <EffectShowManagement/esm_data_plugin_interface.h>
|
||||
|
||||
#include <LtsPrinting/printing.h>
|
||||
#include <QTreeView>
|
||||
|
||||
namespace EffectShowManagement
|
||||
{
|
||||
|
||||
EffectShowList::EffectShowList(const QString &menuGroup, QWidget *parent)
|
||||
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::CloseOnly)
|
||||
, m_menuGroup(menuGroup)
|
||||
, m_model(nullptr)
|
||||
, m_ftc(nullptr)
|
||||
, m_session(nullptr)
|
||||
, m_ui(new Ui::EffectShowList)
|
||||
, m_requestHelper(new LtsUtils::RequestHelper(this))
|
||||
, m_logger(getLogger("EffectShowList"))
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
m_ui->widget->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
|
||||
|
||||
//cbx show expired
|
||||
QCheckBox *cbExpired = new QCheckBox(tr("Show expired"), m_ui->widget);
|
||||
cbExpired->setProperty("const", true);
|
||||
m_ui->widget->setCustomWidget(cbExpired);
|
||||
connect(cbExpired, &QCheckBox::toggled, this, &EffectShowList::setShowExpired);
|
||||
|
||||
// connects fuer Widgetaenderungen
|
||||
connect(m_ui->widget, &LtsDataView::LtsDataView::signalSelectionChanged,
|
||||
this, &EffectShowList::onSelectionChanged);
|
||||
|
||||
connect(m_ui->widget, &LtsDataView::LtsDataView::signalDoubleClicked,
|
||||
this, &EffectShowList::onEditEffectShow);
|
||||
|
||||
// Edit-Button erzeugen
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Edit, this, &EffectShowList::onEditEffectShow);
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Remove, this, &EffectShowList::onRemoveEffectShow);
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Edit, false);
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Remove, false);
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Print, this, &EffectShowList::onPrint);
|
||||
|
||||
setOnlineHelpFilename(QStringLiteral("Situation-Effect_Shows"));
|
||||
|
||||
} // end of ctor()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
EffectShowList::~EffectShowList()
|
||||
{
|
||||
delete m_ui;
|
||||
} // end of dtor()
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void EffectShowList::retranslate()
|
||||
{
|
||||
translate(m_ui, tr("Effect Representations"));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool EffectShowList::init(LtsSession::LtsSession *session)
|
||||
{
|
||||
if (!session)
|
||||
return false;
|
||||
|
||||
m_session = session;
|
||||
if (!m_session->getFtc<EffectShowManagement::DataInterface>(m_ftc))
|
||||
return false;
|
||||
|
||||
m_model = new EffectShowModel(this);
|
||||
m_model->initModel(session);
|
||||
|
||||
m_proxyModel = new EffectShowProxyModel(this);
|
||||
m_proxyModel->setSourceModel(m_model);
|
||||
m_ui->widget->setModel(m_proxyModel);
|
||||
|
||||
#ifndef LTS_DEBUG
|
||||
m_ui->widget->hideColumn(EffectShowModel::Columns::Id);
|
||||
#endif
|
||||
|
||||
return true;
|
||||
} // end of init()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void EffectShowList::onSelectionChanged()
|
||||
{
|
||||
int rowCount = m_ui->widget->selectedRows().size();
|
||||
|
||||
bool enaEdit = false;
|
||||
if (rowCount > 0)
|
||||
{
|
||||
int row = m_ui->widget->currentIndex().row();
|
||||
EffectShowManagement::EffectShow effectShow = m_model->getRowData(row);
|
||||
enaEdit = effectShow.orderConfirmation() != OrderConfirmation_e::OrderCarriedOut &&
|
||||
effectShow.orderConfirmation() != OrderConfirmation_e::Execution;
|
||||
}
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Edit, enaEdit);
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Remove, rowCount);
|
||||
|
||||
|
||||
} // end of onSelectionChanged()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void EffectShowList::onEditEffectShow()
|
||||
{
|
||||
const QModelIndex idx = m_ui->widget->currentIndex();
|
||||
|
||||
int row = idx.row();
|
||||
if (row < 0)
|
||||
return;
|
||||
|
||||
EffectShowManagement::EffectShow effectShow = m_model->getRowData(row);
|
||||
|
||||
DEBUG_LOG(m_logger) << "--- onEffectShow() "
|
||||
<< " id: " << effectShow.id()
|
||||
<< " position: " << effectShow.position();
|
||||
|
||||
|
||||
EffectShowEdit *dialog = new EffectShowEdit(effectShow, this);
|
||||
dialog->init(m_session, m_model);
|
||||
addDialog(dialog, m_menuGroup, QLatin1String("esmEffectShow") + QString::number(effectShow.id()), LtsWidgets::LayoutArea::eDialogTab);
|
||||
|
||||
} // end of onEditEffectShow()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void EffectShowList::onRemoveEffectShow()
|
||||
{
|
||||
const QModelIndexList idxList = m_ui->widget->selectedRows();
|
||||
|
||||
if (idxList.isEmpty())
|
||||
return;
|
||||
int row = idxList.first().row();
|
||||
|
||||
EffectShowManagement::EffectShow es = m_model->getRowData(row);
|
||||
|
||||
// Send request via FTC call
|
||||
|
||||
m_requestHelper->startSingleRequest([es, this]()
|
||||
{
|
||||
const Core::RemoveElementRequest req(es.id());
|
||||
return m_ftc->effectShowRemoveRequest(req, this);
|
||||
});
|
||||
} // end of onRemoveEffectShow()
|
||||
|
||||
|
||||
void EffectShowList::setShowExpired(bool show)
|
||||
{
|
||||
m_proxyModel->setShowExpired(show);
|
||||
}
|
||||
|
||||
void EffectShowList::onPrint()
|
||||
{
|
||||
LtsPrinting::printView(m_session, this, m_ui->widget->treeView());
|
||||
} // end of onPrint()
|
||||
|
||||
void EffectShowList::tableColumnOrganiserSetting()
|
||||
{
|
||||
//LtsColumnOrganiser
|
||||
m_ui->widget->setColumnsOrganiserEnabled(identifier(), true);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
} // namespace EffectShowManagement
|
||||
@@ -0,0 +1,75 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for MeteoDataManagement - Meteo Data Overview Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-10-05
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Services/EffectShowManagement/esm_dtc.h>
|
||||
#include <Services/EffectShowManagement/esm_ftc.h>
|
||||
#include <Services/ParticipantManagement/ppm_dtc.h>
|
||||
|
||||
#include <AreaEffectSimulation/aes_dtc.h>
|
||||
#include <ProjectDataManagement/pdm_dtc.h>
|
||||
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <EffectShowManagement/logger.h>
|
||||
#include <LtsUtilsGuiDds/request_helper.h>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class EffectShowList;
|
||||
}
|
||||
namespace EffectShowManagement
|
||||
{
|
||||
class EffectShowModel;
|
||||
class EffectShowProxyModel;
|
||||
class EffectShowActorModel;
|
||||
class EffectShowActorRelocationModel;
|
||||
/**
|
||||
* @brief The EffectShowList is the view related to #EffectShowModel
|
||||
*/
|
||||
class EffectShowList : public LtsWidgets::LtsDialog
|
||||
, protected EffectShowManagement::Interface::Ftc::EffectShowRemoveReplyHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit EffectShowList(const QString &menuGroup, QWidget *parent = nullptr);
|
||||
~EffectShowList();
|
||||
bool init(LtsSession::LtsSession *session);
|
||||
|
||||
private slots:
|
||||
void setShowExpired(bool show);
|
||||
|
||||
private:
|
||||
void retranslate() override;
|
||||
void onSelectionChanged();
|
||||
void onEditEffectShow();
|
||||
void onRemoveEffectShow();
|
||||
void onPrint();
|
||||
void tableColumnOrganiserSetting() override;
|
||||
|
||||
void onEffectShowRemoveReply(const Core::FunctionReplyObject &reply) override
|
||||
{
|
||||
m_requestHelper->requestReply(reply);
|
||||
}
|
||||
private:
|
||||
QString m_menuGroup;
|
||||
EffectShowModel *m_model;
|
||||
EffectShowProxyModel *m_proxyModel;
|
||||
std::shared_ptr<EffectShowManagement::Interface::Ftc> m_ftc;
|
||||
LtsSession::LtsSession *m_session;
|
||||
Ui::EffectShowList *m_ui;
|
||||
|
||||
LtsUtils::RequestHelper *m_requestHelper;
|
||||
LOGGER_T m_logger;
|
||||
|
||||
};
|
||||
|
||||
} // namespace EffectShowManagement
|
||||
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>EffectShowList</class>
|
||||
<widget class="QWidget" name="EffectShowList">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>455</width>
|
||||
<height>341</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">Effect Show</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="LtsDataView::LtsDataView" name="widget">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>250</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>LtsDataView::LtsDataView</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>LtsDataView/lts_data_view.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -0,0 +1,522 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for EffectShowManagement - Effect Show Overview Dialog Model
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-10.05
|
||||
*/
|
||||
|
||||
#include "esm_effect_show_model.h"
|
||||
#include "esm_effect_show_actor_model.h"
|
||||
#include "esm_effect_show_actor_relocation_model.h"
|
||||
#include <EffectShowManagement/esm_translation.h>
|
||||
#include <AreaEffectSimulation/aes_translation.h>
|
||||
#include <ParticipantManagement/ppm_data_plugin_interface.h>
|
||||
#include <EffectShowManagement/esm_data_plugin_interface.h>
|
||||
#include <AreaEffectSimulation/aes_data_plugin_interface.h>
|
||||
#include <LtsCoordTrans/lts_coord_trans.h>
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <ngltools/ngltools_dtg.h>
|
||||
|
||||
namespace EffectShowManagement
|
||||
{
|
||||
//---------------------------------
|
||||
// Effect Show Model
|
||||
//---------------------------------
|
||||
EffectShowModel::EffectShowModel(QObject *parent)
|
||||
: LtsWidgets::LtsAbstractTableModel<EffectShowManagement::EffectShow>(
|
||||
{
|
||||
tr("Name AES"),
|
||||
tr("Id"),
|
||||
tr("Fire"),
|
||||
tr("Duration"),
|
||||
tr("Position"),
|
||||
tr("AesStatus"),
|
||||
tr("Actor"),
|
||||
tr("Volley"),
|
||||
tr("Shots in total"),
|
||||
tr("Dimension [m]"),
|
||||
tr("Rotation"),
|
||||
tr("Status"),
|
||||
tr("Answer")
|
||||
},
|
||||
parent)
|
||||
, m_dtc(nullptr)
|
||||
, m_effectShowActorProxyModel(nullptr)
|
||||
, m_effectShowActorModel(nullptr)
|
||||
, m_effectShowActorRelocationModel(nullptr)
|
||||
, m_logger(getLogger("EffectShowModel"))
|
||||
{}
|
||||
|
||||
EffectShowModel::~EffectShowModel()
|
||||
{
|
||||
delete m_effectShowActorProxyModel;
|
||||
delete m_effectShowActorModel;
|
||||
delete m_effectShowActorRelocationModel;
|
||||
}
|
||||
|
||||
|
||||
bool EffectShowModel::initModel(LtsSession::LtsSession *session)
|
||||
{
|
||||
if (!session->getDtc<EffectShowManagement::DataInterface>(m_dtc))
|
||||
return false;
|
||||
if (!session->getDtc<ParticipantManagement::DataInterface>(m_dtcPpm))
|
||||
return false;
|
||||
if (!session->getDtc<AreaEffectSimulation::DataInterface>(m_dtcAes))
|
||||
return false;
|
||||
|
||||
connect(m_dtc.get(), &EffectShowManagement::Interface::Dtc::effectShowChanged,
|
||||
this, &EffectShowModel::onDataChanged);
|
||||
connect(m_dtc.get(), &EffectShowManagement::Interface::Dtc::effectShowVehicleStatusChanged,
|
||||
this, &EffectShowModel::onEffectShowVehicleStatusChanged);
|
||||
|
||||
|
||||
// insert Model
|
||||
m_dtc->effectShows([this](const EffectShowManagement::EffectShow & effectShow) { insertRow(effectShow); });
|
||||
m_effectShowVehicleStatus = m_dtc->effectShowVehicleStatuss();
|
||||
|
||||
m_effectShowActorModel = new EffectShowActorModel(this, this);
|
||||
m_effectShowActorProxyModel = new EffectShowActorProxyModel(m_effectShowActorModel, this, this);
|
||||
m_effectShowActorModel->initModel(session);
|
||||
|
||||
m_effectShowActorRelocationModel = new EffectShowActorRelocationModel(this, this);
|
||||
m_effectShowActorRelocationModel->initModel(m_dtc);
|
||||
|
||||
m_dtc->effectShowVehicleStatuss([this](const EffectShowManagement::EffectShowVehicleStatus &item) { onEffectShowVehicleStatusChanged(item, DataModification::eAdded);});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
QVariant EffectShowModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (role != Qt::DisplayRole || !indexIsValid(index))
|
||||
return QVariant();
|
||||
|
||||
const EffectShowManagement::EffectShow &effectShow = m_vecData.at(index.row());
|
||||
AreaEffectSimulation::AesItem aesItem;
|
||||
m_dtcAes->aesItemFromId(effectShow.idAreaEffectSimulation(), aesItem);
|
||||
|
||||
switch (index.column())
|
||||
{
|
||||
case Id:
|
||||
return effectShow.id();
|
||||
case Name_AES:
|
||||
return QString::fromStdString(effectShow.nameAreaEffectSimulation());
|
||||
case Duration:
|
||||
return LtsWidgets::readableDuration(effectShow.duration());;
|
||||
case StartTime:
|
||||
return effectShow.startTime().is_set() ? DTG::toStringMSec(effectShow.startTime().get()) : QStringLiteral("---");
|
||||
case Position:
|
||||
{
|
||||
const Core::GeoPosition2D &pos = effectShow.position();
|
||||
return LtsCoordTrans::mgrsFromGeographic(pos.lon(), pos.lat());
|
||||
}
|
||||
case EffectShowActor:
|
||||
{
|
||||
int id = effectShow.esmParticipantId();
|
||||
return (id > 0) ? getParticipantName(id) : QStringLiteral("---");
|
||||
}
|
||||
case Volley:
|
||||
{
|
||||
if (effectShow.typeOfAmmunition() == 5) //smoke
|
||||
return QStringLiteral("--");
|
||||
else
|
||||
return effectShow.numOfVolley();
|
||||
}
|
||||
case ShotsInTotal:
|
||||
{
|
||||
if (effectShow.typeOfAmmunition() == 5) //smoke
|
||||
return QStringLiteral("--");
|
||||
else
|
||||
return effectShow.shotsPerVolley();
|
||||
}
|
||||
case Size:
|
||||
return tr("%1 x %2").arg(QString::number(effectShow.areaWidth()), QString::number(effectShow.areaDepth()));
|
||||
case Rotation:
|
||||
return effectShow.areaRotation();
|
||||
case Status:
|
||||
return EffectShowManagement::toString(effectShow.orderConfirmation());
|
||||
case Answer:
|
||||
return QString::fromStdString(effectShow.answerText());
|
||||
case AesStatus:
|
||||
return AreaEffectSimulation::toString(aesItem.effectStateId());
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
QMap<int, QString> EffectShowModel::getParticipantList() const
|
||||
{
|
||||
QMap<int, QString> ret;
|
||||
int numRow = m_effectShowActorProxyModel->rowCount(QModelIndex());
|
||||
|
||||
for (int i = 0; i < numRow; ++i)
|
||||
{
|
||||
const ParticipantManagement::Participant part = m_effectShowActorModel->getRowData(m_effectShowActorProxyModel->mapToSource(m_effectShowActorProxyModel->index(i, 0)).row());
|
||||
if (hasVehicleReportedOperationalToday(part.equipmentNumber().get()))
|
||||
ret.insert(part.id(), getParticipantName(part.id()));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
QMap<int, QString> EffectShowModel::getParticipantList(bool is_smoke) const
|
||||
{
|
||||
QMap<int, QString> ret;
|
||||
int numRow = m_effectShowActorProxyModel->rowCount(QModelIndex());
|
||||
|
||||
for (int i = 0; i < numRow; ++i)
|
||||
{
|
||||
int realRow = m_effectShowActorProxyModel->mapToSource(m_effectShowActorProxyModel->index(i, 0)).row();
|
||||
const ParticipantManagement::Participant part = m_effectShowActorModel->getRowData(realRow);
|
||||
|
||||
if (!hasVehicleReportedOperationalToday(part.equipmentNumber().get()))
|
||||
continue;
|
||||
|
||||
EffectShowManagement::Feature_e feature = m_effectShowActorModel->getFeature(realRow);
|
||||
if (feature != EffectShowManagement::Feature_e_def::NotSpecified &&
|
||||
(
|
||||
(feature == EffectShowManagement::Feature_e_def::Smoke && is_smoke) ||
|
||||
(feature != EffectShowManagement::Feature_e_def::Smoke && !is_smoke)
|
||||
)
|
||||
)
|
||||
ret.insert(part.id(), getParticipantName(part.id()));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
QVector<QPair<int, QString>> EffectShowModel::getParticipantListByDistance(bool is_smoke, const Core::GeoPosition2D &origin)
|
||||
{
|
||||
QVector<QPair<int, QString>> ret;
|
||||
|
||||
//first get the list of all pariticpants and it's name
|
||||
QMap<int, QString> participantList = getParticipantList(is_smoke);
|
||||
//reserve
|
||||
ret.reserve(participantList.size());
|
||||
|
||||
QMap<double, int> distanceMapSorted;
|
||||
for (const auto partId : participantList.keys())
|
||||
{
|
||||
|
||||
int eqNr = m_dtcPpm->equipmentNumberByParticipantId(partId);
|
||||
if (eqNr <= 0)
|
||||
continue;
|
||||
EffectShowManagement::EffectShowVehicleStatus vehicleStatus;
|
||||
bool isVehicleStatus = getVehicleStatus(eqNr, vehicleStatus);
|
||||
if (!isVehicleStatus)
|
||||
continue;
|
||||
const ParticipantManagement::ParticipantPosition &pos = m_dtcPpm->participantPosition(partId);
|
||||
|
||||
//Get Distance to Effect Show (center?)
|
||||
LtsCoordTrans::UtmCoordinate pPos = LtsCoordTrans::UtmCoordinate::fromGeographic(pos.pos().lon(), pos.pos().lat());
|
||||
LtsCoordTrans::UtmCoordinate pOrigin = LtsCoordTrans::UtmCoordinate::fromGeographic(origin.lon(), origin.lat());
|
||||
|
||||
double distance = LtsCoordTrans::distance(pPos, pOrigin);
|
||||
// Save distance and particiapnt Id into temporar map.
|
||||
// the map is sorted so we can use that later instead of writing a sort method vor a vec
|
||||
// for now
|
||||
distanceMapSorted.insert(distance, partId);
|
||||
|
||||
//get already assigned effect shows
|
||||
QString currentAssigendEffectShows;
|
||||
for (const auto &dat : m_vecData)
|
||||
{
|
||||
if (dat.esmParticipantId() == partId)
|
||||
{
|
||||
if (!currentAssigendEffectShows.isEmpty())
|
||||
currentAssigendEffectShows.append(QStringLiteral(", "));
|
||||
currentAssigendEffectShows.append(QString::fromStdString(dat.nameAreaEffectSimulation()));
|
||||
}
|
||||
}
|
||||
|
||||
//Now we create the new Info String
|
||||
// they want
|
||||
// the Name
|
||||
// Available pyrotechnics/smoke pots (and current load?)
|
||||
// Distance to Target Area
|
||||
// already
|
||||
QString newString = participantList.value(partId);
|
||||
newString.append(QStringLiteral(" "));
|
||||
newString.append(tr("Mag: %1 | Avail: %2").arg(vehicleStatus.ammunitionMagazine()).arg(vehicleStatus.ammunitionAvailable()));
|
||||
newString.append(tr(" | Dist: %1[m]").arg(QString::number(int(distance))));
|
||||
if (!currentAssigendEffectShows.isEmpty())
|
||||
newString.append(tr(" | Assigned: %1").arg(currentAssigendEffectShows));
|
||||
// Update the String from the original list
|
||||
participantList.insert(partId, newString);
|
||||
}
|
||||
|
||||
QMapIterator<double, int> it(distanceMapSorted);
|
||||
while(it.hasNext())
|
||||
{
|
||||
it.next();
|
||||
ret.append(QPair<int, QString>(it.value(), participantList.value(it.value())));
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
QString EffectShowModel::getParticipantName(int id) const
|
||||
{
|
||||
auto it = m_effectShowActorModel->getIt(id);
|
||||
if (it == m_effectShowActorModel->getItEnd()) return QString();
|
||||
QString eqNumber = QStringLiteral("-");
|
||||
if (it->equipmentNumber().is_set())
|
||||
eqNumber = QString::number(it->equipmentNumber().get());
|
||||
return QStringLiteral("%1 - %2 (%3)").arg(QString::fromStdString(it->designator())).arg(QString::fromStdString(it->tacticalIdentifier())).arg(eqNumber);
|
||||
}
|
||||
|
||||
QString EffectShowModel::getParticipantAmmunition(int id) const
|
||||
{
|
||||
auto it = m_effectShowActorModel->getIt(id);
|
||||
if (it == m_effectShowActorModel->getItEnd()) return QString();
|
||||
|
||||
EffectShowManagement::EffectShowVehicleStatus vehicleStatus;
|
||||
if (!getVehicleStatus(it->equipmentNumber().get(), vehicleStatus)) return QString();
|
||||
|
||||
QString res = QString::number(vehicleStatus.ammunitionMagazine());
|
||||
res.append(QLatin1String(" / "));
|
||||
res.append(QString::number(vehicleStatus.ammunitionAvailable()));
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
bool EffectShowModel::isVehicleStatus(int equipmentNum) const
|
||||
{
|
||||
auto it = m_effectShowVehicleStatus.find(equipmentNum);
|
||||
return (it != m_effectShowVehicleStatus.end());
|
||||
}
|
||||
|
||||
bool EffectShowModel::getVehicleStatus(int equipmentNum, EffectShowManagement::EffectShowVehicleStatus &vehicleStatus) const
|
||||
{
|
||||
auto it = m_effectShowVehicleStatus.find(equipmentNum);
|
||||
if (it == m_effectShowVehicleStatus.end())
|
||||
return false;
|
||||
|
||||
vehicleStatus = it.value();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EffectShowModel::hasVehicleReportedOperationalToday(int equipmentNum) const
|
||||
{
|
||||
EffectShowVehicleStatus vehicleStatus;
|
||||
getVehicleStatus(equipmentNum, vehicleStatus);
|
||||
|
||||
// vehicle is operational ...................................................................................................
|
||||
if (vehicleStatus.operational())
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Effect show actor " << vehicleStatus.nameEffectShowActor() << " with participantId "
|
||||
<< vehicleStatus.esmParticipantId() << " is operational.";
|
||||
return true;
|
||||
} // if
|
||||
|
||||
// vehicle has never reported as operational ................................................................................
|
||||
if (!m_effectShowVehicleLastTimeOperational.contains(equipmentNum))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Effect show actor " << vehicleStatus.nameEffectShowActor() << " with participantId "
|
||||
<< vehicleStatus.esmParticipantId() << " has not reported operational at any time.";
|
||||
return false;
|
||||
} // if
|
||||
|
||||
// check last time vehicle reported as operational ..........................................................................
|
||||
bool bRet = QDateTime().addMSecs(m_effectShowVehicleLastTimeOperational[equipmentNum]).date() == QDate::currentDate();
|
||||
if (bRet)
|
||||
DEBUG_LOG(m_logger) << "Effect show actor " << vehicleStatus.nameEffectShowActor() << " with participantId "
|
||||
<< vehicleStatus.esmParticipantId() << " is not operational, but has reported operational today.";
|
||||
else
|
||||
DEBUG_LOG(m_logger) << "Effect show actor " << vehicleStatus.nameEffectShowActor() << " with participantId "
|
||||
<< vehicleStatus.esmParticipantId() << " is not operational and has not reported operational today.";
|
||||
return bRet;
|
||||
}
|
||||
|
||||
QString EffectShowModel::getTimeAndPositionOfNextEffectShow(int idParticipant) const
|
||||
{
|
||||
auto it = m_vecData.begin();
|
||||
if (it == m_vecData.end())
|
||||
return QString();
|
||||
|
||||
qint64 effectStart = 0;
|
||||
int numOrder = 0;
|
||||
Core::GeoPosition2D position;
|
||||
while (it != m_vecData.end())
|
||||
{
|
||||
if (it->orderConfirmation() != OrderConfirmation_e::OrderCarriedOut &&
|
||||
it->esmParticipantId() == idParticipant)
|
||||
{
|
||||
++numOrder;
|
||||
qint64 start = it->startTime().is_set() ? it->startTime().get() : 0;
|
||||
|
||||
if (effectStart == 0)
|
||||
{
|
||||
effectStart = start;
|
||||
position = it->position();
|
||||
}
|
||||
else if (start < effectStart)
|
||||
{
|
||||
effectStart = start;
|
||||
position = it->position();
|
||||
}
|
||||
}
|
||||
++it;
|
||||
}
|
||||
if ((numOrder == 0) || ((numOrder > 1) && (effectStart == 0)))
|
||||
return QString(); // no order, or all order without start time
|
||||
|
||||
QString res;
|
||||
res = (effectStart != 0) ? DTG::toStringMSec(effectStart) : tr("---");
|
||||
|
||||
res += QLatin1String(", ");
|
||||
res += LtsCoordTrans::mgrsFromGeographic(position.lon(), position.lat());
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
QString EffectShowModel::getTimeAndPositionOfNextActorRelocation(int idParticipant) const
|
||||
{
|
||||
auto it = m_effectShowActorRelocationModel->getItBegin();
|
||||
if (it == m_effectShowActorRelocationModel->getItEnd())
|
||||
return QString();
|
||||
|
||||
qint64 arrivalTime = std::numeric_limits<qint64>::max();
|
||||
Core::GeoPosition2D position;
|
||||
bool found = false;
|
||||
|
||||
while (it != m_effectShowActorRelocationModel->getItEnd())
|
||||
{
|
||||
if (it->orderConfirmation() != OrderConfirmation_e::OrderCarriedOut &&
|
||||
it->orderConfirmation() != OrderConfirmation_e::PositionReached &&
|
||||
it->orderConfirmation() != OrderConfirmation_e::Abort &&
|
||||
it->orderConfirmation() != OrderConfirmation_e::Nonacceptance &&
|
||||
it->esmParticipantId() == idParticipant)
|
||||
{
|
||||
if (it->arrival_time().get() < arrivalTime)
|
||||
{
|
||||
arrivalTime = it->arrival_time().get();
|
||||
position = it->position();
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
++it;
|
||||
}
|
||||
|
||||
if (!found)
|
||||
return QString();
|
||||
|
||||
QString res;
|
||||
res = (arrivalTime != 0) ? DTG::toStringMSec(arrivalTime) : tr("---");
|
||||
|
||||
res += QLatin1String(", ");
|
||||
res += LtsCoordTrans::mgrsFromGeographic(position.lon(), position.lat());
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
void EffectShowModel::updateAll()
|
||||
{
|
||||
this->update();
|
||||
m_effectShowActorModel->update();
|
||||
m_effectShowActorRelocationModel->update();
|
||||
}
|
||||
|
||||
bool EffectShowModel::onEffectShowVehicleStatusChanged(const EffectShowManagement::EffectShowVehicleStatus &data, DataModification modType)
|
||||
{
|
||||
int equipmentNumber = m_dtcPpm->equipmentNumberByParticipantId(data.esmParticipantId());
|
||||
|
||||
switch (modType)
|
||||
{
|
||||
case DataModification::eAdded:
|
||||
case DataModification::eModified:
|
||||
if (m_effectShowVehicleStatus.contains(equipmentNumber))
|
||||
{
|
||||
if (m_effectShowVehicleStatus[equipmentNumber].operational() && !data.operational())
|
||||
m_effectShowVehicleLastTimeOperational[equipmentNumber] = data.sampleTime();
|
||||
} // if
|
||||
else
|
||||
m_effectShowVehicleLastTimeOperational[equipmentNumber] = 0;
|
||||
m_effectShowVehicleStatus[equipmentNumber] = data;
|
||||
break;
|
||||
|
||||
case DataModification::eRemoved:
|
||||
m_effectShowVehicleStatus.remove(equipmentNumber);
|
||||
m_effectShowVehicleLastTimeOperational.remove(equipmentNumber);
|
||||
break;
|
||||
}
|
||||
|
||||
updateAll();
|
||||
emit effectShowVehicleStatusChanged(data, modType);
|
||||
return true;
|
||||
}
|
||||
|
||||
void EffectShowProxyModel::setSourceModel(QAbstractItemModel *sourceModel)
|
||||
{
|
||||
m_sourceModel = qobject_cast<EffectShowModel *>(sourceModel);
|
||||
LtsWidgets::LtsColumnFilterProxyModel::setSourceModel(sourceModel);
|
||||
}
|
||||
|
||||
void EffectShowProxyModel::setShowExpired(bool show)
|
||||
{
|
||||
if (m_showExpired == show)
|
||||
return;
|
||||
|
||||
m_showExpired = show;
|
||||
invalidateFilter();
|
||||
}
|
||||
|
||||
bool EffectShowProxyModel::lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const
|
||||
{
|
||||
if (!m_sourceModel ||
|
||||
source_left.column() != source_right.column() ||
|
||||
!source_left.isValid() ||
|
||||
!source_right.isValid())
|
||||
return LtsWidgets::LtsColumnFilterProxyModel::lessThan(source_left, source_right);
|
||||
const auto &dataLeft = m_sourceModel->m_vecData.at(source_left.row());
|
||||
const auto dataRight = m_sourceModel->m_vecData.at(source_right.row());
|
||||
switch (source_left.column())
|
||||
{
|
||||
case EffectShowModel::StartTime:
|
||||
if (dataLeft.startTime().is_set() && dataRight.startTime().is_set())
|
||||
return dataLeft.startTime().get() < dataRight.startTime().get();
|
||||
if (dataRight.startTime().is_set())
|
||||
return true;
|
||||
if (dataLeft.startTime().is_set())
|
||||
return false;
|
||||
return dataLeft.id() < dataRight.id();
|
||||
|
||||
case EffectShowModel::Name_AES:
|
||||
case EffectShowModel::Id:
|
||||
case EffectShowModel::Duration:
|
||||
case EffectShowModel::Position:
|
||||
case EffectShowModel::EffectShowActor:
|
||||
case EffectShowModel::Volley:
|
||||
case EffectShowModel::ShotsInTotal:
|
||||
case EffectShowModel::Status:
|
||||
case EffectShowModel::Answer:
|
||||
break;
|
||||
}
|
||||
return LtsWidgets::LtsColumnFilterProxyModel::lessThan(source_left, source_right);
|
||||
}
|
||||
|
||||
bool EffectShowProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
|
||||
{
|
||||
bool bRet = checkFilter(source_row);
|
||||
if (!bRet)
|
||||
return false;
|
||||
return LtsWidgets::LtsColumnFilterProxyModel::filterAcceptsRow(source_row, source_parent);
|
||||
}
|
||||
|
||||
bool EffectShowProxyModel::checkFilter(int source_row) const
|
||||
{
|
||||
|
||||
// If showExpired: Show all
|
||||
if (showExpired())
|
||||
return true;
|
||||
|
||||
const auto effectShowSource = m_sourceModel->getRowData(source_row);
|
||||
|
||||
// show when not expired
|
||||
if (effectShowSource.orderConfirmation() != EffectShowManagement::OrderConfirmation_e_def::OrderCarriedOut)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace EffectShowModel
|
||||
@@ -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
|
||||
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <PluginInterfaces/data_plugin_interface.h>
|
||||
#include <EffectShowManagement/esm_dtc.h>
|
||||
#include <EffectShowManagement/esm_ftc.h>
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
|
||||
namespace EffectShowManagement
|
||||
{
|
||||
/**
|
||||
* @brief The DataInterface class provides the Topics Clients only for the GUI Plugins
|
||||
*/
|
||||
class DataInterface : public DataPluginBase::Interface
|
||||
{
|
||||
public:
|
||||
using DataPluginBase::Interface::Interface;
|
||||
|
||||
virtual std::shared_ptr<EffectShowManagement::Interface::Dtc> getDtc() = 0;
|
||||
virtual std::shared_ptr<EffectShowManagement::Interface::Ftc> getFtc() = 0;
|
||||
};
|
||||
|
||||
} // namespace EffectShowManagement
|
||||
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for EffectShowManagement (Interface for access from other Plugins)
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Christian Ehrlicher, SLSE, 2016-02-29
|
||||
*/
|
||||
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
#include <AreaEffectSimulation/aes_dtc.h>
|
||||
|
||||
#pragma once
|
||||
|
||||
class QColor;
|
||||
class QComboBox;
|
||||
class QPixmap;
|
||||
class QWidget;
|
||||
namespace Core {
|
||||
class GeoPosition;
|
||||
}
|
||||
|
||||
namespace EffectShowManagement
|
||||
{
|
||||
|
||||
class ForeignGuiComboboxInterface
|
||||
{
|
||||
|
||||
public:
|
||||
ForeignGuiComboboxInterface() = default;
|
||||
virtual ~ForeignGuiComboboxInterface() = default;
|
||||
|
||||
virtual bool fillActorComboBox(QComboBox *cbx, const Core::GeoPosition &targetLocation, const bool isFog, const int featureFilter) = 0; // use in retranslate() method only
|
||||
};
|
||||
|
||||
} // namespace EffectShowManagement
|
||||
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for MeteoDataManagement (Interface for access from other Plugins)
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-10-05
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace EffectShowManagement
|
||||
{
|
||||
|
||||
class ForeignGuiInterface
|
||||
{
|
||||
public:
|
||||
ForeignGuiInterface() = default;
|
||||
virtual ~ForeignGuiInterface() = default;
|
||||
};
|
||||
|
||||
} //namespace EffectShowManagement
|
||||
Reference in new issue
Block a user