Qt6 Migration: Merge latest Qt5 devel content and apply migration fixes
- Merged 292 changed files from dlbo snapshot - Fixed IDL enum collisions (PortType, PdmEventType) - Fixed Grantlee template for C++11 scoped enums - Fixed CMake VERSION_GREATER syntax - Added missing directories (THP, LtsRestClient, etc.) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
310 files changed
+2775
-692
No files matched your search
+2
-2
@@ -22,7 +22,7 @@ variables:
|
||||
BUILD_IMAGE: 'asset-repository.sf.defence-elec.de/docker-rme/livesim/guez'
|
||||
CHECKOUT_IMAGE: 'asset-repository.sf.defence-elec.de/docker-local/docker/docker:git'
|
||||
ARTIFACTORY: 'http://asset-repository.sf.defence-elec.de:80/artifactory'
|
||||
ARTIFACTORY_PATH: 'generic-rme/livesim/guez/master'
|
||||
ARTIFACTORY_PATH: 'generic-rme/livesim/guez/dlbo'
|
||||
RUNNER_TAG: ''
|
||||
|
||||
stages:
|
||||
@@ -77,7 +77,7 @@ build:
|
||||
variables:
|
||||
BUILD_VERSION: $VERSION
|
||||
VERSION_DATE: $CI_COMMIT_TIMESTAMP
|
||||
PROJECT_BASE_DIR: /builds/projects-domain-live/guez/legatus
|
||||
PROJECT_BASE_DIR: /builds/projects-domain-live/guez/dlbo/legatus
|
||||
EMERGE_VERBOSE: 1 # Verbosity level 0:warning 1:info 2:debug
|
||||
script:
|
||||
- export BUILD_NUMBER=$(date +%Y%m%d%H)
|
||||
|
||||
+16
-18
@@ -6,30 +6,28 @@
|
||||
|
||||
ADD_SUBDIRECTORY(CodeGen)
|
||||
ADD_SUBDIRECTORY(httq)
|
||||
#ADD_SUBDIRECTORY(LtsBotan)
|
||||
ADD_SUBDIRECTORY(LtsCommandLineParser)
|
||||
ADD_SUBDIRECTORY(LtsCoordTrans)
|
||||
ADD_SUBDIRECTORY(LtsCoordinate)
|
||||
ADD_SUBDIRECTORY(LtsElevation)
|
||||
ADD_SUBDIRECTORY(LtsLicence)
|
||||
ADD_SUBDIRECTORY(LtsPluginManager)
|
||||
ADD_SUBDIRECTORY(LtsSession)
|
||||
ADD_SUBDIRECTORY(LtsUtils)
|
||||
ADD_SUBDIRECTORY(LtsWidgets)
|
||||
ADD_SUBDIRECTORY(LtsAppDescriptor)
|
||||
ADD_SUBDIRECTORY(LtsAppManager)
|
||||
ADD_SUBDIRECTORY(LtsMultiMonitor)
|
||||
ADD_SUBDIRECTORY(LtsCommandLineParser)
|
||||
ADD_SUBDIRECTORY(LtsCoordinate)
|
||||
ADD_SUBDIRECTORY(LtsCoordTrans)
|
||||
ADD_SUBDIRECTORY(LtsElevation)
|
||||
ADD_SUBDIRECTORY(LtsLicence)
|
||||
ADD_SUBDIRECTORY(LtsLogin)
|
||||
ADD_SUBDIRECTORY(LtsMultiMonitor)
|
||||
ADD_SUBDIRECTORY(LtsNotification)
|
||||
ADD_SUBDIRECTORY(LtsTimeline)
|
||||
ADD_SUBDIRECTORY(LtsPluginManager)
|
||||
ADD_SUBDIRECTORY(LtsPrinting)
|
||||
ADD_SUBDIRECTORY(LtsSerialPortQuerry)
|
||||
ADD_SUBDIRECTORY(LtsScriptTimeline)
|
||||
ADD_SUBDIRECTORY(LtsWebSocket)
|
||||
ADD_SUBDIRECTORY(LtsProjectionWorkstation)
|
||||
ADD_SUBDIRECTORY(LtsRestClient)
|
||||
ADD_SUBDIRECTORY(LtsScriptTimeline)
|
||||
ADD_SUBDIRECTORY(LtsSerialPortQuerry)
|
||||
ADD_SUBDIRECTORY(LtsSession)
|
||||
ADD_SUBDIRECTORY(LtsTimeline)
|
||||
ADD_SUBDIRECTORY(LtsUtils)
|
||||
ADD_SUBDIRECTORY(LtsVirtualKeyboard)
|
||||
ADD_SUBDIRECTORY(LtsWebSocket)
|
||||
ADD_SUBDIRECTORY(LtsWidgets)
|
||||
ADD_SUBDIRECTORY(PluginInterfaces)
|
||||
ADD_SUBDIRECTORY(ProjectConfig)
|
||||
ADD_SUBDIRECTORY(TopicEditorBase) # TODO: rename / move ?
|
||||
#ADD_SUBDIRECTORY(LtsEventTimeline)
|
||||
#ADD_SUBDIRECTORY(LtsTranslator)
|
||||
ADD_SUBDIRECTORY(TopicEditorBase)
|
||||
@@ -22,7 +22,7 @@ QString toString({{ idl_enum.name }} state)
|
||||
{
|
||||
switch(state.underlying())
|
||||
{{% for idl_member in idl_enum.member %}
|
||||
case {{ idl_enum.name }}::{{ idl_member.key }}: return QCoreApplication::translate("{{ idl_enum.name }}", "{{ idl_member.key }}");
|
||||
case {{ idl_enum.name }}_def::{{ idl_member.key }}: return QCoreApplication::translate("{{ idl_enum.name }}", "{{ idl_member.key }}");
|
||||
{% endfor %}
|
||||
default: break;
|
||||
}
|
||||
|
||||
@@ -61,6 +61,7 @@ struct PluginInfo
|
||||
UNKNOWN,
|
||||
DATA,
|
||||
GUI,
|
||||
GUI_ELEMENT,
|
||||
};
|
||||
|
||||
enum class Flag
|
||||
|
||||
@@ -258,7 +258,8 @@ bool LtsPluginLoader::loadPlugins(PluginType requestedPluginType,
|
||||
QStringLiteral("topic_type"),
|
||||
QStringLiteral("project"),
|
||||
QStringLiteral("style"),
|
||||
QStringLiteral("special")}); // #warning TODO: recordreplay is a data plugin ?
|
||||
QStringLiteral("special"),
|
||||
QStringLiteral("gui_element")}); // #warning TODO: recordreplay is a data plugin ?
|
||||
|
||||
QDirIterator pluginDir(libPath, nameFilter, QDir::Files);
|
||||
while (pluginDir.hasNext())
|
||||
@@ -335,6 +336,9 @@ bool LtsPluginLoader::loadPlugins(PluginType requestedPluginType,
|
||||
case 5: // special
|
||||
pluginType = PluginType::SPECIAL;
|
||||
break;
|
||||
case 6: // gui_element
|
||||
pluginType = PluginType::GUI_ELEMENT;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -49,6 +49,8 @@ enum class PluginType
|
||||
PROJECT,
|
||||
STYLE,
|
||||
SPECIAL, // TODO: rm
|
||||
GUI_ELEMENT,
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
#
|
||||
# Lightweight REST Client Framework
|
||||
# $Id$
|
||||
# $HeadURL$
|
||||
# $Author$
|
||||
# Created by Hannes Fritsche, ESZS, 2026-08-21
|
||||
|
||||
#
|
||||
# --- Library LtsRestClient --------------------------------------------------------------------------------
|
||||
#
|
||||
SET(LtsRestClient_SRCS
|
||||
lts_rest_client.cpp
|
||||
lts_rest_client.h
|
||||
)
|
||||
|
||||
NGL_ADD_LIBRARY2(ALL LtsRestClient SHARED ${LtsRestClient_SRCS})
|
||||
|
||||
NGL_TARGET_INCLUDE_DIRECTORIES(LtsRestClient
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../
|
||||
)
|
||||
|
||||
NGL_TARGET_LINK_LIBRARIES(LtsRestClient
|
||||
PUBLIC
|
||||
Qt5::Core
|
||||
Qt5::Network
|
||||
)
|
||||
@@ -0,0 +1,172 @@
|
||||
/**
|
||||
* Lightweight REST Client Framework
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Hannes Fritsche, ESZS, 2026-08-21
|
||||
*/
|
||||
|
||||
#include "lts_rest_client.h"
|
||||
#include <QTimer>
|
||||
#include <QUrl>
|
||||
#include <QtNetwork/QNetworkAccessManager>
|
||||
#include <QtNetwork/QNetworkReply>
|
||||
#include <QtNetwork/QNetworkRequest>
|
||||
|
||||
namespace LtsCommon
|
||||
{
|
||||
|
||||
LtsRestClient::LtsRestClient(const QString &baseUrl, QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_baseUrl(baseUrl)
|
||||
, m_manager(new QNetworkAccessManager(this))
|
||||
{
|
||||
}
|
||||
|
||||
void LtsRestClient::ping(PingSuccessCallback onSuccess, ErrorCallback onError, int timeoutMs)
|
||||
{
|
||||
const QNetworkRequest request((QUrl(m_baseUrl)));
|
||||
QNetworkReply *reply = m_manager->head(request);
|
||||
|
||||
if (!reply)
|
||||
{
|
||||
if (onError)
|
||||
onError(QStringLiteral("Failed to initiate ping."));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// 1. Setup the timer (parented to reply for auto-cleanup)
|
||||
QTimer *timeoutTimer = new QTimer(reply);
|
||||
timeoutTimer->setSingleShot(true);
|
||||
|
||||
// 2. Connect the timeout signal to abort the request
|
||||
connect(timeoutTimer, &QTimer::timeout, this, [reply]()
|
||||
{
|
||||
if (reply && reply->isRunning())
|
||||
reply->abort(); // Triggers finished() with OperationCanceledError
|
||||
});
|
||||
|
||||
// 3. Connect the finished signal to handle the response
|
||||
connect(reply,
|
||||
&QNetworkReply::finished,
|
||||
this,
|
||||
[reply, timeoutTimer, onSuccess, onError]()
|
||||
{
|
||||
timeoutTimer->stop();
|
||||
reply->deleteLater();
|
||||
|
||||
if (reply->error() != QNetworkReply::NoError)
|
||||
{
|
||||
if (onError)
|
||||
{
|
||||
if (reply->error() == QNetworkReply::OperationCanceledError)
|
||||
onError(QStringLiteral("Ping timed out."));
|
||||
else
|
||||
onError(reply->errorString());
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const int statusCode = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
|
||||
|
||||
if (onSuccess)
|
||||
onSuccess(statusCode);
|
||||
});
|
||||
|
||||
// 4. Start the timer only after all connections are successfully established
|
||||
timeoutTimer->start(timeoutMs);
|
||||
}
|
||||
|
||||
void LtsRestClient::get(const QString &endpoint, SuccessCallback onSuccess, ErrorCallback onError)
|
||||
{
|
||||
sendRequest(QStringLiteral("GET"), endpoint, QByteArray(), onSuccess, onError);
|
||||
}
|
||||
|
||||
void LtsRestClient::post(const QString &endpoint, const QJsonDocument &json, SuccessCallback onSuccess, ErrorCallback onError)
|
||||
{
|
||||
sendRequest(QStringLiteral("POST"), endpoint, json.toJson(), onSuccess, onError);
|
||||
}
|
||||
|
||||
void LtsRestClient::put(const QString &endpoint, const QJsonDocument &json, SuccessCallback onSuccess, ErrorCallback onError)
|
||||
{
|
||||
sendRequest(QStringLiteral("PUT"), endpoint, json.toJson(), onSuccess, onError);
|
||||
}
|
||||
|
||||
void LtsRestClient::del(const QString &endpoint, SuccessCallback onSuccess, ErrorCallback onError)
|
||||
{
|
||||
sendRequest(QStringLiteral("DELETE"), endpoint, QByteArray(), onSuccess, onError);
|
||||
}
|
||||
|
||||
void LtsRestClient::sendRequest(const QString &method, const QString &endpoint, const QByteArray &data, SuccessCallback onSuccess, ErrorCallback onError)
|
||||
{
|
||||
QUrl url(m_baseUrl);
|
||||
url.setPath(url.path() + endpoint);
|
||||
|
||||
QNetworkRequest request(url);
|
||||
request.setHeader(QNetworkRequest::ContentTypeHeader, QStringLiteral("application/json"));
|
||||
|
||||
QNetworkReply *reply = nullptr;
|
||||
|
||||
if (method == QStringLiteral("GET"))
|
||||
reply = m_manager->get(request);
|
||||
else if (method == QStringLiteral("POST"))
|
||||
reply = m_manager->post(request, data);
|
||||
else if (method == QStringLiteral("PUT"))
|
||||
reply = m_manager->put(request, data);
|
||||
else if (method == QStringLiteral("DELETE"))
|
||||
reply = m_manager->deleteResource(request);
|
||||
|
||||
if (!reply)
|
||||
{
|
||||
if (onError)
|
||||
onError(QStringLiteral("Failed to initiate request."));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
connect(reply,
|
||||
&QNetworkReply::finished,
|
||||
this,
|
||||
[reply, onSuccess, onError]()
|
||||
{
|
||||
reply->deleteLater();
|
||||
|
||||
// Handle network errors
|
||||
if (reply->error() != QNetworkReply::NoError)
|
||||
{
|
||||
if (onError)
|
||||
onError(reply->errorString());
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle HTTP errors
|
||||
const int statusCode = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
|
||||
if (statusCode >= 400)
|
||||
{
|
||||
if (onError)
|
||||
onError(QStringLiteral("HTTP Error %1").arg(statusCode));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Parse JSON safely
|
||||
QJsonParseError parseError;
|
||||
const QJsonDocument doc = QJsonDocument::fromJson(reply->readAll(), &parseError);
|
||||
|
||||
if (parseError.error != QJsonParseError::NoError)
|
||||
{
|
||||
if (onError)
|
||||
onError(QStringLiteral("JSON Parse Error: ") + parseError.errorString());
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (onSuccess)
|
||||
onSuccess(doc);
|
||||
});
|
||||
}
|
||||
|
||||
} // namespace LtsCommon
|
||||
@@ -0,0 +1,51 @@
|
||||
/**
|
||||
* Lightweight REST Client Framework
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Hannes Fritsche, ESZS, 2026-08-21
|
||||
*/
|
||||
|
||||
// Short documentation on how to use it can be found at https://confluence-classified.rh-int.de/spaces/LEG/pages/207915647/HOWTO+LtsRestClient
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QJsonDocument>
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <functional>
|
||||
#include <LtsRestClient/ltsrestclient_export.h>
|
||||
|
||||
class QNetworkAccessManager;
|
||||
|
||||
namespace LtsCommon
|
||||
{
|
||||
|
||||
class LTSRESTCLIENT_EXPORT LtsRestClient : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit LtsRestClient(const QString &baseUrl, QObject *parent = nullptr);
|
||||
|
||||
// type aliases
|
||||
using PingSuccessCallback = std::function<void(int statusCode)>;
|
||||
using SuccessCallback = std::function<void(const QJsonDocument &)>;
|
||||
using ErrorCallback = std::function<void(const QString &)>;
|
||||
|
||||
// HTTP Header Ping to m_baseUrl to check server availability
|
||||
void ping(PingSuccessCallback onSuccess, ErrorCallback onError = nullptr, int timeoutMs = 3000);
|
||||
|
||||
// HTTP Methods
|
||||
void get(const QString &endpoint, SuccessCallback onSuccess, ErrorCallback onError = nullptr);
|
||||
void post(const QString &endpoint, const QJsonDocument &json, SuccessCallback onSuccess, ErrorCallback onError = nullptr);
|
||||
void put(const QString &endpoint, const QJsonDocument &json, SuccessCallback onSuccess, ErrorCallback onError = nullptr);
|
||||
void del(const QString &endpoint, SuccessCallback onSuccess, ErrorCallback onError = nullptr);
|
||||
|
||||
private:
|
||||
void sendRequest(const QString &method, const QString &endpoint, const QByteArray &data, SuccessCallback onSuccess, ErrorCallback onError);
|
||||
|
||||
QString m_baseUrl;
|
||||
QNetworkAccessManager *m_manager;
|
||||
}; // class RestClient
|
||||
} // namespace LtsCommon
|
||||
@@ -14,7 +14,7 @@
|
||||
#include <QMap>
|
||||
#include <QUrl>
|
||||
#include <memory>
|
||||
#include <Core/core_dtc_types.h>
|
||||
#include <DDS/Core/core_dtc_types.h>
|
||||
//#include <NGLLogger/INGLLogger.h>
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
#include <Common/ProjectConfig/project_defines.h>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include <LtsSession/ltssession_export.h>
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <Core/core_ftc.h>
|
||||
#include <DDS/Core/core_ftc.h>
|
||||
|
||||
#include <QPointer>
|
||||
#include <memory>
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
#define LTSUTILSGUIDDS_INTERNAL_EXPORT LTSUTILSDDS_EXPORT
|
||||
#endif
|
||||
|
||||
#include <Core/function_reply_object.h>
|
||||
#include <Core/core.hpp> // Core::FunctionReply (base reply)
|
||||
#include <DDS/Core/function_reply_object.h>
|
||||
#include <DDS/Core/core.hpp> // Core::FunctionReply (base reply)
|
||||
|
||||
#include <QObject>
|
||||
#include <QVector>
|
||||
|
||||
@@ -108,6 +108,8 @@ SET(ltswidgets_SRCS
|
||||
lts_text_editor2.h
|
||||
lts_text_editor2.cpp
|
||||
|
||||
|
||||
|
||||
LtsImageCropper/lts_image_cropper.cpp
|
||||
)
|
||||
|
||||
@@ -148,6 +150,7 @@ NGL_WRAP_UI(ltswidgets_SRCS
|
||||
NGL_ADD_BIG_RESOURCES(ltswidgets_SRCS resources/lts_resources.qrc)
|
||||
NGL_ADD_LIBRARY(WS TOOLSWS TOOLSSV LtsWidgets SHARED ${ltswidgets_SRCS})
|
||||
|
||||
|
||||
NGL_TARGET_INCLUDE_DIRECTORIES(LtsWidgets
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QThread>
|
||||
#include <Core/core_dts_types.h>
|
||||
#include <DDS/Core/core_dts_types.h>
|
||||
#include "core_export.h"
|
||||
|
||||
namespace DDSConnector
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Core/core.hpp>
|
||||
#include <DDS/Core/core.hpp>
|
||||
|
||||
#include <future>
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "abstract_requester.h"
|
||||
#include "generic_ftc_threading.h"
|
||||
|
||||
#include <Core/core.hpp>
|
||||
#include <DDS/Core/core.hpp>
|
||||
#include <DDS/FTS/connext.h>
|
||||
#include <DDS/Generic/generic_logger.h>
|
||||
#include <DDS/Generic/generic_base.h>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <Core/core.hpp>
|
||||
#include <DDS/Core/core.hpp>
|
||||
|
||||
#include "generic_fts_internal.h"
|
||||
#include "connext.h"
|
||||
|
||||
@@ -470,6 +470,8 @@ void ExplosionsEditAdler::onEffectClusterChanged(const EffectCluster &ecData, Da
|
||||
m_ui->pbStateChange->setEnabled(false);
|
||||
m_ui->gbEffectMarkingInTa->setEnabled(false);
|
||||
}
|
||||
|
||||
__unchange__();
|
||||
}
|
||||
|
||||
QPointF ExplosionsEditAdler::centerOfFiringUnitGeo(int particpantUnitId)
|
||||
|
||||
+21
-6
@@ -283,6 +283,15 @@ ExplosionsEditAdlerStandAlone::ExplosionsEditAdlerStandAlone(const QString &menu
|
||||
if (enableRocket)
|
||||
m_gearClassFilter += ProjectDataManagement::GearClass::Rocket;
|
||||
m_uiRequirements->addRequirement({m_ui->lblPosition, [this]() { return (!m_coord.isNull()); }});
|
||||
m_uiRequirements->addRequirement({m_ui->lblPosition_2, [this]() {
|
||||
// Im Fall (Zielgeometrie == Linear) ist positionEdit_2 enabled. Ansonsten disabled.
|
||||
// Daher: Wenn enabled, muss auch ein Wert enthalten sein.
|
||||
// Andernfalls wird in apply() die cornerBottomLeft aufgrund fehlerhafter Werte berechnet.
|
||||
// Die dabei resultierenden Werte haben bereits mal zu einem Absturz gefuehrt.
|
||||
// LS-693 [Stand-Alone] Koordinatenberechnung Linear...
|
||||
return (!m_ui->positionEdit_2->isEnabled()) || // Ok, wenn disabled
|
||||
(!m_ui->positionEdit_2->coordinate().isNull()); } // oder coordinate not null
|
||||
});
|
||||
m_uiRequirements->addRequirement({m_ui->lblRadiusBreite, [this]() { return (m_ui->sbDimensionX_BreiteRadius->value() >= s_minWidth); }});
|
||||
m_uiRequirements->addRequirement({m_ui->lblDimensionY_Tiefe, [this]() { return (m_ui->sbDimensionY_Tiefe->value() >= s_minHeight); }});
|
||||
// m_uiRequirements->addRequirement({m_ui->lblName, [this]() { return (!m_ui->leElement->text().isEmpty()); }});
|
||||
@@ -1669,6 +1678,13 @@ void ExplosionsEditAdlerStandAlone::onEffectClusterChanged(const EffectCluster &
|
||||
if (m_aesItem.effectStateId() == AreaEffectSimulation::AesEffectState::EsCreated ||
|
||||
m_aesItem.effectStateId() == AreaEffectSimulation::AesEffectState::EsPrepared)
|
||||
enableUiElements(!unchangeable());
|
||||
else if (m_aesItem.effectStateId() == AreaEffectSimulation::AesEffectState::EsExpired ||
|
||||
m_aesItem.effectStateId() == AreaEffectSimulation::AesEffectState::EsFired ||
|
||||
m_aesItem.effectStateId() == AreaEffectSimulation::AesEffectState::EsActivated)
|
||||
{
|
||||
if (hasUnsavedChanges())
|
||||
__unchange__();
|
||||
}
|
||||
|
||||
if(!unchangeable())
|
||||
setFireBtnState();
|
||||
@@ -2106,14 +2122,10 @@ bool ExplosionsEditAdlerStandAlone::apply()
|
||||
request.firePurposeId(m_ui->cbFirePurpose->currentData().toInt());
|
||||
|
||||
if (m_ui->dteEffectStart->isChecked() && m_ui->dteEffectStart->isVisible())
|
||||
{
|
||||
const FiringType::type firingType = static_cast<FiringType::type>(m_ui->cbFiringType->currentData().toInt());
|
||||
if (firingType != FiringType::FireWithIndicationTTF)
|
||||
{
|
||||
// we use the effect start as usual
|
||||
request.effectStart().set(m_ui->dteEffectStart->msecsSinceEpoch());
|
||||
}
|
||||
}
|
||||
if (m_ui->sbDurationSec->isVisible())
|
||||
request.effectDuration(m_ui->sbDurationSec->value() * 1000);
|
||||
|
||||
@@ -2293,13 +2305,16 @@ bool ExplosionsEditAdlerStandAlone::apply()
|
||||
const QString properties = QString::fromUtf8(QJsonDocument(propertiesObj).toJson());
|
||||
DEBUG_LOG(m_logger) << "properties: " << properties;
|
||||
request.properties(properties.toStdString());
|
||||
DEBUG_LOG(m_logger) << "request abschicken";
|
||||
|
||||
// Rocket-Spezifika:
|
||||
const QVariant currentData = m_ui->cbGearClass->currentData();
|
||||
const ProjectDataManagement::GearClass::type currentGearClass = static_cast<ProjectDataManagement::GearClass::type>(currentData.toInt());
|
||||
|
||||
if (currentGearClass == ProjectDataManagement::GearClass::Rocket)
|
||||
{
|
||||
RocketUtility::addRocketPropertiesToRequest(request, m_ppmDtc);
|
||||
}
|
||||
|
||||
DEBUG_LOG(m_logger) << "request abschicken, request = '" << request << "'";
|
||||
|
||||
m_requestHelper->addRequest([this, request]() { return m_ftc->effectClusterModifyRequest(request, this); });
|
||||
|
||||
|
||||
@@ -179,6 +179,7 @@ void addRocketPropertiesForLinearGeometry(EffectClusterModifyRequest &request, c
|
||||
const double flightTimeStep = currentEffector.flightTime() / static_cast<double>(trajectoryWithoutTime.size());
|
||||
double currentFlightTime = 0.0;
|
||||
|
||||
currentEffector.trajectoryRelative().clear(); // LS_711_akkumulierende_flugkurven_bei_rakete
|
||||
const LtsCoordTrans::UtmCoordinate utmStartPos = LtsCoordTrans::UtmCoordinate::fromGeographic(participantPosition.pos().lon(), participantPosition.pos().lat());
|
||||
for (const Core::GeoPosition &pos : trajectoryWithoutTime)
|
||||
{
|
||||
@@ -240,6 +241,7 @@ void addRocketPropertiesForPointGeometry(EffectClusterModifyRequest &request, co
|
||||
const double flightTimeStep = currentEffector.flightTime() / static_cast<double>(trajectoryWithoutTime.size());
|
||||
double currentFlightTime = 0.0;
|
||||
|
||||
currentEffector.trajectoryRelative().clear(); // LS_711_akkumulierende_flugkurven_bei_rakete
|
||||
const LtsCoordTrans::UtmCoordinate utmStartPos = LtsCoordTrans::UtmCoordinate::fromGeographic(participantPosition.pos().lon(), participantPosition.pos().lat());
|
||||
for (const Core::GeoPosition &pos : trajectoryWithoutTime)
|
||||
{
|
||||
@@ -250,7 +252,7 @@ void addRocketPropertiesForPointGeometry(EffectClusterModifyRequest &request, co
|
||||
|
||||
currentFlightTime += flightTimeStep;
|
||||
}
|
||||
}
|
||||
} // for (EffectorData ¤tEffector : request.effectors())
|
||||
}
|
||||
|
||||
} // namespace RocketUtility
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#include "flm_hq_report_converter.h"
|
||||
|
||||
#include <FileManagement/flm_data_plugin_interface.h>
|
||||
#include <FileManagement/flm_ftc.h>
|
||||
#include <FileManagement/flm_ftc_types.h>
|
||||
#include <FileManagement/flm_data_plugin_interface.h>
|
||||
|
||||
#include <Symbology/sidc_builder_base.h>
|
||||
#include <Symbology/sidc_codec.h>
|
||||
@@ -11,20 +11,20 @@
|
||||
|
||||
#include <GeometryModel/geometry_model_factory.h>
|
||||
|
||||
#include <LtsUtilsCore/dds_vector.h>
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <LtsSession/lts_session_data.h>
|
||||
#include <LtsUtilsCore/dds_vector.h>
|
||||
|
||||
#include <ParticipantManagement/ppm_data_plugin_interface.h>
|
||||
#include <AreaEffectSimulation/Utils/polygons.h>
|
||||
#include <ParticipantManagement/ppm_data_plugin_interface.h>
|
||||
|
||||
namespace FileManagement
|
||||
{
|
||||
|
||||
FlmHqReportConverter::FlmHqReportConverter() : m_logger(getLogger("HQReportConverter"))
|
||||
FlmHqReportConverter::FlmHqReportConverter()
|
||||
: m_logger(getLogger("HQReportConverter"))
|
||||
{
|
||||
connect(this, &FlmHqReportConverter::allRequestsFinished,
|
||||
this, &FlmHqReportConverter::onRequestsFinished);
|
||||
connect(this, &FlmHqReportConverter::allRequestsFinished, this, &FlmHqReportConverter::onRequestsFinished);
|
||||
}
|
||||
|
||||
bool FlmHqReportConverter::init(LtsSession::LtsSession *session, int currentPartyId)
|
||||
@@ -82,11 +82,20 @@ bool FlmHqReportConverter::init(LtsSession::LtsSession *session, int currentPart
|
||||
return true;
|
||||
}
|
||||
|
||||
void FlmHqReportConverter::addHqToPlanIds(const QMap<int, QList<int>> &hqToPlanIds)
|
||||
void FlmHqReportConverter::addHqToPlanIds(const QMap<int, QSet<int>> &hqToPlanIds)
|
||||
{
|
||||
for (auto it = hqToPlanIds.constBegin(); it != hqToPlanIds.constEnd(); ++it)
|
||||
{
|
||||
m_hqToPlanIds[it.key()].append(it.value());
|
||||
int planFileId = it.key();
|
||||
const QSet<int> &hqMessageIds = it.value();
|
||||
|
||||
for (int id : hqMessageIds)
|
||||
{
|
||||
if (id == planFileId) // Eventueller Eintrag in Map wegen QTreeView verhindern
|
||||
continue;
|
||||
|
||||
m_hqToPlanIds[planFileId].append(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,15 +103,17 @@ void FlmHqReportConverter::processCollectedHqs()
|
||||
{
|
||||
for (auto it = m_hqToPlanIds.constBegin(); it != m_hqToPlanIds.constEnd(); ++it)
|
||||
{
|
||||
m_pendingRequests += it.value().size();
|
||||
int planId = it.key();
|
||||
for (int id : it.value())
|
||||
m_pendingRequests++;
|
||||
}
|
||||
|
||||
for (auto it = m_hqToPlanIds.constBegin(); it != m_hqToPlanIds.constEnd(); ++it)
|
||||
{
|
||||
int planId = it.key();
|
||||
const QList<int> &reportIds = it.value();
|
||||
// Request file content for each HqReport
|
||||
for (int id : reportIds)
|
||||
const QList<int> &hqMessageIds = it.value();
|
||||
|
||||
for (int id : hqMessageIds)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Request File with ID: " << id << " from plan with ID: " << planId;
|
||||
FileManagement::GetFileContentDataRequest request(id);
|
||||
@@ -110,46 +121,21 @@ void FlmHqReportConverter::processCollectedHqs()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FlmHqReportConverter::createGeometryFromReport(const HqReportData &data)
|
||||
{
|
||||
m_symbolFactory.build(data.art, data, m_geometryModel);
|
||||
}
|
||||
void FlmHqReportConverter::createGeometryFromReport(const HqReportData &data) { m_symbolFactory.build(data.art, data, m_geometryModel); }
|
||||
|
||||
void FlmHqReportConverter::checkIfAllFinished()
|
||||
{
|
||||
if (m_pendingRequests <= 0) emit allRequestsFinished();
|
||||
if (m_pendingRequests <= 0)
|
||||
emit allRequestsFinished();
|
||||
}
|
||||
|
||||
void FlmHqReportConverter::onGetFileContentDataReply(
|
||||
const FileManagement::GetFileContentDataReply &reply)
|
||||
void FlmHqReportConverter::onGetFileContentDataReply(const FileManagement::GetFileContentDataReply &reply)
|
||||
{
|
||||
m_pendingRequests--;
|
||||
|
||||
if (reply.errorString().size() > 0)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Got onGetFileContentDataReply error: " << reply.errorString();
|
||||
return;
|
||||
}
|
||||
|
||||
int id = static_cast<int>(reply.id());
|
||||
const int id = static_cast<int>(reply.id());
|
||||
int planId = -1;
|
||||
|
||||
DEBUG_LOG(m_logger) << "Reply File with ID: " << id << " from plan with ID: " << planId;
|
||||
|
||||
INFO_LOG(m_logger) << "Got reply with id " << id << " and errorString " << reply.errorString();
|
||||
|
||||
QByteArray fileContent = QByteArray(reinterpret_cast<const char*>(reply.content().data()), reply.content().size());
|
||||
|
||||
FlmHqReportJsonParser m_parser = FlmHqReportJsonParser();
|
||||
|
||||
HqReportData data = m_parser.parse(fileContent);
|
||||
data.contentFileId = id;
|
||||
|
||||
DEBUG_LOG(m_logger) << "Party: " << m_partyId << " has Color: "<< QColor::fromRgb(QRgb(m_ppmDtc->party(m_partyId).color())).value();
|
||||
|
||||
data.partyColor = QColor::fromRgb(QRgb(m_ppmDtc->party(m_partyId).color()));
|
||||
|
||||
for (auto it = m_hqToPlanIds.constBegin(); it != m_hqToPlanIds.constEnd(); ++it)
|
||||
{
|
||||
if (it.value().contains(id))
|
||||
@@ -159,7 +145,24 @@ void FlmHqReportConverter::onGetFileContentDataReply(
|
||||
}
|
||||
}
|
||||
|
||||
m_convertedHqToPlanIds[planId].append(data);
|
||||
DEBUG_LOG(m_logger) << "Reply File with ID: " << id << " from plan with ID: " << planId;
|
||||
INFO_LOG(m_logger) << "Got reply with id " << id;
|
||||
|
||||
QByteArray fileContent = QByteArray::fromRawData(reinterpret_cast<const char *>(reply.content().data()), reply.content().size());
|
||||
|
||||
DEBUG_LOG(m_logger) << "fileContent: " << fileContent;
|
||||
|
||||
FileManagement::FileContent flc = m_flmDtc->fileContent(reply.id());
|
||||
|
||||
DEBUG_LOG(m_logger) << "FlmHqReportConverter::onGetFileContentDataReply FILECONTENTNAME: " << flc.name();
|
||||
|
||||
HqReportData data = m_parser.parse(fileContent);
|
||||
data.contentFileId = id;
|
||||
data.name = QString::fromStdString(flc.name());
|
||||
|
||||
data.partyColor = QColor::fromRgb(m_ppmDtc->party(m_partyId).color());
|
||||
|
||||
m_convertedHqToPlanIds[planId].append(std::move(data));
|
||||
|
||||
DEBUG_LOG(m_logger) << "Content size: " << reply.content().size();
|
||||
|
||||
@@ -171,10 +174,7 @@ void FlmHqReportConverter::onFileContentModifyReply(const Core::FunctionReplyObj
|
||||
DEBUG_LOG(m_logger) << "Got FileContentModify Reply: " << reply.translated();
|
||||
|
||||
if (reply.error())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Error while insert HX Message: " << reply.translated()
|
||||
<< ", error: " << reply.error();
|
||||
}
|
||||
ERROR_LOG(m_logger) << "Error while insert HX Message: " << reply.translated() << ", error: " << reply.error();
|
||||
}
|
||||
|
||||
void FlmHqReportConverter::onFileContentRemoveReply(const Core::FunctionReplyObject &reply)
|
||||
@@ -182,28 +182,62 @@ void FlmHqReportConverter::onFileContentRemoveReply(const Core::FunctionReplyObj
|
||||
DEBUG_LOG(m_logger) << "Got FileContentRemove Reply: " << reply.translated();
|
||||
|
||||
if (reply.error())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Error while insert HX Message: " << reply.translated()
|
||||
<< ", error: " << reply.error();
|
||||
}
|
||||
ERROR_LOG(m_logger) << "Error while insert HX Message: " << reply.translated() << ", error: " << reply.error();
|
||||
}
|
||||
|
||||
void FlmHqReportConverter::onRequestsFinished()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "ALL REQUESTS FINISHED";
|
||||
DEBUG_LOG(m_logger) << "ALL REQUESTS FINISHED -> STARTING CONTENT FETCH";
|
||||
|
||||
for (auto it = m_convertedHqToPlanIds.constBegin(); it != m_convertedHqToPlanIds.constEnd(); ++it)
|
||||
{
|
||||
int planId = it.key();
|
||||
const QList<HqReportData> &reportDatas = it.value();
|
||||
QList<HqReportData> reportDatas = it.value();
|
||||
const FileManagement::FileContent flc = m_flmDtc->fileContent(planId);
|
||||
FileManagement::GetFileContentDataRequest req;
|
||||
req.fileContentId(planId);
|
||||
|
||||
for (auto &reportData : reportDatas)
|
||||
m_flmFtc->getFileContentDataRequest(req,
|
||||
[this, planId, reportDatas = std::move(reportDatas), flc = std::move(flc)](const FileManagement::GetFileContentDataReply &reply)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "createGeometryFromReport :" << reportData.art;
|
||||
createGeometryFromReport(reportData);
|
||||
const auto &fetchedFlc = reply;
|
||||
if (fetchedFlc.content().size() > 0)
|
||||
{
|
||||
QByteArray existingContent
|
||||
= QByteArray::fromRawData(reinterpret_cast<const char *>(fetchedFlc.content().data()), fetchedFlc.content().size());
|
||||
|
||||
if (!m_geometryModel->fromByteArray(existingContent))
|
||||
WARNING_LOG(m_logger) << "Could not load existing geometry content for planId" << planId;
|
||||
}
|
||||
|
||||
const FileManagement::FileContent &flc = m_flmDtc->fileContent(planId);
|
||||
QJsonArray jsonNameArray;
|
||||
QJsonDocument existingDocs = QJsonDocument::fromJson(QByteArray::fromRawData(flc.properties().data(), flc.properties().size()));
|
||||
|
||||
if (existingDocs.isArray())
|
||||
jsonNameArray = existingDocs.array();
|
||||
|
||||
for (const auto &reportData : reportDatas)
|
||||
{
|
||||
|
||||
bool alreadyExists = false;
|
||||
for (const QJsonValue &value : jsonNameArray)
|
||||
{
|
||||
if (value.toString() == reportData.name)
|
||||
{
|
||||
alreadyExists = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!alreadyExists)
|
||||
{
|
||||
createGeometryFromReport(reportData);
|
||||
jsonNameArray.append(reportData.name);
|
||||
}
|
||||
}
|
||||
|
||||
QJsonDocument jsonDoc(jsonNameArray);
|
||||
QString combinedNames = QString::fromUtf8(jsonDoc.toJson(QJsonDocument::Compact));
|
||||
|
||||
FileManagement::FileContentModifyRequest data;
|
||||
|
||||
@@ -221,10 +255,10 @@ void FlmHqReportConverter::onRequestsFinished()
|
||||
data.lastModified(QDateTime::currentMSecsSinceEpoch());
|
||||
data.content(LtsUtils::convert<std::vector<uint8_t>>(m_geometryModel->toByteArray()));
|
||||
data.exerciseId(m_session->exerciseId());
|
||||
|
||||
data.properties(combinedNames.toStdString());
|
||||
m_flmFtc->fileContentModifyRequest(data, this);
|
||||
|
||||
m_geometryModel->clearModel();
|
||||
});
|
||||
}
|
||||
}
|
||||
} // namespace FileManagement
|
||||
@@ -18,13 +18,14 @@ class Dtc;
|
||||
class Ftc;
|
||||
} // namespace Interface
|
||||
|
||||
class FlmHqReportConverter : public QObject,
|
||||
public Interface::Ftc::GetFileContentDataReplyHandler,
|
||||
public Interface::Ftc::FileContentModifyReplyHandler,
|
||||
public Interface::Ftc::FileContentRemoveReplyHandler
|
||||
class FlmHqReportConverter
|
||||
: public QObject
|
||||
, public Interface::Ftc::GetFileContentDataReplyHandler
|
||||
, public Interface::Ftc::FileContentModifyReplyHandler
|
||||
, public Interface::Ftc::FileContentRemoveReplyHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
public:
|
||||
FlmHqReportConverter();
|
||||
~FlmHqReportConverter() = default;
|
||||
|
||||
@@ -33,7 +34,7 @@ public:
|
||||
* @brief add hqToPlanIds to m_hqToPlanIds
|
||||
* @param const QMap<int, QList<int>> &hqToPlanIds -> <planId, QList<HqIds>>
|
||||
*/
|
||||
void addHqToPlanIds(const QMap<int, QList<int>> &hqToPlanIds);
|
||||
void addHqToPlanIds(const QMap<int, QSet<int>> &hqToPlanIds);
|
||||
/**
|
||||
* @brief Iterate and send GetFileContentDataRequest to get File Information HQ
|
||||
*/
|
||||
@@ -44,22 +45,22 @@ public:
|
||||
*/
|
||||
void createGeometryFromReport(const HqReportData &data);
|
||||
|
||||
private:
|
||||
private:
|
||||
void checkIfAllFinished();
|
||||
|
||||
protected:
|
||||
protected:
|
||||
void onGetFileContentDataReply(const FileManagement::GetFileContentDataReply &reply) override;
|
||||
void onFileContentModifyReply(const Core::FunctionReplyObject &reply) override;
|
||||
void onFileContentRemoveReply(const Core::FunctionReplyObject &reply) override;
|
||||
public slots:
|
||||
public slots:
|
||||
void onRequestsFinished();
|
||||
signals:
|
||||
signals:
|
||||
/**
|
||||
* @brief checks if all getFileContentDataRequests are finished
|
||||
*/
|
||||
void allRequestsFinished();
|
||||
|
||||
private:
|
||||
private:
|
||||
LOGGER_T m_logger;
|
||||
LtsSession::LtsSession *m_session{nullptr};
|
||||
std::shared_ptr<Interface::Dtc> m_flmDtc;
|
||||
@@ -72,7 +73,7 @@ private:
|
||||
|
||||
int m_partyId;
|
||||
int m_pendingRequests{0};
|
||||
|
||||
FlmHqReportJsonParser m_parser;
|
||||
QMap<int, QList<int>> m_hqToPlanIds; /// Map<planIds, QList<HQMessageId>>
|
||||
QMap<int, int> m_hqToPlanIdsLookup; /// Map<planIds, HQMessageId> for Lookup
|
||||
QMap<int, QList<HqReportData>> m_convertedHqToPlanIds; /// Map<planIds, QList<convertedHqMessage>>
|
||||
|
||||
@@ -136,7 +136,7 @@ bool HQReportEdit::init(LtsSession::LtsSession *session, int partyId)
|
||||
m_ui->listViewPlan->setDragDropMode(QAbstractItemView::DropOnly);
|
||||
m_ui->listViewPlan->setDefaultDropAction(Qt::CopyAction);
|
||||
m_ui->listViewPlan->setDropIndicatorShown(true);
|
||||
|
||||
m_ui->listViewPlan->setHeaderHidden(true);
|
||||
// configure listViewMessage
|
||||
m_ui->listViewMessage->setDragDropMode(QAbstractItemView::DragOnly);
|
||||
m_ui->listViewMessage->setDefaultDropAction(Qt::CopyAction);
|
||||
@@ -151,31 +151,6 @@ bool HQReportEdit::init(LtsSession::LtsSession *session, int partyId)
|
||||
return false;
|
||||
}
|
||||
|
||||
// init models
|
||||
qDeleteAll(m_hqModels);
|
||||
m_hqModels.clear();
|
||||
|
||||
qDeleteAll(m_planModels);
|
||||
m_planModels.clear();
|
||||
|
||||
for (int index = 0; index < m_ui->cboParties->count(); ++index)
|
||||
{
|
||||
const int partyId = m_ui->cboParties->itemData(index).toInt();
|
||||
createModels(partyId);
|
||||
}
|
||||
|
||||
// configure listViewPlan
|
||||
m_ui->listViewPlan->setDragDropMode(QAbstractItemView::DropOnly);
|
||||
m_ui->listViewPlan->setDefaultDropAction(Qt::MoveAction);
|
||||
m_ui->listViewPlan->setDropIndicatorShown(true);
|
||||
|
||||
// configure listViewMessage
|
||||
m_ui->listViewMessage->setDragDropMode(QAbstractItemView::DragOnly);
|
||||
m_ui->listViewMessage->setDefaultDropAction(Qt::MoveAction);
|
||||
m_ui->listViewMessage->setDropIndicatorShown(true);
|
||||
|
||||
onPartyChanged();
|
||||
|
||||
connect(m_ui->cboParties, qOverload<int>(&QComboBox::currentIndexChanged), this, &HQReportEdit::onPartyChanged);
|
||||
|
||||
int partyIndex = m_ui->cboParties->findData(partyId); // in case of notification: onPartyChanged() is called when index changes
|
||||
@@ -190,11 +165,16 @@ void HQReportEdit::createModels(const int partyId)
|
||||
if (partyFolderId == 0)
|
||||
{
|
||||
WARNING_LOG(m_logger) << "No partyFolderId found for partyId " << partyId;
|
||||
delete m_planModels.take(partyId);
|
||||
delete m_hqModels.take(partyId);
|
||||
return;
|
||||
}
|
||||
|
||||
const int hqReportFolderId = m_flmDtc->findFolder(partyFolderId, QStringLiteral("Messages"));
|
||||
|
||||
delete m_planModels.take(partyId);
|
||||
delete m_hqModels.take(partyId);
|
||||
|
||||
auto *planModel = new FlmHQReportModel(m_ui->listViewPlan);
|
||||
if (!planModel->init(m_session, partyFolderId, FileType::inner_enum::TacticalPlan))
|
||||
{
|
||||
@@ -220,17 +200,15 @@ void HQReportEdit::createModels(const int partyId)
|
||||
|
||||
bool HQReportEdit::apply()
|
||||
{
|
||||
QMap<int, QList<int>> allHqToPlanIds;
|
||||
QMap<int, QSet<int>> allHqToPlanIds;
|
||||
|
||||
for (auto it = m_planModels.begin(); it != m_planModels.end(); ++it)
|
||||
{
|
||||
QMap<int, QList<int>> hqToPlanIds = it.value()->getHQToPlan(); // <planId, hq-message ids>
|
||||
QMap<int, QSet<int>> hqToPlanIds = it.value()->getChangedPlans(); // <planId, hq-message ids>
|
||||
|
||||
for (auto planId : hqToPlanIds.keys())
|
||||
for (auto it = hqToPlanIds.constBegin(); it != hqToPlanIds.constEnd(); ++it)
|
||||
{
|
||||
allHqToPlanIds[planId].append(hqToPlanIds[planId]);
|
||||
|
||||
it.value()->clearMovedData();
|
||||
allHqToPlanIds[it.key()] += it.value();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -254,14 +232,10 @@ void HQReportEdit::retranslate() { translate(m_ui, tr("HQ Report")); }
|
||||
void HQReportEdit::onPartyChanged(int index)
|
||||
{
|
||||
Q_UNUSED(index);
|
||||
|
||||
const int currentPartyId = m_ui->cboParties->currentData().toInt();
|
||||
DEBUG_LOG(m_logger) << "onPartyChanged " << currentPartyId;
|
||||
|
||||
if (!m_planModels.contains(currentPartyId) || !m_hqModels.contains(currentPartyId))
|
||||
{
|
||||
INFO_LOG(m_logger) << "Models for party" << currentPartyId << "not found. Attempting to create...";
|
||||
createModels(currentPartyId);
|
||||
}
|
||||
|
||||
QAbstractItemModel *hqModel = m_hqModels.value(currentPartyId, nullptr);
|
||||
QAbstractItemModel *planModel = m_planModels.value(currentPartyId, nullptr);
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="3" column="2">
|
||||
<widget class="QListView" name="listViewPlan"/>
|
||||
<widget class="QTreeView" name="listViewPlan"/>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QLabel" name="lblPlans">
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
#include "flm_hq_report_model.h"
|
||||
|
||||
#include <QJsonArray>
|
||||
#include <QJsonDocument>
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <Plugins/FileManagement/flm_data_plugin_interface.h>
|
||||
|
||||
namespace FileManagement
|
||||
{
|
||||
FlmHQReportModel::FlmHQReportModel(QObject *parent)
|
||||
: QAbstractListModel(parent)
|
||||
: QAbstractItemModel(parent)
|
||||
, m_logger(getLogger("HQReportModel"))
|
||||
{
|
||||
}
|
||||
@@ -32,7 +33,7 @@ bool FlmHQReportModel::init(LtsSession::LtsSession *session, int contentFolderId
|
||||
|
||||
m_flmDtc->enableFileContent();
|
||||
m_flmDtc->waitForHistoricalDataFileContent(3000);
|
||||
m_flmDtc->fileContents([this](const FileContent &content){onFileContentChanged(content, DataModification::eAdded);});
|
||||
m_flmDtc->fileContents([this](const FileContent &content) { onFileContentChanged(content, DataModification::eAdded); });
|
||||
|
||||
connect(m_flmDtc.get(), &Interface::Dtc::fileContentChanged, this, &FlmHQReportModel::onFileContentChanged);
|
||||
|
||||
@@ -41,25 +42,74 @@ bool FlmHQReportModel::init(LtsSession::LtsSession *session, int contentFolderId
|
||||
|
||||
int FlmHQReportModel::rowCount(const QModelIndex &parent) const
|
||||
{
|
||||
if (parent.isValid())
|
||||
return 0;
|
||||
if (!parent.isValid())
|
||||
return m_data.count();
|
||||
|
||||
if (parent.internalId() != 0)
|
||||
return 0;
|
||||
|
||||
if (parent.row() >= 0 && parent.row() < m_data.size())
|
||||
{
|
||||
const HQData &data = m_data.at(parent.row());
|
||||
auto it = m_movedData.constFind(data.id);
|
||||
if (it != m_movedData.constEnd())
|
||||
return it.value().count();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
QModelIndex FlmHQReportModel::parent(const QModelIndex &index) const
|
||||
{
|
||||
|
||||
if (!index.isValid())
|
||||
return QModelIndex();
|
||||
|
||||
quintptr internalId = index.internalId();
|
||||
|
||||
if (internalId == 0)
|
||||
return QModelIndex();
|
||||
|
||||
int parentRow = static_cast<int>(internalId) - 1;
|
||||
|
||||
return createIndex(parentRow, 0, quintptr(0));
|
||||
}
|
||||
|
||||
QVariant FlmHQReportModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (!index.isValid())
|
||||
return QVariant();
|
||||
return {};
|
||||
|
||||
if (role == Qt::DisplayRole)
|
||||
return createText(index.row());
|
||||
{
|
||||
quintptr internalId = index.internalId();
|
||||
|
||||
return QVariant();
|
||||
if (internalId == 0)
|
||||
{
|
||||
if (index.row() >= 0 && index.row() < m_data.size())
|
||||
return m_data.at(index.row()).name;
|
||||
}
|
||||
else // Child-Item
|
||||
{
|
||||
int parentRow = static_cast<int>(internalId) - 1;
|
||||
if (parentRow >= 0 && parentRow < m_data.size())
|
||||
{
|
||||
const HQData &parentData = m_data.at(parentRow);
|
||||
auto it = m_movedData.constFind(parentData.id);
|
||||
if (it != m_movedData.constEnd())
|
||||
{
|
||||
const QList<HQData> &children = it.value();
|
||||
if (index.row() >= 0 && index.row() < children.size())
|
||||
return children.at(index.row()).name;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
Qt::ItemFlags FlmHQReportModel::flags(const QModelIndex &index) const
|
||||
{
|
||||
Qt::ItemFlags defaultFlags = QAbstractListModel::flags(index);
|
||||
Qt::ItemFlags defaultFlags = QAbstractItemModel::flags(index);
|
||||
|
||||
if (!index.isValid())
|
||||
return defaultFlags;
|
||||
@@ -67,15 +117,9 @@ Qt::ItemFlags FlmHQReportModel::flags(const QModelIndex &index) const
|
||||
return defaultFlags | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled;
|
||||
}
|
||||
|
||||
Qt::DropActions FlmHQReportModel::supportedDropActions() const
|
||||
{
|
||||
return Qt::CopyAction;
|
||||
}
|
||||
Qt::DropActions FlmHQReportModel::supportedDropActions() const { return Qt::CopyAction; }
|
||||
|
||||
Qt::DropActions FlmHQReportModel::supportedDragActions() const
|
||||
{
|
||||
return Qt::CopyAction;
|
||||
}
|
||||
Qt::DropActions FlmHQReportModel::supportedDragActions() const { return Qt::CopyAction; }
|
||||
|
||||
QStringList FlmHQReportModel::mimeTypes() const
|
||||
{
|
||||
@@ -109,8 +153,34 @@ QMimeData *FlmHQReportModel::mimeData(const QList<QModelIndex> &indexes) const
|
||||
{
|
||||
if (index.isValid())
|
||||
{
|
||||
HQData md = m_data.at(index.row());
|
||||
stream << md.id << md.name;// Serialize your custom metadata to QByteArray
|
||||
HQData md;
|
||||
QString visibleName = index.data(Qt::DisplayRole).toString();
|
||||
|
||||
if (index.internalId() != 0)
|
||||
{
|
||||
int parentRow = static_cast<int>(index.internalId()) - 1;
|
||||
if (parentRow >= 0 && parentRow < m_data.size())
|
||||
{
|
||||
const HQData &parentData = m_data.at(parentRow);
|
||||
const auto &children = m_movedData.value(parentData.id);
|
||||
if (index.row() >= 0 && index.row() < children.size())
|
||||
{
|
||||
md = children.at(index.row());
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (index.row() >= 0 && index.row() < m_data.size())
|
||||
{
|
||||
const HQData &originalData = m_data.at(index.row());
|
||||
md.id = originalData.id;
|
||||
md.name = visibleName;
|
||||
md.properties = originalData.properties;
|
||||
}
|
||||
}
|
||||
md.name = visibleName;
|
||||
stream << md.id << md.name;
|
||||
}
|
||||
}
|
||||
mimeData->setData(mimeType, encodedData);
|
||||
@@ -128,17 +198,20 @@ bool FlmHQReportModel::dropMimeData(const QMimeData *data, Qt::DropAction action
|
||||
QByteArray encodedData = data->data(mimeType);
|
||||
QDataStream stream(&encodedData, QIODevice::ReadOnly);
|
||||
|
||||
if (parent.isValid() && parent.row() >= 0 && parent.row() < m_data.size())
|
||||
DEBUG_LOG(m_logger) << "DROP ZIEL (Parent im Tree): " << m_data.at(parent.row()).name;
|
||||
|
||||
while (!stream.atEnd())
|
||||
{
|
||||
HQData md;
|
||||
|
||||
stream >> md.id >> md.name;
|
||||
|
||||
addMovedData(parent.row(), md);
|
||||
DEBUG_LOG(m_logger) << "DROP INHALT aus Stream -> ID: " << md.id << ", NAME: " << md.name;
|
||||
|
||||
addMovedData(parent, md);
|
||||
}
|
||||
|
||||
emit dataAddedOrRemoved();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -147,52 +220,106 @@ bool FlmHQReportModel::canDropMimeData(const QMimeData *data, Qt::DropAction act
|
||||
Q_UNUSED(row)
|
||||
Q_UNUSED(column)
|
||||
|
||||
if (!parent.isValid() ||
|
||||
!data->hasFormat(mimeType) ||
|
||||
action != Qt::CopyAction ||
|
||||
parent.row() < 0 ||
|
||||
parent.row() >= m_data.size())
|
||||
if (!parent.isValid() || !data->hasFormat(mimeType) || action != Qt::CopyAction || parent.row() < 0 || parent.row() >= m_data.size())
|
||||
return false;
|
||||
|
||||
QByteArray encodedData = data->data(mimeType);
|
||||
QDataStream stream(&encodedData, QIODevice::ReadOnly);
|
||||
const HQData ¤tData = m_data.at(parent.row());
|
||||
|
||||
if (!m_movedData.contains(currentData.id))
|
||||
const HQData ¤tParentData = m_data.at(parent.row());
|
||||
|
||||
if (!m_movedData.contains(currentParentData.id))
|
||||
return true;
|
||||
|
||||
const QList<HQData> &movedDataListForCurrentData = m_movedData.value(currentData.id);
|
||||
const QList<HQData> &existingChildren = m_movedData.value(currentParentData.id);
|
||||
|
||||
while (!stream.atEnd())
|
||||
{
|
||||
HQData movedData;
|
||||
HQData incomingData;
|
||||
stream >> incomingData.id >> incomingData.name;
|
||||
|
||||
stream >> movedData.id >> movedData.name;
|
||||
|
||||
if (movedDataListForCurrentData.contains(movedData)) // we do not allow double entries
|
||||
for (const HQData &child : existingChildren)
|
||||
{
|
||||
if (child.id == incomingData.id)
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
QModelIndex FlmHQReportModel::index(int row, int column, const QModelIndex &parent) const
|
||||
{
|
||||
if (!hasIndex(row, column, parent))
|
||||
return QModelIndex();
|
||||
|
||||
if (!parent.isValid())
|
||||
{
|
||||
if (row >= 0 && row < m_data.size())
|
||||
return createIndex(row, column, quintptr(0)); // internalId = 0 für Parents
|
||||
}
|
||||
else
|
||||
{
|
||||
if (parent.internalId() == 0)
|
||||
{
|
||||
int parentRow = parent.row();
|
||||
return createIndex(row, column, quintptr(parentRow + 1));
|
||||
}
|
||||
}
|
||||
|
||||
return QModelIndex();
|
||||
}
|
||||
void FlmHQReportModel::addHQReportData(const HQData &data)
|
||||
{
|
||||
beginInsertRows(QModelIndex(), rowCount(), rowCount());
|
||||
m_data.append(data);
|
||||
QList<HQData> childProperties;
|
||||
HQData copyData = data;
|
||||
|
||||
if (!data.properties.empty())
|
||||
{
|
||||
QJsonDocument doc = QJsonDocument::fromJson(QByteArray::fromStdString(data.properties));
|
||||
// Hole Einträge aus den properties
|
||||
if (doc.isArray())
|
||||
{
|
||||
QJsonArray jsonArray = doc.array();
|
||||
for (const QJsonValue &value : jsonArray)
|
||||
{
|
||||
QString prop = value.toString().trimmed();
|
||||
if (!prop.isEmpty() && prop != data.name)
|
||||
{
|
||||
HQData childData;
|
||||
childData.id = data.id;
|
||||
childData.name = prop;
|
||||
copyData.children.insert(childData.id);
|
||||
childProperties.append(childData);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
QString prop = QString::fromStdString(data.properties).trimmed();
|
||||
if (!prop.isEmpty() && prop != data.name)
|
||||
{
|
||||
HQData childData;
|
||||
childData.id = data.id;
|
||||
childData.name = prop;
|
||||
childProperties.append(childData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
beginInsertRows(QModelIndex(), m_data.count(), m_data.count());
|
||||
m_data.append(copyData);
|
||||
|
||||
if (!childProperties.isEmpty())
|
||||
m_movedData.insert(data.id, childProperties);
|
||||
endInsertRows();
|
||||
}
|
||||
|
||||
void FlmHQReportModel::deleteHQReportData(const HQData &data)
|
||||
{
|
||||
beginInsertRows(QModelIndex(), rowCount(), rowCount());
|
||||
endInsertRows();
|
||||
|
||||
const int zeile = m_data.indexOf(data);
|
||||
|
||||
if (zeile == -1) {
|
||||
if (zeile == -1)
|
||||
return;
|
||||
}
|
||||
|
||||
beginRemoveRows(QModelIndex(), zeile, zeile);
|
||||
m_data.removeAt(zeile);
|
||||
@@ -202,40 +329,53 @@ void FlmHQReportModel::deleteHQReportData(const HQData &data)
|
||||
|
||||
void FlmHQReportModel::onFileContentChanged(const FileContent &content, DataModification modType)
|
||||
{
|
||||
HQData data;
|
||||
data.id = content.id();
|
||||
data.name = QString::fromStdString(content.name());
|
||||
if (content.folderId() != m_contentFolderId || content.fileType() != m_fileType)
|
||||
return;
|
||||
|
||||
if (content.fileStatus() == FileStatus::Deleted) {
|
||||
if (modType == DataModification::eModified || modType == DataModification::eAdded) {
|
||||
HQData data;
|
||||
data.id = content.id();
|
||||
data.name = QString::fromStdString(content.name());
|
||||
data.properties = content.properties();
|
||||
|
||||
DEBUG_LOG(m_logger) << "FlmHQReportModel::onFileContentChanged " << "properties " << data.properties << " " << " Name: " << data.name;
|
||||
|
||||
if (content.fileStatus() == FileStatus::Deleted)
|
||||
{
|
||||
if (modType == DataModification::eModified || modType == DataModification::eAdded)
|
||||
deleteHQReportData(data);
|
||||
}
|
||||
} else if (modType == DataModification::eAdded) {
|
||||
else if (modType == DataModification::eAdded)
|
||||
{
|
||||
addHQReportData(data);
|
||||
}
|
||||
}
|
||||
|
||||
int FlmHQReportModel::folderId() const
|
||||
{
|
||||
return m_contentFolderId;
|
||||
}
|
||||
int FlmHQReportModel::folderId() const { return m_contentFolderId; }
|
||||
|
||||
QMap<int, QList<int>> FlmHQReportModel::getHQToPlan() const
|
||||
QMap<int, QSet<int>> FlmHQReportModel::getChangedPlans() const
|
||||
{
|
||||
QMap<int, QList<int>> hqToPlan;
|
||||
QMap<int, QSet<int>> hqToPlan;
|
||||
|
||||
for (auto it = m_movedData.constBegin(); it != m_movedData.constEnd(); ++it)
|
||||
{
|
||||
const QList<HQData> &movedData = it.value();
|
||||
QList<int> hqIds;
|
||||
QSet<int> hqIds;
|
||||
|
||||
hqIds.reserve(movedData.size());
|
||||
|
||||
for (const HQData ¤tData : movedData)
|
||||
hqIds.append(currentData.id);
|
||||
hqIds.insert(currentData.id);
|
||||
|
||||
HQData myPlan;
|
||||
for (const auto &plan : m_data)
|
||||
{
|
||||
if (plan.id == it.key())
|
||||
{
|
||||
myPlan = plan;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (myPlan.children != hqIds)
|
||||
hqToPlan.insert(it.key(), hqIds);
|
||||
}
|
||||
|
||||
@@ -244,51 +384,47 @@ QMap<int, QList<int>> FlmHQReportModel::getHQToPlan() const
|
||||
|
||||
void FlmHQReportModel::clearMovedData()
|
||||
{
|
||||
if (m_movedData.isEmpty())
|
||||
return;
|
||||
|
||||
beginResetModel();
|
||||
m_movedData.clear();
|
||||
endResetModel();
|
||||
|
||||
emit dataAddedOrRemoved();
|
||||
emit dataChanged(index(0, 0), index(rowCount() - 1, 0));
|
||||
}
|
||||
|
||||
QString FlmHQReportModel::createText(int dataIndex) const
|
||||
void FlmHQReportModel::addMovedData(const QModelIndex &parentIndex, const HQData &movedData)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " dataIndex: " << dataIndex;
|
||||
|
||||
if (dataIndex < 0 || dataIndex >= m_data.size())
|
||||
return QString();
|
||||
|
||||
const HQData &data = m_data.at(dataIndex);
|
||||
|
||||
if (!m_movedData.contains(data.id))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "No moved data for " << data.name;
|
||||
return data.name;
|
||||
}
|
||||
|
||||
const QList<HQData> &movedData = m_movedData.value(data.id);
|
||||
QStringList movedDataNames;
|
||||
|
||||
movedDataNames.reserve(movedData.size());
|
||||
|
||||
for (const HQData ¤tMovedData : movedData)
|
||||
movedDataNames.append(currentMovedData.name);
|
||||
|
||||
return QString(QStringLiteral("%1 (%2)")).arg(data.name).arg(movedDataNames.join(QLatin1Char(',')));
|
||||
}
|
||||
|
||||
void FlmHQReportModel::addMovedData(int dataIndex, const HQData &movedData)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " dataIndex: " << dataIndex << ", movedData.id: " << movedData.id << ", movedData.name: " << movedData.name;
|
||||
|
||||
int dataIndex = parentIndex.row();
|
||||
if (dataIndex < 0 || dataIndex >= m_data.size())
|
||||
return;
|
||||
|
||||
const HQData &data = m_data.at(dataIndex);
|
||||
|
||||
if (data.id == movedData.id)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "DROP ABGEWIESEN: PlanId entspricht der ReportId (" << data.id << ")";
|
||||
return;
|
||||
}
|
||||
|
||||
if (!m_movedData.contains(data.id))
|
||||
m_movedData.insert(data.id, QList<HQData>());
|
||||
|
||||
m_movedData[data.id].append(movedData);
|
||||
}
|
||||
const QList<HQData> &existingChildren = m_movedData[data.id];
|
||||
for (const HQData &child : existingChildren)
|
||||
{
|
||||
if (child.id == movedData.id || child.name.trimmed() == movedData.name.trimmed())
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "DROP ABGEWIESEN: Element '" << movedData.name << "' ist bereits vorhanden.";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
int newRow = m_movedData[data.id].size();
|
||||
|
||||
beginInsertRows(parentIndex, newRow, newRow);
|
||||
m_movedData[data.id].append(movedData);
|
||||
endInsertRows();
|
||||
}
|
||||
} // namespace FileManagement
|
||||
@@ -1,14 +1,13 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
#include <QObject>
|
||||
#include <QAbstractListModel>
|
||||
#include <QStandardItemModel>
|
||||
#include <QList>
|
||||
#include <QMimeData>
|
||||
#include <QByteArray>
|
||||
#include <QDataStream>
|
||||
#include <QMimeData>
|
||||
#include <QObject>
|
||||
#include <QSet>
|
||||
#include <QStandardItemModel>
|
||||
|
||||
#include <FileManagement/flm_enums.hpp>
|
||||
#include <FileManagement/logger.h>
|
||||
@@ -22,7 +21,7 @@ namespace Interface
|
||||
{
|
||||
class Dtc;
|
||||
}
|
||||
}
|
||||
} // namespace FileManagement
|
||||
|
||||
namespace LtsSession
|
||||
{
|
||||
@@ -33,21 +32,19 @@ namespace FileManagement
|
||||
{
|
||||
struct HQData
|
||||
{
|
||||
int id;
|
||||
int id{0};
|
||||
QString name;
|
||||
std::string properties;
|
||||
QSet<int> children;
|
||||
|
||||
bool operator==(const HQData &other) const
|
||||
{
|
||||
return id == other.id &&
|
||||
name == other.name;
|
||||
}
|
||||
bool operator==(const HQData &other) const { return id == other.id && name == other.name; }
|
||||
};
|
||||
|
||||
class FlmHQReportModel : public QAbstractListModel
|
||||
class FlmHQReportModel : public QAbstractItemModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
public:
|
||||
explicit FlmHQReportModel(QObject *parent = nullptr);
|
||||
|
||||
bool init(LtsSession::LtsSession *session, int contentFolderId, const FileManagement::FileType &fileType);
|
||||
@@ -63,35 +60,37 @@ public:
|
||||
QMimeData *mimeData(const QList<QModelIndex> &indexes) const override;
|
||||
bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override;
|
||||
bool canDropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) const override;
|
||||
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const override { return 1; }
|
||||
QModelIndex parent(const QModelIndex &index) const override;
|
||||
|
||||
void addHQReportData(const HQData &data);
|
||||
void deleteHQReportData(const HQData &data);
|
||||
|
||||
int folderId() const;
|
||||
|
||||
QMap<int, QList<int>> getHQToPlan() const;
|
||||
QMap<int, QSet<int>> getChangedPlans() const;
|
||||
void clearMovedData();
|
||||
|
||||
private:
|
||||
QString createText(int dataIndex) const;
|
||||
void addMovedData(int dataIndex, const HQData &movedData);
|
||||
private:
|
||||
void addMovedData(const QModelIndex &parentIndex, const HQData &movedData);
|
||||
|
||||
private Q_SLOTS:
|
||||
private Q_SLOTS:
|
||||
void onFileContentChanged(const FileContent &content, DataModification modType);
|
||||
|
||||
Q_SIGNALS:
|
||||
Q_SIGNALS:
|
||||
void dataAddedOrRemoved();
|
||||
|
||||
private:
|
||||
private:
|
||||
QList<HQData> m_data;
|
||||
QMap<int, QList<HQData>> m_movedData;
|
||||
const QString mimeType = QStringLiteral("application/x-custom-hqdata");
|
||||
int m_contentFolderId {-1};
|
||||
int m_contentFolderId{-1};
|
||||
FileManagement::FileType m_fileType;
|
||||
std::shared_ptr<FileManagement::Interface::Dtc> m_flmDtc;
|
||||
|
||||
LOGGER_T m_logger;
|
||||
};
|
||||
}//namespace FileManagement
|
||||
} // namespace FileManagement
|
||||
|
||||
Q_DECLARE_METATYPE(FileManagement::HQData)
|
||||
@@ -15,7 +15,7 @@
|
||||
#include <FileManagement/flm_ftc.h>
|
||||
#include <FileManagement/flm_dtc.h>
|
||||
#include <OperatorManagement/opm_dtc.h>
|
||||
#include <Core/core_dtc.h>
|
||||
#include <DDS/Core/core_dtc.h>
|
||||
#include <LtsUtilsGuiDds/request_helper.h>
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <PluginInterfaces/gui_plugin_interface.h>
|
||||
|
||||
@@ -101,3 +101,11 @@ ADD_INTERFACE_LIBRARY(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../
|
||||
)
|
||||
ENDIF()
|
||||
|
||||
# GuiElementInterface
|
||||
ADD_INTERFACE_LIBRARY(
|
||||
GuiElementInterface
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/participant_info_gui_element_interface.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/..
|
||||
Qt5::Core LtsWidgets
|
||||
)
|
||||
@@ -100,6 +100,8 @@ NGL_TARGET_LINK_LIBRARIES(PpmParticipantInfoGuiPlugin
|
||||
AesDataPluginInterface
|
||||
LtsDataView
|
||||
IsmDataPluginInterface
|
||||
LtsPluginLoader
|
||||
GuiElementInterface
|
||||
)
|
||||
|
||||
NGL_INSTALL_TARGET(PpmParticipantInfoGuiPlugin)
|
||||
|
||||
@@ -33,8 +33,10 @@
|
||||
#include <LtsSession/lts_session_data.h>
|
||||
#include <LtsUtilsCore/outdated_position.h>
|
||||
#include <LtsUtilsSettings/settings.h>
|
||||
#include <LtsPluginManager/lts_plugin_loader.h>
|
||||
|
||||
#include <Services/AreaEffectSimulation/Utils/polygons.h>
|
||||
#include <ParticipantManagement/participant_info_gui_element_interface.h>
|
||||
|
||||
#include <QJsonDocument>
|
||||
#include <QTableWidgetItem>
|
||||
@@ -471,8 +473,38 @@ bool ParticipantInfoDialog::setUiValues()
|
||||
ERROR_LOG(m_logger) << LOGFUNCTION << m_typeClass;
|
||||
}
|
||||
|
||||
#if LTS_DEBUG
|
||||
//-- start Test Gui Elment plugin
|
||||
|
||||
auto cb = [this](const LtsPluginManager::PluginInstance &pi) { return loadGuiElementPLugin(pi);};
|
||||
LtsPluginManager::LtsPluginLoader::getInstance()->loadPlugins(LtsPluginManager::PluginType::GUI_ELEMENT,
|
||||
cb,
|
||||
QStringList());
|
||||
|
||||
//-- end Test Gui Element plugin
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ParticipantInfoDialog::loadGuiElementPLugin(const LtsPluginManager::PluginInstance &pi)
|
||||
{
|
||||
WARNING_LOG(m_logger)<<">>>> GUI Element pluginName: "<<pi.fileName;
|
||||
GuiElementInterface *guiElement = qobject_cast<GuiElementInterface *>(pi.plugin);
|
||||
|
||||
if (guiElement->pluginName() == QStringLiteral("KeyValueGuiElement_XY"))
|
||||
{
|
||||
if (!guiElement->init(m_session, m_participant.id()))
|
||||
return false;
|
||||
|
||||
m_ui->gridLayout_2->addWidget(guiElement->createGuiElement(this));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
//SLOTS
|
||||
|
||||
void ParticipantInfoDialog::onDynamicParticipantDataChanged(const DynamicParticipantData &data, DataModification modType)
|
||||
|
||||
@@ -110,6 +110,7 @@ private:
|
||||
bool initTargetConfig(bool bShow);
|
||||
// Target (L400)
|
||||
bool initTargetConfigL400(bool bShow);
|
||||
bool loadGuiElementPLugin(const LtsPluginManager::PluginInstance &pi);
|
||||
|
||||
|
||||
private Q_SLOTS:
|
||||
|
||||
@@ -54,7 +54,7 @@ PartyEdit::~PartyEdit()
|
||||
|
||||
void PartyEdit::retranslate()
|
||||
{
|
||||
translate(m_ui, m_dtc->party(m_partyId), tr("Party"));
|
||||
translate(m_ui, m_dtc->party(m_partyId), trPartyName(m_dtc->party(m_partyId).name()), tr("Party"));
|
||||
m_ppmGuiCbxIfc->fillRoleComboBox(m_ui->cbRole);
|
||||
m_ppmGuiCbxIfc->fillHlaForceIdentifierComboBox(m_ui->cbHlaForceIdentifier);
|
||||
}
|
||||
|
||||
@@ -105,14 +105,11 @@ QVariant PartyModel::data(const QModelIndex &index, int role) const
|
||||
QString connectState;
|
||||
switch (status.underlying())
|
||||
{
|
||||
case ParticipantManagement::ConnectState::Connected:
|
||||
connectState = tr("Connected");
|
||||
break;
|
||||
case ParticipantManagement::ConnectState::NoHeartbeat:
|
||||
connectState = tr("No Heartbeat");
|
||||
case ParticipantManagement::ConnectState::Undefined:
|
||||
connectState = QStringLiteral("");
|
||||
break;
|
||||
default:
|
||||
connectState = QStringLiteral("");
|
||||
connectState = ParticipantManagement::toString(status);
|
||||
break;
|
||||
}
|
||||
return connectState;
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
|
||||
#include <QtPlugin>
|
||||
#include <QWidget>
|
||||
|
||||
namespace LtsSession
|
||||
{
|
||||
class LtsSession;
|
||||
}
|
||||
|
||||
class GuiElementInterface
|
||||
{
|
||||
public:
|
||||
GuiElementInterface() = default;
|
||||
virtual ~GuiElementInterface() = default;
|
||||
virtual QString pluginName() = 0;
|
||||
virtual QWidget* createGuiElement(QWidget *parent = nullptr) = 0;
|
||||
virtual bool init(LtsSession::LtsSession *session, int participantId = 0) = 0;
|
||||
};
|
||||
|
||||
// Eindeutige ID für das Qt-Plugin-System
|
||||
#define IGuiElementPlugin "gui_element:3:participantInfo.guiElement"
|
||||
Q_DECLARE_INTERFACE(GuiElementInterface, IGuiElementPlugin)
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "pre_storyboard.h" // QPointer
|
||||
#include "filter_topic.h"
|
||||
|
||||
#include <Core/core_dtc.h>
|
||||
#include <DDS/Core/core_dtc.h>
|
||||
#include <PluginInterfaces/topic_replay_interface.h>
|
||||
#include <LtsPluginManager/lts_plugin_manager.h>
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
#include "pre_journal_types.h"
|
||||
#include "pre_utils.h"
|
||||
|
||||
#include <Core/core_dtc.h>
|
||||
#include <DDS/Core/core_dtc.h>
|
||||
#include <LtsPluginManager/lts_plugin_manager.h>
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <LtsUtilsGuiDds/request_helper.h>
|
||||
|
||||
@@ -9,12 +9,12 @@
|
||||
|
||||
#include "srm_data_plugin.h"
|
||||
|
||||
#include <Core/core_dtc.h>
|
||||
#include <DDS/Core/core_dtc.h>
|
||||
#include <SituationReplayManagement/srm_ftc.h>
|
||||
#include <LtsSession/lts_session_data_dds.h>
|
||||
#include <DDS/DDSConnector/dds_connector.h>
|
||||
#include <DDS/QosProfile/DDS_DefaultQos.h>
|
||||
#include <Core/core_dts_types.h>
|
||||
#include <DDS/Core/core_dts_types.h>
|
||||
#include <DDS/DTS/generic_dts_impl.h>
|
||||
#include <SituationReplayManagement/logger.h>
|
||||
#include <LtsUtilsCore/await.h>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include <Services/SituationReplayManagement/srm_ftc.h>
|
||||
#include <Plugins/SituationReplayManagement/srm_data_plugin_interface.h>
|
||||
#include <Services/SituationReplayManagement/logger.h>
|
||||
#include <Core/core_dtc.h>
|
||||
#include <DDS/Core/core_dtc.h>
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <LtsUtilsGuiDds/request_helper.h>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <SituationReplayManagement/srm_dtc.h>
|
||||
#include <Core/core_dtc.h>
|
||||
#include <DDS/Core/core_dtc.h>
|
||||
#include <SituationReplayManagement/logger.h>
|
||||
|
||||
#include <LtsWidgets/lts_abstract_table_model.h>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#include <PluginInterfaces/data_plugin_interface.h>
|
||||
#include <SituationReplayManagement/srm_ftc.h>
|
||||
#include <Core/core_dtc.h>
|
||||
#include <DDS/Core/core_dtc.h>
|
||||
|
||||
namespace Core
|
||||
{
|
||||
|
||||
@@ -457,6 +457,10 @@ UsePvSan=true
|
||||
# Default -> @Point(0 0)
|
||||
;webSocketServerPortRange/3=@Point(0 0)
|
||||
|
||||
# ADLER WebSocket
|
||||
# sets the interval, in milliseconds, after which the ADLER WebSocket connection is reported as disconnected.
|
||||
AdlerKeepalive=30000
|
||||
|
||||
#############################
|
||||
# IPS/OPS GPS transition
|
||||
# DistanceIpsToGps=0 Distance of the first GPS coordinate to the building after an IPS position default = 0 [m] (int)
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "dds_handler.h"
|
||||
|
||||
#include <Core/pacemaker.h>
|
||||
#include <DDS/Core/pacemaker.h>
|
||||
|
||||
namespace Buildings
|
||||
{
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "main_handler.h"
|
||||
#include "settings.h"
|
||||
#include <Core/pacemaker.h>
|
||||
#include <DDS/Core/pacemaker.h>
|
||||
#include <AssetManagement/asm_dtc.h>
|
||||
#include <QObject>
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include <AudioVideoManagement/avm_ftc.h>
|
||||
#include <ExerciseManagement/exm_dtc.h>
|
||||
#include <InfrastructureManagement/ism_dtc.h>
|
||||
#include <Core/pacemaker.h>
|
||||
#include <DDS/Core/pacemaker.h>
|
||||
|
||||
namespace CombatNetRadio
|
||||
{
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "active_exercises.h"
|
||||
#include "exercise_manager.h"
|
||||
#include "WebSocketInterface/websocket_interface_handler.h"
|
||||
#include <Core/pacemaker.h>
|
||||
#include <DDS/Core/pacemaker.h>
|
||||
|
||||
using namespace CombatNetRadio;
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "cmo_fts.h"
|
||||
|
||||
#include <DDS/DTS/generic_dts_impl.h>
|
||||
#include <Core/pacemaker.h>
|
||||
#include <DDS/Core/pacemaker.h>
|
||||
|
||||
#include <InfrastructureManagement/ism_dtc.h>
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <DDS/DDSConnector/dds_connector.h>
|
||||
#include <Core/core_dts_types.h>
|
||||
#include <DDS/Core/core_dts_types.h>
|
||||
|
||||
#include <ComponentMonitor/cmo_dts.h>
|
||||
#include <ComponentMonitor/cmo_fts.h>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
#include <DDS/DDSConnector/dds_connector.h>
|
||||
#include <ngldb/db_service_handler.h>
|
||||
#include <Core/pacemaker.h>
|
||||
#include <DDS/Core/pacemaker.h>
|
||||
|
||||
namespace ComponentMonitor
|
||||
{
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
#include "dds_handler.h"
|
||||
#include <Core/pacemaker.h>
|
||||
#include <DDS/Core/pacemaker.h>
|
||||
|
||||
namespace DifferentialGPS
|
||||
{
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#include <QMutexLocker>
|
||||
#include <QTimer>
|
||||
#include <Core/pacemaker.h>
|
||||
#include <DDS/Core/pacemaker.h>
|
||||
|
||||
namespace DifferentialGPS
|
||||
{
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include <GuezNasat/gna_db.h>
|
||||
|
||||
#include <DDS/DDSConnector/dds_connector.h>
|
||||
#include <Core/pacemaker.h>
|
||||
#include <DDS/Core/pacemaker.h>
|
||||
|
||||
#include <QTimer>
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "dds_handler.h"
|
||||
|
||||
#include <Core/pacemaker.h>
|
||||
#include <DDS/Core/pacemaker.h>
|
||||
#include <DDS/DTS/generic_dts_impl.h>
|
||||
|
||||
namespace HighLevelArchitecture
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <DDS/DDSConnector/dds_connector.h>
|
||||
#include <Core/core_dts_types.h>
|
||||
#include <DDS/Core/core_dts_types.h>
|
||||
#include <ExerciseManagement/exm_dtc.h>
|
||||
#include <QObject>
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <Common/settings.h>
|
||||
#include <QCoreApplication>
|
||||
#include <QTimer>
|
||||
#include <Core/pacemaker.h>
|
||||
#include <DDS/Core/pacemaker.h>
|
||||
|
||||
namespace HighLevelArchitecture
|
||||
{
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "dds_handler.h"
|
||||
|
||||
#include <Core/pacemaker.h>
|
||||
#include <DDS/Core/pacemaker.h>
|
||||
#include <DDS/DTS/generic_dts_impl.h>
|
||||
|
||||
namespace HighLevelArchitecture
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <DDS/DDSConnector/dds_connector.h>
|
||||
#include <Core/core_dts_types.h>
|
||||
#include <DDS/Core/core_dts_types.h>
|
||||
#include <ExerciseManagement/exm_dtc.h>
|
||||
#include <QObject>
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include <QTimer>
|
||||
#include <Common/settings.h>
|
||||
#include <Common/logger.h>
|
||||
#include <Core/pacemaker.h>
|
||||
#include <DDS/Core/pacemaker.h>
|
||||
|
||||
namespace HighLevelArchitecture
|
||||
{
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include <QTimer>
|
||||
#include <Common/settings.h>
|
||||
#include <Common/logger.h>
|
||||
#include <Core/pacemaker.h>
|
||||
#include <DDS/Core/pacemaker.h>
|
||||
|
||||
namespace HighLevelArchitecture
|
||||
{
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
#include "aes_handler.h"
|
||||
#include "Core/function_reply_object.h"
|
||||
#include "DDS/Core/function_reply_object.h"
|
||||
#include "aes.hpp"
|
||||
#include "json_dispatcher.h"
|
||||
#include <QJsonArray>
|
||||
@@ -525,7 +525,11 @@ void AesHandler::handleEffectCluster(const WirkfeldplanungData &data, int wsId)
|
||||
// maye wrong?
|
||||
// not only maybe.. we need to swap .. yes..
|
||||
area.height(data.zieldaten.breiteRadius);
|
||||
if (data.zieldaten.tiefe > 0)
|
||||
area.width(data.zieldaten.tiefe);
|
||||
else
|
||||
if (data.zieldaten.geometrie == ProjectDataManagement::L4_TargetGeometry::Linear)
|
||||
area.width(5); // E01562-472 [Verbund] ImpactWidth invalid. Ein Wirkfeld mit der Zielgeometrie "Linear" kann nicht verarbeitet werden.
|
||||
}
|
||||
|
||||
if (!createArea)
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Core/function_reply_object.h"
|
||||
#include "DDS/Core/function_reply_object.h"
|
||||
#include "logger.h"
|
||||
#include "main_dispatcher.h"
|
||||
#include "telegrams.h"
|
||||
|
||||
@@ -477,25 +477,17 @@ void JsonDispatcher::onSAASQWS(const int wsId, const Waffensystemdaten &exSQWS)
|
||||
const bool isVerbund = true;
|
||||
auto saa = getSAAByWs(wsId);
|
||||
int partyId = saa->getPartyId();
|
||||
QStringList args;
|
||||
|
||||
const ParticipantManagement::Participant &part = m_ppmHandler->findParticipantByInternalName(exSQWS.einheit.verein, partyId, isVerbund);
|
||||
|
||||
QString content = QString::fromUtf8(tr_lts("Notification","<a href='lts://ParticipantInfo/%1'>Show Participant Info</a><br /><B>Unit:</B> %2/%3/%4"));
|
||||
args.append(QString::number(part.id()));
|
||||
args.append(ortsIdMap.key(exSQWS.einheit.oi));
|
||||
args.append(QString::number(exSQWS.einheit.r));
|
||||
args.append(exSQWS.einheit.verein);
|
||||
|
||||
DEBUG_LOG(m_logger) << "Stellungsmeldung Waffensystem content=" << content;
|
||||
createNotificationRequest(wsId,
|
||||
QString::fromUtf8(tr_lts("Notification","Weapon System Position Report")),
|
||||
NotificationManagement::MessageType_def::Info,
|
||||
NotificationManagement::NotificationType::AdlerNotification,
|
||||
content,
|
||||
args);
|
||||
// Parse in party SAA
|
||||
m_ppmHandler->parseSQWS(exSQWS, wsId);
|
||||
if (part.id() > 0)
|
||||
{
|
||||
sendParticipantInfoNotification(wsId, partyId, isVerbund, exSQWS.einheit);
|
||||
return;
|
||||
}
|
||||
QTimer::singleShot(5000, this, [this, wsId, partyId, isVerbund, exSQWS]() {
|
||||
sendParticipantInfoNotification(wsId, partyId, isVerbund, exSQWS.einheit);
|
||||
});
|
||||
}
|
||||
|
||||
void JsonDispatcher::onSAASQFS(const int wsId, const Feuerstellungsdaten &exSQFS)
|
||||
@@ -504,25 +496,17 @@ void JsonDispatcher::onSAASQFS(const int wsId, const Feuerstellungsdaten &exSQFS
|
||||
auto saa = getSAAByWs(wsId);
|
||||
int partyId = saa->getPartyId();
|
||||
const bool isVerbund = true;
|
||||
QStringList args;
|
||||
|
||||
const ParticipantManagement::Participant &part = m_ppmHandler->findParticipantByInternalName(exSQFS.feuereinheit.verein, partyId, isVerbund);
|
||||
|
||||
QString content = QString::fromUtf8(tr_lts("Notification","<a href='lts://ParticipantInfo/%1'>Show Participant Info</a><br /><B>Unit:</B> %2/%3/%4"));
|
||||
args.append(QString::number(part.id()));
|
||||
args.append(ortsIdMap.key(exSQFS.feuereinheit.oi));
|
||||
args.append(QString::number(exSQFS.feuereinheit.r));
|
||||
args.append(exSQFS.feuereinheit.verein);
|
||||
|
||||
DEBUG_LOG(m_logger) << "Stellungsmeldung Feuerstellung content=" << content;
|
||||
createNotificationRequest(wsId,
|
||||
QString::fromUtf8(tr_lts("Notification","Position Report: Firing Unit")),
|
||||
NotificationManagement::MessageType_def::Info,
|
||||
NotificationManagement::NotificationType::AdlerNotification,
|
||||
content,
|
||||
args);
|
||||
// Parse in party SAA
|
||||
m_ppmHandler->parseSQFS(exSQFS, wsId);
|
||||
const ParticipantManagement::Participant &part = m_ppmHandler->findParticipantByInternalName(exSQFS.feuereinheit.verein, partyId, isVerbund);
|
||||
if (part.id() > 0)
|
||||
{
|
||||
sendParticipantInfoNotification(wsId, partyId, isVerbund, exSQFS.feuereinheit);
|
||||
return;
|
||||
}
|
||||
QTimer::singleShot(5000, this, [this, wsId, partyId, isVerbund, exSQFS]() {
|
||||
sendParticipantInfoNotification(wsId, partyId, isVerbund, exSQFS.feuereinheit);
|
||||
});
|
||||
}
|
||||
|
||||
void JsonDispatcher::onSAASQLP(const int wsId, const Ladeplatzdaten &exSQLP)
|
||||
@@ -531,17 +515,35 @@ void JsonDispatcher::onSAASQLP(const int wsId, const Ladeplatzdaten &exSQLP)
|
||||
auto saa = getSAAByWs(wsId);
|
||||
int partyId = saa->getPartyId();
|
||||
const bool isVerbund = true;
|
||||
QStringList args;
|
||||
|
||||
const ParticipantManagement::Participant &part = m_ppmHandler->findParticipantByInternalName(exSQLP.einheit.verein, partyId, isVerbund);
|
||||
DEBUG_LOG(m_logger) << "ParticipantId=" << part.id();
|
||||
|
||||
|
||||
m_ppmHandler->parseSQLP(exSQLP, wsId);
|
||||
if (part.id() > 0)
|
||||
{
|
||||
sendParticipantInfoNotification(wsId, partyId, isVerbund, exSQLP.einheit);
|
||||
return;
|
||||
}
|
||||
QTimer::singleShot(5000, this, [this, wsId, partyId, exSQLP]() {
|
||||
sendParticipantInfoNotification(wsId, partyId, isVerbund, exSQLP.einheit);
|
||||
});
|
||||
}
|
||||
|
||||
void JsonDispatcher::sendParticipantInfoNotification(const int wsId, const int partyId, const bool isVerbund, const Einheit &einheit)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "sendParticipantInfoNotification";
|
||||
QStringList args;
|
||||
|
||||
const ParticipantManagement::Participant &part = m_ppmHandler->findParticipantByInternalName(einheit.verein, partyId, isVerbund);
|
||||
DEBUG_LOG(m_logger) << "sendParticipantInfoNotification ParticipantId=" << part.id();
|
||||
|
||||
QString content = QString::fromUtf8(tr_lts("Notification","<a href='lts://ParticipantInfo/%1'>Show Participant Info</a><br /><B>Unit:</B> %2/%3/%4"));
|
||||
|
||||
args.append(QString::number(part.id()));
|
||||
args.append(ortsIdMap.key(exSQLP.einheit.oi));
|
||||
args.append(QString::number(exSQLP.einheit.r));
|
||||
args.append(exSQLP.einheit.verein);
|
||||
args.append(ortsIdMap.key(einheit.oi));
|
||||
args.append(QString::number(einheit.r));
|
||||
args.append(einheit.verein);
|
||||
|
||||
createNotificationRequest(wsId,
|
||||
QString::fromUtf8(tr_lts("Notification","Loading Point Position Report")),
|
||||
@@ -549,9 +551,7 @@ void JsonDispatcher::onSAASQLP(const int wsId, const Ladeplatzdaten &exSQLP)
|
||||
NotificationManagement::NotificationType::AdlerNotification,
|
||||
content,
|
||||
args);
|
||||
DEBUG_LOG(m_logger) << "Stellungsmeldung Ladeplatz content=" << content;
|
||||
// Parse in party SAA
|
||||
m_ppmHandler->parseSQLP(exSQLP, wsId);
|
||||
DEBUG_LOG(m_logger) << "Stellungsmeldung content=" << content;
|
||||
}
|
||||
|
||||
void JsonDispatcher::onSAATrajectoryData(const int wsId, const Flugbahndaten &exFlugbahndaten, const QString referenceUuid)
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <QObject>
|
||||
#include <QVector>
|
||||
#include <QWebSocket>
|
||||
#include <Core/function_reply_object.h> // tr_lts
|
||||
#include <DDS/Core/function_reply_object.h> // tr_lts
|
||||
#include <TrainingAreaBase/tab_plugin_interface.h>
|
||||
// #include "logger.h"
|
||||
#include "aes_handler.h"
|
||||
@@ -98,6 +98,7 @@ class JsonDispatcher final
|
||||
void onSAASQWS(const int wsId, const Waffensystemdaten &exSQWS);
|
||||
void onSAASQFS(const int wsId, const Feuerstellungsdaten &exSQFS);
|
||||
void onSAASQLP(const int wsId, const Ladeplatzdaten &exSQLP);
|
||||
void sendParticipantInfoNotification(const int wsId, const int partyId, const bool isVerbund, const Einheit &einheit);
|
||||
void onSAAHXGuidingLines(const int wsId, const Koordinierungsdaten &koordinierungsdaten);
|
||||
void onSAAHXGuidingLinesAndBoundaries(const int wsId, const Fuehrungsdaten &fuehrungsdaten);
|
||||
void onSSAEXFIREHALT(const int wsId, const FeuerHaltDaten &feuerhaltdaten);
|
||||
|
||||
@@ -203,12 +203,13 @@ bool JsonHandlerRx::handleTelegram(int wsId, const QJsonObject &telegram, int &e
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "[EX_GUIDING_LINES] EX-HQ Koordinierungsmassnahmen";
|
||||
auto data = telegram[JsonKeys::DATA()].toObject();
|
||||
const QString artStr = data.value(JsonKeys::ART()).toString(QStringLiteral("Koordinierungsmassnahmen"));
|
||||
Koordinierungsdaten koordinierungsdaten;
|
||||
bool bOk = true;
|
||||
koordinierungsdatenFromJson(data, koordinierungsdaten, bOk);
|
||||
|
||||
if (koordinierungsdaten.name.isEmpty())
|
||||
koordinierungsdaten.name = QString(QStringLiteral("%1 - %2")).arg(typeName).arg(uuid);
|
||||
koordinierungsdaten.name = QString(QStringLiteral("%1 - %2")).arg(typeName).arg(artStr);
|
||||
else
|
||||
koordinierungsdaten.name = QString(QStringLiteral("%1 - %2")).arg(typeName).arg(koordinierungsdaten.name);
|
||||
|
||||
@@ -219,12 +220,13 @@ bool JsonHandlerRx::handleTelegram(int wsId, const QJsonObject &telegram, int &e
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "[EX_GUIDING_LINES_AND_BOUNDARIES] EX-HQ(G)Fuehrungslinien und Grenzen ";
|
||||
auto data = telegram[JsonKeys::DATA()].toObject();
|
||||
const QString artStr = data.value(JsonKeys::ART()).toString(QStringLiteral("Fuehrungslinien und Grenzen"));
|
||||
Fuehrungsdaten fuehrungsdaten;
|
||||
bool bOk = true;
|
||||
fuehrungsdatenFromJson(data, fuehrungsdaten, bOk);
|
||||
|
||||
if (fuehrungsdaten.name.isEmpty())
|
||||
fuehrungsdaten.name = QString(QStringLiteral("%1 - %2")).arg(typeName).arg(uuid);
|
||||
fuehrungsdaten.name = QString(QStringLiteral("%1 - %2")).arg(typeName).arg(artStr);
|
||||
else
|
||||
fuehrungsdaten.name = QString(QStringLiteral("%1 - %2")).arg(typeName).arg(fuehrungsdaten.name);
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "json_dispatcher.h"
|
||||
//#include "json_handler_tx.h"
|
||||
#include <nglsettings/nglsettings_settings.h>
|
||||
#include <Core/pacemaker.h>
|
||||
#include <DDS/Core/pacemaker.h>
|
||||
#include <QTimer>
|
||||
|
||||
namespace AdlerJson
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#include <QObject>
|
||||
#include <TrainingAreaBase/tab_plugin_interface.h>
|
||||
#include <Core/function_reply_object.h> // tr_lts
|
||||
#include <DDS/Core/function_reply_object.h> // tr_lts
|
||||
#include <TrainingAreaBase/dds_handler.h>
|
||||
//#include "logger.h"
|
||||
#include "ppm_handler.h"
|
||||
|
||||
@@ -1916,33 +1916,13 @@ Szenarstatus strToSzenarstatus(QString status) { return szenarstatusMap.value(st
|
||||
|
||||
int getFeuerkommandoRaketeEffectDurationMsec(const QJsonObject &data)
|
||||
{
|
||||
bool bOk = false;
|
||||
int wirkzeitMsec;
|
||||
switch (toInteger(data[JsonKeys::WIRKZEIT()], bOk)){
|
||||
case 1:
|
||||
wirkzeitMsec = 3 * 60 * 60 * 1000;
|
||||
break;
|
||||
case 2:
|
||||
wirkzeitMsec = 6 * 60 * 60 * 1000;
|
||||
break;
|
||||
case 3:
|
||||
wirkzeitMsec = 12 * 60 * 60 * 1000;
|
||||
break;
|
||||
case 4:
|
||||
wirkzeitMsec = 24 * 60 * 60 * 1000;
|
||||
break;
|
||||
case 5:
|
||||
wirkzeitMsec = 48 * 60 * 60 * 1000;
|
||||
break;
|
||||
case 6:
|
||||
wirkzeitMsec = 96 * 60 * 60 * 1000;
|
||||
break;
|
||||
default:
|
||||
wirkzeitMsec = 3 * 60 * 60 * 1000;
|
||||
break;
|
||||
}
|
||||
constexpr int hourToMsec = 60 * 60 * 1000;
|
||||
constexpr int defaultWirkzeitMsec = 3 * hourToMsec;
|
||||
|
||||
return wirkzeitMsec;
|
||||
bool bOk = false;
|
||||
int wirkzeitHour = toInteger(data[JsonKeys::WIRKZEIT()], bOk);
|
||||
|
||||
return (bOk ? wirkzeitHour * hourToMsec : defaultWirkzeitMsec);
|
||||
}
|
||||
|
||||
} // namespace AdlerJson
|
||||
@@ -383,15 +383,15 @@ template <> QJsonObject EXStatus::toJsonInternal<EXStatus>();
|
||||
// EX-L13
|
||||
struct SAATELEGRAMS_EXPORT Koordinate
|
||||
{
|
||||
double latitude; // -90.0…90.0
|
||||
double longitude; // -180.0…180.0
|
||||
double latitude {0.0}; // -90.0…90.0
|
||||
double longitude {0.0}; // -180.0…180.0
|
||||
};
|
||||
|
||||
// EX-L14
|
||||
struct SAATELEGRAMS_EXPORT KoordinateMitHoehe
|
||||
{
|
||||
Koordinate koordinate; // EX-L13
|
||||
int hoehe; // EX-L5 -399…9999 Meter
|
||||
int hoehe {0}; // EX-L5 -399…9999 Meter
|
||||
};
|
||||
|
||||
// EX-L6 Abfeuerungsart
|
||||
@@ -683,10 +683,10 @@ struct SAATELEGRAMS_EXPORT FeuerkommandoGeschosse
|
||||
QString ladung; // EX-L10 (table pdm_load_type)
|
||||
QString zuender; // EX-L11 (table pdm_igniter_type)
|
||||
QString zuenderFunktion; // EX-L41 (table pdm_igniter_function)
|
||||
double zuenderZeit; // [ms]
|
||||
int anzahl;
|
||||
int ladungsNummer;
|
||||
double intervall; // [s]
|
||||
double zuenderZeit {0.0};// [ms]
|
||||
int anzahl {-1};
|
||||
int ladungsNummer {-1};
|
||||
double intervall {0.0}; // [s]
|
||||
};
|
||||
|
||||
// EX-L35 Flugbahnpunkt
|
||||
@@ -744,22 +744,22 @@ struct SAATELEGRAMS_EXPORT WirkmittelFeuerkommando
|
||||
struct SAATELEGRAMS_EXPORT Treffpunkt
|
||||
{
|
||||
KoordinateMitHoehe koordinate; // EX-L14
|
||||
int anzahl;
|
||||
int anzahl {-1};
|
||||
};
|
||||
|
||||
// EX-L49 Wirkmittel Feuerkommando Rakete
|
||||
struct SAATELEGRAMS_EXPORT WirkmittelFeuerkommandoRakete
|
||||
{
|
||||
ProjectDataManagement::L27_EffectorId kenner; // EX-L27
|
||||
ProjectDataManagement::L27_EffectorId kenner {ProjectDataManagement::L27_EffectorId_def::get_default()}; // EX-L27
|
||||
QVector<Treffpunkt> treffpunkte;
|
||||
double flugzeit;
|
||||
int gipfelhoehe;
|
||||
double schussrichtung;
|
||||
int fallwinkel;
|
||||
ProjectDataManagement::L48_TrajectoryRocket anflug;
|
||||
double flugzeit {0.0};
|
||||
int gipfelhoehe {0};
|
||||
double schussrichtung {0.0};
|
||||
int fallwinkel {0};
|
||||
ProjectDataManagement::L48_TrajectoryRocket anflug {ProjectDataManagement::L48_TrajectoryRocket_def::get_default()};
|
||||
FeuerkommandoGeschosse geschoss;
|
||||
ProjectDataManagement::L46_GpsFrequency gps;
|
||||
int wirkzeit;
|
||||
ProjectDataManagement::L46_GpsFrequency gps {ProjectDataManagement::L46_GpsFrequency_def::get_default()};
|
||||
int wirkzeit {-1};
|
||||
};
|
||||
|
||||
// EX-L33 Feuerkommando
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "dds_handler.h"
|
||||
|
||||
#include <Core/pacemaker.h>
|
||||
#include <DDS/Core/pacemaker.h>
|
||||
|
||||
namespace ApHlaJson
|
||||
{
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include <QObject>
|
||||
#include <QWebSocket>
|
||||
#include <TrainingAreaBase/tab_plugin_interface.h>
|
||||
#include <Core/function_reply_object.h> // tr_lts
|
||||
#include <DDS/Core/function_reply_object.h> // tr_lts
|
||||
#include "logger.h"
|
||||
#include "ppm_handler.h"
|
||||
#include "aes_handler.h"
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
#include <QObject>
|
||||
#include <TrainingAreaBase/tab_plugin_interface.h>
|
||||
#include <Core/function_reply_object.h> // tr_lts
|
||||
#include <DDS/Core/function_reply_object.h> // tr_lts
|
||||
#include "dds_handler.h"
|
||||
#include "logger.h"
|
||||
#include "ppm_handler.h"
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
#include <QObject>
|
||||
#include <TrainingAreaBase/tab_plugin_interface.h>
|
||||
#include <Core/function_reply_object.h>
|
||||
#include <DDS/Core/function_reply_object.h>
|
||||
#include "../TetraJson/convert_from_json.h"
|
||||
#include "convert_to_json_file.h"
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include <QObject>
|
||||
#include <QWebSocket>
|
||||
#include <TrainingAreaBase/tab_plugin_interface.h>
|
||||
#include <Core/function_reply_object.h> // tr_lts
|
||||
#include <DDS/Core/function_reply_object.h> // tr_lts
|
||||
#include "logger.h"
|
||||
|
||||
class QTimer;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
#include <QObject>
|
||||
#include <TrainingAreaBase/tab_plugin_interface.h>
|
||||
#include <Core/function_reply_object.h> // tr_lts
|
||||
#include <DDS/Core/function_reply_object.h> // tr_lts
|
||||
#include "logger.h"
|
||||
|
||||
namespace HlaJson
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
#include <QObject>
|
||||
#include <TrainingAreaBase/tab_plugin_interface.h>
|
||||
#include <Core/function_reply_object.h> // tr_lts
|
||||
#include <DDS/Core/function_reply_object.h> // tr_lts
|
||||
#include "logger.h"
|
||||
|
||||
namespace Nmea
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include <QUdpSocket>
|
||||
#include <TrainingAreaBase/tab_plugin_interface.h>
|
||||
#include <nglsettings/nglsettings_settings.h>
|
||||
#include <Core/function_reply_object.h> // tr_lts
|
||||
#include <DDS/Core/function_reply_object.h> // tr_lts
|
||||
#include "logger.h"
|
||||
|
||||
namespace Nmea
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
#include <TrainingAreaBase/tab_plugin_interface.h>
|
||||
#include <TrainingAreaBase/dds_handler.h>
|
||||
#include <Core/function_reply_object.h> // tr_lts
|
||||
#include <DDS/Core/function_reply_object.h> // tr_lts
|
||||
|
||||
#include <QObject>
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
#include <QObject>
|
||||
#include <TrainingAreaBase/tab_plugin_interface.h>
|
||||
#include <Core/function_reply_object.h> // tr_lts
|
||||
#include <DDS/Core/function_reply_object.h> // tr_lts
|
||||
#include "logger.h"
|
||||
|
||||
namespace WlsTetra
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include <QTimer>
|
||||
#include <TrainingAreaBase/tab_plugin_interface.h>
|
||||
#include <PrtCnv/PrtCnvApplication.hpp>
|
||||
#include <Core/function_reply_object.h> // tr_lts
|
||||
#include <DDS/Core/function_reply_object.h> // tr_lts
|
||||
#include "tetra_prtcnv.h"
|
||||
#include "logger.h"
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include <QObject>
|
||||
#include <QWebSocket>
|
||||
#include <TrainingAreaBase/tab_plugin_interface.h>
|
||||
#include <Core/function_reply_object.h> // tr_lts
|
||||
#include <DDS/Core/function_reply_object.h> // tr_lts
|
||||
#include "logger.h"
|
||||
|
||||
class QTimer;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
#include <DDS/DDSConnector/publisher.h>
|
||||
#include <DDS/DDSConnector/dds_connector.h>
|
||||
#include <Core/pacemaker.h>
|
||||
#include <DDS/Core/pacemaker.h>
|
||||
#include <DDS/DTC/generic_dtc_impl.h>
|
||||
#include <DDS/DTS/generic_dts_impl.h>
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <DDS/DDSConnector/dds_connector.h>
|
||||
#include <Core/core_dtc_types.h>
|
||||
#include <DDS/Core/core_dtc_types.h>
|
||||
|
||||
#include <TrainingAreaBase/tab_dts_types.h>
|
||||
#include <TrainingAreaBase/tab_dts.h>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include "WebSocketInterface/json_keys.h"
|
||||
|
||||
#include <AssetManagement/asm_dtc.h>
|
||||
#include <Core/pacemaker.h>
|
||||
#include <DDS/Core/pacemaker.h>
|
||||
#include <ExerciseManagement/exm_dtc.h>
|
||||
#include <LtsPluginManager/lts_plugin_loader.h>
|
||||
#include <TrainingAreaBase/tab_record_replay_plugin.h>
|
||||
|
||||
@@ -310,6 +310,9 @@ void RecvFromDdsFts::onSendCesHitRequest(const rti::core::SampleIdentity &cookie
|
||||
//data.aesTetraIdUnused = m_mainHandler->aesHandler()->tetraIdFromDdsId(request.aesId());
|
||||
data.aesDdsId = request.aesId();
|
||||
//TODO: !!!!!! Use new EventType to check which AreaEffectSimulationType will be chosen.
|
||||
if (request.eventType() == ProjectDataManagement::EventType::ExplosionCluster)
|
||||
data.aesType = TetraIcd::AreaEffectSimulationType::ExplosionArea;
|
||||
else
|
||||
data.aesType = m_mainHandler->aesHandler()->aesTypeFromId(request.aesId());
|
||||
/*!
|
||||
\brief Take the new event type attribute to check if its is a HazardArea(DangerZone/Gefahrenbereich)
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "dds_handler.h"
|
||||
|
||||
#include <Core/pacemaker.h>
|
||||
#include <DDS/Core/pacemaker.h>
|
||||
|
||||
namespace TrainingAreaBaseOC
|
||||
{
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <DDS/DDSConnector/dds_connector.h>
|
||||
#include <Core/core_dtc.h>
|
||||
#include <DDS/Core/core_dtc.h>
|
||||
|
||||
#include <TrainingAreaBaseOC/taboc_dts.h>
|
||||
#include <TrainingAreaBaseOC/taboc_fts.h>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "main_handler.h"
|
||||
#include "settings.h"
|
||||
#include "logger.h"
|
||||
#include <Core/pacemaker.h>
|
||||
#include <DDS/Core/pacemaker.h>
|
||||
|
||||
namespace TrainingAreaBaseOC
|
||||
{
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "dds_handler.h"
|
||||
|
||||
#include <Core/pacemaker.h>
|
||||
#include <DDS/Core/pacemaker.h>
|
||||
|
||||
namespace WarehouseManagement
|
||||
{
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "dds_handler_exercise.h"
|
||||
|
||||
#include <Core/pacemaker.h>
|
||||
#include <DDS/Core/pacemaker.h>
|
||||
#include <dds/domain/DomainParticipant.hpp>
|
||||
|
||||
namespace WarehouseManagement
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Created by Christian Ehrlicher, SLSE, 2016-04-14
|
||||
*/
|
||||
#include "main_handler.h"
|
||||
#include <Core/pacemaker.h>
|
||||
#include <DDS/Core/pacemaker.h>
|
||||
|
||||
namespace WarehouseManagement
|
||||
{
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "dds_handler.h"
|
||||
|
||||
#include <Core/pacemaker.h>
|
||||
#include <DDS/Core/pacemaker.h>
|
||||
|
||||
namespace WirelessLocationSystem
|
||||
{
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "main_handler.h"
|
||||
#include "settings.h"
|
||||
#include <Core/pacemaker.h>
|
||||
#include <DDS/Core/pacemaker.h>
|
||||
|
||||
namespace WirelessLocationSystem
|
||||
{
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
#pragma once
|
||||
|
||||
#include <DDS/DDSConnector/dds_connector.h>
|
||||
#include <Core/core_dtc.h>
|
||||
#include <Core/topic_lock_master.h>
|
||||
#include <DDS/Core/core_dtc.h>
|
||||
#include <DDS/Core/topic_lock_master.h>
|
||||
#include <AlarmManagement/alm_dts.h>
|
||||
#include <AlarmManagement/alm_dtc.h>
|
||||
#include <AlarmManagement/alm_fts.h>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <dds_handler.h>
|
||||
#include "logger.h"
|
||||
|
||||
#include <Core/function_reply_object.h>
|
||||
#include <DDS/Core/function_reply_object.h>
|
||||
//Generated
|
||||
#include <AlarmManagement/alm_db.h>
|
||||
|
||||
|
||||
+15
-5
@@ -40,19 +40,19 @@ AbstractFiringStrategy::~AbstractFiringStrategy()
|
||||
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
|
||||
}
|
||||
|
||||
void AbstractFiringStrategy::calculateDispersionTrajectory()
|
||||
bool AbstractFiringStrategy::calculateDispersionTrajectory()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "calculateDispersionTrajectory";
|
||||
// 1. Neuen Zielpunkt berechnen
|
||||
|
||||
const auto &intendendTrajectory = m_effector->intendendTrajectory();
|
||||
const auto intendendTrajectory = m_effector->intendendTrajectory();
|
||||
|
||||
// sanity check:
|
||||
if (intendendTrajectory.size() < 2)
|
||||
{
|
||||
ERROR_LOG(m_logger) << LOGFUNCTION
|
||||
<< " size of intendendTrajectory not sufficiant, size=" << intendendTrajectory.size();
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
LtsUtils::QPoint3D newTarget = intendendTrajectory.last().position;
|
||||
@@ -66,6 +66,16 @@ void AbstractFiringStrategy::calculateDispersionTrajectory()
|
||||
|
||||
// 2. Neue Trajektorie berechnen
|
||||
m_transformedTrajectory = TrajectoryTransform::transformToNewTarget(intendendTrajectory, newTarget);
|
||||
|
||||
// sanity check:
|
||||
if (m_transformedTrajectory.size() < 2)
|
||||
{
|
||||
ERROR_LOG(m_logger) << LOGFUNCTION
|
||||
<< " size of m_transformedTrajectory not sufficiant, size=" << m_transformedTrajectory.size();
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
std::vector<Core::GeoPositionRelativeTime> AbstractFiringStrategy::buildTrajectoryGeometry(const QVector<TrajectoryPoint> &relativeTrajectory)
|
||||
@@ -135,7 +145,7 @@ int AbstractFiringStrategy::sendChargeEffect(const TrajectoryTimeAware &trajecto
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "sendChargeEffect";
|
||||
|
||||
const auto &trajGeometry = trajectoryTimeAware.geometry();
|
||||
const auto trajGeometry = trajectoryTimeAware.geometry();
|
||||
|
||||
// sanity check:
|
||||
if (trajGeometry.size() < 2)
|
||||
@@ -165,7 +175,7 @@ int AbstractFiringStrategy::sendChargeEffect(const TrajectoryTimeAware &trajecto
|
||||
chargeEffect.trajectoryTimeAware(trajectoryTimeAware);
|
||||
|
||||
const auto &reply = m_effector->mainHandler()->chargeEffectHandler()->createChargeEffect(chargeEffect);
|
||||
DEBUG_LOG(m_logger) << "reply.id=" << reply.id() << ", str:" << reply.str() << ", uniqueId:" << reply.uniqueId();
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " reply.id=" << reply.id() << ", str:" << reply.str() << ", uniqueId:" << reply.uniqueId();
|
||||
return reply.id();
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
explicit AbstractFiringStrategy(ObjectEffector *parent);
|
||||
virtual ~AbstractFiringStrategy();
|
||||
|
||||
virtual void doFiring() = 0;
|
||||
virtual bool doFiring() = 0;
|
||||
|
||||
Q_SIGNALS:
|
||||
// Has to be emitted in doFiring() implementation!
|
||||
@@ -52,7 +52,7 @@ Q_SIGNALS:
|
||||
|
||||
protected:
|
||||
// methods:
|
||||
void calculateDispersionTrajectory();
|
||||
bool calculateDispersionTrajectory();
|
||||
std::vector<Core::GeoPositionRelativeTime> buildTrajectoryGeometry(const QVector<TrajectoryPoint> &trajectory);
|
||||
TrajectoryTimeAware buildTrajectoryTimeAware(const std::vector<Core::GeoPositionRelativeTime> &trajectoryGeometry, qint64 curTime, int index = 0);
|
||||
|
||||
|
||||
+35
-4
@@ -29,19 +29,50 @@ DefaultFiringStrategy::~DefaultFiringStrategy()
|
||||
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
|
||||
}
|
||||
|
||||
void DefaultFiringStrategy::doFiring()
|
||||
bool DefaultFiringStrategy::doFiring()
|
||||
{
|
||||
calculateDispersionTrajectory();
|
||||
// 1: calculateDispersionTrajectory
|
||||
if (!calculateDispersionTrajectory())
|
||||
{
|
||||
ERROR_LOG(m_logger) << LOGFUNCTION << " Error on calculateDispersionTrajectory";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_transformedTrajectory.size() < 2)
|
||||
{
|
||||
ERROR_LOG(m_logger) << LOGFUNCTION << " transformedTrajectory is not sufficiant"
|
||||
<< ", m_transformedTrajectory.size()" << m_transformedTrajectory.size();
|
||||
return false;
|
||||
}
|
||||
|
||||
// 2: getStartTime
|
||||
const qint64 trajectoryStartTime = getStartTime();
|
||||
|
||||
const auto &geometry = buildTrajectoryGeometry(m_transformedTrajectory);
|
||||
const auto &trajTimeAware = buildTrajectoryTimeAware(geometry, trajectoryStartTime);
|
||||
// 3a buildTrajectoryGeometry
|
||||
const auto geometry = buildTrajectoryGeometry(m_transformedTrajectory);
|
||||
|
||||
// 3b: buildTrajectoryTimeAware
|
||||
const auto trajTimeAware = buildTrajectoryTimeAware(geometry, trajectoryStartTime);
|
||||
// to be bullet-proof:
|
||||
if (trajTimeAware.geometry().size() < 2)
|
||||
{
|
||||
ERROR_LOG(m_logger) << LOGFUNCTION << " trajTimeAware is empty";
|
||||
return false;
|
||||
}
|
||||
|
||||
// 4: sendChargeEffect
|
||||
const int chargeEffectId = sendChargeEffect(trajTimeAware);
|
||||
if (chargeEffectId < 0)
|
||||
{
|
||||
ERROR_LOG(m_logger) << LOGFUNCTION << " sendChargeEffect failed";
|
||||
return false;
|
||||
}
|
||||
|
||||
// 5: signalFired
|
||||
emit signalFired(m_effector->participantId(), m_effector->aesItemId(), {chargeEffectId});
|
||||
|
||||
DEBUG_LOG(m_logger) << "created ChargeEffectId: " << chargeEffectId;
|
||||
return true;
|
||||
}
|
||||
|
||||
} //namespace AreaEffectSimulation
|
||||
@@ -22,7 +22,7 @@ public:
|
||||
explicit DefaultFiringStrategy(ObjectEffector *effector);
|
||||
virtual ~DefaultFiringStrategy();
|
||||
|
||||
void doFiring() override;
|
||||
bool doFiring() override;
|
||||
|
||||
}; // class DefaultFiringStrategy
|
||||
} // namespace AreaEffectSimulation
|
||||
@@ -32,35 +32,57 @@ Dm72FiringStrategy::Dm72FiringStrategy(ObjectEffector *effector)
|
||||
DEBUG_LOG(m_logger) << "using Dm72FiringStrategy";
|
||||
}
|
||||
|
||||
void Dm72FiringStrategy::doFiring()
|
||||
bool Dm72FiringStrategy::doFiring()
|
||||
{
|
||||
m_transformedTrajectory = TrajectoryTransform::transformToNewTarget(m_effector->intendendTrajectory(), m_impactPoints.at(m_impactPointIndex++));
|
||||
|
||||
if (m_transformedTrajectory.size() < 2)
|
||||
{
|
||||
ERROR_LOG(m_logger) << LOGFUNCTION << " transformedTrajectory is not sufficiant"
|
||||
<< ", m_transformedTrajectory.size()" << m_transformedTrajectory.size();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_impactPointIndex >= m_impactPoints.size())
|
||||
m_impactPointIndex = 0;
|
||||
|
||||
const qint64 trajectoryStartTime = getStartTime();
|
||||
|
||||
const auto &geometry = buildTrajectoryGeometry(m_transformedTrajectory);
|
||||
const auto &trajTimeAware = buildTrajectoryTimeAware(geometry, trajectoryStartTime);
|
||||
const auto geometry = buildTrajectoryGeometry(m_transformedTrajectory);
|
||||
const auto trajTimeAware = buildTrajectoryTimeAware(geometry, trajectoryStartTime);
|
||||
|
||||
QJsonObject props{{QStringLiteral("effectDurationMsec"), m_effectDurationMsec}};
|
||||
const int chargeEffectId = sendChargeEffect(trajTimeAware, props);
|
||||
if (chargeEffectId < 0)
|
||||
{
|
||||
ERROR_LOG(m_logger) << LOGFUNCTION << " sendChargeEffect failed";
|
||||
return false;
|
||||
}
|
||||
|
||||
emit signalFired(m_effector->participantId(), m_effector->aesItemId(), {chargeEffectId});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Dm72FiringStrategy::init()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " START"
|
||||
<< ", m_effector->participantId=" << m_effector->participantId()
|
||||
<< ", m_effector->aesItemId=" << m_effector->aesItemId();
|
||||
|
||||
using namespace AdlerJson;
|
||||
using namespace LtsCoordTrans;
|
||||
|
||||
m_impactPointIndex = 0;
|
||||
m_impactPoints.clear();
|
||||
|
||||
bool bOk;
|
||||
bool bOk = false;
|
||||
WirkmittelFeuerkommandoRakete wirkmittel;
|
||||
const QJsonObject properties = QJsonDocument::fromJson(QByteArray::fromStdString(m_effector->effectorData().properties())).object();
|
||||
|
||||
const std::string propertiesStdStr = m_effector->effectorData().properties();
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " START" << ", propertiesStdStr= '" << propertiesStdStr << "'";
|
||||
|
||||
const QJsonObject properties = QJsonDocument::fromJson(QByteArray::fromStdString(propertiesStdStr)).object();
|
||||
const Core::GeoPosition geoStartPos = participantPosition(m_effector->participantId());
|
||||
const UtmCoordinate utmStartPos = UtmCoordinate::fromGeographic(geoStartPos.lon(), geoStartPos.lat());
|
||||
|
||||
@@ -99,6 +121,8 @@ void Dm72FiringStrategy::init()
|
||||
}
|
||||
|
||||
DEBUG_LOG(m_logger) << "Got " << m_impactPoints.size() << " impact points";
|
||||
|
||||
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
|
||||
}
|
||||
|
||||
QVector<QPointF> Dm72FiringStrategy::mineLayingCentroids() const
|
||||
|
||||
@@ -24,7 +24,7 @@ class Dm72FiringStrategy : public AbstractFiringStrategy
|
||||
public:
|
||||
explicit Dm72FiringStrategy(ObjectEffector *effector);
|
||||
|
||||
void doFiring() override final;
|
||||
bool doFiring() final;
|
||||
|
||||
private: // methods
|
||||
void init();
|
||||
|
||||
@@ -36,7 +36,7 @@ GmlrsFiringStrategy::~GmlrsFiringStrategy()
|
||||
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
|
||||
}
|
||||
|
||||
void GmlrsFiringStrategy::doFiring()
|
||||
bool GmlrsFiringStrategy::doFiring()
|
||||
{
|
||||
m_transformedTrajectory = TrajectoryTransform::transformToNewTarget(m_effector->intendendTrajectory(), m_impactPoints.at(m_impactPointIndex++));
|
||||
|
||||
@@ -45,12 +45,18 @@ void GmlrsFiringStrategy::doFiring()
|
||||
|
||||
const qint64 trajectoryStartTime = getStartTime();
|
||||
|
||||
const auto &geometry = buildTrajectoryGeometry(m_transformedTrajectory);
|
||||
const auto &trajTimeAware = buildTrajectoryTimeAware(geometry, trajectoryStartTime);
|
||||
const auto geometry = buildTrajectoryGeometry(m_transformedTrajectory);
|
||||
const auto trajTimeAware = buildTrajectoryTimeAware(geometry, trajectoryStartTime);
|
||||
|
||||
const int chargeEffectId = sendChargeEffect(trajTimeAware);
|
||||
if (chargeEffectId < 0)
|
||||
{
|
||||
ERROR_LOG(m_logger) << LOGFUNCTION << " sendChargeEffect failed";
|
||||
return false;
|
||||
}
|
||||
|
||||
emit signalFired(m_effector->participantId(), m_effector->aesItemId(), {chargeEffectId});
|
||||
return true;
|
||||
}
|
||||
|
||||
void GmlrsFiringStrategy::init()
|
||||
|
||||
Loaded 100 of 310 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user