/** * Handler for building models. * $Id$ * $HeadURL$ * $Author$ * Created by biedziak_f, SLTE, 2021-03-23 */ #pragma once #include "ces_building_model.h" #include "handler_aes_data.h" // for interface #include "../../proxy_building.h" #include #include #include namespace NGL { class INGLLogger; } namespace CesBuildings { /////////////////////////////////////////////////////////////////////////////////////////////////// // HandlerBuildingModel // /** * @brief The HandlerBuildingModel class contains building and rooms geometry in detail. * Based on that LineOfSight operations could be offered. */ class HandlerBuildingModel final : public QObject , public HandlerBuildingModelInterface , protected CentralEffectSimulation::Interface::Fts::GetLineBuildingIntersectionRequestHandler , protected CentralEffectSimulation::Interface::Fts::GetLineBuildingIntersectsRequestHandler , protected CentralEffectSimulation::Interface::Fts::DetonationLocationRequestHandler { Q_OBJECT public: explicit HandlerBuildingModel( const std::shared_ptr &ddsHandler, const std::shared_ptr &aesDataHandler, QObject *parent = nullptr ); ~HandlerBuildingModel(); bool init(); const QMap &buildingModels() const { return m_buildingModels; } /*! \name implementation of synchron calls of HandlerBuildingModel - LineOfSight etc*/ //@{ ///< LineOfSight: find exact intersection LineBuildingIntersectionResult getLineBuildingIntersection(const std::vector &line, const std::string &requestIdOpt = {}) override; ///< LineOfSight: find if lingOfSight is given or not LineBuildingIntersectsResult getLineBuildingIntersects(const std::vector &line, const std::string &requestIdOpt = {}) override; //@} protected: ///< LineOfSight: find exact intersection void onGetLineBuildingIntersectionRequest(const rti::core::SampleIdentity &cookie, const CentralEffectSimulation::GetLineBuildingIntersectionRequest &request) override final; ///< LineOfSight: find if lingOfSight is given or not void onGetLineBuildingIntersectsRequest(const rti::core::SampleIdentity &cookie, const CentralEffectSimulation::GetLineBuildingIntersectsRequest &request) override final; ///< special request for AreaEffectSimulation void onDetonationLocationRequest(const rti::core::SampleIdentity &cookie, const CentralEffectSimulation::DetonationLocationRequest &request) override final; private Q_SLOTS: /** * Handle MainStructureElement from 'ISM' */ void onMainStructureElementChanged(const InfrastructureManagement::MainStructureElement &data, DataModification modType); private: /*! * \brief getLineBuildingIntersectionInternal * \param request more or less genral request * \param justForLineOfSight stop on first intersection or find exact intersection? * \param segmentIdxOfIntersectionPtrOut intersection of intersection * \return reply */ CentralEffectSimulation::GetLineBuildingIntersectionReply getLineBuildingIntersectionInternal(const CentralEffectSimulation::GetLineBuildingIntersectionRequest &request, bool justForLineOfSight = false, int *buildingIdOut = nullptr, int *segmentIdxOfIntersectionPtrOut = nullptr ) const; ///< special request for AreaEffectSimulation CentralEffectSimulation::DetonationLocationReply handleDetonationLocationRequest(const CentralEffectSimulation::DetonationLocationRequest &request) const; Core::GeoPosition calculateDetonationLocation(const std::vector &trajectoryGeometry, double detonationDistance) const; private: std::shared_ptr m_ddsHandler; std::shared_ptr m_aesDataHandler; QMap m_buildingModels; // key = buildingId CentralEffectSimulation::LOGGER_T m_logger; }; // class HandlerBuildingModel } // namespace CesBuildings