/** * Handler for player data * $Id$ * $HeadURL$ * $Author$ * Created by gr, SLSE, 2017-02-20 */ #pragma once #include "logger.h" #include #include #include #include #include #include #include #include #include #include #include #include namespace LtsUtils { class QPoint3D; } // AES-Handling for buildings namespace Ces2D { class HandlerAesData : public QObject , protected Buildings::Interface::Ftc::SendCesHitOnBuildingReplyHandler , protected TrainingAreaBase::Interface::Ftc::SendCesHitInformationReplyHandler { Q_OBJECT public: explicit HandlerAesData(const std::shared_ptr &ddsHandler, const std::shared_ptr &buildingDataHandler, QObject *parent = nullptr); ~HandlerAesData(); /** * Initialize the handler to manage information from player management */ bool init(); AreaEffectSimulation::AesItemView itemView(const int &aesId) const { return m_aesItemViews.value(aesId); } protected: void onSendCesHitOnBuildingReply(const Core::FunctionReplyObject &replyObject) override final; void onSendCesHitInformationReply(const Core::FunctionReplyObject &reply) override final; private slots: /** * Handle the signals from 'AES' */ void onExplosionSingleChanged(const AreaEffectSimulation::ExplosionSingle &data, DataModification modType); void onAirSupportImpactChanged(const AreaEffectSimulation::AirSupportImpact &data, DataModification modType); void onAesItemViewChanged(const AreaEffectSimulation::AesItemView &data, DataModification modType); void onTriggeredImpactsChanged(const AreaEffectSimulation::TriggeredImpacts &data, DataModification modType); /** * Handle MainFootprint from 'ISM' */ void onMainFootprintChanged(const InfrastructureManagement::MainFootprint &data, DataModification modType); void removeStates(const AreaEffectSimulation::AesItemView &data); private: // structs struct Footprint { int mseId = -1; int zone = -1; Core::GeoPosition geoPosition; QPolygonF polyUtm; QRectF boundingBoxPolyUtm; bool isValid() const { return mseId > 0; } }; typedef QHash> BitfieldStates; private: // methoden void handleExplosionSingleCentral(const AreaEffectSimulation::AesItemView &itemView); void calculateFootprint(const InfrastructureManagement::MainFootprint &mainFootprint); bool inFootprint(const Core::GeoPosition2D &geoPosition, const double radius, const Footprint &footPrint) const; void preCalculateImpacts(const AreaEffectSimulation::TriggeredImpacts &data); void calculateImpacts(const AreaEffectSimulation::TriggeredImpacts &data, const Footprint &footprint); double getRadiusOfMunition(const int32_t chargeTypeId) const; private: // attributes std::shared_ptr m_ddsHandler; ///< Pointer to VOM DDS handler std::shared_ptr m_handlerBuildingData; QHash m_footprints; // key = footprint.mseId QHash m_bitfieldStatesBld; // key = mseId, value = BitfieldState // AES-Values QHash m_aesItemViews; // key = aesItemId QHash m_explosionSingleState; // key = id value = state NGL::INGLLogger &m_logger; ///< Interface to the Logging-Facility }; } // namespace Ces2D