/** * @RDE_HEADER@ * $Id$ * $HeadURL$ * $Author$ * Created by Norbert Thoden, SLTE, 2023-11-08 */ #pragma once #include "logger.h" #include #include //#include #include #include #include #include // qAddPostRoutine #include #include // !!! Do NOT include files of __SituationMap/Elevation__ in this header file!! namespace LtsSession { class LtsSessionDataDds; } // namespace LtsSession namespace ExerciseManagement { namespace Interface { class Dtc; } } namespace AssetManagement { namespace Interface { class Dtc; } } namespace LtsElevation { enum class LineOfSight { LOS_UNDEFINED, LOS_ERROR, LOS_VISIBLE, LOS_INVISIBLE }; class LtsElevationManager; using LTS_ELEVATION_MANAGER_TYPE = QPointer; /** * @brief The LtsElevationManager class provides access to the terrain / elevation * It wraps the SituationMap::ElevationMapManger. */ class LTSELEVATION_EXPORT LtsElevationManager : public QObject { public: // main access: /** * @brief createInstance create method for singleton. * * @param exerciseId to be choosen. * @param exmDtc access to ExerciseManagement * @param asmDtc access to AssetDataManagement * * Example: * * \code // Server: Prepare at MainHandler // (dtcs necessary for very first call) LtsElevation::LtsElevationManager *ltsElevationManager = LtsElevation::LtsElevationManager::createInstance(exerciseId, dds()->exmDtc(), dds()->asmDtc()); // Server: Use later on - e.g. Ces plugin: // (dtcs not necessary anymore) LtsElevation::LtsElevationManager *ltsElevationManager = LtsElevation::LtsElevationManager::createInstance(exerciseId); * \endcode * */ static LTS_ELEVATION_MANAGER_TYPE createInstance(int exerciseId, const std::shared_ptr &exmDtc = {}, const std::shared_ptr &asmDtc = {}); static LTS_ELEVATION_MANAGER_TYPE getInstance(int exerciseId); static LTS_ELEVATION_MANAGER_TYPE createInstanceForTrainingAreaId(int trainingAreaId, const std::shared_ptr &asmDtc = nullptr); // // For WS / OperatorApplication maybe like: // static LtsElevationManager *createInstance(int exerciseId, LtsSession::LtsSessionDataDds *session); static void cleanupAll(); virtual ~LtsElevationManager(); bool waitForInitialization(); bool isValid() const; double elevation(double lon_rad, double lat_rad, double defaultValue = std::numeric_limits::min(), bool *bIsCovered = nullptr) const; LineOfSight lineOfSightCalculation(const LtsUtils::QPoint3D &startPointGeo_absZ, const LtsUtils::QPoint3D &endPointGeo_absZ); LineOfSight lineOfSightCalculation(const QPointF &startPointGeo, double startHat, const QPointF &endPointGeo, double endHat); protected: explicit LtsElevationManager(); /** * @brief initDDS * @param exmDtc * @param asmDtc */ void initDDS(const std::shared_ptr &exmDtc, const std::shared_ptr &asmDtc); bool init(const QStringList &filePaths_rough_to_fine); static int exerciseIdToTrainingAreaId(int exerciseId, const std::shared_ptr &exmDtc); // static bool setupDtcs(); QStringList getFilenamesForExercise(int exerciseId); QStringList getFilenamesForTrainingArea(int trainingAreaId); // !!! For UnitTest only !!! // !!! For UnitTest only !!! // !!! For UnitTest only !!! static LTS_ELEVATION_MANAGER_TYPE createInstanceUnitTest(int id, const QStringList &filePaths_rough_to_fine); private: // bool initDefaultValues(); class Private; Private *d; LOGGER_T m_logger; ///< Interface of the Logging-Facility }; LTSELEVATION_EXPORT const QString toString(const LtsElevation::LineOfSight &value); LTSELEVATION_EXPORT std::ostream &operator<< (std::ostream &stream, const LtsElevation::LineOfSight value); } // namespace LtsElevation