/** * 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 #include #include #include // std::shared_pt #include #include // safe_enum GearClass #include //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 &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 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 m_dtcPdm; QMap m_chargeTypes; QMap m_gearTypeChargeTypes; bool m_bPdmInitialized{false}; LOGGER_T m_logger; }; }