Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
@@ -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
|
||||
Reference in new issue
Block a user