Files
qt5-legatus-legacy/Lts/Plugins/SituationMapPlugin/Gui/SituationMap/AdapterDds/pdm_handler.h
T
2026-08-13 18:33:10 +02:00

88 lines
2.5 KiB
C++
Executable File

/**
* Handling of PDM-Data so we dont call the DTC more than once
* $Id$
* $HeadURL$
* $Author$
* Created by Philipp Dassow, SLST, 2017-09-25
*/
#pragma once
#include <Common/situation_map_logging.h>
#include <QMap>
#include <QObject>
#include <memory> // std::shared_pt
#include <LtsUtilsCore/data_modification_enum.h>
#include <ProjectDataManagement/pdm_dtc.h> // safe_enum GearClass
#include <AreaEffectSimulation/aes_dtc.h>
//namespace ProjectDataManagement
//{
//class ChargeType;
//class GearTypeChargeType;
//namespace Interface
//{
//// forward
//class Dtc;
//}
//}
namespace SituationMap
{
enum class SpecialChargeType
{
NoneSpecial,
LRF, // LaserRangeFinder / Laser-Entfernungsmesser
LTD // LaserTargetDesignator / Zielmarkierung
};
QString toString(SpecialChargeType value);
static inline std::ostream &operator<< (std::ostream &stream,
const SpecialChargeType value)
{
stream << "SpecialChargeType " << toString(value);
return stream;
}
class PdmHandler : public QObject
{
Q_OBJECT
public:
explicit PdmHandler(const std::shared_ptr<ProjectDataManagement::Interface::Dtc> &dtcPdm);
ProjectDataManagement::ChargeType chargeTypeFromId(int chargeTypeId);
int maxRangeFromGearTypeIdAndChargeTypeId(int gearTypeId, int chargeTypeId);
double impactRadius(const AreaEffectSimulation::ChargeStruct &chargeStruct, double defaultValue = 10.0);
bool isSmart(const AreaEffectSimulation::ChargeStruct &chargeStruct);
QString trChargeTypeShortName(int chargeTypeId);
SpecialChargeType isSpecialChargeType(int chargeTypeId);
bool isLRFChargeType(int chargeTypeId);
bool isLTDChargeType(int chargeTypeId);
bool isChargeTypeLtdOrLrf(int chargeTypeId);
static bool isChargeTypeLtdOrLrf(SpecialChargeType sct);
ProjectDataManagement::GearClass gearClassFromChargeTypeId(int chargeTypeId);
QVector<ProjectDataManagement::CasEffect> casEffects(const AreaEffectSimulation::ChargeStruct &chargeStruct);
private:
void initializePdm();
void onChargeTypeChanged(const ProjectDataManagement::ChargeType &data, DataModification mod);
void onGearTypeChargeTypeChanged(const ProjectDataManagement::GearTypeChargeType &data, DataModification mod);
private:
std::shared_ptr<ProjectDataManagement::Interface::Dtc> m_dtcPdm;
QMap<int, ProjectDataManagement::ChargeType> m_chargeTypes;
QMap<int, ProjectDataManagement::GearTypeChargeType> m_gearTypeChargeTypes;
bool m_bPdmInitialized{false};
LOGGER_T m_logger;
};
}