Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
@@ -0,0 +1,41 @@
|
||||
#
|
||||
# $Id$
|
||||
# $HeadURL$
|
||||
# $Author$
|
||||
# Created by Philipp Dassow, SLEA, 2017-09-06
|
||||
#
|
||||
|
||||
SET(smo_hgr_and_mine_search_gui_SRCS
|
||||
smo_hgr_and_mine_search_gui_plugin.cpp
|
||||
smo_hgr_and_mine_search_gui_plugin.h
|
||||
smo_hgr_and_mine_search_dialog.cpp
|
||||
smo_hgr_and_mine_search_dialog.h
|
||||
smo_hgr_and_mine_search_model.cpp
|
||||
smo_hgr_and_mine_search_model.h
|
||||
)
|
||||
|
||||
NGL_WRAP_UI(smo_hgr_and_mine_search_gui_SRCS
|
||||
smo_hgr_and_mine_search_dialog.ui
|
||||
)
|
||||
|
||||
NGL_ADD_LIBRARY(WS SmoHgrAndMineSearchGuiPlugin MODULE ${smo_hgr_and_mine_search_gui_SRCS})
|
||||
NGL_TARGET_LINK_LIBRARIES(SmoHgrAndMineSearchGuiPlugin
|
||||
ExmDataPluginInterface
|
||||
GuiPluginInterface
|
||||
LtsCoordTrans
|
||||
LtsDataView
|
||||
LtsPrinting
|
||||
LtsSession
|
||||
LtsUtilsSettings
|
||||
ngltools
|
||||
PpmDataPluginInterface
|
||||
PpmGuiComboboxPluginInterface
|
||||
SmoCommon
|
||||
SmoHgrAndMineSearchGuiPluginInterface
|
||||
svcSmoDummy
|
||||
TlnDataPluginInterface
|
||||
AesDataPluginInterface
|
||||
SituationMapGuiPluginInterface
|
||||
)
|
||||
|
||||
NGL_INSTALL_TARGET(SmoHgrAndMineSearchGuiPlugin)
|
||||
+128
@@ -0,0 +1,128 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Handgrande and mine search dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Philipp Dassow, SLEA, 2017-09-06
|
||||
*/
|
||||
|
||||
#include "smo_hgr_and_mine_search_dialog.h"
|
||||
#include "ui_smo_hgr_and_mine_search_dialog.h"
|
||||
|
||||
#include "smo_hgr_and_mine_search_model.h"
|
||||
|
||||
#include <PluginInterfaces/gui_plugin_interface.h>
|
||||
#include <Plugins/SituationMapPlugin/situation_map_gui_plugin_interface.h>
|
||||
#include <Plugins/Timeline/tln_data_plugin_interface.h>
|
||||
#include <Plugins/ParticipantManagement/Data/ppm_data_plugin.h>
|
||||
#include <Common/logger.h>
|
||||
|
||||
#include <LtsPrinting/printing.h>
|
||||
#include <QTreeView>
|
||||
#include <QHeaderView>
|
||||
|
||||
namespace ServiceMonitor
|
||||
{
|
||||
|
||||
HgrAndMineSearchDialog::HgrAndMineSearchDialog(QWidget *parent)
|
||||
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::CloseOnly)
|
||||
, m_session(nullptr)
|
||||
, m_ui(new Ui::HgrAndMineSearchDialog)
|
||||
, m_logger(getLogger("HgrAndMineSearchDialog"))
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Print, this, &HgrAndMineSearchDialog::onPrint);
|
||||
m_buttonBox->getButton(LtsWidgets::DialogButton::Save)->setText(tr("Center on Map"));
|
||||
m_buttonBox->getButton(LtsWidgets::DialogButton::Save)->setIcon(QIcon(QStringLiteral("icon:center_to_object.svg")));
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Save, this, &HgrAndMineSearchDialog::onCenterItem);
|
||||
m_buttonBox->getButton(LtsWidgets::DialogButton::Save)->setDisabled(true);
|
||||
|
||||
setOnlineHelpFilename(QStringLiteral("Situation-Handgrenades_and_Mine_search"));
|
||||
}
|
||||
|
||||
HgrAndMineSearchDialog::~HgrAndMineSearchDialog()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
bool HgrAndMineSearchDialog::init(LtsSession::LtsSession *session,
|
||||
const std::shared_ptr<ParticipantManagement::Interface::Dtc> &ppmDtc,
|
||||
const std::shared_ptr<ParticipantManagement::Interface::Ftc> &ppmFtc,
|
||||
const std::shared_ptr<TimeLineManagement::ForeignDataInterface> &eemForeign,
|
||||
const std::shared_ptr<ExerciseManagement::Interface::Dtc> &exmDtc,
|
||||
const std::shared_ptr<ProjectDataManagement::Interface::Dtc> &pdmDtc,
|
||||
const std::shared_ptr<ParticipantManagement::ForeignGuiComboboxInterface> &ppmCbxIfc,
|
||||
const std::shared_ptr<AreaEffectSimulation::Interface::Dtc> &aesDtc)
|
||||
{
|
||||
m_session = session;
|
||||
|
||||
if (m_model)
|
||||
delete m_model;
|
||||
|
||||
m_model = new HgrAndMineSearchModel(this);
|
||||
connect(m_model, &HgrAndMineSearchModel::chunksUpdated,
|
||||
this, &HgrAndMineSearchDialog::onChunksUpdated);
|
||||
m_model->initModel(m_session, ppmDtc, ppmFtc, eemForeign, exmDtc, pdmDtc, ppmCbxIfc, aesDtc);
|
||||
|
||||
auto proxy = new HgrAndMineSearchProxyModel(this);
|
||||
proxy->setSourceModel(m_model);
|
||||
m_ui->dvList->setModel(proxy);
|
||||
|
||||
// TODO: does not work properly
|
||||
//m_ui->dvList->resizeColumnsToContent();
|
||||
|
||||
connect(m_ui->dvList, &LtsDataView::LtsDataView::signalSelectionChanged,
|
||||
this, &HgrAndMineSearchDialog::onSelectionChanged);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void HgrAndMineSearchDialog::onChunksUpdated(int chunksReceived, int chunksRequested)
|
||||
{
|
||||
m_ui->pbLoading->setValue(chunksReceived);
|
||||
m_ui->pbLoading->setMaximum(chunksRequested);
|
||||
m_ui->pbLoading->setVisible(chunksReceived != chunksRequested);
|
||||
m_ui->lblLoading->setVisible(chunksReceived != chunksRequested);
|
||||
}
|
||||
|
||||
void HgrAndMineSearchDialog::onPrint()
|
||||
{
|
||||
LtsPrinting::printView(m_session, this, m_ui->dvList->treeView() );
|
||||
}
|
||||
|
||||
void HgrAndMineSearchDialog::onCenterItem()
|
||||
{
|
||||
QPointF position = m_model->position(m_ui->dvList->currentIndex());
|
||||
|
||||
std::shared_ptr<SituationMap::ForeignGuiInterface> ifc;
|
||||
|
||||
if (m_session->getForeignGuiInterface<SituationMap::ForeignGuiInterface>(ifc))
|
||||
ifc->setCenterPoint(position);
|
||||
}
|
||||
|
||||
void HgrAndMineSearchDialog::onSelectionChanged()
|
||||
{
|
||||
if (!m_model)
|
||||
{
|
||||
m_buttonBox->getButton(LtsWidgets::DialogButton::Save)->setDisabled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
QPointF position = m_model->position(m_ui->dvList->currentIndex());
|
||||
|
||||
m_buttonBox->getButton(LtsWidgets::DialogButton::Save)->setDisabled(position == QPointF());
|
||||
}
|
||||
|
||||
void HgrAndMineSearchDialog::retranslate()
|
||||
{
|
||||
translate(m_ui, tr("Handgrenade and Mine search"));
|
||||
}
|
||||
|
||||
void HgrAndMineSearchDialog::tableColumnOrganiserSetting()
|
||||
{
|
||||
//LtsColumnOrganiser
|
||||
m_ui->dvList->setColumnsOrganiserEnabled(identifier(), true);
|
||||
}
|
||||
|
||||
}
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Handgrande and mine search dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Philipp Dassow, SLEA, 2017-09-06
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <Plugins/ParticipantManagement/ppm_gui_combobox_plugin_interface.h>
|
||||
|
||||
namespace AreaEffectSimulation
|
||||
{
|
||||
namespace Interface
|
||||
{
|
||||
class Dtc;
|
||||
}
|
||||
}
|
||||
namespace ParticipantManagement
|
||||
{
|
||||
namespace Interface
|
||||
{
|
||||
class Ftc;
|
||||
class Dtc;
|
||||
}
|
||||
}
|
||||
namespace TimeLineManagement
|
||||
{
|
||||
class ForeignDataInterface;
|
||||
}
|
||||
namespace ExerciseManagement
|
||||
{
|
||||
namespace Interface
|
||||
{
|
||||
class Dtc;
|
||||
}
|
||||
}
|
||||
namespace ProjectDataManagement
|
||||
{
|
||||
namespace Interface
|
||||
{
|
||||
class Dtc;
|
||||
}
|
||||
}
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class HgrAndMineSearchDialog;
|
||||
}
|
||||
|
||||
namespace ServiceMonitor
|
||||
{
|
||||
class HgrAndMineSearchModel;
|
||||
|
||||
class HgrAndMineSearchDialog : public LtsWidgets::LtsDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit HgrAndMineSearchDialog(QWidget *parent = nullptr);
|
||||
~HgrAndMineSearchDialog();
|
||||
|
||||
bool init(LtsSession::LtsSession *session,
|
||||
const std::shared_ptr<ParticipantManagement::Interface::Dtc> &ppmDtc,
|
||||
const std::shared_ptr<ParticipantManagement::Interface::Ftc> &ppmFtc,
|
||||
const std::shared_ptr<TimeLineManagement::ForeignDataInterface> &eemForeign,
|
||||
const std::shared_ptr<ExerciseManagement::Interface::Dtc> &exmDtc,
|
||||
const std::shared_ptr<ProjectDataManagement::Interface::Dtc> &pdmDtc,
|
||||
const std::shared_ptr<ParticipantManagement::ForeignGuiComboboxInterface> &ppmCbxIfc,
|
||||
const std::shared_ptr<AreaEffectSimulation::Interface::Dtc> &aesDtc);
|
||||
|
||||
public slots:
|
||||
void onChunksUpdated(int chunksReceived, int chunksRequested);
|
||||
void onPrint();
|
||||
|
||||
private slots:
|
||||
void onCenterItem();
|
||||
void onSelectionChanged();
|
||||
|
||||
private:
|
||||
bool hasValidPosition();
|
||||
void retranslate() override;
|
||||
void tableColumnOrganiserSetting() override;
|
||||
|
||||
LtsSession::LtsSession *m_session;
|
||||
HgrAndMineSearchModel *m_model {nullptr};
|
||||
Ui::HgrAndMineSearchDialog *m_ui;
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>HgrAndMineSearchDialog</class>
|
||||
<widget class="QWidget" name="HgrAndMineSearchDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lblLoading">
|
||||
<property name="text">
|
||||
<string>Loading:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="LtsDataView::LtsDataView" name="dvList"/>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QProgressBar" name="pbLoading">
|
||||
<property name="value">
|
||||
<number>24</number>
|
||||
</property>
|
||||
<property name="format">
|
||||
<string notr="true">%p%</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>LtsDataView::LtsDataView</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>LtsDataView/lts_data_view.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
+102
@@ -0,0 +1,102 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Handgrande and mine search GUI plugin
|
||||
* $Id: smo_hgr_and_mine_search_plugin.cpp 48783 2019-11-06 14:23:43Z ojog_i $
|
||||
* $HeadURL: svn://slssvn/TDS/branches/product/devel/trunk/Lts/Plugins/ServiceMonitor/Gui/HgrAndMineSearch/smo_hgr_and_mine_search_plugin.cpp $
|
||||
* $Author: ojog_i $
|
||||
* Created by Philipp Dassow, SLEA, 2017-09-06
|
||||
*/
|
||||
|
||||
#include "smo_hgr_and_mine_search_gui_plugin.h"
|
||||
#include "smo_hgr_and_mine_search_dialog.h"
|
||||
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <LtsUtilsSettings/settings.h>
|
||||
#include <ServiceMonitor/smo_operator_rights.h>
|
||||
#include <Common/logger.h>
|
||||
|
||||
namespace ServiceMonitor
|
||||
{
|
||||
|
||||
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("AppStarter"))
|
||||
, m_ppmDtc(nullptr)
|
||||
, m_ppmFtc(nullptr)
|
||||
, m_eemForeign(nullptr)
|
||||
, m_exmDtc(nullptr)
|
||||
, m_pdmDtc(nullptr)
|
||||
, m_ppmCbxIfc(nullptr)
|
||||
{}
|
||||
|
||||
bool InterfaceImpl::fetchInterfaces()
|
||||
{
|
||||
//foreign
|
||||
if (!m_session->getDtc<ParticipantManagement::DataInterface>(m_ppmDtc))
|
||||
return false;
|
||||
if (!m_session->getFtc<ParticipantManagement::DataInterface>(m_ppmFtc))
|
||||
return false;
|
||||
if (!m_session->getForeignDataInterface<TimeLineManagement::DataInterface>(m_eemForeign))
|
||||
return false;
|
||||
if (!m_session->getDtc<ExerciseManagement::DataInterface>(m_exmDtc))
|
||||
return false;
|
||||
if (!m_session->getDtc<ProjectDataManagement::DataInterface>(m_pdmDtc))
|
||||
return false;
|
||||
if (!m_session->getForeignGuiInterface<ParticipantManagement::ForeignGuiComboboxInterface>(m_ppmCbxIfc))
|
||||
return false;
|
||||
if (!m_session->getDtc<AreaEffectSimulation::DataInterface>(m_aesDtc))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void InterfaceImpl::clearInterfaces()
|
||||
{
|
||||
m_ppmDtc = nullptr;
|
||||
m_ppmFtc = nullptr;
|
||||
m_eemForeign = nullptr;
|
||||
m_exmDtc = nullptr;
|
||||
m_pdmDtc = nullptr;
|
||||
m_ppmCbxIfc = nullptr;
|
||||
}
|
||||
|
||||
QVector<LtsWidgets::PluginData> InterfaceImpl::getActions()
|
||||
{
|
||||
QVector<LtsWidgets::PluginData> ret;
|
||||
|
||||
LtsUtils::ProjectSettings *ps = LtsUtils::ProjectSettings::getInstance();
|
||||
const bool enableHandgrenadeAndMineSearchShow = ps->value(QStringLiteral("smo"),
|
||||
QStringLiteral("enableHandgrenadeAndMineSearchShow")).toBool();
|
||||
|
||||
if (enableHandgrenadeAndMineSearchShow)
|
||||
{
|
||||
LtsWidgets::PluginData plData;
|
||||
plData.layoutArea = LtsWidgets::LayoutArea::eDialogTab;
|
||||
plData.menuGroup = menuGroup();
|
||||
plData.menuText = tr("Handgrenade and Mine search");
|
||||
plData.identifier = QLatin1String("smoHgrAndMineSearch");
|
||||
plData.menuIcon = QIcon(QLatin1String("icon:hand_grenade_locations.svg"));
|
||||
plData.operatorRight = OperatorRights::HandgrenadeMineSearchShow;
|
||||
plData.exercisePart = LtsWidgets::ExercisePart::eAfterAction;
|
||||
plData.createWidgetFunc = [this](QWidget * parent)
|
||||
{
|
||||
return onShowHgrAndMineSearch(parent);
|
||||
};
|
||||
ret.append(plData);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
LtsWidgets::LtsDialog *InterfaceImpl::onShowHgrAndMineSearch(QWidget *parent)
|
||||
{
|
||||
return LtsWidgets::initDialog(new HgrAndMineSearchDialog(parent),
|
||||
m_session, m_ppmDtc, m_ppmFtc, m_eemForeign, m_exmDtc, m_pdmDtc, m_ppmCbxIfc, m_aesDtc);
|
||||
}
|
||||
|
||||
}
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Handgrande and mine search GUI plugin
|
||||
* $Id: smo_hgr_and_mine_search_plugin.h 48783 2019-11-06 14:23:43Z ojog_i $
|
||||
* $HeadURL: svn://slssvn/TDS/branches/product/devel/trunk/Lts/Plugins/ServiceMonitor/Gui/HgrAndMineSearch/smo_hgr_and_mine_search_plugin.h $
|
||||
* $Author: ojog_i $
|
||||
* Created by Philipp Dassow, SLEA, 2017-09-06
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Plugins/ServiceMonitor/smo_hgr_and_mine_search_gui_plugin_interface.h>
|
||||
|
||||
#include <PluginInterfaces/gui_plugin_interface.h>
|
||||
#include <Common/ProjectConfig/project_defines.h>
|
||||
|
||||
#include <Plugins/ExerciseManagement/exm_data_plugin_interface.h>
|
||||
#include <Plugins/ParticipantManagement/ppm_data_plugin_interface.h>
|
||||
#include <Plugins/ParticipantManagement/ppm_gui_combobox_plugin_interface.h>
|
||||
#include <Plugins/ProjectDataManagement/Data/pdm_data_plugin.h>
|
||||
#include <Plugins/Timeline/tln_data_plugin_interface.h>
|
||||
#include <Plugins/AreaEffectSimulation/Data/aes_data_plugin.h>
|
||||
|
||||
namespace ServiceMonitor
|
||||
{
|
||||
|
||||
class GuiPlugin final : public QObject, public GuiPluginBase::Plugin
|
||||
{
|
||||
Q_PLUGIN_METADATA(IID "gui:3:smo.hgrminesearch")
|
||||
Q_INTERFACES(GuiPluginBase::Plugin)
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit GuiPlugin() = default;
|
||||
~GuiPlugin() = default;
|
||||
|
||||
QString pluginName() override { return QStringLiteral("ServiceMonitorHgrAndMineSearchGui"); }
|
||||
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;
|
||||
QVector<LtsWidgets::PluginData> getActions() override;
|
||||
QString menuGroup() const override { return tr("Service Monitors"); }
|
||||
|
||||
private:
|
||||
LtsWidgets::LtsDialog *onShowHgrAndMineSearch(QWidget *parent);
|
||||
|
||||
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_ppmDtc;
|
||||
std::shared_ptr<ParticipantManagement::Interface::Ftc> m_ppmFtc;
|
||||
std::shared_ptr<TimeLineManagement::ForeignDataInterface>m_eemForeign;
|
||||
std::shared_ptr<ExerciseManagement::Interface::Dtc> m_exmDtc;
|
||||
std::shared_ptr<ProjectDataManagement::Interface::Dtc> m_pdmDtc;
|
||||
std::shared_ptr<ParticipantManagement::ForeignGuiComboboxInterface> m_ppmCbxIfc;
|
||||
std::shared_ptr<AreaEffectSimulation::Interface::Dtc> m_aesDtc;
|
||||
};
|
||||
|
||||
} // namespace ServiceMonitor
|
||||
+516
@@ -0,0 +1,516 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Handgrande and mine search model
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Philipp Dassow, SLEA, 2017-09-06
|
||||
*/
|
||||
|
||||
#include "smo_hgr_and_mine_search_model.h"
|
||||
|
||||
#include <LtsCoordTrans/lts_coord_trans.h>
|
||||
#include <ngltools/ngltools_dtg.h>
|
||||
|
||||
#include <ProjectDataManagement/pdm_translation.h>
|
||||
#include <ParticipantManagement/ppm_translation.h>
|
||||
#include <ProjectDataManagement/pdm_to_string.h>
|
||||
#include <Common/logger.h>
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QJsonArray>
|
||||
#include <QJsonValue>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonDocument>
|
||||
|
||||
namespace ServiceMonitor
|
||||
{
|
||||
|
||||
//###############################################################################
|
||||
|
||||
HgrAndMineSearchModel::HgrAndMineSearchModel(QObject *parent)
|
||||
: LtsWidgets::LtsAbstractTableModel<HgrAndMineSearchEntry>({tr("Type"),
|
||||
tr("Position"),
|
||||
tr("Timestamp"),
|
||||
tr("Source Equipment Number"),
|
||||
tr("Party"),
|
||||
tr("Vulnerability")
|
||||
#ifdef LTS_DEBUG
|
||||
, tr("Properties")
|
||||
, tr("Participant Id")
|
||||
#endif
|
||||
}, parent)
|
||||
, m_ppmDtc(nullptr)
|
||||
, m_ppmFtc(nullptr)
|
||||
, m_eemForeign(nullptr)
|
||||
, m_pdmDtc(nullptr)
|
||||
, m_equipSysEvtFlt()
|
||||
, m_evtFlt()
|
||||
, m_chunksRequested(0)
|
||||
, m_chunksReceived(0)
|
||||
, m_session(nullptr)
|
||||
, m_logger(getLogger("HgrAndMineSearchModel"))
|
||||
{}
|
||||
|
||||
bool HgrAndMineSearchModel::initModel(LtsSession::LtsSession *session,
|
||||
const std::shared_ptr<ParticipantManagement::Interface::Dtc> &ppmDtc,
|
||||
const std::shared_ptr<ParticipantManagement::Interface::Ftc> &ppmFtc,
|
||||
const std::shared_ptr<TimeLineManagement::ForeignDataInterface> &eemForeign,
|
||||
const std::shared_ptr<ExerciseManagement::Interface::Dtc> &exmDtc,
|
||||
const std::shared_ptr<ProjectDataManagement::Interface::Dtc> &pdmDtc,
|
||||
const std::shared_ptr<ParticipantManagement::ForeignGuiComboboxInterface> &ppmCbxIfc,
|
||||
const std::shared_ptr<AreaEffectSimulation::Interface::Dtc> &aesDtc)
|
||||
{
|
||||
m_session = session;
|
||||
|
||||
m_ppmDtc = ppmDtc;
|
||||
m_ppmFtc = ppmFtc;
|
||||
m_eemForeign = eemForeign;
|
||||
m_exmDtc = exmDtc;
|
||||
m_pdmDtc = pdmDtc;
|
||||
m_ppmGuiCbxIfc = ppmCbxIfc;
|
||||
m_aesDtc = aesDtc;
|
||||
|
||||
if (!m_ppmDtc->enableEquipmentSystemEventFtcReply())
|
||||
{
|
||||
ERROR_LOG(m_logger) << " Could not enable EquipmentSystemEventFtcReply Data-Topic in PPM DTC!";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!m_ppmFtc->enableEquipmentSystemEventData())
|
||||
{
|
||||
ERROR_LOG(m_logger) << " Could not enable EquipmentSystemEventData Function-Topic in PPM FTC!";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!m_exmDtc->enableExercise())
|
||||
{
|
||||
ERROR_LOG(m_logger) << " Could not enable Exercise Data-Topic in EXM DTC!";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (!m_pdmDtc->enableEquipmentSystemEventFilter())
|
||||
{
|
||||
ERROR_LOG(m_logger) << " Could not enable EquipmentSystemEventFilter Data-Topic in PDM DTC!";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!m_pdmDtc->enableEventFilterHgrMineSearch())
|
||||
{
|
||||
ERROR_LOG(m_logger) << " Could not enable EventFilterHgrMineSearch Data-Topic in PDM DTC!";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!m_aesDtc->enableMineArea())
|
||||
{
|
||||
ERROR_LOG(m_logger) << " Could not enable MineArea Data-Topic in AES DTC!";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!m_aesDtc->enableDusMineState())
|
||||
{
|
||||
ERROR_LOG(m_logger) << " Could not enable DusMineState Data-Topic in AES DTC!";
|
||||
return false;
|
||||
}
|
||||
|
||||
m_pdmDtc->waitForHistoricalDataEquipmentSystemEventFilter();
|
||||
m_pdmDtc->waitForHistoricalDataEventFilterHgrMineSearch();
|
||||
|
||||
connect(m_eemForeign.get(), &TimeLineManagement::ForeignDataInterface::requestedDataAvailable,
|
||||
this, &HgrAndMineSearchModel::onRequestedDataAvailable);
|
||||
|
||||
// load filter setttings
|
||||
loadFilterSettings();
|
||||
|
||||
// do function request for model data
|
||||
doEquipmentSystemEventRequests();
|
||||
doEventRequests();
|
||||
|
||||
emit chunksUpdated(m_chunksReceived, m_chunksRequested);
|
||||
|
||||
connect(this, &HgrAndMineSearchModel::rowsInserted,
|
||||
this, &HgrAndMineSearchModel::onUpdateComboboxFilterData, Qt::UniqueConnection);
|
||||
connect(this, &HgrAndMineSearchModel::rowsRemoved,
|
||||
this, &HgrAndMineSearchModel::onUpdateComboboxFilterData, Qt::UniqueConnection);
|
||||
connect(this, &HgrAndMineSearchModel::modelReset,
|
||||
this, &HgrAndMineSearchModel::onUpdateComboboxFilterData, Qt::UniqueConnection);
|
||||
|
||||
onUpdateComboboxFilterData();
|
||||
|
||||
doInsertMines();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
QVariant HgrAndMineSearchModel::headerData(int section, Qt::Orientation orientation, int role) const
|
||||
{
|
||||
if (role == LtsWidgets::LtsColumnFilterProxyModel::ComboboxFilterRole &&
|
||||
orientation == Qt::Horizontal)
|
||||
{
|
||||
switch (section)
|
||||
{
|
||||
case EventType:
|
||||
return m_typeCbxFilterContent;
|
||||
case EventParty:
|
||||
return m_cbxFilterParty;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return LtsWidgets::LtsAbstractTableModel<HgrAndMineSearchEntry>::headerData(section, orientation, role);
|
||||
}
|
||||
|
||||
QVariant HgrAndMineSearchModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (!indexIsValid(index))
|
||||
return QVariant();
|
||||
|
||||
const HgrAndMineSearchEntry &entry = m_vecData.at(index.row());
|
||||
|
||||
if (role == Qt::DecorationRole)
|
||||
{
|
||||
switch (index.column())
|
||||
{
|
||||
case EventParty:
|
||||
return iconFromPartyId(entry.party);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
if (role == Qt::DisplayRole)
|
||||
{
|
||||
switch (index.column())
|
||||
{
|
||||
case EventType:
|
||||
return ProjectDataManagement::toString(entry.type);
|
||||
case EventPosition:
|
||||
if (entry.pos.lon() == 0 || entry.pos.lat() == 0 || std::isnan(entry.pos.lon()))
|
||||
return QStringLiteral("---");
|
||||
return LtsCoordTrans::mgrsFromGeographic(entry.pos.lon(), entry.pos.lat());
|
||||
case EventTime:
|
||||
return QDateTime::fromMSecsSinceEpoch(entry.timeStamp);
|
||||
case EventSource:
|
||||
return source(entry);
|
||||
case EventParty:
|
||||
return stringFromPartyId(entry.party);
|
||||
case EventParticipantId:
|
||||
return entry.participantId;
|
||||
case EventProperties:
|
||||
return entry.properties;
|
||||
case EventVBG:
|
||||
{
|
||||
QString vulnerabilityState = tr("All Types");
|
||||
if (entry.vbg>=0)
|
||||
{
|
||||
ParticipantManagement::TypeClass typeClass = m_ppmDtc->type(m_ppmDtc->participant(entry.participantId).typeId()).typeClass();
|
||||
const ProjectDataManagement::VulnerabilityClass vc = typeClass == ParticipantManagement::TypeClass::Human ?
|
||||
ProjectDataManagement::VulnerabilityClass_def::SoldierInjuries :
|
||||
ProjectDataManagement::VulnerabilityClass_def::VehicleDamages;
|
||||
ProjectDataManagement::VulnerabilityState vs = static_cast<ProjectDataManagement::VulnerabilityState_def::type>(entry.vbg);
|
||||
vulnerabilityState = ProjectDataManagement::toString(vs, vc);
|
||||
}
|
||||
return vulnerabilityState;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (role == LtsWidgets::LtsColumnFilterProxyModel::ComboboxFilterRole)
|
||||
{
|
||||
switch (index.column())
|
||||
{
|
||||
case EventType:
|
||||
return entry.type.underlying();
|
||||
case EventParty:
|
||||
return entry.party;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
QPointF HgrAndMineSearchModel::position(const QModelIndex &index) const
|
||||
{
|
||||
if (!indexIsValid(index))
|
||||
return QPointF();
|
||||
|
||||
const Core::GeoPosition pos = m_vecData.at(index.row()).pos;
|
||||
|
||||
if (pos.lon() == 0 || pos.lat() == 0 || std::isnan(pos.lon()))
|
||||
return QPointF();
|
||||
|
||||
return {pos.lon(), pos.lat()};
|
||||
}
|
||||
|
||||
void HgrAndMineSearchModel::onEquipmentSystemEventDataReply(const Core::FunctionReplyObject &replyObject)
|
||||
{
|
||||
m_chunksReceived++;
|
||||
|
||||
if (!replyObject.error())
|
||||
{
|
||||
auto cb = [this, &replyObject](const ParticipantManagement::EquipmentSystemEventFtcReply &event)
|
||||
{
|
||||
if (event.filterId() != replyObject.id())
|
||||
return;
|
||||
HgrAndMineSearchEntry entry;
|
||||
|
||||
entry.type = ProjectDataManagement::HgrMineSearchFilterType(ProjectDataManagement::HgrMineSearchFilterType_def::Handgrenade);
|
||||
entry.pos = event.position();
|
||||
entry.timeStamp = event.timeStamp();
|
||||
entry.source = event.equipmentNumber();
|
||||
entry.participantId = 0;
|
||||
entry.party = 0;
|
||||
entry.vbg = 0;
|
||||
entry.properties = QString();
|
||||
|
||||
insertRow(entry);
|
||||
};
|
||||
m_ppmDtc->equipmentSystemEventFtcReplys(cb);
|
||||
}
|
||||
|
||||
emit chunksUpdated(m_chunksReceived, m_chunksRequested);
|
||||
}
|
||||
|
||||
void HgrAndMineSearchModel::onRequestedDataAvailable(TimeLineManagement::TimelineDataProviderInterface *request)
|
||||
{
|
||||
auto it = m_requests.find(request);
|
||||
if (it == m_requests.end())
|
||||
return;
|
||||
m_requests.erase(it);
|
||||
|
||||
m_chunksReceived++;
|
||||
|
||||
const QVector<ExerciseEventManagement::Event> &events = request->eventData();
|
||||
HgrAndMineSearchEntry entry;
|
||||
for (const auto &event : events)
|
||||
{
|
||||
const QJsonObject obj = QJsonDocument::fromJson(QByteArray::fromRawData(event.properties().c_str(),
|
||||
event.properties().size())).object();
|
||||
entry.type = m_evtFlt.value(obj.value(QStringLiteral("OriginatorChargeTypeId")).toInt());
|
||||
|
||||
if (entry.type == ProjectDataManagement::HgrMineSearchFilterType::inner_enum::Mine)
|
||||
continue;
|
||||
|
||||
entry.pos = event.position();
|
||||
entry.timeStamp = event.sampleTime();
|
||||
entry.source = event.equipmentNumber();
|
||||
entry.participantId = event.participantId();
|
||||
entry.party = event.partyId();
|
||||
entry.vbg = obj.value(QStringLiteral("VulnerabilityState")).toInt();
|
||||
entry.properties = QString::fromUtf8(event.properties().c_str());
|
||||
|
||||
insertRow(entry);
|
||||
}
|
||||
|
||||
emit chunksUpdated(m_chunksReceived, m_chunksRequested);
|
||||
}
|
||||
|
||||
void HgrAndMineSearchModel::doEquipmentSystemEventRequests()
|
||||
{
|
||||
ExerciseManagement::Exercise ex = m_exmDtc->exercise(m_session->exerciseId());
|
||||
int64_t start = ex.beginTime();
|
||||
int64_t end = m_session->partitionTime() < ex.endTime() ? m_session->partitionTime() : ex.endTime(); // already at end of exercise?
|
||||
|
||||
while (start < end)
|
||||
{
|
||||
ParticipantManagement::EquipmentSystemEventDataRequest req;
|
||||
int64_t reqEnd = ((start + 24 * 60 * 60 * 1000) > end ? end : start + 24 * 60 * 60 * 1000);
|
||||
|
||||
req.startTime(start);
|
||||
req.endTime(reqEnd);
|
||||
|
||||
for (const auto &filter : qAsConst(m_equipSysEvtFlt))
|
||||
{
|
||||
req.equipmentFunctionId(filter.equipmentFunctionId());
|
||||
req.subDeviceId(filter.subDeviceId());
|
||||
req.deviceSpecificEventCode(filter.deviceSpecificCode());
|
||||
|
||||
m_ppmFtc->equipmentSystemEventDataRequest(req, this);
|
||||
|
||||
m_chunksRequested++;
|
||||
}
|
||||
|
||||
// set new start
|
||||
start += (24 * 60 * 60 * 1000) + 1;
|
||||
}
|
||||
}
|
||||
|
||||
void HgrAndMineSearchModel::doEventRequests()
|
||||
{
|
||||
ExerciseManagement::Exercise ex = m_exmDtc->exercise(m_session->partitionId());
|
||||
int64_t startTime = ex.beginTime();
|
||||
const int64_t endTime = ex.stopTime() > 0 ? ex.stopTime() : m_session->partitionTime();
|
||||
while (startTime < endTime)
|
||||
{
|
||||
int64_t reqEnd = ((startTime + 24 * 60 * 60 * 1000) > endTime ? endTime : startTime + 24 * 60 * 60 * 1000);
|
||||
QJsonArray arr;
|
||||
for (auto it = m_evtFlt.cbegin(), end = m_evtFlt.cend(); it != end; ++it)
|
||||
arr += QJsonValue(it.key());
|
||||
const QJsonObject filter({{QStringLiteral("OriginatorChargeTypeId"), arr}});
|
||||
|
||||
m_requests += m_eemForeign->requestData(startTime, reqEnd, {ProjectDataManagement::EventType_def::Hit,
|
||||
ProjectDataManagement::EventType_def::HitEffectSimulation,
|
||||
ProjectDataManagement::EventType_def::HitMine}, filter);
|
||||
|
||||
// set new start
|
||||
startTime += (24 * 60 * 60 * 1000) + 1;
|
||||
}
|
||||
m_chunksRequested += m_requests.size();
|
||||
}
|
||||
|
||||
void HgrAndMineSearchModel::doInsertMines()
|
||||
{
|
||||
QMap<qint32, AreaEffectSimulation::MineArea> mineAreas;
|
||||
const QMap<qint32, AreaEffectSimulation::DusMineState> dusMineStates = m_aesDtc->dusMineStates();
|
||||
HgrAndMineSearchEntry entry;
|
||||
QJsonObject properties;
|
||||
|
||||
entry.type = ProjectDataManagement::HgrMineSearchFilterType::inner_enum::Mine;
|
||||
entry.timeStamp = QDateTime::currentMSecsSinceEpoch();
|
||||
|
||||
for (auto it = dusMineStates.constBegin(); it != dusMineStates.constEnd(); ++it)
|
||||
{
|
||||
if (!mineAreas.contains(it.key()))
|
||||
mineAreas.insert(it.key(), m_aesDtc->mineArea(it.key()));
|
||||
|
||||
const std::vector<AreaEffectSimulation::DusMine> mines = it.value().mines();
|
||||
entry.party = mineAreas.value(it.key()).partyId().is_set() ? mineAreas.value(it.key()).partyId().get() : 0;
|
||||
|
||||
for (const AreaEffectSimulation::DusMine ¤tMine : mines)
|
||||
{
|
||||
properties.insert(tr("Mine-ID"), currentMine.eqId());
|
||||
|
||||
entry.properties = QString::fromUtf8(QJsonDocument(properties).toJson(QJsonDocument::Compact));
|
||||
entry.pos.lon(currentMine.position().lon());
|
||||
entry.pos.lat(currentMine.position().lat());
|
||||
|
||||
insertRow(entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void HgrAndMineSearchModel::loadFilterSettings()
|
||||
{
|
||||
// ppm filter
|
||||
m_equipSysEvtFlt = m_pdmDtc->equipmentSystemEventFilters();
|
||||
|
||||
// eem filter
|
||||
auto cb = [this](const ProjectDataManagement::EventFilterHgrMineSearch &filter)
|
||||
{
|
||||
m_evtFlt.insert(filter.chargeTypeId(), filter.hgrMineSearchFilterType());
|
||||
};
|
||||
m_pdmDtc->eventFilterHgrMineSearchs(cb);
|
||||
}
|
||||
|
||||
int HgrAndMineSearchModel::source(const HgrAndMineSearchEntry &entry) const
|
||||
{
|
||||
if (entry.source != -1)
|
||||
return entry.source;
|
||||
|
||||
QJsonDocument properties = QJsonDocument::fromJson(entry.properties.toUtf8());
|
||||
QJsonObject propertiesObj = properties.object();
|
||||
const QString KEY = QLatin1String("Mine-ID");
|
||||
|
||||
return propertiesObj.value(KEY).toInt(-1);
|
||||
}
|
||||
|
||||
//
|
||||
// HgrAndMineSearchProxyModel
|
||||
//
|
||||
void HgrAndMineSearchProxyModel::setSourceModel(QAbstractItemModel *sourceModel)
|
||||
{
|
||||
m_sourceModel = qobject_cast<HgrAndMineSearchModel*>(sourceModel);
|
||||
LtsWidgets::LtsColumnFilterProxyModel::setSourceModel(sourceModel);
|
||||
}
|
||||
|
||||
bool HgrAndMineSearchProxyModel::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 HgrAndMineSearchModel::EventType:
|
||||
case HgrAndMineSearchModel::EventPosition:
|
||||
break;
|
||||
case HgrAndMineSearchModel::EventTime:
|
||||
return dataLeft.timeStamp < dataRight.timeStamp;
|
||||
case HgrAndMineSearchModel::EventSource:
|
||||
return dataLeft.source < dataRight.source;
|
||||
case HgrAndMineSearchModel::EventParty:
|
||||
return dataLeft.party < dataRight.party;
|
||||
case HgrAndMineSearchModel::EventParticipantId:
|
||||
return dataLeft.participantId < dataRight.participantId;
|
||||
case HgrAndMineSearchModel::EventProperties:
|
||||
return dataLeft.properties < dataRight.properties;
|
||||
}
|
||||
return LtsWidgets::LtsColumnFilterProxyModel::lessThan(source_left, source_right);
|
||||
}
|
||||
|
||||
QIcon HgrAndMineSearchModel::iconFromPartyId(int partyId) const
|
||||
{
|
||||
if (!m_ppmGuiCbxIfc)
|
||||
return QIcon();
|
||||
auto it = m_partyIcons.find(partyId);
|
||||
if (it != m_partyIcons.end())
|
||||
return it.value();
|
||||
const QRgb col = QRgb(m_ppmDtc->party(partyId).color());
|
||||
const QIcon icon = m_ppmGuiCbxIfc->pixmapFromParty(col);
|
||||
m_partyIcons.insert(partyId, icon);
|
||||
return icon;
|
||||
}
|
||||
|
||||
QVariant HgrAndMineSearchModel::stringFromPartyId(int partyId) const
|
||||
{
|
||||
auto it = m_partyNames.find(partyId);
|
||||
if (it != m_partyNames.end())
|
||||
return it.value();
|
||||
const QString name = ParticipantManagement::trPartyName(m_ppmDtc->party(partyId).name());
|
||||
m_partyNames.insert(partyId, name);
|
||||
return name;
|
||||
}
|
||||
|
||||
void HgrAndMineSearchModel::onUpdateComboboxFilterData()
|
||||
{
|
||||
LtsWidgets::ComboboxFilterContent cfc;
|
||||
LtsWidgets::ComboboxFilterData cfd;
|
||||
const auto types = {ProjectDataManagement::HgrMineSearchFilterType::Handgrenade,
|
||||
ProjectDataManagement::HgrMineSearchFilterType::Mine,
|
||||
ProjectDataManagement::HgrMineSearchFilterType::Claymore,
|
||||
ProjectDataManagement::HgrMineSearchFilterType::Ied};
|
||||
cfc.data.reserve(types.size());
|
||||
for (const auto typeId : types)
|
||||
{
|
||||
cfd.data = typeId;
|
||||
cfd.text = ProjectDataManagement::toString(typeId);
|
||||
cfc.data.push_back(cfd);
|
||||
}
|
||||
cfc.sortItems = true;
|
||||
m_typeCbxFilterContent = cfc.toVariant();
|
||||
|
||||
QSet<int> availablePartyIds;
|
||||
for (const auto &data : qAsConst(m_vecData))
|
||||
availablePartyIds.insert(data.party);
|
||||
|
||||
cfc.data.clear();
|
||||
for (const int i : qAsConst(availablePartyIds))
|
||||
{
|
||||
cfd.data = i;
|
||||
cfd.text = ParticipantManagement::trPartyName(m_ppmDtc->party(i).name());
|
||||
cfd.icon = iconFromPartyId(i);
|
||||
cfc.data.push_back(cfd);
|
||||
}
|
||||
cfc.sortItems = false;
|
||||
m_cbxFilterParty = cfc.toVariant();
|
||||
}
|
||||
|
||||
}
|
||||
+133
@@ -0,0 +1,133 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Handgrande and mine search model
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Philipp Dassow, SLEA, 2017-09-06
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Plugins/ExerciseManagement/Data/exm_data_plugin.h>
|
||||
#include <Plugins/ParticipantManagement/Data/ppm_data_plugin.h>
|
||||
#include <Plugins/ProjectDataManagement/Data/pdm_data_plugin.h>
|
||||
#include <Plugins/Timeline/tln_data_plugin_interface.h>
|
||||
#include <Plugins/ParticipantManagement/ppm_gui_combobox_plugin_interface.h>
|
||||
#include <Plugins/AreaEffectSimulation/Data/aes_data_plugin.h>
|
||||
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <LtsWidgets/lts_abstract_table_model.h>
|
||||
#include <LtsWidgets/lts_column_filter_proxy_model.h>
|
||||
#include <QSet>
|
||||
|
||||
namespace ServiceMonitor
|
||||
{
|
||||
struct HgrAndMineSearchEntry
|
||||
{
|
||||
ProjectDataManagement::HgrMineSearchFilterType type = ProjectDataManagement::HgrMineSearchFilterType::Unknown;
|
||||
Core::GeoPosition pos;
|
||||
int64_t timeStamp = -1;
|
||||
int32_t source = -1;
|
||||
int32_t party = -1;
|
||||
int32_t participantId = -1;
|
||||
int32_t vbg = -1;
|
||||
QString properties;
|
||||
};
|
||||
|
||||
//###############################################################################
|
||||
|
||||
class HgrAndMineSearchModel final
|
||||
: public LtsWidgets::LtsAbstractTableModel<HgrAndMineSearchEntry>
|
||||
, protected ParticipantManagement::Interface::Ftc::EquipmentSystemEventDataReplyHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum Columns
|
||||
{
|
||||
EventType,
|
||||
EventPosition,
|
||||
EventTime,
|
||||
EventSource,
|
||||
EventParty,
|
||||
EventVBG,
|
||||
EventProperties,
|
||||
EventParticipantId
|
||||
};
|
||||
explicit HgrAndMineSearchModel(QObject *parent = nullptr);
|
||||
|
||||
bool initModel(LtsSession::LtsSession *session,
|
||||
const std::shared_ptr<ParticipantManagement::Interface::Dtc> &ppmDtc,
|
||||
const std::shared_ptr<ParticipantManagement::Interface::Ftc> &ppmFtc,
|
||||
const std::shared_ptr<TimeLineManagement::ForeignDataInterface> &eemForeign,
|
||||
const std::shared_ptr<ExerciseManagement::Interface::Dtc> &exmDtc,
|
||||
const std::shared_ptr<ProjectDataManagement::Interface::Dtc> &pdmDtc,
|
||||
const std::shared_ptr<ParticipantManagement::ForeignGuiComboboxInterface> &ppmCbxIfc,
|
||||
const std::shared_ptr<AreaEffectSimulation::Interface::Dtc> &aesDtc);
|
||||
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
|
||||
QPointF position(const QModelIndex &index) const;
|
||||
signals:
|
||||
void chunksUpdated(int chunksReceived, int chunksRequested);
|
||||
|
||||
protected:
|
||||
QIcon iconFromPartyId(int partyId) const;
|
||||
QVariant stringFromPartyId(int partyId) const;
|
||||
void onUpdateComboboxFilterData();
|
||||
|
||||
private:
|
||||
void onEquipmentSystemEventDataReply(const Core::FunctionReplyObject &replyObject) override final;
|
||||
void onRequestedDataAvailable(TimeLineManagement::TimelineDataProviderInterface *request);
|
||||
|
||||
void doEquipmentSystemEventRequests();
|
||||
void doEventRequests();
|
||||
void doInsertMines();
|
||||
void loadFilterSettings();
|
||||
|
||||
mutable QHash<int, QVariant> m_partyNames;
|
||||
mutable QHash<int, QIcon> m_partyIcons;
|
||||
QVariant m_cbxFilterParty;
|
||||
int source(const HgrAndMineSearchEntry &entry) const;
|
||||
|
||||
std::shared_ptr<AreaEffectSimulation::Interface::Dtc> m_aesDtc;
|
||||
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_ppmDtc;
|
||||
std::shared_ptr<ParticipantManagement::Interface::Ftc> m_ppmFtc;
|
||||
std::shared_ptr<TimeLineManagement::ForeignDataInterface> m_eemForeign;
|
||||
std::shared_ptr<ExerciseManagement::Interface::Dtc> m_exmDtc;
|
||||
std::shared_ptr<ProjectDataManagement::Interface::Dtc> m_pdmDtc;
|
||||
std::shared_ptr<ParticipantManagement::ForeignGuiComboboxInterface> m_ppmGuiCbxIfc;
|
||||
|
||||
// filter for ppm EquipmentSystemEvent request
|
||||
QMap<int32_t, ProjectDataManagement::EquipmentSystemEventFilter> m_equipSysEvtFlt;
|
||||
|
||||
// filter for eem Event request
|
||||
QMap<int32_t, ProjectDataManagement::HgrMineSearchFilterType> m_evtFlt;
|
||||
|
||||
int m_chunksRequested;
|
||||
int m_chunksReceived;
|
||||
QSet<TimeLineManagement::TimelineDataProviderInterface*> m_requests;
|
||||
|
||||
QVariant m_typeCbxFilterContent;
|
||||
|
||||
LtsSession::LtsSession *m_session;
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
friend class HgrAndMineSearchProxyModel;
|
||||
};
|
||||
|
||||
class HgrAndMineSearchProxyModel final : public LtsWidgets::LtsColumnFilterProxyModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
using LtsWidgets::LtsColumnFilterProxyModel::LtsColumnFilterProxyModel;
|
||||
void setSourceModel(QAbstractItemModel *sourceModel) override;
|
||||
protected:
|
||||
bool lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const override;
|
||||
private:
|
||||
HgrAndMineSearchModel *m_sourceModel = nullptr;
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user