Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
@@ -0,0 +1,30 @@
|
||||
#
|
||||
# monitoring of the target areas
|
||||
# $Id$
|
||||
# $HeadURL$
|
||||
# $Author$
|
||||
#
|
||||
|
||||
SET(SRCS
|
||||
plugin.cpp
|
||||
plugin.h
|
||||
handler_artillerie_sound.cpp
|
||||
handler_artillerie_sound.h
|
||||
settings.cpp
|
||||
settings.h
|
||||
)
|
||||
|
||||
NGL_ADD_LIBRARY(AAR SV cesPluginArtillerySound MODULE ${SRCS})
|
||||
NGL_TARGET_LINK_LIBRARIES(cesPluginArtillerySound
|
||||
Qt5::Network
|
||||
Qt5::Widgets
|
||||
cesPluginInterface
|
||||
ngltools
|
||||
ngldb
|
||||
svcTabClient
|
||||
LtsCoordTrans
|
||||
# ProjectConfig
|
||||
svcCesDDSCommon
|
||||
)
|
||||
NGL_INSTALL_TARGET(cesPluginArtillerySound)
|
||||
|
||||
+223
@@ -0,0 +1,223 @@
|
||||
/**
|
||||
* Handler for player data
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by hjl, SLSE, 2017-02-20
|
||||
*/
|
||||
|
||||
#include "handler_artillerie_sound.h"
|
||||
#include "settings.h"
|
||||
|
||||
#include <LtsUtilsSettings/settings.h>
|
||||
|
||||
#include <QNetworkReply>
|
||||
#include <qmath.h>
|
||||
#include <math.h>
|
||||
|
||||
namespace CesArtillerySound
|
||||
{
|
||||
|
||||
HandlerArtillerieSound::HandlerArtillerieSound(const std::shared_ptr<CentralEffectSimulation::DdsHandler> &ddsHandler,
|
||||
const std::shared_ptr<CentralEffectSimulation::HandlerBuildingData> &buildingDataHandler,
|
||||
QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_ddsHandler(ddsHandler)
|
||||
, m_handlerBuildingData(buildingDataHandler)
|
||||
, m_logger(CentralEffectSimulation::getLogger("Plugin.ArtillerySound.HandlerArtillerieSound"))
|
||||
{
|
||||
}
|
||||
|
||||
HandlerArtillerieSound::~HandlerArtillerieSound()
|
||||
{
|
||||
} // end of dtor()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
bool HandlerArtillerieSound::init()
|
||||
{
|
||||
|
||||
if (Settings::cesPlayArtillerieSounds())
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "init with Artillerie-Sounds";
|
||||
auto dtcAes = m_ddsHandler->dtcAes();
|
||||
|
||||
dtcAes->enableExplosionSingle();
|
||||
connect(dtcAes.get(), &AreaEffectSimulation::Interface::Dtc::explosionSingleChanged,
|
||||
this, &HandlerArtillerieSound::onExplosionSingleChanged);
|
||||
|
||||
dtcAes->enableTechnicalArea();
|
||||
connect(dtcAes.get(), &AreaEffectSimulation::Interface::Dtc::technicalAreaChanged,
|
||||
this, &HandlerArtillerieSound::onTechnicalAreaChanged);
|
||||
}
|
||||
else
|
||||
DEBUG_LOG(m_logger) << "init without Artillerie-Sounds";
|
||||
return true;
|
||||
} // end of init()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
void HandlerArtillerieSound::onExplosionSingleChanged(const AreaEffectSimulation::ExplosionSingle &data, DataModification modType)
|
||||
{
|
||||
bool handleExplosion = false;
|
||||
if (modType != DataModification::eAdded &&
|
||||
modType != DataModification::eModified)
|
||||
{
|
||||
m_explosionSingleState.remove(data.id());
|
||||
return;
|
||||
}
|
||||
|
||||
if (data.effectStateId() == AreaEffectSimulation::AesEffectState_def::EsRemoved)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Remove SingleExplosion";
|
||||
m_explosionSingleState.remove(data.id());
|
||||
return;
|
||||
}
|
||||
// Only handle transitions from prepared or fired to activated
|
||||
if ((m_explosionSingleState.value(data.id()) == AreaEffectSimulation::AesEffectState_def::EsPrepared ||
|
||||
m_explosionSingleState.value(data.id()) == AreaEffectSimulation::AesEffectState_def::EsFired) &&
|
||||
data.effectStateId() == AreaEffectSimulation::AesEffectState_def::EsActivated)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Handle SingleExplosion";
|
||||
handleExplosion = true;
|
||||
}
|
||||
m_explosionSingleState.insert(data.id(), data.effectStateId());
|
||||
|
||||
|
||||
DEBUG_LOG(m_logger) << "Got ExplosionSingle State=" << data.effectStateId()
|
||||
<< " id=" << data.id();
|
||||
if (handleExplosion)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Handle ExplosionSingle (EsActivated) HandlerArtillerieSound";
|
||||
|
||||
auto assetPositions = m_handlerBuildingData->getAssetPositions();
|
||||
///////////////////////////////////////////////////////////////////
|
||||
/// Play Sound to each EGCU and OSGU volume depends on distance
|
||||
///////////////////////////////////////////////////////////////////
|
||||
INFO_LOG(m_logger) << "printAssetPositions: ";
|
||||
QHashIterator<int, CentralEffectSimulation::HandlerBuildingData::AssetPosition> i(assetPositions);
|
||||
while (i.hasNext())
|
||||
{
|
||||
i.next();
|
||||
INFO_LOG(m_logger) << "printAssetPositions: "
|
||||
<< i.key() << ": " << i.value().structureElementId
|
||||
<< " type = " << i.value().mountingPointType
|
||||
<< " hostname =" << i.value().hostname
|
||||
<< " pos=" << i.value().geoPosition
|
||||
<< " posUtm=" << i.value().positionUtm.x()
|
||||
<< "/" << i.value().positionUtm.y()
|
||||
<< " zone=" << i.value().zone;
|
||||
// Calculate the distance between the speaker and the explosion
|
||||
const QPointF posExplosionUtm = CentralEffectSimulation::geographic2Utm(data.impactPosition(), i.value().zone);
|
||||
const qreal distance = qSqrt(qPow(posExplosionUtm.x() - i.value().positionUtm.x(), 2) + qPow(posExplosionUtm.y() - i.value().positionUtm.y(), 2));
|
||||
int sound = Settings::cesSoundId();
|
||||
const qreal distanceThreshold = Settings::cesDistanceThreshold(); // [m]
|
||||
const qreal factor = Settings::cesFactor();
|
||||
const qreal cesReduceFactor = Settings::cesReduceFactor();
|
||||
INFO_LOG(m_logger) << "Distance to Explosion =" << distance
|
||||
<< " hostname =" << i.value().hostname
|
||||
<< " distanceThreshold=" << distanceThreshold
|
||||
<< " factor=" << factor;
|
||||
qreal volumePercent = 100;
|
||||
if (distance > distanceThreshold)
|
||||
volumePercent = factor * log10(distance) * cesReduceFactor;
|
||||
QString user = Settings::cesUser();
|
||||
QString passwd = Settings::cesPasswd();
|
||||
playSound(user, passwd, i.value().hostname, sound, volumePercent);
|
||||
}
|
||||
}
|
||||
|
||||
} // onExplosionSingleChanged
|
||||
|
||||
void HandlerArtillerieSound::playSound(QString &user, QString &passwd, const QString &host, int &sound, qreal &volume)
|
||||
{
|
||||
QUrl url;
|
||||
QString request = QStringLiteral("http://%1/hitsound.php?sound=%2&vol=%3")
|
||||
.arg(host)
|
||||
.arg(sound)
|
||||
.arg(volume);
|
||||
url.setUrl(request);
|
||||
url.setUserName(user);
|
||||
url.setPassword(passwd);
|
||||
DEBUG_LOG(m_logger) << "startRequest: " << url.toString();
|
||||
startRequest(url);
|
||||
}
|
||||
|
||||
void HandlerArtillerieSound::startRequest(const QUrl &requestedUrl)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "startRequest: " << requestedUrl.toString();
|
||||
m_httpRequestAborted = false;
|
||||
auto reply = m_qnam.get(QNetworkRequest(requestedUrl));
|
||||
connect(reply, &QNetworkReply::finished, this, &HandlerArtillerieSound::httpFinished);
|
||||
}
|
||||
|
||||
|
||||
void HandlerArtillerieSound::httpFinished()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "httpFinished";
|
||||
auto reply = qobject_cast<QNetworkReply *>(sender());
|
||||
if (!reply)
|
||||
return;
|
||||
|
||||
if (m_httpRequestAborted)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "httpRequestAborted";
|
||||
reply->deleteLater();
|
||||
return;
|
||||
}
|
||||
|
||||
if (reply->error())
|
||||
{
|
||||
QNetworkRequest request = reply->request();
|
||||
QUrl url = request.url();
|
||||
ERROR_LOG(m_logger) << "reply->error: " << reply->errorString()
|
||||
<< " host=" << url.host()
|
||||
<< " query='" << url.query()
|
||||
<< "' '" << qUtf8Printable(url.toString()) << "'";
|
||||
reply->deleteLater();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Sucess
|
||||
|
||||
//parse the reply JSON and display result in the UI
|
||||
const QByteArray json(reply->readAll());
|
||||
DEBUG_LOG(m_logger) << "Sucess " << json;
|
||||
|
||||
reply->deleteLater();
|
||||
}
|
||||
|
||||
|
||||
void HandlerArtillerieSound::onTechnicalAreaChanged(const AreaEffectSimulation::TechnicalArea &data, DataModification modType)
|
||||
{
|
||||
if (modType != DataModification::eAdded &&
|
||||
modType != DataModification::eModified)
|
||||
{
|
||||
m_technicalAreas.remove(data.id());
|
||||
return;
|
||||
}
|
||||
|
||||
if (data.effectStateId() == AreaEffectSimulation::AesEffectState_def::EsRemoved)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Remove TechnicalArea";
|
||||
m_technicalAreas.remove(data.id());
|
||||
return;
|
||||
}
|
||||
if (data.type() == AreaEffectSimulation::AesTechnicalAreaType_def::TatSoundZone)
|
||||
{
|
||||
int zone = -1;
|
||||
m_technicalAreas.insert(data.id(), data);
|
||||
DEBUG_LOG(m_logger) << "Handle TechnicalArea HandlerArtillerieSound id=" << data.id();
|
||||
QPointF cornerButtomLeft = CentralEffectSimulation::geographic2Utm(data.area().cornerBottomLeft(), &zone);
|
||||
qreal x = cornerButtomLeft.x() + data.area().width() / 2;
|
||||
qreal y = cornerButtomLeft.y() + data.area().height() / 2;
|
||||
QPointF center(x, y);
|
||||
DEBUG_LOG(m_logger) << "Handle TechnicalArea HandlerArtillerieSound cornerButtomLeft = " << cornerButtomLeft.x() << "/" << cornerButtomLeft.y()
|
||||
<< " zone=" << zone;
|
||||
DEBUG_LOG(m_logger) << "Handle TechnicalArea HandlerArtillerieSound center = " << center.x() << "/" << center.y()
|
||||
<< " zone=" << zone;
|
||||
}
|
||||
} // onTechnicalAreaChanged
|
||||
|
||||
|
||||
} // namespace CesArtillerySound
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
/**
|
||||
* Handler for Blocked Areas
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by gr, SLSE, 2018-07-02
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <CentralEffectSimulation/logger.h>
|
||||
#include <CentralEffectSimulation/dds_handler.h>
|
||||
#include <CentralEffectSimulation/handler_participant.h>
|
||||
#include <CentralEffectSimulation/handler_building_data.h>
|
||||
#include <AreaEffectSimulation/aes_dtc.h>
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
#include <TrainingAreaBase/tab_ftc.h>
|
||||
|
||||
#include <QtCore/QObject>
|
||||
|
||||
// HTTP Request
|
||||
#include <QNetworkAccessManager>
|
||||
|
||||
namespace CesArtillerySound
|
||||
{
|
||||
|
||||
class HandlerArtillerieSound final
|
||||
: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
explicit HandlerArtillerieSound(const std::shared_ptr<CentralEffectSimulation::DdsHandler> &ddsHandler,
|
||||
const std::shared_ptr<CentralEffectSimulation::HandlerBuildingData> &buildingDataHandler,
|
||||
QObject *parent);
|
||||
|
||||
~HandlerArtillerieSound();
|
||||
|
||||
bool init();
|
||||
|
||||
private Q_SLOTS:
|
||||
|
||||
void onExplosionSingleChanged(const AreaEffectSimulation::ExplosionSingle &data, DataModification modType);
|
||||
void onTechnicalAreaChanged(const AreaEffectSimulation::TechnicalArea &data, DataModification modType);
|
||||
void httpFinished();
|
||||
|
||||
private:
|
||||
void playSound(QString &user, QString &passwd, const QString &host, int &sound, qreal &volume);
|
||||
void startRequest(const QUrl &requestedUrl);
|
||||
private: // attributes
|
||||
std::shared_ptr<CentralEffectSimulation::DdsHandler> m_ddsHandler; ///< Pointer to DDS handler
|
||||
std::shared_ptr<CentralEffectSimulation::HandlerBuildingData> m_handlerBuildingData;
|
||||
|
||||
QHash<int, AreaEffectSimulation::AesEffectState> m_explosionSingleState; // key = id, value = state
|
||||
QHash<int, AreaEffectSimulation::TechnicalArea> m_technicalAreas;
|
||||
QHash<int, QPointF> m_centerSoundArea; // key: TechnicalAreaId, value Center of SoundArea
|
||||
QHash<int, QPointF> m_egcus;
|
||||
QHash<int, QPointF> m_ogcus;
|
||||
|
||||
QNetworkAccessManager m_qnam;
|
||||
bool m_httpRequestAborted = false;
|
||||
|
||||
CentralEffectSimulation::LOGGER_T &m_logger; ///< Interface to the Logging-Facility
|
||||
|
||||
};
|
||||
} // namespace CesArtillerySound
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
/**
|
||||
* Handle Artillery Sound
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Gerlinde Rudolphus, SLTE, 2016-04-14
|
||||
*/
|
||||
|
||||
#include "plugin.h"
|
||||
#include "settings.h"
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
#include <ngldb/db_service_handler.h>
|
||||
|
||||
namespace CesArtillerySound
|
||||
{
|
||||
|
||||
// 29.11.2024, Norbert Thoden:
|
||||
// a) das PluginHandling wurde vereinfacht, sprich 'nur' mainHandler übergeben statt explizit ddsHandler, dbhandler etc
|
||||
// b) Loggder überarbeiten (logger{h,cpp} und ces_export.h entsorgen
|
||||
// c) Bereinigung des Namensschema: CentralEffectSimulation2DPlugin -> CentralEffectSimulationArtillerySoundPlugin
|
||||
|
||||
std::shared_ptr<CentralEffectSimulation::Plugin::Interface> CentralEffectSimulationArtillerySoundPlugin::createInterface(CentralEffectSimulation::Plugin::DataProvider *pdp,
|
||||
const std::shared_ptr<DDSConnector::DdsConnector> &dDSConnector,
|
||||
NGL::Settings *settings,
|
||||
CentralEffectSimulation::MainHandler *mainHandler)
|
||||
{
|
||||
return std::make_shared<CesArtillerySoundInterfaceImpl>(pdp, dDSConnector, settings, mainHandler);
|
||||
}
|
||||
|
||||
//std::shared_ptr<CentralEffectSimulation::Plugin::Interface> CentralEffectSimulation2DPlugin::createInterface(CentralEffectSimulation::Plugin::DataProvider *pdp,
|
||||
// const std::shared_ptr<DDSConnector::DdsConnector> &dDSConnector,
|
||||
// NGL::Settings *settings,
|
||||
// CentralEffectSimulation::MainHandler *mainHandler)
|
||||
//{
|
||||
// return std::make_shared<CesArtillerySoundInterfaceImpl>(pdp, dDSConnector, settings, mainHandler);
|
||||
//}
|
||||
|
||||
|
||||
CesArtillerySoundInterfaceImpl::CesArtillerySoundInterfaceImpl(CentralEffectSimulation::Plugin::DataProvider *pdp,
|
||||
const std::shared_ptr<DDSConnector::DdsConnector> &dDSConnector,
|
||||
NGL::Settings *settings,
|
||||
CentralEffectSimulation::MainHandler *mainHandler)
|
||||
: m_pdp(pdp)
|
||||
, m_ddsConnector(dDSConnector)
|
||||
, m_ddsHandler(mainHandler->dds())
|
||||
, m_db(mainHandler->db())
|
||||
, m_handlerBuildingData(mainHandler->handlerBuildingData())
|
||||
, m_handlerParticipant(mainHandler->handlerParticipant())
|
||||
, m_logger(CentralEffectSimulation::getLogger("Plugin.ArtillerySound.CesArtillerySoundInterfaceImpl"))
|
||||
{
|
||||
Q_UNUSED(settings)
|
||||
}
|
||||
|
||||
CesArtillerySoundInterfaceImpl::~CesArtillerySoundInterfaceImpl()
|
||||
{
|
||||
m_handlerArtillerieSound.reset();
|
||||
}
|
||||
|
||||
|
||||
bool CesArtillerySoundInterfaceImpl::init(int domainId, int exerciseId)
|
||||
{
|
||||
m_domainId = domainId;
|
||||
m_exerciseId = exerciseId;
|
||||
INFO_LOG(m_logger) << "CentralEffectSimulation2DInterfaceImpl::init()"
|
||||
<< " m_domainId=" << m_domainId
|
||||
<< " m_exerciseId=" << m_exerciseId;
|
||||
|
||||
|
||||
|
||||
// initialize handlerArtillerieSound
|
||||
m_handlerArtillerieSound = std::make_shared<HandlerArtillerieSound>(m_ddsHandler,
|
||||
m_handlerBuildingData,
|
||||
this);
|
||||
|
||||
if (!m_handlerArtillerieSound->init())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Initialisation m_handlerArtillerieSound failed.";
|
||||
return false;
|
||||
}
|
||||
|
||||
INFO_LOG(m_logger) << "CentralEffectSimulation2DInterfaceImpl::init() return true";
|
||||
return true;
|
||||
}
|
||||
|
||||
} //namespace CesArtillerySound
|
||||
@@ -0,0 +1,98 @@
|
||||
/**
|
||||
* Plugin Artillery Sound
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Gerlinde Rudolphus, SLTE, 2016-04-14
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "handler_artillerie_sound.h"
|
||||
|
||||
|
||||
#include <DDS/DDSConnector/dds_connector.h>
|
||||
#include <CentralEffectSimulation/ces_plugin_interface.h>
|
||||
#include <CentralEffectSimulation/ces_plugin_interface.h>
|
||||
#include <CentralEffectSimulation/dds_handler.h>
|
||||
#include <CentralEffectSimulation/handler_building_data.h>
|
||||
#include <CentralEffectSimulation/main_handler.h>
|
||||
|
||||
#include <QObject>
|
||||
|
||||
|
||||
namespace CesArtillerySound
|
||||
{
|
||||
|
||||
// 29.11.2024, Norbert Thoden:
|
||||
// a) das PluginHandling wurde vereinfacht, sprich 'nur' mainHandler übergeben statt explizit ddsHandler, dbhandler etc
|
||||
// b) Loggder überarbeiten (logger{h,cpp} und ces_export.h entsorgen
|
||||
// c) Bereinigung des Namensschema: CentralEffectSimulation2DPlugin -> CentralEffectSimulationArtillerySoundPlugin
|
||||
|
||||
class CentralEffectSimulationArtillerySoundPlugin : public QObject, public CentralEffectSimulation::Plugin::Plugin
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "special:3:ces.CentralEffectSimulationArtillerySoundPlugin")
|
||||
Q_INTERFACES(CentralEffectSimulation::Plugin::Plugin)
|
||||
|
||||
public:
|
||||
CentralEffectSimulationArtillerySoundPlugin() = default;
|
||||
~CentralEffectSimulationArtillerySoundPlugin() = default;
|
||||
std::shared_ptr<CentralEffectSimulation::Plugin::Interface> createInterface(CentralEffectSimulation::Plugin::DataProvider *pdp,
|
||||
const std::shared_ptr<DDSConnector::DdsConnector> &dDSConnector,
|
||||
NGL::Settings *settings,
|
||||
CentralEffectSimulation::MainHandler *mainHandler) override;
|
||||
|
||||
};
|
||||
|
||||
//class CentralEffectSimulation2DPlugin : public QObject, public CentralEffectSimulation::Plugin::Plugin
|
||||
//{
|
||||
// Q_OBJECT
|
||||
// Q_PLUGIN_METADATA(IID "special:3:ces.CentralEffectSimulation2DPlugin")
|
||||
// Q_INTERFACES(CentralEffectSimulation::Plugin::Plugin)
|
||||
|
||||
//public:
|
||||
// CentralEffectSimulation2DPlugin() = default;
|
||||
// ~CentralEffectSimulation2DPlugin() = default;
|
||||
// std::shared_ptr<CentralEffectSimulation::Plugin::Interface> createInterface(CentralEffectSimulation::Plugin::DataProvider *pdp,
|
||||
// const std::shared_ptr<DDSConnector::DdsConnector> &dDSConnector,
|
||||
// NGL::Settings *settings,
|
||||
// CentralEffectSimulation::MainHandler *mainHandler) override;
|
||||
//};
|
||||
|
||||
|
||||
class CesArtillerySoundInterfaceImpl final : public CentralEffectSimulation::Plugin::Interface
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CesArtillerySoundInterfaceImpl(CentralEffectSimulation::Plugin::DataProvider *pdp,
|
||||
const std::shared_ptr<DDSConnector::DdsConnector> &dDSConnector,
|
||||
NGL::Settings *settings,
|
||||
CentralEffectSimulation::MainHandler *mainHandler);
|
||||
~CesArtillerySoundInterfaceImpl();
|
||||
//bool init();
|
||||
const char *name() const override { return "CentralEffectSimulation2D"; }
|
||||
QString echo(const QString &/*message*/) override { return QString();}
|
||||
|
||||
private Q_SLOTS:
|
||||
bool init(int domainId, int exerciseId) override;
|
||||
private:
|
||||
|
||||
private:
|
||||
CentralEffectSimulation::Plugin::DataProvider *m_pdp;
|
||||
std::shared_ptr<DDSConnector::DdsConnector> m_ddsConnector;
|
||||
|
||||
std::shared_ptr<CentralEffectSimulation::DdsHandler> m_ddsHandler;
|
||||
std::shared_ptr<CentralEffectSimulation::DatabaseInterface> m_db;
|
||||
std::shared_ptr<CentralEffectSimulation::HandlerBuildingData> m_handlerBuildingData; ///< Pointer to AES Building handler
|
||||
std::shared_ptr<CentralEffectSimulation::HandlerParticipant> m_handlerParticipant; ///< Pointer to handler for all participants
|
||||
std::shared_ptr<HandlerArtillerieSound> m_handlerArtillerieSound; /// < Pointer to handler for Artillerie Sound
|
||||
|
||||
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
int m_domainId = 0;
|
||||
int m_exerciseId = 0;
|
||||
};
|
||||
|
||||
} // namespace CesArtillerySound
|
||||
@@ -0,0 +1,81 @@
|
||||
/**
|
||||
* Settings for CentralEffectSimulation
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
#include "settings.h"
|
||||
|
||||
#include <QtCore/QSettings>
|
||||
#include <QtCore/QVariant>
|
||||
#include <nglsettings/nglsettings_settings.h>
|
||||
#include <ngltools/ngltools_filesystem.h>
|
||||
|
||||
namespace CesArtillerySound
|
||||
{
|
||||
class NGLSettingsClass : public NGL::Settings
|
||||
{
|
||||
public:
|
||||
NGLSettingsClass()
|
||||
: NGL::Settings(s_iniFile.isEmpty() ? NGL::findProjectConfigFile() : s_iniFile)
|
||||
{}
|
||||
static void setIniFile(const QString &fn)
|
||||
{
|
||||
s_iniFile = fn;
|
||||
}
|
||||
static QString s_iniFile;
|
||||
};
|
||||
QString NGLSettingsClass::s_iniFile;
|
||||
Q_GLOBAL_STATIC(NGLSettingsClass, s)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
NGL::Settings *Settings::settings()
|
||||
{
|
||||
return s();
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void Settings::setIniFile(const QString &ini)
|
||||
{
|
||||
NGLSettingsClass::setIniFile(ini);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Artillerie-Sounds:
|
||||
bool Settings::cesPlayArtillerieSounds()
|
||||
{
|
||||
return s()->settings()->value(QStringLiteral("CES_ARTILLERY_SOUND/playArtillerieSounds"), false).toBool();
|
||||
}
|
||||
|
||||
QString Settings::cesUser()
|
||||
{
|
||||
return s()->settings()->value(QStringLiteral("CES_ARTILLERY_SOUND/user"), QStringLiteral("katar")).toString();
|
||||
}
|
||||
|
||||
QString Settings::cesPasswd()
|
||||
{
|
||||
return s()->settings()->value(QStringLiteral("CES_ARTILLERY_SOUND/passwd"), QStringLiteral("mout11de")).toString();
|
||||
}
|
||||
|
||||
qreal Settings::cesDistanceThreshold()
|
||||
{
|
||||
return s()->settings()->value(QStringLiteral("CES_ARTILLERY_SOUND/distanceThreshold"), 1.415).toReal();
|
||||
}
|
||||
|
||||
qreal Settings::cesFactor()
|
||||
{
|
||||
return s()->settings()->value(QStringLiteral("CES_ARTILLERY_SOUND/factor"), 15.05).toReal();
|
||||
}
|
||||
|
||||
int Settings::cesSoundId()
|
||||
{
|
||||
return s()->settings()->value(QStringLiteral("CES_ARTILLERY_SOUND/soundId"), 1).toInt();
|
||||
}
|
||||
|
||||
qreal Settings::cesReduceFactor()
|
||||
{
|
||||
return s()->settings()->value(QStringLiteral("CES_ARTILLERY_SOUND/reduceFactor"), 1.0).toReal();
|
||||
}
|
||||
|
||||
} // namespace CesArtillerySound
|
||||
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* Settings for CentralEffectSimulation
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <QString>
|
||||
|
||||
namespace NGL
|
||||
{
|
||||
class Settings;
|
||||
}
|
||||
|
||||
namespace CesArtillerySound
|
||||
{
|
||||
namespace Settings
|
||||
{
|
||||
|
||||
NGL::Settings *settings();
|
||||
void setIniFile(const QString &ini);
|
||||
|
||||
// Artillerie-Sounds:
|
||||
bool cesPlayArtillerieSounds();
|
||||
QString cesUser();
|
||||
QString cesPasswd();
|
||||
qreal cesDistanceThreshold();
|
||||
qreal cesFactor();
|
||||
int cesSoundId();
|
||||
qreal cesReduceFactor();
|
||||
}
|
||||
|
||||
} // namespace CesArtillerySound
|
||||
Reference in new issue
Block a user